//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//   using 3Dmigoto v1.2.27 on Mon Feb 08 02:06:23 2016
//
//
// Buffer Definitions: 
//
// cbuffer SceneBuffer
// {
//
//   row_major float4x4 View;           // Offset:    0 Size:    64 [unused]
//   row_major float4x4 ScreenMatrix;   // Offset:   64 Size:    64 [unused]
//   float2 DepthExportScale;           // Offset:  128 Size:     8 [unused]
//   float2 __padding0;                 // Offset:  136 Size:     8 [unused]
//   float4 FogParams;                  // Offset:  144 Size:    16 [unused]
//   float3 __CameraPosition;           // Offset:  160 Size:    12 [unused]
//   float __padding12;                 // Offset:  172 Size:     4 [unused]
//   float3 CameraDirection;            // Offset:  176 Size:    12 [unused]
//   float __padding9;                  // Offset:  188 Size:     4 [unused]
//   float3 DepthFactors;               // Offset:  192 Size:    12 [unused]
//   float __padding10;                 // Offset:  204 Size:     4 [unused]
//   float3 ShadowDepthBiasAndLightType;// Offset:  208 Size:    12 [unused]
//   float __padding11;                 // Offset:  220 Size:     4 [unused]
//   float4 SubframeViewport;           // Offset:  224 Size:    16 [unused]
//   row_major float3x4 DepthToWorld;   // Offset:  240 Size:    48 [unused]
//   float4 DepthToView;                // Offset:  288 Size:    16
//   float4 OneOverDepthToView;         // Offset:  304 Size:    16 [unused]
//   float4 DepthToW;                   // Offset:  320 Size:    16
//   float4 ClipPlane;                  // Offset:  336 Size:    16 [unused]
//   float2 ViewportDepthScaleOffset;   // Offset:  352 Size:     8 [unused]
//   float2 __padding1;                 // Offset:  360 Size:     8 [unused]
//   float2 ColorDOFDepthScaleOffset;   // Offset:  368 Size:     8 [unused]
//   float2 __padding2;                 // Offset:  376 Size:     8 [unused]
//   float4 TimeVector;                 // Offset:  384 Size:    16 [unused]
//   float4 FogParams2;                 // Offset:  400 Size:    16 [unused]
//   float4 FogParams3;                 // Offset:  416 Size:    16 [unused]
//   float3 GlobalAmbient;              // Offset:  432 Size:    12 [unused]
//   float __padding8;                  // Offset:  444 Size:     4 [unused]
//   float4 GlobalParams[16];           // Offset:  448 Size:   256 [unused]
//   float4 ViewToFogH;                 // Offset:  704 Size:    16 [unused]
//   float4 ScreenExtents;              // Offset:  720 Size:    16
//   float2 ScreenResolution;           // Offset:  736 Size:     8 [unused]
//   float2 __padding3;                 // Offset:  744 Size:     8 [unused]
//   float4 PSSMToMap1Lin;              // Offset:  752 Size:    16 [unused]
//   float4 PSSMToMap1Const;            // Offset:  768 Size:    16 [unused]
//   float4 PSSMToMap2Lin;              // Offset:  784 Size:    16 [unused]
//   float4 PSSMToMap2Const;            // Offset:  800 Size:    16 [unused]
//   float4 PSSMToMap3Lin;              // Offset:  816 Size:    16 [unused]
//   float4 PSSMToMap3Const;            // Offset:  832 Size:    16 [unused]
//   float4 PSSMDistances;              // Offset:  848 Size:    16 [unused]
//   row_major float4x4 WorldToPSSM0;   // Offset:  864 Size:    64 [unused]
//   row_major float4x4 PrevViewProject;// Offset:  928 Size:    64 [unused]
//   row_major float4x4 PrevWorld;      // Offset:  992 Size:    64 [unused]
//   row_major float4x4 ViewT;          // Offset: 1056 Size:    64 [unused]
//   float4 PSSMExtents;                // Offset: 1120 Size:    16 [unused]
//   float4 ShadowAtlasResolution;      // Offset: 1136 Size:    16 [unused]
//   float4 UnitRimData[3];             // Offset: 1152 Size:    48 [unused]
//   float3 __CameraPositionForCorrection;// Offset: 1200 Size:    12 [unused]
//   float __padding7;                  // Offset: 1212 Size:     4 [unused]
//   row_major float4x4 CameraViewProject;// Offset: 1216 Size:    64 [unused]
//   float4 BackBufferResolution;       // Offset: 1280 Size:    16 [unused]
//   row_major float4x4 InverseProjection;// Offset: 1296 Size:    64 [unused]
//   float4 StereoOffset;               // Offset: 1360 Size:    16 [unused]
//   row_major float4x4 Projection;     // Offset: 1376 Size:    64 [unused]
//   row_major float4x4 ViewInv;        // Offset: 1440 Size:    64 [unused]
//   float4 ColorSSAO;                  // Offset: 1504 Size:    16 [unused]
//   float4 GlobalFogColor;             // Offset: 1520 Size:    16 [unused]
//   float4 VolumetricLightGlobalParams;// Offset: 1536 Size:    16 [unused]
//   float4 SnowParams01;               // Offset: 1552 Size:    16 [unused]
//   float4 SnowParams02;               // Offset: 1568 Size:    16 [unused]
//   float4 SnowParams03;               // Offset: 1584 Size:    16 [unused]
//   int SSREnabled;                    // Offset: 1600 Size:     4 [unused]
//   int __padding4;                    // Offset: 1604 Size:     4 [unused]
//   int __padding5;                    // Offset: 1608 Size:     4 [unused]
//   int __padding6;                    // Offset: 1612 Size:     4 [unused]
//
// }
//
// cbuffer cbTiledLighting
// {
//
//   uint g_uNumNonDirectionalLights;   // Offset:    0 Size:     4
//   uint g_uNumDirectionalLights;      // Offset:    4 Size:     4 [unused]
//   uint g_uNumTilesX;                 // Offset:    8 Size:     4
//   uint g_uNumTilesY;                 // Offset:   12 Size:     4 [unused]
//   row_major float4x4 g_mProjection;  // Offset:   16 Size:    64 [unused]
//   row_major float4x4 g_mInvProjection;// Offset:   80 Size:    64 [unused]
//
// }
//
// Resource bind info for LightMinMaxBuffer
// {
//
//   float3 $Element;                   // Offset:    0 Size:    12
//
// }
//
// Resource bind info for LightDataBuffer
// {
//
//   struct STiledLightData
//   {
//       
//       float3 vPosition;              // Offset:    0
//       float fSegmentLength;          // Offset:   12
//       float3 vDirection;             // Offset:   16
//       float fMinShadowSpec;          // Offset:   28
//       float4 vAttParams;             // Offset:   32
//       float3 vSpotParams;            // Offset:   48
//       float fIntensity;              // Offset:   60
//       float4 vDiffuseColor;          // Offset:   64
//       float4 vShadowFadeParams;      // Offset:   80
//       uint uRelCen;                  // Offset:   96
//       uint uFxSpecificIdx;           // Offset:  100
//       uint uFxType;                  // Offset:  104
//       float fRadiusSquared;          // Offset:  108
//       float3 vLambertWeights;        // Offset:  112
//       float fSpecularStrength;       // Offset:  124
//       float3 vBoxAxisX;              // Offset:  128
//       uint uLightType;               // Offset:  140
//       float3 vBoxAxisZ;              // Offset:  144
//       uint bShadowEnabled;           // Offset:  156
//       float3 vBoxInnerDistance;      // Offset:  160
//       uint bModulationMapEnabled;    // Offset:  172
//       float3 vBoxInvRange;           // Offset:  176
//       uint uModulationMapIndex;      // Offset:  188
//       row_major float4x4 mViewToShadowMap;// Offset:  192
//       row_major float4x4 mViewToModulationMap;// Offset:  256
//       float3 vRecipOuterColiProxy;   // Offset:  320
//       uint uProbeFlags;              // Offset:  332
//       float3 vColixProxyCen;         // Offset:  336
//       uint bForwardOnly;             // Offset:  348
//       uint uShadowType;              // Offset:  352
//       uint uNumSoftShadowSamples;    // Offset:  356
//       float fSoftShadowRadius;       // Offset:  360
//       float fSoftShadowDepthBias;    // Offset:  364
//       float fSoftShadowExponent;     // Offset:  368
//       float fProbePriority;          // Offset:  372
//       float fUnusedParam[2];         // Offset:  376
//
//   } $Element;                        // Offset:    0 Size:   384
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// DepthBufferTexture_texture        texture  float4          2d    1        1
// LightMinMaxBuffer                 texture  struct         r/o    3        1
// LightDataBuffer                   texture  struct         r/o    4        1
// LightIndexBuffer                      UAV   uint4         buf    0        1
// SceneBuffer                       cbuffer      NA          NA    0        1
// cbTiledLighting                   cbuffer      NA          NA    7        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// no Input
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// no Output
cs_5_0
dcl_globalFlags refactoringAllowed
dcl_immediateConstantBuffer { { 1.000000, 0, 0, 0},
                              { 0, 1.000000, 0, 0},
                              { 0, 0, 1.000000, 0},
                              { 0, 0, 0, 1.000000} }
