// Tile Lighting - generates LightMinMaxBuffer for cs f72d0d363421b2a2

// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//   using 3Dmigoto v1.2.27 on Fri Jan 29 08:58:48 2016
//
//
// Buffer Definitions: 
//
// cbuffer cbTiledLighting
// {
//
//   uint g_uNumNonDirectionalLights;   // Offset:    0 Size:     4
//   uint g_uNumDirectionalLights;      // Offset:    4 Size:     4 [unused]
//   uint g_uNumTilesX;                 // Offset:    8 Size:     4 [unused]
//   uint g_uNumTilesY;                 // Offset:   12 Size:     4 [unused]
//   row_major float4x4 g_mProjection;  // Offset:   16 Size:    64
//   row_major float4x4 g_mInvProjection;// Offset:   80 Size:    64
//
// }
//
// Resource bind info for LightBoundsBuffer
// {
//
//   struct STiledLightBounds
//   {
//       
//       float3 vBoxAxisX;              // Offset:    0
//       uint bForwardOnly;             // Offset:   12
//       float3 vBoxAxisY;              // Offset:   16
//       float fPad1;                   // Offset:   28
//       float3 vBoxAxisZ;              // Offset:   32
//       float fPad2;                   // Offset:   44
//       float3 vCen;                   // Offset:   48
//       float fPad3;                   // Offset:   60
//       float2 vScaleXZ;               // Offset:   64
//       float fRadius;                 // Offset:   72
//       float fPad4;                   // Offset:   76
//
//   } $Element;                        // Offset:    0 Size:    80
//
// }
//
// Resource bind info for LightMinMaxBuffer
// {
//
//   float3 $Element;                   // Offset:    0 Size:    12
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// LightBoundsBuffer                 texture  struct         r/o    3        1
// LightMinMaxBuffer                     UAV  struct         r/w    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

// Declare cbuffer SceneBuffer, which is still bound according to frame analysis:
dcl_constantbuffer cb0[101], immediateIndexed

dcl_constantbuffer cb7[9], immediateIndexed
dcl_resource_structured t3, 80 
dcl_uav_structured u0, 12
dcl_input vThreadIDInGroupFlattened
dcl_input vThreadGroupID.x
dcl_temps 21
// dcl_temps 20
dcl_tgsm_structured g0, 4, 144
dcl_tgsm_structured g1, 4, 144
dcl_tgsm_structured g2, 4, 144
dcl_tgsm_structured g3, 4, 144
dcl_tgsm_structured g4, 4, 48
dcl_thread_group 64, 1, 1

dcl_resource_texture2d (float,float,float,float) t125

ushr r0.x, vThreadIDInGroupFlattened.x, l(3)
imad r0.y, vThreadGroupID.x, l(8), r0.x
and r0.z, vThreadIDInGroupFlattened.x, l(7)
ld_structured_indexable(structured_buffer, stride=80)(mixed,mixed,mixed,mixed) r1.xyzw, r0.y, l(0), t3.xyzw
ld_structured_indexable(structured_buffer, stride=80)(mixed,mixed,mixed,mixed) r2.xyz, r0.y, l(16), t3.xyzx
ld_structured_indexable(structured_buffer, stride=80)(mixed,mixed,mixed,mixed) r3.xyz, r0.y, l(32), t3.xyzx

// LightBoundsBuffer.vCen:
ld_structured_indexable(structured_buffer, stride=80)(mixed,mixed,mixed,mixed) r4.xyz, r0.y, l(48), t3.xyzx

// Adjust light bounding box center to fix one of the clipping issues:
ld_indexable(texture2d)(float,float,float,float) r20.xyzw, l(0, 0, 0, 0), t125.xyzw
add r20.w, r4.z, -r20.y
mul r20.w, r20.w, r20.x
mul r20.w, r20.w, cb0[81].x
add r4.x, r4.x, r20.w