dcl_constantbuffer cb0[46], immediateIndexed
dcl_constantbuffer cb7[1], immediateIndexed
dcl_resource_texture2d (float,float,float,float) t1
dcl_resource_structured t3, 12 
dcl_resource_structured t4, 384 
dcl_uav_typed_buffer (uint,uint,uint,uint) u0
dcl_input vThreadIDInGroupFlattened
dcl_input vThreadGroupID.xy
dcl_temps 13
dcl_indexableTemp x0[2], 4
dcl_tgsm_raw g0, 4
dcl_tgsm_raw g1, 4
dcl_tgsm_structured g2, 4, 2
dcl_tgsm_structured g3, 4, 2
dcl_tgsm_raw g4, 4
dcl_tgsm_structured g5, 4, 64
dcl_tgsm_structured g6, 4, 64
dcl_tgsm_structured g7, 4, 2
dcl_thread_group 64, 1, 1
if_z vThreadIDInGroupFlattened.x
  store_raw g0.x, l(0), l(340282346638528860000000000000000000000.000000)
  store_raw g1.x, l(0), l(0)
  store_raw g4.x, l(0), l(0)
endif 
ult r0.x, vThreadIDInGroupFlattened.x, l(2)
if_nz r0.x
  store_structured g7.x, vThreadIDInGroupFlattened.x, l(0), l(0)
  store_structured g2.x, vThreadIDInGroupFlattened.x, l(0), l(0)
  store_structured g3.x, vThreadIDInGroupFlattened.x, l(0), l(0)
endif 
resinfo_indexable(texture2d)(float,float,float,float)_uint r0.xy, l(0), t1.xyzw
iadd r0.zw, r0.xxxy, l(0, 0, 15, 15)
ushr r0.zw, r0.zzzw, l(0, 0, 4, 4)
sync_g_t
ishl r1.xy, vThreadGroupID.xyxx, l(4, 4, 0, 0)
mov r2.zw, l(0,0,0,0)
mov r1.zw, l(0,0,340282346638528860000000000000000000000.000000,0)
mov r3.x, vThreadIDInGroupFlattened.x
loop 
  uge r3.y, r3.x, l(256)
  breakc_nz r3.y
  bfi r3.y, l(28), l(4), vThreadGroupID.x, r3.x
  ushr r3.z, r3.x, l(4)
  iadd r3.z, r1.y, r3.z
  utof r4.xy, r3.yzyy
  ftoi r2.xy, r4.xyxx
  ld_indexable(texture2d)(float,float,float,float) r2.x, r2.xyzw, t1.xyzw
  mad r2.x, r2.x, cb0[20].z, cb0[20].w
  max r2.x, r2.x, l(0.000000)
  lt r2.y, r2.x, l(1.000000)
  min r4.x, r1.z, r2.x
  max r4.y, r1.w, r2.x
  movc r1.zw, r2.yyyy, r4.xxxy, r1.zzzw
  iadd r3.x, r3.x, l(64)