ld_structured_indexable(structured_buffer, stride=80)(mixed,mixed,mixed,mixed) r5.xyz, r0.y, l(64), t3.xyzx
ult r0.w, r0.z, l(6)
ult r0.y, r0.y, cb7[0].x
and r0.w, r0.y, r0.w
if_nz r0.w
  ieq r6.xyzw, r0.zzzz, l(0, 1, 2, 3)
  or r6.xy, r6.ywyy, r6.xzxx
  movc r0.w, r6.y, l(1), l(2)
  movc r0.w, r6.x, l(0), r0.w
  and r2.w, vThreadIDInGroupFlattened.x, l(1)
  movc r3.w, r2.w, l(1.000000), l(-1.000000)
  ieq r6.yz, r0.wwww, l(0, 1, 2, 0)
  movc r7.xyz, r6.yyyy, r3.xyzx, r2.xyzx
  movc r7.xyz, r6.xxxx, r1.xyzx, r7.xyzx
  mul r8.xyz, r3.wwww, r7.xyzx
  movc r9.xyz, r6.yyyy, -r1.xyzx, r3.xyzx
  movc r9.xyz, r6.xxxx, r3.xyzx, r9.xyzx
  mul r9.xyz, r3.wwww, r9.xyzx
  or r0.w, r6.x, r6.y
  movc r10.xyz, r0.wwww, r2.xyzx, -r1.xyzx
  ine r2.w, r2.w, l(0)
  and r2.w, r2.w, r6.z
  mul r6.yzw, r5.yyyy, r9.xxyz
  mul r11.xyz, r5.xxxx, r10.xyzx
  movc r6.yzw, r2.wwww, r6.yyzw, r9.xxyz
  movc r9.xyz, r2.wwww, r11.xyzx, r10.xyzx
  movc r10.xy, r6.xxxx, r5.xyxx, r5.yxyy
  mul r10.xzw, r8.xxyz, r10.xxxx
  mul r11.xyz, r6.yzwy, r10.yyyy
  movc r8.xyz, r0.wwww, r10.xzwx, r8.xyzx
  movc r10.xyz, r0.wwww, r11.xyzx, r6.yzwy
  mad r7.xyz, r3.wwww, r7.xyzx, r4.xyzx
  add r11.xyz, r6.yzwy, r7.xyzx
  add r11.xyz, -r9.xyzx, r11.xyzx
  add r8.xyz, r4.xyzx, r8.xyzx
  add r12.xyz, r10.xyzx, r8.xyzx
  add r12.xyz, r9.xyzx, r12.xyzx
  add r8.xyz, -r10.xyzx, r8.xyzx
  add r8.xyz, r9.xyzx, r8.xyzx
  add r6.xyz, -r6.yzwy, r7.xyzx
  add r6.xyz, -r9.xyzx, r6.xyzx
  mul r7.xyzw, r11.yyyy, cb7[2].xyzw
  mad r7.xyzw, r11.xxxx, cb7[1].xyzw, r7.xyzw
  mad r7.xyzw, r11.zzzz, cb7[3].xyzw, r7.xyzw
  add r7.xyzw, r7.xyzw, cb7[4].xyzw
  mul r9.xyzw, r12.yyyy, cb7[2].xyzw
  mad r9.xyzw, r12.xxxx, cb7[1].xyzw, r9.xyzw
  mad r9.xyzw, r12.zzzz, cb7[3].xyzw, r9.xyzw
  add r9.xyzw, r9.xyzw, cb7[4].xyzw
  mul r10.xyzw, r8.yyyy, cb7[2].xyzw
  mad r10.xyzw, r8.xxxx, cb7[1].xyzw, r10.xyzw
  mad r8.xyzw, r8.zzzz, cb7[3].xyzw, r10.xyzw
  add r8.xyzw, r8.xyzw, cb7[4].xyzw
  mul r10.xyzw, r6.yyyy, cb7[2].xyzw
  mad r10.xyzw, r6.xxxx, cb7[1].xyzw, r10.xyzw
  mad r6.xyzw, r6.zzzz, cb7[3].xyzw, r10.xyzw
  add r6.xyzw, r6.xyzw, cb7[4].xyzw
  lt r10.xy, r7.xyxx, -r7.wwww
  lt r11.xyz, r7.wwww, r7.xyzx
  and r11.xyz, r11.xyzx, l(2, 8, 32, 0)
  bfi r0.w, l(1), l(0), r10.x, r11.x
  and r2.w, r10.y, l(4)
  iadd r0.w, r0.w, r2.w
  iadd r0.w, r11.y, r0.w
  lt r10.xy, r7.zwzz, l(0.000000, 0.000000, 0.000000, 0.000000)
  and r2.w, r10.x, l(16)
  iadd r0.w, r0.w, r2.w
  iadd r0.w, r11.z, r0.w
  lt r10.xz, r9.xxyx, -r9.wwww
  lt r11.xyz, r9.wwww, r9.xyzx
  and r11.xy, r11.xyxx, l(2, 8, 0, 0)
  bfi r2.w, l(1), l(0), r10.x, r11.x
  and r3.w, r10.z, l(4)
  iadd r2.w, r2.w, r3.w
  iadd r2.w, r11.y, r2.w
  lt r10.xz, r9.zzwz, l(0.000000, 0.000000, 0.000000, 0.000000)
  and r3.w, r10.x, l(16)
  iadd r2.w, r2.w, r3.w
  lt r10.xw, r8.xxxy, -r8.wwww
  lt r11.xyw, r8.wwww, r8.xyxz
  and r11.xy, r11.xyxx, l(2, 8, 0, 0)
  bfi r3.w, l(1), l(0), r10.x, r11.x
  and r5.w, r10.w, l(4)
  iadd r3.w, r3.w, r5.w
  iadd r3.w, r11.y, r3.w
  lt r10.xw, r8.zzzw, l(0.000000, 0.000000, 0.000000, 0.000000)
  and r5.w, r10.x, l(16)
  iadd r3.w, r3.w, r5.w
  lt r11.xy, r6.xyxx, -r6.wwww
  lt r12.xyz, r6.wwww, r6.xyzx
  and r12.xy, r12.xyxx, l(2, 8, 0, 0)
  bfi r5.w, l(1), l(0), r11.x, r12.x
  and r10.x, r11.y, l(4)
  iadd r5.w, r5.w, r10.x
  iadd r5.w, r12.y, r5.w
  lt r11.xy, r6.zwzz, l(0.000000, 0.000000, 0.000000, 0.000000)
  and r10.x, r11.x, l(16)
  iadd r5.w, r5.w, r10.x
  movc r10.x, r10.y, l(-1.000000), l(1.000000)
  movc r7.w, r10.y, -r7.w, r7.w
  lt r10.y, r7.w, l(1.192092896E-007)
  movc r7.w, r10.y, l(1.192092896E-007), r7.w
  mul r7.w, r7.w, r10.x
  div r7.xyz, r7.xyzx, r7.wwww
  movc r10.x, r10.z, l(-1.000000), l(1.000000)
  movc r9.w, r10.z, -r9.w, r9.w
  lt r10.y, r9.w, l(1.192092896E-007)
  movc r9.w, r10.y, l(1.192092896E-007), r9.w
  mul r9.w, r9.w, r10.x
  div r9.xyz, r9.xyzx, r9.wwww
  lt r10.xyz, r7.xyzx, r9.xyzx
  lt r12.xyw, r9.xyxz, r7.xyxz
  movc r13.xyz, r12.xywx, r9.xyzx, r7.xyzx
  mov r7.w, r9.x
  mov r13.w, r7.x
  movc r14.yz, r10.xxxx, r7.xxwx, r13.xxwx
  mov r9.w, r7.y
  mov r15.y, r13.y
  mov r15.z, r9.w
  movc r15.yz, r10.yyyy, r9.wwyw, r15.yyzy
  mov r13.x, r7.z
  mov r13.y, r9.z
  movc r7.yz, r10.zzzz, r13.xxyx, r13.zzxz
  movc r9.x, r10.w, l(-1.000000), l(1.000000)
  movc r8.w, r10.w, -r8.w, r8.w
  lt r9.y, r8.w, l(1.192092896E-007)
  movc r8.w, r9.y, l(1.192092896E-007), r8.w
  mul r8.w, r8.w, r9.x
  div r8.xyz, r8.xyzx, r8.wwww
  lt r8.w, r14.z, r8.x
  lt r9.x, r8.x, r14.y
  movc r14.x, r9.x, r8.x, r14.y
  mov r14.w, r8.x
  movc r9.yz, r8.wwww, r14.yywy, r14.xxzx
  lt r8.x, r15.z, r8.y
  lt r8.w, r8.y, r15.y
  movc r15.x, r8.w, r8.y, r15.y
  mov r15.w, r8.y
  movc r10.yz, r8.xxxx, r15.yywy, r15.xxzx
  lt r8.x, r7.z, r8.z
  lt r8.y, r8.z, r7.y
  movc r7.x, r8.y, r8.z, r7.y
  mov r7.w, r8.z
  movc r7.yz, r8.xxxx, r7.yywy, r7.xxzx
  movc r8.x, r11.y, l(-1.000000), l(1.000000)
  movc r6.w, r11.y, -r6.w, r6.w
  lt r8.y, r6.w, l(1.192092896E-007)
  movc r6.w, r8.y, l(1.192092896E-007), r6.w
  mul r6.w, r6.w, r8.x
  div r6.xyz, r6.xyzx, r6.wwww
  lt r6.w, r9.z, r6.x
  lt r8.x, r6.x, r9.y
  movc r9.x, r8.x, r6.x, r9.y
  mov r9.w, r6.x
  movc r6.xw, r6.wwww, r9.yyyw, r9.xxxz
  lt r8.x, r10.z, r6.y
  lt r8.y, r6.y, r10.y
  movc r10.x, r8.y, r6.y, r10.y
  mov r10.w, r6.y
  movc r8.xy, r8.xxxx, r10.ywyy, r10.xzxx
  lt r6.y, r7.z, r6.z
  lt r8.z, r6.z, r7.y
  movc r7.x, r8.z, r6.z, r7.y
  mov r7.w, r6.z
  movc r6.yz, r6.yyyy, r7.yywy, r7.xxzx
  imul null, r7.x, r0.x, l(9)
  imad r7.y, r0.x, l(6), r0.z
  ishl r7.z, r11.z, l(6)
  and r7.z, r7.z, l(2048)
  imad r2.w, r2.w, l(64), r7.z
  iadd r0.w, r0.w, r2.w
  ishl r2.w, r11.w, l(12)
  and r2.w, r2.w, l(0x00020000)
  imad r2.w, r3.w, l(4096), r2.w
  iadd r0.w, r0.w, r2.w
  ishl r2.w, r12.z, l(18)
  and r2.w, r2.w, l(0x00800000)
  imad r2.w, r5.w, l(0x00040000), r2.w
  iadd r0.w, r0.w, r2.w
  store_structured g4.x, r7.y, l(0), r0.w
  ishl r0.w, r7.x, l(1)
  iadd r0.w, r0.z, r0.w
  store_structured g0.x, r0.w, l(0), r6.x
  store_structured g1.x, r0.w, l(0), r8.x
  store_structured g2.x, r0.w, l(0), r6.y
  iadd r0.w, r0.w, l(6)
  store_structured g0.x, r0.w, l(0), r6.w
  store_structured g1.x, r0.w, l(0), r8.y
  store_structured g2.x, r0.w, l(0), r6.z