endloop 
atomic_umax g1, l(0), r1.w
atomic_umin g0, l(0), r1.z
sync_g_t
ld_raw r2.z, l(0), g0.xxxx
ld_raw r1.z, l(0), g1.xxxx
add r3.z, r1.z, l(1.000000012E-007)
utof r1.zw, r1.xxxy
utof r0.xy, r0.xyxx
div r2.xy, r1.zwzz, r0.xyxx
iadd r1.xz, r1.xxyx, l(16, 0, 16, 0)
utof r1.xz, r1.xxzx
div r3.xy, r1.xzxx, r0.xyxx
mov r0.x, vThreadIDInGroupFlattened.x
loop 
  uge r0.y, r0.x, cb7[0].x
  breakc_nz r0.y
  ishl r0.y, r0.x, l(1)
  ld_structured_indexable(structured_buffer, stride=12)(mixed,mixed,mixed,mixed) r1.xzw, r0.y, l(0), t3.xxyz
  bfi r0.y, l(31), l(1), r0.x, l(1)
  ld_structured_indexable(structured_buffer, stride=12)(mixed,mixed,mixed,mixed) r4.xyz, r0.y, l(0), t3.xyzx
  lt r4.xyz, r2.xyzx, r4.xyzx
  and r0.y, r4.y, r4.x
  and r0.y, r4.z, r0.y
  lt r1.xzw, r1.xxzw, r3.xxyz
  and r1.x, r1.z, r1.x
  and r1.x, r1.w, r1.x
  and r0.y, r0.y, r1.x
  if_nz r0.y
    imm_atomic_iadd r4.x, g4, l(0), l(1)
    ult r0.y, r4.x, l(64)
    if_nz r0.y
      store_structured g5.x, r4.x, l(0), r0.x
    else 
      break 
    endif 
  endif 
  iadd r0.x, r0.x, l(64)
endloop 
sync_g_t
ld_raw r0.x, l(0), g4.xxxx
imin r0.x, r0.x, l(64)
if_nz r0.x
  bfi r0.y, l(28), l(4), vThreadGroupID.x, vThreadIDInGroupFlattened.x
  ushr r1.x, vThreadIDInGroupFlattened.x, l(4)
  imad r1.x, vThreadGroupID.y, l(16), r1.x
  utof r2.x, r0.y
  utof r2.y, r1.x
  ftoi r2.xy, r2.xyxx
  mov r2.zw, l(0,0,0,0)
  ld_indexable(texture2d)(float,float,float,float) r0.y, r2.xyzw, t1.yxzw
  mad r0.y, r0.y, cb0[20].x, cb0[20].y
  div r2.x, l(1.000000, 1.000000, 1.000000, 1.000000), r0.y
  iadd r1.xzw, vThreadIDInGroupFlattened.xxxx, l(64, 0, 128, 192)
  bfi r3.xyz, l(28, 28, 28, 0), l(4, 4, 4, 0), vThreadGroupID.xxxx, r1.xzwx
  ushr r1.xzw, r1.xxzw, l(4, 0, 4, 4)
  imad r1.xzw, vThreadGroupID.yyyy, l(16, 0, 16, 16), r1.xxzw
  utof r4.xz, r3.xxyx
  utof r4.yw, r1.xxxz
  ftoi r5.xy, r4.xyxx
  mov r5.zw, l(0,0,0,0)
  ld_indexable(texture2d)(float,float,float,float) r0.y, r5.xyzw, t1.yxzw
  mad r0.y, r0.y, cb0[20].x, cb0[20].y
  div r2.y, l(1.000000, 1.000000, 1.000000, 1.000000), r0.y
  ftoi r4.xy, r4.zwzz
  mov r4.zw, l(0,0,0,0)
  ld_indexable(texture2d)(float,float,float,float) r0.y, r4.xyzw, t1.yxzw
  mad r0.y, r0.y, cb0[20].x, cb0[20].y
  div r2.z, l(1.000000, 1.000000, 1.000000, 1.000000), r0.y
  utof r3.x, r3.z
  utof r3.y, r1.w
  ftoi r3.xy, r3.xyxx
  mov r3.zw, l(0,0,0,0)
  ld_indexable(texture2d)(float,float,float,float) r0.y, r3.xyzw, t1.yxzw
  mad r0.y, r0.y, cb0[20].x, cb0[20].y
  div r2.w, l(1.000000, 1.000000, 1.000000, 1.000000), r0.y
  mov x0[0].x, l(0)
  mov x0[1].x, l(0)
  mov r0.y, l(0)
  loop 
    uge r1.x, r0.y, r0.x
    breakc_nz r1.x
    ld_structured r1.x, r0.y, l(0), g5.xxxx
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r1.z, r1.x, l(140), t4.xxxx
    mov r1.w, r0.y
    mov r3.xy, r1.xzxx
    loop 
      ult r3.z, r1.w, r0.x
      ieq r4.xy, r3.yyyy, l(0, 1, 0, 0)
      or r3.w, r4.y, r4.x
      and r3.z, r3.w, r3.z
      breakc_z r3.z
      ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r4.xyzw, r3.x, l(0), t4.xyzw
      ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r5.xyz, r3.x, l(16), t4.xyzx
      ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r3.z, r3.x, l(108), t4.xxxx
      mov r3.w, r3.y
      mov r5.w, l(0)
      mov r6.x, l(0)
      loop 
        ult r6.y, r6.x, l(4)
        ieq r6.z, r5.w, l(0)
        and r6.y, r6.z, r6.y
        breakc_z r6.y
        bfi r6.y, l(26), l(6), r6.x, vThreadIDInGroupFlattened.x
        bfi r6.z, l(28), l(4), vThreadGroupID.x, r6.y
        ushr r6.y, r6.y, l(4)
        iadd r6.y, r1.y, r6.y
        utof r7.xy, r6.zyzz
        add r6.yz, r7.xxyx, l(0.000000, 0.500000, 0.500000, 0.000000)
        dp4 r7.z, r2.xyzw, icb[r6.x + 0].xyzw
        mad r6.yz, r6.yyzy, cb0[45].zzwz, cb0[45].xxyx
        mad r6.yz, r6.yyzy, cb0[18].xxyx, cb0[18].zzwz
        mul r7.xy, r7.zzzz, r6.yzyy
        add r6.yzw, -r4.xxyz, r7.xxyz
        ieq r7.x, r3.w, l(1)
        dp3 r7.y, r6.yzwy, r5.xyzx
        max r7.y, r7.y, l(0.000000)
        min r7.y, r4.w, r7.y
        mad r7.yzw, -r7.yyyy, r5.xxyz, r6.yyzw
        movc r6.yzw, r7.xxxx, r7.yyzw, r6.yyzw
        dp3 r6.y, r6.yzwy, r6.yzwy
        lt r6.y, r6.y, r3.z
        movc r5.w, r6.y, l(1), r5.w
        iadd r6.x, r6.x, l(1)
      endloop 
      ult r3.z, r1.w, l(32)
      movc r3.z, r3.z, l(0), l(1)
      ishl r3.w, r5.w, r1.w
      mov r4.x, x0[r3.z + 0].x
      or r3.w, r3.w, r4.x
      mov x0[r3.z + 0].x, r3.w
      iadd r1.w, r1.w, l(1)
      ult r3.z, r1.w, r0.x
      ld_structured r3.w, r1.w, l(0), g5.xxxx
      and r3.x, r3.w, r3.z
      ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r3.w, r3.x, l(140), t4.xxxx
      and r3.y, r3.w, r3.z
    endloop 
    mov r1.x, r1.w
    mov r1.z, r3.x
    mov r3.z, r3.y
    loop 
      ult r3.w, r1.x, r0.x
      ieq r4.xy, r3.zzzz, l(2, 3, 0, 0)
      or r4.x, r4.y, r4.x
      and r3.w, r3.w, r4.x
      breakc_z r3.w
      ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r4.xyzw, r1.z, l(0), t4.xyzw
      ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r5.xyz, r1.z, l(16), t4.xyzx
      ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r6.xyz, r1.z, l(48), t4.xyzx
      ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r7.x, r1.z, l(108), t4.xxxx
      ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r8.xyz, r1.z, l(128), t4.xyzx
      div r3.w, -r6.y, r6.x
      mov r6.w, r3.z
      mov r7.zw, l(0,0,0,0)
      loop 
        ult r8.w, r7.w, l(4)
        ieq r9.x, r7.z, l(0)
        and r8.w, r8.w, r9.x
        breakc_z r8.w
        bfi r8.w, l(26), l(6), r7.w, vThreadIDInGroupFlattened.x
        bfi r9.x, l(28), l(4), vThreadGroupID.x, r8.w
        ushr r8.w, r8.w, l(4)
        iadd r8.w, r1.y, r8.w
        utof r9.x, r9.x
        utof r9.y, r8.w
        add r9.xy, r9.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000)
        dp4 r10.z, r2.xyzw, icb[r7.w + 0].xyzw
        mad r9.xy, r9.xyxx, cb0[45].zwzz, cb0[45].xyxx
        mad r9.xy, r9.xyxx, cb0[18].xyxx, cb0[18].zwzz
        mul r10.xy, r10.zzzz, r9.xyxx
        add r9.xyz, -r4.xyzx, r10.xyzx
        ieq r8.w, r6.w, l(3)
        dp3 r9.w, r9.xyzx, r8.xyzx
        max r9.w, r9.w, l(0.000000)
        min r9.w, r4.w, r9.w
        mad r10.xyz, -r9.wwww, r8.xyzx, r9.xyzx
        movc r9.xyz, r8.wwww, r10.xyzx, r9.xyzx
        dp3 r6.x, r9.xyzx, r9.xyzx
        dp3 r7.y, r9.xyzx, r5.xyzx
        sqrt r8.w, r6.x
        mul r6.y, r3.w, r8.w
        lt r9.xyz, r6.xyzx, r7.xyyx
        and r6.x, r9.y, r9.x
        and r6.x, r9.z, r6.x
        movc r7.z, r6.x, l(1), r7.z
        iadd r7.w, r7.w, l(1)
      endloop 
      ult r3.w, r1.x, l(32)
      movc r3.w, r3.w, l(0), l(1)
      ishl r4.x, r7.z, r1.x
      mov r4.y, x0[r3.w + 0].x
      or r4.x, r4.x, r4.y
      mov x0[r3.w + 0].x, r4.x
      iadd r1.x, r1.x, l(1)
      ult r3.w, r1.x, r0.x
      ld_structured r4.x, r1.x, l(0), g5.xxxx
      and r1.z, r3.w, r4.x
      ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r4.x, r1.z, l(140), t4.xxxx
      and r3.z, r3.w, r4.x
    endloop 
    mov r3.w, r1.x
    mov r4.x, r1.z
    mov r4.y, r3.z
    loop 
      ult r4.z, r3.w, r0.x
      ieq r4.w, r4.y, l(4)
      and r4.z, r4.w, r4.z
      breakc_z r4.z
      ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r5.xyz, r4.x, l(0), t4.xyzx
      ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r6.xyz, r4.x, l(16), t4.xyzx
      ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r7.xyw, r4.x, l(128), t4.xyxz
      ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r8.xyz, r4.x, l(144), t4.xyzx
      ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r9.xyz, r4.x, l(160), t4.xyzx
      ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r10.xyz, r4.x, l(176), t4.xyzx
      mov r4.zw, l(0,0,0,0)
      loop 
        ult r6.w, r4.w, l(4)
        ieq r8.w, r4.z, l(0)
        and r6.w, r6.w, r8.w
        breakc_z r6.w
        bfi r6.w, l(26), l(6), r4.w, vThreadIDInGroupFlattened.x
        bfi r8.w, l(28), l(4), vThreadGroupID.x, r6.w
        ushr r6.w, r6.w, l(4)
        iadd r6.w, r1.y, r6.w
        utof r11.x, r8.w
        utof r11.y, r6.w
        add r11.xy, r11.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000)
        dp4 r12.z, r2.xyzw, icb[r4.w + 0].xyzw
        mad r11.xy, r11.xyxx, cb0[45].zwzz, cb0[45].xyxx
        mad r11.xy, r11.xyxx, cb0[18].xyxx, cb0[18].zwzz
        mul r12.xy, r12.zzzz, r11.xyxx
        add r11.xyz, r5.xyzx, -r12.xyzx
        dp3 r12.x, r11.xyzx, r7.xywx
        dp3 r12.y, r11.xyzx, r6.xyzx
        dp3 r12.z, r11.xyzx, r8.xyzx
        add r11.xyz, -r9.xyzx, |r12.xyzx|
        mul r11.xyz, r10.xyzx, r11.xyzx
        max r6.w, r11.y, r11.x
        max r6.w, r11.z, r6.w
        lt r6.w, r6.w, l(1.000000)
        movc r4.z, r6.w, l(1), r4.z
        iadd r4.w, r4.w, l(1)
      endloop 
      ult r4.w, r3.w, l(32)
      movc r4.w, r4.w, l(0), l(1)
      ishl r5.x, r4.z, r3.w
      mov r5.y, x0[r4.w + 0].x
      or r5.x, r5.x, r5.y
      mov x0[r4.w + 0].x, r5.x
      iadd r3.w, r3.w, l(1)
      ult r4.w, r3.w, r0.x
      ld_structured r5.x, r3.w, l(0), g5.xxxx
      and r4.x, r4.w, r5.x
      ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r5.x, r4.x, l(140), t4.xxxx
      and r4.y, r4.w, r5.x
    endloop 
    uge r4.x, r4.y, l(5)
    iadd r0.y, r3.w, -r4.x
  endloop 
  mov r0.y, x0[0].x
  atomic_or g7, l(0, 0, 0, 0), r0.y
  mov r0.y, x0[1].x
  atomic_or g7, l(1, 0, 0, 0), r0.y
  sync_g_t