endif 
sync_g_t
ieq r0.z, r0.z, l(0)
and r0.y, r0.y, r0.z
if_nz r0.y
  mov r0.yzw, l(0,-1,0,0)
  loop 
    ige r2.w, r0.w, l(6)
    breakc_nz r2.w
    imad r2.w, r0.x, l(6), r0.w
    ld_structured r2.w, r2.w, l(0), g4.xxxx
    and r3.w, r2.w, l(63)
    mov r5.w, r3.w
    mov r6.x, r3.w
    mov r6.y, l(1)
    loop 
      ige r6.z, r6.y, l(4)
      breakc_nz r6.z
      imul null, r6.z, r6.y, l(6)
      ushr r6.z, r2.w, r6.z
      and r6.z, r6.z, l(63)
      and r5.w, r5.w, r6.z
      or r6.x, r6.z, r6.x
      iadd r6.y, r6.y, l(1)
    endloop 
    and r0.y, r0.y, r5.w
    or r0.z, r0.z, r6.x
    iadd r0.w, r0.w, l(1)
  endloop 
  ine r0.y, r0.y, l(0)
  ieq r0.w, r0.z, l(0)
  or r0.y, r0.w, r0.y
  if_nz r0.y
    if_z r0.z
      imul null, r0.y, r0.x, l(9)
      ishl r0.y, r0.y, l(1)
      mov r6.xyzw, l(0,0,0,0)
      mov r7.zw, l(0,0,0,0)
      mov r0.z, l(0)
      loop 
        ige r2.w, r0.z, l(6)
        breakc_nz r2.w
        iadd r2.w, r0.z, r0.y
        ld_structured r8.y, r2.w, l(0), g0.xxxx
        ld_structured r8.z, r2.w, l(0), g1.xxxx
        ld_structured r8.w, r2.w, l(0), g2.xxxx
        iadd r2.w, r2.w, l(6)
        ld_structured r9.y, r2.w, l(0), g0.xxxx
        ld_structured r9.z, r2.w, l(0), g1.xxxx
        ld_structured r9.w, r2.w, l(0), g2.xxxx
        ieq r2.w, r0.z, l(0)
        mov r10.xyzw, r6.zyxw
        mov r11.xw, r7.zzzw
        mov r3.w, l(0)
        loop 
          ige r5.w, r3.w, l(2)
          breakc_nz r5.w
          movc r12.yzw, r3.wwww, r9.yyzw, r8.yyzw
          ieq r5.w, r3.w, l(0)
          and r5.w, r2.w, r5.w
          movc r12.x, r5.w, r12.y, r10.x
          movc r13.x, r5.w, r12.z, r10.z
          mov r11.yz, r10.yywy
          movc r14.xyzw, r5.wwww, r12.wyzw, r11.xyzw
          lt r15.xyz, r14.yzwy, r12.yzwy
          lt r8.x, r12.y, r12.x
          or r8.x, r5.w, r8.x
          movc r16.x, r8.x, r12.y, r10.x
          mov r16.yw, r14.yyyz
          movc r10.xy, r15.xxxx, r12.xyxx, r16.xyxx
          lt r8.x, r12.z, r13.x
          or r8.x, r5.w, r8.x
          movc r16.z, r8.x, r12.z, r10.z
          mov r13.y, r12.z
          movc r10.zw, r15.yyyy, r13.xxxy, r16.zzzw
          lt r8.x, r12.w, r14.x
          or r5.w, r5.w, r8.x
          movc r14.z, r5.w, r12.w, r11.x
          mov r14.y, r12.w
          movc r11.xw, r15.zzzz, r14.xxxy, r14.zzzw
          iadd r3.w, r3.w, l(1)
        endloop 
        mov r6.xyzw, r10.zyxw
        mov r7.zw, r11.xxxw
        iadd r0.z, r0.z, l(1)
      endloop 
    else 
      mov r6.xyzw, l(0,0,0,0)
      mov r7.zw, l(0,0,0,0)
    endif 
  else 
    imul null, r0.y, r0.x, l(9)
    ishl r0.z, r0.y, l(1)
    imad r0.y, r0.y, l(2), l(1)
    iadd r8.xy, r0.zzzz, l(2, 3, 0, 0)
    mov r2.w, l(0)
    mov r3.w, l(0)
    mov r5.w, l(0)
    mov r8.zw, l(0,0,0,0)
    mov r9.xyz, l(0,0,0,0)
    loop 
      ige r9.w, r9.z, l(6)
      breakc_nz r9.w
      ieq r10.xyzw, r9.zzzz, l(0, 1, 2, 3)
      or r10.xy, r10.ywyy, r10.xzxx
      movc r9.w, r10.y, l(1), l(2)
      movc r9.w, r10.x, l(0), r9.w
      and r10.y, r9.z, l(1)
      movc r10.z, r10.y, l(1.000000), l(-1.000000)
      ieq r11.xy, r9.wwww, l(1, 2, 0, 0)
      movc r12.xyz, r11.xxxx, r3.xyzx, r2.xyzx
      movc r12.xyz, r10.xxxx, r1.xyzx, r12.xyzx
      mul r13.xyz, r10.zzzz, r12.xyzx
      movc r14.xyz, r11.xxxx, -r1.xyzx, r3.xyzx
      movc r14.xyz, r10.xxxx, r3.xyzx, r14.xyzx
      mul r14.xyz, r10.zzzz, r14.xyzx
      or r9.w, r10.x, r11.x
      movc r11.xzw, r9.wwww, r2.xxyz, -r1.xxyz
      ine r10.y, r10.y, l(0)
      and r10.y, r10.y, r11.y
      mul r15.xyz, r5.yyyy, r14.xyzx
      mul r16.xyz, r5.xxxx, r11.xzwx
      movc r14.xyz, r10.yyyy, r15.xyzx, r14.xyzx
      movc r11.xyz, r10.yyyy, r16.xyzx, r11.xzwx
      movc r10.xy, r10.xxxx, r5.xyxx, r5.yxyy
      mul r15.xyz, r10.xxxx, r13.xyzx
      mul r10.xyw, r10.yyyy, r14.xyxz
      movc r13.xyz, r9.wwww, r15.xyzx, r13.xyzx
      movc r10.xyw, r9.wwww, r10.xyxw, r14.xyxz
      mad r12.xyz, r10.zzzz, r12.xyzx, r4.xyzx
      add r15.xyz, r14.xyzx, r12.xyzx
      add r15.xyz, -r11.xyzx, r15.xyzx
      add r13.xyz, r4.xyzx, r13.xyzx
      add r16.xyz, r10.xywx, r13.xyzx
      add r16.xyz, r11.xyzx, r16.xyzx
      add r10.xyz, -r10.xywx, r13.xyzx
      add r10.xyz, r11.xyzx, r10.xyzx
      add r12.xyz, -r14.xyzx, r12.xyzx
      add r11.xyz, -r11.xyzx, r12.xyzx
      mul r12.xyzw, r15.yyyy, cb7[2].xyzw
      mad r12.xyzw, r15.xxxx, cb7[1].xyzw, r12.xyzw
      mad r12.xyzw, r15.zzzz, cb7[3].xyzw, r12.xyzw
      add r12.xyzw, r12.xyzw, cb7[4].xyzw
      mul r13.xyzw, r16.yyyy, cb7[2].xyzw
      mad r13.xyzw, r16.xxxx, cb7[1].xyzw, r13.xyzw
      mad r13.xyzw, r16.zzzz, cb7[3].xyzw, r13.xyzw
      add r13.xyzw, r13.xyzw, cb7[4].xyzw
      mul r14.xyzw, r10.yyyy, cb7[2].xyzw
      mad r14.xyzw, r10.xxxx, cb7[1].xyzw, r14.xyzw
      mad r10.xyzw, r10.zzzz, cb7[3].xyzw, r14.xyzw
      add r10.xyzw, r10.xyzw, cb7[4].xyzw
      mul r14.xyzw, r11.yyyy, cb7[2].xyzw
      mad r14.xyzw, r11.xxxx, cb7[1].xyzw, r14.xyzw
      mad r11.xyzw, r11.zzzz, cb7[3].xyzw, r14.xyzw
      add r11.xyzw, r11.xyzw, cb7[4].xyzw
      store_structured g0.x, r0.z, l(0), r12.x
      store_structured g0.x, r0.y, l(0), r13.x
      store_structured g0.x, r8.x, l(0), r10.x
      store_structured g0.x, r8.y, l(0), r11.x
      store_structured g1.x, r0.z, l(0), r12.y
      store_structured g1.x, r0.y, l(0), r13.y
      store_structured g1.x, r8.x, l(0), r10.y
      store_structured g1.x, r8.y, l(0), r11.y
      store_structured g2.x, r0.z, l(0), r12.z
      store_structured g2.x, r0.y, l(0), r13.z
      store_structured g2.x, r8.x, l(0), r10.z
      store_structured g2.x, r8.y, l(0), r11.z
      store_structured g3.x, r0.z, l(0), r12.w
      store_structured g3.x, r0.y, l(0), r13.w
      store_structured g3.x, r8.x, l(0), r10.w
      store_structured g3.x, r8.y, l(0), r11.w
      mov r9.w, l(0)
      mov r10.xy, l(4,0,0,0)
      loop 
        uge r10.z, r10.y, l(6)
        breakc_nz r10.z
        imad r10.zw, r9.wwww, l(0, 0, 9, -9), r0.zzzz
        iadd r10.w, r10.w, l(9)
        iadd r11.x, r10.z, r10.x
        iadd r11.x, r11.x, l(-1)
        ld_structured r11.y, r11.x, l(0), g0.xxxx
        ld_structured r11.z, r11.x, l(0), g1.xxxx
        ld_structured r11.w, r11.x, l(0), g2.xxxx
        ld_structured r11.x, r11.x, l(0), g3.xxxx
        ishl r12.x, l(1), r10.y
        lt r12.y, r11.y, -r11.x
        lt r12.z, r11.x, r11.y
        and r12.z, r12.z, l(2)
        bfi r12.y, l(1), l(0), r12.y, r12.z
        lt r12.z, r11.z, -r11.x
        and r12.z, r12.z, l(4)
        iadd r12.y, r12.z, r12.y
        lt r12.z, r11.x, r11.z
        and r12.z, r12.z, l(8)
        iadd r12.y, r12.z, r12.y
        lt r12.z, r11.w, l(0.000000)
        and r12.z, r12.z, l(16)
        iadd r12.y, r12.z, r12.y
        lt r12.z, r11.x, r11.w
        and r12.z, r12.z, l(32)
        iadd r12.y, r12.z, r12.y
        and r12.y, r12.x, r12.y
        ieq r12.y, r12.y, l(0)
        ieq r12.z, r10.y, l(4)
        and r12.w, r10.y, l(1)
        movc r12.w, r12.w, l(1.000000), l(-1.000000)
        movc r12.z, r12.z, l(0), r12.w
        ushr r12.w, r10.y, l(1)
        ieq r13.x, r12.w, l(1)
        mov r14.xyzw, r11.yzwx
        mov r13.z, r12.y
        mov r13.yw, l(0,0,0,0)
        loop 
          ige r15.x, r13.w, r10.x
          breakc_nz r15.x
          iadd r15.x, r10.z, r13.w
          ld_structured r16.x, r15.x, l(0), g0.xxxx
          ld_structured r16.y, r15.x, l(0), g1.xxxx
          ld_structured r16.z, r15.x, l(0), g2.xxxx
          ld_structured r16.w, r15.x, l(0), g3.xxxx
          lt r15.xy, r16.xyxx, -r16.wwww
          lt r17.xyz, r16.wwww, r16.xyzx
          and r17.xyz, r17.xyzx, l(2, 8, 32, 0)
          bfi r15.x, l(1), l(0), r15.x, r17.x
          and r15.y, r15.y, l(4)
          iadd r15.x, r15.y, r15.x
          iadd r15.x, r17.y, r15.x
          lt r15.y, r16.z, l(0.000000)
          and r15.y, r15.y, l(16)
          iadd r15.x, r15.y, r15.x
          iadd r15.x, r17.z, r15.x
          and r15.x, r12.x, r15.x
          ieq r15.y, r15.x, l(0)
          not r15.z, r13.z
          and r15.z, r15.z, r15.y
          not r15.w, r15.y
          and r15.w, r13.z, r15.w
          or r15.z, r15.w, r15.z
          if_nz r15.z
            ilt r15.z, r13.y, l(9)
            if_nz r15.z
              swapc r17.xyzw, r18.xyzw, r15.xxxx, r14.xyzw, r16.xyzw
              movc r15.z, r13.x, r18.y, r18.z
              movc r15.z, r12.w, r15.z, r18.x
              movc r15.w, r13.x, r17.y, r17.z
              movc r15.w, r12.w, r15.w, r17.x
              mad r19.x, r12.z, r17.w, -r15.w
              add r15.z, -r15.w, r15.z
              add r15.w, -r17.w, r18.w
              mad r15.z, -r12.z, r15.w, r15.z
              div r15.z, r19.x, r15.z
              add r15.w, -r15.z, l(1.000000)
              mul r17.xyzw, r15.wwww, r17.xyzw
              mad r17.xyzw, r18.xyzw, r15.zzzz, r17.xyzw
              mul r18.x, r12.z, r17.w
              mov r18.yz, r17.yyzy
              movc r17.yz, r13.xxxx, r18.xxzx, r18.yyxy
              movc r17.xyz, r12.wwww, r17.xyzx, r18.xyzx
              iadd r15.z, r10.w, r13.y
              store_structured g0.x, r15.z, l(0), r17.x
              store_structured g1.x, r15.z, l(0), r17.y
              store_structured g2.x, r15.z, l(0), r17.z
              store_structured g3.x, r15.z, l(0), r17.w
              iadd r13.y, r13.y, l(1)
            endif 
          endif 
          if_z r15.x
            ilt r15.x, r13.y, l(9)
            if_nz r15.x
              iadd r15.x, r10.w, r13.y
              store_structured g0.x, r15.x, l(0), r16.x
              store_structured g1.x, r15.x, l(0), r16.y
              store_structured g2.x, r15.x, l(0), r16.z
              store_structured g3.x, r15.x, l(0), r16.w
              iadd r13.y, r13.y, l(1)
            endif 
          endif 
          iadd r13.w, r13.w, l(1)
          mov r14.xyzw, r16.xyzw
          mov r13.z, r15.y
        endloop 
        iadd r10.z, -r9.w, l(1)
        ilt r10.w, r13.y, l(3)
        ige r11.x, r13.y, l(9)
        or r10.w, r10.w, r11.x
        if_nz r10.w
          mov r9.w, r10.z
          mov r10.x, r13.y
          break 
        endif 
        iadd r10.y, r10.y, l(1)
        mov r9.w, r10.z
        mov r10.x, r13.y
      endloop 
      ilt r10.y, l(2), r10.x
      if_nz r10.y
        imad r10.y, r9.w, l(9), r0.z
        mov r10.z, r2.w
        mov r11.x, r3.w
        mov r11.y, r5.w
        mov r10.w, r8.z
        mov r11.z, r8.w
        mov r11.w, r9.x
        mov r12.x, r9.y
        mov r12.y, l(0)
        loop 
          ige r12.z, r12.y, r10.x
          breakc_nz r12.z
          iadd r12.z, r10.y, r12.y
          ld_structured r12.w, r12.z, l(0), g0.xxxx
          ld_structured r13.x, r12.z, l(0), g1.xxxx
          ld_structured r13.z, r12.z, l(0), g2.xxxx
          ld_structured r12.z, r12.z, l(0), g3.xxxx
          div r14.y, r12.w, r12.z
          div r14.zw, r13.xxxz, r12.zzzz
          movc r14.x, r12.x, r10.z, r14.y
          movc r15.xz, r12.xxxx, r11.xxyx, r14.zzwz
          mov r11.y, r10.w
          movc r16.yzw, r12.xxxx, r11.zzyw, r14.zzyw
          lt r13.xzw, r16.zzyw, r14.yyzw
          lt r12.z, r14.y, r14.x
          movc r16.x, r12.z, r14.y, r14.x
          movc r10.zw, r13.xxxx, r14.xxxy, r16.xxxz
          lt r12.zw, r14.zzzw, r15.xxxz
          movc r16.xz, r12.zzwz, r14.zzwz, r15.xxzx
          mov r15.yw, r14.zzzw
          movc r11.xyzw, r13.zwzw, r15.xzyw, r16.xzyw
          iadd r12.y, r12.y, l(1)
          mov r12.x, l(-1)
        endloop 
        mov r2.w, r10.z
        mov r3.w, r11.x
        mov r5.w, r11.y
        mov r8.z, r10.w
        mov r8.w, r11.z
        mov r9.x, r11.w
        mov r9.y, r12.x
      endif 
      iadd r9.z, r9.z, l(1)
    endloop 
    mov r0.y, l(0)
    loop 
      ige r8.x, r0.y, l(8)
      breakc_nz r8.x
      and r10.xyz, r0.yyyy, l(1, 2, 4, 0)
      movc r10.xyz, r10.xyzx, l(1,1,1,0), l(-1,-1,0,0)
      itof r10.xyz, r10.xyzx
      mul r11.xyzw, r10.yyyy, cb7[6].xyzw
      mad r11.xyzw, r10.xxxx, cb7[5].xyzw, r11.xyzw
      mad r10.xyzw, r10.zzzz, cb7[7].xyzw, r11.xyzw
      add r10.xyzw, r10.xyzw, cb7[8].xyzw
      div r10.xyz, r10.xyzx, r10.wwww
      iadd r8.x, r0.y, r0.z
      store_structured g0.x, r8.x, l(0), r10.x
      store_structured g1.x, r8.x, l(0), r10.y
      store_structured g2.x, r8.x, l(0), r10.z
      iadd r0.y, r0.y, l(1)
    endloop 
    mov r0.y, l(255)
    mov r8.x, l(0)
    loop 
      ige r8.y, r8.x, l(6)
      breakc_nz r8.y
      ieq r10.xyzw, r8.xxxx, l(0, 1, 2, 3)
      or r9.zw, r10.yyyw, r10.xxxz
      movc r8.y, r9.w, l(1), l(2)
      movc r8.y, r9.z, l(0), r8.y
      and r9.w, r8.x, l(1)
      movc r10.x, r9.w, l(1.000000), l(-1.000000)
      ieq r10.yz, r8.yyyy, l(0, 1, 2, 0)
      movc r11.xyz, r10.yyyy, r3.yzxy, r2.yzxy
      movc r11.xyz, r9.zzzz, r1.yzxy, r11.xyzx
      mul r12.xyz, r10.xxxx, r11.xyzx
      movc r13.xyz, r10.yyyy, -r1.yzxy, r3.yzxy
      movc r13.xyz, r9.zzzz, r3.yzxy, r13.xyzx
      mul r13.xyz, r10.xxxx, r13.xyzx
      or r8.y, r9.z, r10.y
      movc r14.xyz, r8.yyyy, r2.yzxy, -r1.yzxy
      ine r9.w, r9.w, l(0)
      and r9.w, r9.w, r10.z
      mul r10.yzw, r5.yyyy, r13.xxyz
      mul r15.xyz, r5.xxxx, r14.xyzx
      movc r10.yzw, r9.wwww, r10.yyzw, r13.xxyz
      movc r13.xyz, r9.wwww, r15.xyzx, r14.xyzx
      movc r9.zw, r9.zzzz, r5.xxxy, r5.yyyx
      mul r14.xyz, r9.zzzz, r12.xyzx
      mul r15.xyz, r9.wwww, r10.yzwy
      movc r12.xyz, r8.yyyy, r14.xyzx, r12.xyzx
      movc r14.xyz, r8.yyyy, r15.xyzx, r10.yzwy
      mad r11.xyz, r10.xxxx, r11.xyzx, r4.yzxy
      add r15.xyz, r10.zwyz, r11.yzxy
      add r15.xyz, -r13.yzxy, r15.xyzx
      add r12.xyz, r4.yzxy, r12.xyzx
      add r16.xyz, r14.xyzx, r12.xyzx
      add r16.xyz, r13.xyzx, r16.xyzx
      add r12.xyz, -r14.xyzx, r12.xyzx
      add r12.xyz, r13.xyzx, r12.xyzx
      add r10.xyz, -r10.yzwy, r11.xyzx
      add r10.xyz, -r13.xyzx, r10.xyzx
      add r11.xyz, -r15.xyzx, r16.yzxy
      add r13.xyz, -r15.zxyz, r10.xyzx
      mul r14.xyz, r11.xyzx, r13.xyzx
      mad r11.xyz, r11.zxyz, r13.yzxy, -r14.xyzx
      add r13.xyz, -r16.yzxy, r12.yzxy
      add r14.xyz, r15.zxyz, -r16.xyzx
      mul r17.xyz, r13.xyzx, r14.xyzx
      mad r13.xyz, r13.zxyz, r14.yzxy, -r17.xyzx
      add r11.xyz, r11.xyzx, r13.xyzx
      add r13.xyz, -r12.yzxy, r10.yzxy
      add r14.xyz, -r12.xyzx, r16.xyzx
      mul r16.xyz, r13.xyzx, r14.xyzx
      mad r13.xyz, r13.zxyz, r14.yzxy, -r16.xyzx
      add r11.xyz, r11.xyzx, r13.xyzx
      add r13.xyz, -r10.yzxy, r15.xyzx
      add r10.xyz, -r10.xyzx, r12.xyzx
      mul r12.xyz, r10.xyzx, r13.xyzx
      mad r10.xyz, r13.zxyz, r10.yzxy, -r12.xyzx
      add r10.xyz, r10.xyzx, r11.xyzx
      dp3 r8.y, r10.xyzx, r10.xyzx
      sqrt r9.z, r8.y
      lt r9.z, l(1.000000), r9.z
      rsq r8.y, r8.y
      mul r11.xyz, r8.yyyy, r10.xyzx
      movc r10.xyz, r9.zzzz, r11.xyzx, r10.xyzx
      mov r8.y, r0.y
      mov r9.z, l(0)
      loop 
        ige r9.w, r9.z, l(8)
        breakc_nz r9.w
        iadd r9.w, r0.z, r9.z
        ld_structured r11.x, r9.w, l(0), g0.xxxx
        ld_structured r11.y, r9.w, l(0), g1.xxxx
        ld_structured r11.z, r9.w, l(0), g2.xxxx
        add r11.xyz, -r15.yzxy, r11.xyzx
        dp3 r9.w, r11.xyzx, r10.xyzx
        lt r9.w, r9.w, l(0.000000)
        ishl r10.w, l(1), r9.z
        not r10.w, r10.w
        movc r9.w, r9.w, l(255), r10.w
        and r8.y, r8.y, r9.w
        iadd r9.z, r9.z, l(1)
      endloop 
      mov r0.y, r8.y
      iadd r8.x, r8.x, l(1)
    endloop 
    mov r6.z, r2.w
    mov r6.x, r3.w
    mov r7.z, r5.w
    mov r6.yw, r8.zzzw
    mov r7.w, r9.x
    mov r0.w, r9.y
    mov r0.z, l(0)
    loop 
      ige r1.x, r0.z, l(8)
      breakc_nz r1.x
      ishl r1.x, l(1), r0.z
      and r1.x, r0.y, r1.x
      if_nz r1.x
        and r1.xyz, r0.zzzz, l(1, 2, 4, 0)
        movc r1.xyz, r1.xyzx, l(1,1,1,0), l(-1,-1,0,0)
        itof r10.yzw, r1.xxyz
        movc r10.x, r0.w, r6.z, r10.y
        movc r11.x, r0.w, r6.x, r10.z
        movc r11.z, r0.w, r7.z, r10.w
        mov r7.yz, r6.yywy
        movc r12.yzw, r0.wwww, r7.zzyw, r10.zzyw
        lt r1.xyz, r12.zywz, r10.yzwy
        lt r2.x, r10.y, r10.x
        movc r12.x, r2.x, r10.y, r10.x
        movc r6.yz, r1.xxxx, r10.yyxy, r12.zzxz
        lt r2.xy, r10.zwzz, r11.xzxx
        movc r12.xz, r2.xxyx, r10.zzwz, r11.xxzx
        mov r11.yw, r10.zzzw
        movc r7.xyzw, r1.yyzz, r11.xyzw, r12.xyzw
        mov r6.xw, r7.xxxy
        mov r0.w, l(-1)
      endif 
      iadd r0.z, r0.z, l(1)
    endloop 
  endif 
  not r0.y, r0.w
  ine r0.z, r1.w, l(0)
  or r0.y, r0.z, r0.y
  if_nz r0.y
    mov r0.yz, l(0,-3.000000,-2.000000,0)
    mov r1.xy, l(-3.000000,-2.000000,0,0)
    mov r2.zw, l(0,0,-3.000000,-2.000000)
  else 
    dp3 r0.w, r4.xyzx, r4.xyzx
    sqrt r0.w, r0.w
    lt r0.w, r5.z, r0.w
    if_nz r0.w
      lt r1.zw, |r4.zzzz|, |r4.xxxy|
      mov r4.w, -r4.z
      movc r3.xy, r1.zzzz, r4.wxww, r4.xzxx
      dp2 r0.w, r3.xyxx, r3.xyxx
      mad r3.z, -r5.z, r5.z, r0.w
      sqrt r3.z, r3.z
      mul r3.z, r3.z, r3.y
      mad r3.w, -r5.z, r3.x, -r3.z
      mad r3.z, -r5.z, r3.x, r3.z
      div r8.xz, r3.wwzw, r0.wwww
      mad r3.xz, -r8.xxzx, r3.xxxx, -r5.zzzz
      div r3.xz, r3.xxzx, r3.yyyy
      mov r3.yw, -r8.xxxz
      mov r8.yw, r3.xxxz
      movc r3.xyzw, r1.zzzz, r3.xyzw, r8.xyzw
      mul r4.xw, r4.zzzy, l(-1.000000, 0.000000, 0.000000, 1.000000)
      movc r4.xy, r1.wwww, r4.xwxx, r4.yzyy
      dp2 r0.w, r4.xyxx, r4.xyxx
      mad r1.z, -r5.z, r5.z, r0.w
      sqrt r1.z, r1.z
      mul r1.z, r1.z, r4.y
      mad r4.w, -r5.z, r4.x, -r1.z
      div r8.x, r4.w, r0.w
      mad r1.z, -r5.z, r4.x, r1.z
      div r8.z, r1.z, r0.w
      mad r4.xw, -r8.xxxz, r4.xxxx, -r5.zzzz
      div r9.xz, r4.xxwx, r4.yyyy
      mov r9.yw, -r8.xxxz
      mov r8.yw, r9.xxxz
      movc r8.xyzw, r1.wwww, r9.xyzw, r8.xyzw
      lt r4.x, r3.x, l(0.000000)
      lt r4.y, r8.x, l(0.000000)
      lt r1.z, l(0.000000), r3.z
      lt r1.w, l(0.000000), r8.z
      dp2 r0.w, cb7[5].xzxx, r3.zwzz
      dp2 r3.z, cb7[8].xzxx, r3.zwzz
      dp2 r3.w, cb7[5].xzxx, r3.xyxx
      dp2 r3.x, cb7[8].xzxx, r3.xyxx
      dp2 r3.y, cb7[6].yzyy, r8.zwzz
      dp2 r4.w, cb7[8].yzyy, r8.zwzz
      dp2 r5.x, cb7[6].yzyy, r8.xyxx
      dp2 r5.y, cb7[8].yzyy, r8.xyxx
      div r8.z, r3.z, r0.w
      div r8.w, r4.w, r3.y
      div r3.x, r3.x, r3.w
      div r3.y, r5.y, r5.x
      max r3.xy, -r3.xyxx, r6.zxzz
      movc r6.xz, r4.yyxy, r3.yyxy, r6.xxzx
      min r3.xy, r6.ywyy, -r8.zwzz
      movc r6.yw, r1.zzzw, r3.xxxy, r6.yyyw
      mov r1.zw, r6.zzzw
    else 
      mov r1.zw, r6.zzzw
    endif 
    add r0.w, r4.z, -r5.z
    lt r3.x, l(0.000000), r0.w
    mad r3.yz, r0.wwww, cb7[3].zzwz, cb7[4].zzwz
    div r0.w, r3.y, r3.z
    max r0.w, r0.w, r7.z
    movc r6.z, r3.x, r0.w, r7.z
    add r0.w, r4.z, r5.z
    lt r3.x, l(0.000000), r0.w
    mad r3.yz, r0.wwww, cb7[3].zzwz, cb7[4].zzwz
    div r0.w, r3.y, r3.z
    min r6.w, r0.w, r7.w
    movc r0.yz, r3.xxxx, r1.zzwz, l(0,-3.000000,-2.000000,0)
    movc r2.xyzw, r3.xxxx, r6.xyzw, l(-3.000000,-2.000000,-3.000000,-2.000000)
    mov r1.xy, r2.xyxx
  endif 
  ishl r0.x, r0.x, l(1)
  imad r0.x, vThreadGroupID.x, l(16), r0.x
  mad r2.xy, r0.yzyy, l(0.500000, -0.500000, 0.000000, 0.000000), l(0.500000, 0.500000, 0.000000, 0.000000)
  store_structured u0.xyz, r0.x, l(0), r2.xyzx
  iadd r0.y, r0.x, l(1)
  mad r2.xz, r1.yyxy, l(0.500000, 0.000000, -0.500000, 0.000000), l(0.500000, 0.000000, 0.500000, 0.000000)
  store_structured u0.xyz, r0.y, l(0), r2.xzwx
endif 
ret 
// Approximately 766 instruction slots used