endif 
ld_structured r0.y, l(0), l(0), g7.xxxx
ld_structured r1.x, l(1), l(0), g7.xxxx
or r0.y, r0.y, r1.x
if_nz r0.y
  ult r0.x, vThreadIDInGroupFlattened.x, r0.x
  if_nz r0.x
    ult r0.x, vThreadIDInGroupFlattened.x, l(32)
    movc r0.x, r0.x, l(0), l(1)
    ld_structured r0.x, r0.x, l(0), g7.xxxx
    ishl r0.y, l(1), vThreadIDInGroupFlattened.x
    and r0.x, r0.y, r0.x
    if_nz r0.x
      ld_structured r0.x, vThreadIDInGroupFlattened.x, l(0), g5.xxxx
      ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r0.x, r0.x, l(104), t4.xxxx
      umin r0.x, r0.x, l(1)
      mov r0.y, l(0)
      imm_atomic_iadd r1.x, g2, r0.xyxx, l(1)
    else 
      mov r1.x, l(-1)
      mov r0.x, l(0)
    endif 
  else 
    mov r1.x, l(-1)
    mov r0.x, l(0)
  endif 
  sync_g_t
  if_z vThreadIDInGroupFlattened.x
    store_structured g3.x, l(0), l(0), l(0)
    ld_structured r0.y, l(0), l(0), g2.xxxx
    imin r0.y, r0.y, l(24)
    store_structured g2.x, l(0), l(0), r0.y
    store_structured g3.x, l(1), l(0), r0.y
    ld_structured r0.y, l(1), l(0), g2.xxxx
    imin r0.y, r0.y, l(24)
    store_structured g2.x, l(1), l(0), r0.y
  endif 
  sync_g_t
  ld_structured r0.x, r0.x, l(0), g3.xxxx
  iadd r0.x, r1.x, r0.x
  ige r0.y, r1.x, l(0)
  ilt r1.x, r0.x, l(64)
  and r0.y, r0.y, r1.x
  if_nz r0.y
    ld_structured r0.y, vThreadIDInGroupFlattened.x, l(0), g5.xxxx
    store_structured g6.x, r0.x, l(0), r0.y
  endif 
endif 
sync_g_t
imad r0.x, vThreadGroupID.y, cb7[0].z, vThreadGroupID.x
imul null, r0.y, r0.w, r0.z
imul null, r0.z, vThreadIDInGroupFlattened.x, l(3)
mov r0.w, l(0)
loop 
  uge r1.x, r0.w, l(2)
  breakc_nz r1.x
  ult r1.x, r0.w, l(2)
  movc r1.x, r1.x, l(8), l(4)
  ult r1.y, vThreadIDInGroupFlattened.x, r1.x
  if_nz r1.y
    ishl r1.y, r0.w, l(3)
    ld_structured r1.z, r0.w, l(0), g2.xxxx
    iadd r1.z, -r0.z, r1.z
    imax r1.z, r1.z, l(0)
    imin r2.w, r1.z, l(3)
    ld_structured r1.z, r0.w, l(0), g3.xxxx
    imad r1.z, vThreadIDInGroupFlattened.x, l(3), r1.z
    imul null, r1.x, r0.x, r1.x
    imad r1.x, r0.y, r1.y, r1.x
    iadd r1.x, r1.x, vThreadIDInGroupFlattened.x
    ld_structured r2.x, r1.z, l(0), g6.xxxx
    iadd r1.yz, r1.zzzz, l(0, 1, 2, 0)
    ld_structured r2.y, r1.y, l(0), g6.xxxx
    ld_structured r2.z, r1.z, l(0), g6.xxxx
    store_uav_typed u0.xyzw, r1.xxxx, r2.xyzw
  endif 
  iadd r0.w, r0.w, l(1)
endloop 
ret 
// Approximately 379 instruction slots used
