// asmtool.py -i --fix-fcprimal-volumetric-fog --only-autofixed -f 63156ad276e52990-cs.txt
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//   using 3Dmigoto v1.2.31 on Wed Mar 02 08:06:48 2016
//
//
// Buffer Definitions: 
//
// cbuffer CViewportShaderParameterProvider
// {
//
//   float4x4 InvProjectionMatrix;      // Offset:    0 Size:    64 [unused]
//   float4x4 InvViewMatrix;            // Offset:   64 Size:    64 [unused]
//   float4x4 ProjectionMatrix;         // Offset:  128 Size:    64 [unused]
//   float4x4 ViewMatrix;               // Offset:  192 Size:    64 [unused]
//   float4x4 ViewProjectionMatrix;     // Offset:  256 Size:    64 [unused]
//   float4x4 ViewRotProjectionMatrix;  // Offset:  320 Size:    64 [unused]
//   float4x4 ViewRotProjectionMatrix_Previous;// Offset:  384 Size:    64 [unused]
//   float4 AmbientSHR;                 // Offset:  448 Size:    16 [unused]
//   float4 AmbientSHG;                 // Offset:  464 Size:    16 [unused]
//   float4 AmbientSHB;                 // Offset:  480 Size:    16 [unused]
//   float4 CameraDistances;            // Offset:  496 Size:    16
//   float4 CameraNearPlaneSize;        // Offset:  512 Size:    16 [unused]
//   float4 DepthScale;                 // Offset:  528 Size:    16 [unused]
//   float4 DepthTextureScaleOffset;    // Offset:  544 Size:    16 [unused]
//   float4 FogParams;                  // Offset:  560 Size:    16 [unused]
//   float4 FogSHB;                     // Offset:  576 Size:    16 [unused]
//   float4 FogSHG;                     // Offset:  592 Size:    16 [unused]
//   float4 FogSHR;                     // Offset:  608 Size:    16 [unused]
//   float4 HeightFogParams;            // Offset:  624 Size:    16 [unused]
//   float4 ViewportSize;               // Offset:  640 Size:    16 [unused]
//   float3 ViewPoint;                  // Offset:  656 Size:    12 [unused]
//   float3 CameraPosition;             // Offset:  672 Size:    12
//   float3 CameraPosition_Previous;    // Offset:  688 Size:    12 [unused]
//   float3 CameraPositionFractions;    // Offset:  704 Size:    12 [unused]
//   float3 CameraPositionFractions_Previous;// Offset:  720 Size:    12 [unused]
//   float3 CameraRight;                // Offset:  736 Size:    12 [unused]
//   float3 CameraUp;                   // Offset:  752 Size:    12 [unused]
//   float3 CameraDirection;            // Offset:  768 Size:    12 [unused]
//   float3 EnvironmentMapColorOffset;  // Offset:  784 Size:    12 [unused]
//   float3 EnvironmentMapColorScale;   // Offset:  800 Size:    12 [unused]
//   float3 AmbientOcclusionRanges;     // Offset:  816 Size:    12 [unused]
//   float3 DepthTextureRcpSize;        // Offset:  832 Size:    12 [unused]
//   float2 MotionVectorOffsets;        // Offset:  848 Size:     8 [unused]
//   float2 DepthRangeCompression;      // Offset:  856 Size:     8 [unused]
//   float ShadowProjDepthMinValue;     // Offset:  864 Size:     4 [unused]
//   float DistanceScale;               // Offset:  868 Size:     4 [unused]
//   float WorldSpaceZOffset;           // Offset:  872 Size:     4 [unused]
//   float WorldSpaceZOffset_Previous;  // Offset:  876 Size:     4 [unused]
//   float CameraFOVDeg;                // Offset:  880 Size:     4 [unused]
//   float EffectsEmissiveEVBias;       // Offset:  884 Size:     4 [unused]
//   float ShadowCSMLastSliceIndex;     // Offset:  888 Size:     4 [unused]
//   float UseNormalization;            // Offset:  892 Size:     4 [unused]
//   float FogUndergroundColorScale;    // Offset:  896 Size:     4 [unused]
//
// }
//
// cbuffer CVolumetricFogProvider
// {
//
//   float4 VFSampleDistribution[4];    // Offset:    0 Size:    64 [unused]
//   float4x4 VPrevWorldToVolumetricShadowMatrix;// Offset:   64 Size:    64 [unused]
//   float4x4 VFInvViewMatrix;          // Offset:  128 Size:    64 [unused]
//   float4 VFDepthDistribution;        // Offset:  192 Size:    16
//   float4 VFDepthParams;              // Offset:  208 Size:    16 [unused]
//   float4 VFFogDensityBottom;         // Offset:  224 Size:    16 [unused]
//   float4 VFFogDensityTop;            // Offset:  240 Size:    16 [unused]
//   float4 VFFogParams0;               // Offset:  256 Size:    16
//   float4 VFFogParams1;               // Offset:  272 Size:    16 [unused]
//   float4 VFFogParams2;               // Offset:  288 Size:    16
//   float4 VFFogParams3;               // Offset:  304 Size:    16 [unused]
//   float4 VFShadowParams;             // Offset:  320 Size:    16 [unused]
//   float4 VFViewDirReconstruction;    // Offset:  336 Size:    16
//   int4 VFCellParams;                 // Offset:  352 Size:    16
//   float3 VFCameraXAxis;              // Offset:  368 Size:    12
//   float3 VFCameraYAxis;              // Offset:  384 Size:    12
//   float3 VFCameraZAxis;              // Offset:  400 Size:    12
//   float4 VFTemporalParams;           // Offset:  416 Size:    16 [unused]
//
// }
//
// cbuffer CTileLightingBlendedParameterProvider
// {
//
//   float4 CSMSlice0_0;                // Offset:    0 Size:    16 [unused]
//   float4 CSMSlice0_1;                // Offset:   16 Size:    16 [unused]
//   float4 CSMSlice0_2;                // Offset:   32 Size:    16 [unused]
//   float4 CSMSlice1_0;                // Offset:   48 Size:    16 [unused]
//   float4 CSMSlice1_1;                // Offset:   64 Size:    16 [unused]
//   float4 CSMSlice1_2;                // Offset:   80 Size:    16 [unused]
//   float4 CSMSlice2_0;                // Offset:   96 Size:    16 [unused]
//   float4 CSMSlice2_1;                // Offset:  112 Size:    16 [unused]
//   float4 CSMSlice2_2;                // Offset:  128 Size:    16 [unused]
//   float4 CSMSliceFade;               // Offset:  144 Size:    16 [unused]
//   float4 ShadowMapSize;              // Offset:  160 Size:    16 [unused]
//   float4 SunColor;                   // Offset:  176 Size:    16 [unused]
//   float4 SunDirection;               // Offset:  192 Size:    16 [unused]
//   int2 NumTiles;                     // Offset:  208 Size:     8
//   int LightCount;                    // Offset:  216 Size:     4 [unused]
//   int ParticlesSmallBufferFactor;    // Offset:  220 Size:     4 [unused]
//
// }
//
// Resource bind info for LightsLightingData
// {
//
//   struct LightingData
//   {
//       
//       float4 pos;                    // Offset:    0
//       float4 color;                  // Offset:   16
//       float4 direction;              // Offset:   32
//       float attenuation;             // Offset:   48
//       float2 spotFactors;            // Offset:   52
//       uint flags;                    // Offset:   60
//       float4 clippingInfo;           // Offset:   64
//       float4 clipPlanes[3];          // Offset:   80
//
//   } $Element;                        // Offset:    0 Size:   128
//
// }
//
// Resource bind info for ShadowData
// {
//
//   struct ShadowProjTextureData
//   {
//       
//       float4 shadowMapSize;          // Offset:    0
//       float4x4 shadowProjectionMatrix;// Offset:   16
//       float4 spotScaleOffsetUVs;     // Offset:   80
//
//   } $Element;                        // Offset:    0 Size:    96
//
// }
//
// Resource bind info for LightIndicesPerTileForBlended
// {
//
//   uint $Element;                     // Offset:    0 Size:     4
//
// }
//
// Resource bind info for LightOutputPerTileForBlended
// {
//
//   uint $Element;                     // Offset:    0 Size:     4
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// ShadowCmpSampler                sampler_c      NA          NA    0        1
// ColorWrap                         sampler      NA          NA    1        1
// ProjectedTexture0__TexObj__       texture  float4          2d    0        1
// VFMaxDepthDiv2Texture             texture   float          2d    1        1
// LightsLightingData                texture  struct         r/o    2        1
// ShadowData                        texture  struct         r/o    3        1
// LightIndicesPerTileForBlended     texture  struct         r/o    4        1
// LightOutputPerTileForBlended      texture  struct         r/o    5        1
// VFOutputBufferRGB                     UAV  float3          3d    0        1
// CViewportShaderParameterProvider    cbuffer      NA          NA    0        1
// CVolumetricFogProvider            cbuffer      NA          NA    1        1
// CTileLightingBlendedParameterProvider    cbuffer      NA          NA    2        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_constantbuffer cb0[43], immediateIndexed
dcl_constantbuffer cb1[26], immediateIndexed
dcl_constantbuffer cb2[14], immediateIndexed
dcl_sampler s0, mode_comparison
dcl_sampler s1, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_resource_structured t2, 128 
dcl_resource_structured t3, 96 
dcl_resource_structured t4, 4 
dcl_resource_structured t5, 4 
dcl_uav_typed_texture3d (float,float,float,float) u0
dcl_input vThreadGroupID.xyz
dcl_input vThreadIDInGroup.xyz
dcl_temps 21
dcl_thread_group 2, 2, 64

// 3DMigoto StereoParams:
dcl_resource_texture2d (float,float,float,float) t125

ld_indexable(texture2d)(float,float,float,float) r18.xyzw, l(0, 0, 0, 0), t125.xyzw

imad r0.xy, vThreadGroupID.xyxx, l(2, 2, 0, 0), vThreadIDInGroup.xyxx
ult r1.xy, r0.xyxx, cb1[22].xyxx
and r1.x, r1.y, r1.x
if_nz r1.x
  imad r0.zw, vThreadGroupID.zzzz, l(0, 0, 64, 64), vThreadIDInGroup.zzzz
  iadd r1.xy, cb1[22].xyxx, l(-1, -1, 0, 0)
  umin r1.xy, r0.xyxx, r1.xyxx
  mov r1.zw, l(0,0,0,0)
  ld_indexable(texture2d)(float,float,float,float) r1.x, r1.xyzw, t1.xyzw
  mad r1.x, r1.x, cb0[31].y, -cb1[12].w
  div r1.x, r1.x, cb1[12].z
  log r1.x, r1.x
  mul r1.x, r1.x, l(0.250000)
  ushr r1.y, cb1[22].z, l(1)
  utof r1.y, r1.y
  mad r1.x, r1.x, r1.y, l(1.000000)
  ftou r1.x, r1.x
  uge r1.x, r1.x, r0.w
  if_nz r1.x
    utof r1.xzw, r0.xxyw
    add r1.xz, r1.xxzx, l(0.500000, 0.000000, 0.500000, 0.000000)
    itof r2.xy, cb1[22].xyxx
    div r1.xz, r1.xxzx, r2.xxyx
    mad r1.xz, r1.xxzx, l(2.000000, 0.000000, 2.000000, 0.000000), l(-1.000000, 0.000000, -1.000000, 0.000000)
    mul r1.xz, r1.zzxz, cb1[21].yyxy
    mul r1.x, r1.x, l(-1.000000)
    mul r2.xyz, r1.xxxx, cb1[24].xyzx
    mad r2.xyz, r1.zzzz, cb1[23].xyzx, r2.xyzx
    add r2.xyz, r2.xyzx, cb1[25].xyzx
    dp3 r1.x, r2.xyzx, r2.xyzx
    rsq r1.x, r1.x
    mul r3.xyz, r1.xxxx, r2.xyzx
    iadd r1.x, r0.w, l(1)
    utof r1.x, r1.x
    div r1.x, r1.x, r1.y
    mul r1.x, r1.x, l(4.000000)
    exp r1.x, r1.x
    mad r1.x, r1.x, cb1[12].z, cb1[12].w
    div r1.y, r1.w, r1.y
    mul r1.y, r1.y, l(4.000000)
    exp r1.y, r1.y
    mad r1.y, r1.y, cb1[12].z, cb1[12].w
    add r1.x, r1.y, r1.x
    mul r1.x, r1.x, l(0.500000)
    mad r2.xyz, r2.xyzx, r1.xxxx, cb0[42].xyzx

// Volumetric Fog fix inserted with DarkStarSword's asmtool.py:
// asmtool.py -i --fix-fcprimal-volumetric-fog --only-autofixed -f 63156ad276e52990-cs.txt

mov r19.xyz, r2.xyzx
mov r19.w, l(1.0)
dp4 r20.w, r19.xyzw, cb0[19].xyzw
add r20.x, r20.w, -r18.y
mul r20.x, r20.x, -r18.x
mul r20.x, r20.x, cb0[0].x
mov r20.yzw, l(0.0)
dp4 r19.x, r20.xyzw, cb0[4].xyzw
dp4 r19.y, r20.xyzw, cb0[5].xyzw
dp4 r19.z, r20.xyzw, cb0[6].xyzw
add r2.xyz, r2.xyzw, r19.xyzx

    imad r4.xyzw, r0.xyxy, cb1[22].wwww, l(4, 4, 12, 4)
    ushr r4.xyzw, r4.xyzw, l(3, 3, 3, 3)
    imad r1.yz, r4.yywy, cb2[13].xxxx, r4.xxzx
    imad r4.xyzw, r0.xyxy, cb1[22].wwww, l(4, 12, 12, 12)
    ushr r4.xyzw, r4.xyzw, l(3, 3, 3, 3)
    imad r4.xy, r4.ywyy, cb2[13].xxxx, r4.xzxx
    ishl r1.zw, r1.yyyz, l(0, 0, 1, 1)
    ishl r4.xy, r4.xyxx, l(1, 1, 0, 0)
    mov r4.zw, l(0,0,0,0)
    mov r3.w, l(0)
    loop 
      uge r5.x, r3.w, l(2)
      breakc_nz r5.x
      iadd r5.xy, r1.zwzz, r3.wwww
      ld_structured_indexable(structured_buffer, stride=4)(mixed,mixed,mixed,mixed) r5.x, r5.x, l(0), t4.xxxx
      ld_structured_indexable(structured_buffer, stride=4)(mixed,mixed,mixed,mixed) r5.y, r5.y, l(0), t4.xxxx
      or r5.x, r5.y, r5.x
      iadd r5.yz, r4.xxyx, r3.wwww
      ld_structured_indexable(structured_buffer, stride=4)(mixed,mixed,mixed,mixed) r5.y, r5.y, l(0), t4.xxxx
      or r5.x, r5.y, r5.x
      ld_structured_indexable(structured_buffer, stride=4)(mixed,mixed,mixed,mixed) r5.y, r5.z, l(0), t4.xxxx
      or r5.x, r5.y, r5.x
      movc r4.z, r3.w, r4.z, r5.x
      ieq r5.y, r3.w, l(1)
      movc r4.w, r5.y, r5.x, r4.w
      iadd r3.w, r3.w, l(1)
    endloop 
    countbits r1.zw, r4.zzzw
    ld_structured_indexable(structured_buffer, stride=4)(mixed,mixed,mixed,mixed) r1.y, r1.y, l(0), t5.xxxx
    mul_sat r1.x, r1.x, cb1[18].y
    mul r1.x, r1.x, r1.x
    mul r1.x, r1.x, r1.x
    and r1.y, r1.y, l(0x60000000)
    ine r1.y, r1.y, l(0)
    mul r3.w, cb1[16].y, l(0.500000)
    mad r4.x, -r3.w, r3.w, l(1.000000)
    mad r3.w, r3.w, r3.w, l(1.000000)
    mov r2.w, l(1.000000)
    mov r4.y, r4.z
    mov r5.xyzw, l(0,0,0,0)
    loop 
      uge r6.x, r5.w, r1.z
      breakc_nz r6.x
      firstbit_lo r6.x, r4.y
      ishl r6.y, l(1), r6.x
      not r6.y, r6.y
      and r6.y, r4.y, r6.y
      ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r7.xyz, r6.x, l(0), t2.xyzx
      ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r8.xyzw, r6.x, l(16), t2.xyzw
      ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r9.xyz, r6.x, l(32), t2.xyzx
      ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r10.xyzw, r6.x, l(48), t2.xyzw
      and r6.x, r10.w, l(1)
      ult r6.x, l(0), r6.x
      add r7.xyz, -r2.xyzx, r7.xyzx
      dp3 r6.z, r7.xyzx, r7.xyzx
      max r6.z, r6.z, l(0.000010)
      rsq r6.w, r6.z
      div r7.w, l(1.000000, 1.000000, 1.000000, 1.000000), r6.z
      min r7.w, r7.w, r8.w
      mul r7.xyz, r6.wwww, r7.xyzx
      mul r6.z, r6.z, r6.z
      mad_sat r6.z, -r6.z, r10.x, l(1.000000)
      mul r6.z, r6.z, r6.z
      mul r6.z, r6.z, r7.w
      dp3 r6.w, r7.xyzx, -r9.xyzx
      mad_sat r6.w, r6.w, r10.y, r10.z
      movc r6.w, r6.x, r6.w, l(1.000000)
      mul r6.w, r6.w, r6.w
      mul r6.z, r6.z, r6.w
      mul r9.xyz, r1.xxxx, r6.zzzz
      lt r6.z, r9.z, l(0.000100)
      iadd r6.w, r5.w, -r6.z
      mov r4.y, r6.y
      mov r5.w, r6.w
      continuec_nz r6.z
      and r6.x, r1.y, r6.x
      and r6.z, r10.w, l(8)
      ult r6.z, l(0), r6.z
      and r6.x, r6.z, r6.x
      if_nz r6.x
        and r6.xz, r10.wwww, l(32, 0, 16, 0)
        ult r6.zw, l(0, 0, 0, 0), r6.xxxz
        ushr r7.w, r10.w, l(5)
        and r7.w, r7.w, l(2)
        or r6.z, r6.w, r6.z
        and r6.z, r1.y, r6.z
        if_nz r6.z
          ld_structured_indexable(structured_buffer, stride=96)(mixed,mixed,mixed,mixed) r10.xyzw, r7.w, l(0), t3.xyzw
          ld_structured_indexable(structured_buffer, stride=96)(mixed,mixed,mixed,mixed) r11.xyzw, r7.w, l(16), t3.xyzw
          ld_structured_indexable(structured_buffer, stride=96)(mixed,mixed,mixed,mixed) r12.xyzw, r7.w, l(32), t3.xyzw
          ld_structured_indexable(structured_buffer, stride=96)(mixed,mixed,mixed,mixed) r13.xyzw, r7.w, l(48), t3.xyzw
          ld_structured_indexable(structured_buffer, stride=96)(mixed,mixed,mixed,mixed) r14.xyzw, r7.w, l(64), t3.xyzw
          ld_structured_indexable(structured_buffer, stride=96)(mixed,mixed,mixed,mixed) r15.xyzw, r7.w, l(80), t3.xyzw
        else 
          mov r10.xyzw, l(0,0,0,0)
          mov r11.xyzw, l(0,0,0,0)
          mov r12.xyzw, l(0,0,0,0)
          mov r13.xyzw, l(0,0,0,0)
          mov r14.xyzw, l(0,0,0,0)
          mov r15.xyzw, l(0,0,0,0)
        endif 
        dp4 r11.x, r2.xyzw, r11.xyzw
        dp4 r11.y, r2.xyzw, r12.xyzw
        dp4 r6.z, r2.xyzw, r13.xyzw
        dp4 r8.w, r2.xyzw, r14.xyzw
        max r8.w, r8.w, l(0.000010)
        div r11.xy, r11.xyxx, r8.wwww
        if_z r7.w
          mad r10.xy, r11.xyxx, r10.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000)
          round_ni r11.zw, r10.xxxy
          add r10.xy, r10.xyxx, -r11.zwzz
          add r11.zw, r11.zzzw, l(0.000000, 0.000000, -0.500000, -0.500000)
          mul r11.zw, r10.zzzw, r11.zzzw
          mad r12.xy, -r10.yxyy, l(2.000000, 2.000000, 0.000000, 0.000000), l(3.000000, 3.000000, 0.000000, 0.000000)
          mad r12.zw, r10.xxxy, l(0.000000, 0.000000, 2.000000, 2.000000), l(0.000000, 0.000000, 1.000000, 1.000000)
          add r13.xy, -r10.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000)
          div r13.xy, r13.xyxx, r12.yxyy
          div r10.xy, r10.xyxx, r12.zwzz
          add r13.zw, r13.xxxy, l(0.000000, 0.000000, -1.000000, -1.000000)
          add r13.xy, r10.xyxx, l(1.000000, 1.000000, 0.000000, 0.000000)
          mul r8.w, r12.x, r12.y
          mad r14.xyzw, r13.zwxw, r10.zwzw, r11.zwzw
          sample_c_lz_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r9.w, r14.xyxx, t0.xxxx, s0, r6.z
          mul r10.xy, r12.xyxx, r12.zwzz
          sample_c_lz_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r12.x, r14.zwzz, t0.xxxx, s0, r6.z
          mul r10.x, r10.x, r12.x
          mad r8.w, r8.w, r9.w, r10.x
          mad r13.xyzw, r13.zyxy, r10.zwzw, r11.zwzw
          sample_c_lz_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r9.w, r13.xyxx, t0.xxxx, s0, r6.z
          mad r8.w, r10.y, r9.w, r8.w
          mul r9.w, r12.w, r12.z
          sample_c_lz_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r6.z, r13.zwzz, t0.xxxx, s0, r6.z
          mad r6.z, r9.w, r6.z, r8.w
          mul r6.z, r6.z, l(0.062500)
        else 
          mov r6.z, l(1.000000)
        endif 
        mul r6.z, r6.z, r9.z
        if_nz r6.x
          if_z r7.w
            mad r10.xy, r11.xyxx, r15.xyxx, r15.zwzz
            sample_l_indexable(texture2d)(float,float,float,float) r10.xyz, r10.xyxx, t0.xyzw, s1, l(0.000000)
          else 
            mov r10.xyz, l(1.000000,0,1.000000,0)
          endif 
          mul r10.xyz, r9.zzzz, r10.xyzx
        else 
          mov r10.xyz, r9.zzzz
        endif 
        movc r9.xyz, r6.wwww, r6.zzzz, r10.xyzx
      endif 
      dp3 r6.x, r7.xyzx, r3.xyzx
      mad r6.x, -cb1[16].y, r6.x, r3.w
      log r6.x, |r6.x|
      mul r6.x, r6.x, l(1.500000)
      exp r6.x, r6.x
      div r6.x, r4.x, r6.x
      mul r6.x, r6.x, l(0.785398185)
      mul r7.xyz, r8.xyzx, r9.xyzx
      mul r7.xyz, r7.xyzx, cb1[18].xxxx
      mad r5.xyz, r7.xyzx, r6.xxxx, r5.xyzx
      iadd r5.w, r5.w, l(1)
      mov r4.y, r6.y
    endloop 
    mov r6.xyz, r2.xyzx
    mov r6.w, l(1.000000)
    mov r7.xyz, r5.xyzx
    mov r1.z, r4.w
    mov r2.w, l(0)
    loop 
      uge r4.y, r2.w, r1.w
      breakc_nz r4.y
      firstbit_lo r4.y, r1.z
      ishl r4.z, l(1), r4.y
      not r4.z, r4.z
      and r4.z, r1.z, r4.z
      iadd r4.y, l(32), r4.y
      ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r8.xyz, r4.y, l(0), t2.xyzx
      ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r9.xyzw, r4.y, l(16), t2.xyzw
      ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r10.xyz, r4.y, l(32), t2.xyzx
      ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r11.xyzw, r4.y, l(48), t2.xyzw
      and r4.y, r11.w, l(1)
      ult r4.y, l(0), r4.y
      add r8.xyz, -r2.xyzx, r8.xyzx
      dp3 r5.w, r8.xyzx, r8.xyzx
      max r5.w, r5.w, l(0.000010)
      rsq r7.w, r5.w
      div r8.w, l(1.000000, 1.000000, 1.000000, 1.000000), r5.w
      min r8.w, r8.w, r9.w
      mul r8.xyz, r7.wwww, r8.xyzx
      mul r5.w, r5.w, r5.w
      mad_sat r5.w, -r5.w, r11.x, l(1.000000)
      mul r5.w, r5.w, r5.w
      mul r5.w, r5.w, r8.w
      dp3 r7.w, r8.xyzx, -r10.xyzx
      mad_sat r7.w, r7.w, r11.y, r11.z
      movc r7.w, r4.y, r7.w, l(1.000000)
      mul r7.w, r7.w, r7.w
      mul r5.w, r5.w, r7.w
      mul r10.xyz, r1.xxxx, r5.wwww
      lt r5.w, r10.z, l(0.000100)
      iadd r7.w, r2.w, -r5.w
      mov r1.z, r4.z
      mov r2.w, r7.w
      continuec_nz r5.w
      and r4.y, r1.y, r4.y
      and r5.w, r11.w, l(8)
      ult r5.w, l(0), r5.w
      and r4.y, r4.y, r5.w
      if_nz r4.y
        and r11.xy, r11.wwww, l(32, 16, 0, 0)
        ult r11.yz, l(0, 0, 0, 0), r11.xxyx
        ushr r4.y, r11.w, l(5)
        and r4.y, r4.y, l(2)
        or r5.w, r11.z, r11.y
        and r5.w, r1.y, r5.w
        if_nz r5.w
          ld_structured_indexable(structured_buffer, stride=96)(mixed,mixed,mixed,mixed) r12.xyzw, r4.y, l(0), t3.xyzw
          ld_structured_indexable(structured_buffer, stride=96)(mixed,mixed,mixed,mixed) r13.xyzw, r4.y, l(16), t3.xyzw
          ld_structured_indexable(structured_buffer, stride=96)(mixed,mixed,mixed,mixed) r14.xyzw, r4.y, l(32), t3.xyzw
          ld_structured_indexable(structured_buffer, stride=96)(mixed,mixed,mixed,mixed) r15.xyzw, r4.y, l(48), t3.xyzw
          ld_structured_indexable(structured_buffer, stride=96)(mixed,mixed,mixed,mixed) r16.xyzw, r4.y, l(64), t3.xyzw
          ld_structured_indexable(structured_buffer, stride=96)(mixed,mixed,mixed,mixed) r17.xyzw, r4.y, l(80), t3.xyzw
        else 
          mov r12.xyzw, l(0,0,0,0)
          mov r13.xyzw, l(0,0,0,0)
          mov r14.xyzw, l(0,0,0,0)
          mov r15.xyzw, l(0,0,0,0)
          mov r16.xyzw, l(0,0,0,0)
          mov r17.xyzw, l(0,0,0,0)
        endif 
        dp4 r13.x, r6.xyzw, r13.xyzw
        dp4 r13.y, r6.xyzw, r14.xyzw
        dp4 r5.w, r6.xyzw, r15.xyzw
        dp4 r7.w, r6.xyzw, r16.xyzw
        max r7.w, r7.w, l(0.000010)
        div r11.yw, r13.xxxy, r7.wwww
        if_z r4.y
          mad r12.xy, r11.ywyy, r12.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000)
          round_ni r13.xy, r12.xyxx
          add r12.xy, r12.xyxx, -r13.xyxx
          add r13.xy, r13.xyxx, l(-0.500000, -0.500000, 0.000000, 0.000000)
          mul r13.xy, r12.zwzz, r13.xyxx
          mad r13.zw, -r12.yyyx, l(0.000000, 0.000000, 2.000000, 2.000000), l(0.000000, 0.000000, 3.000000, 3.000000)
          mad r14.xy, r12.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(1.000000, 1.000000, 0.000000, 0.000000)
          add r14.zw, -r12.xxxy, l(0.000000, 0.000000, 2.000000, 2.000000)
          div r14.zw, r14.zzzw, r13.wwwz
          div r12.xy, r12.xyxx, r14.xyxx
          add r15.zw, r14.zzzw, l(0.000000, 0.000000, -1.000000, -1.000000)
          add r15.xy, r12.xyxx, l(1.000000, 1.000000, 0.000000, 0.000000)
          mul r7.w, r13.z, r13.w
          mad r16.xyzw, r15.zwxw, r12.zwzw, r13.xyxy
          sample_c_lz_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r8.w, r16.xyxx, t0.xxxx, s0, r5.w
          mul r12.xy, r13.zwzz, r14.xyxx
          sample_c_lz_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r9.w, r16.zwzz, t0.xxxx, s0, r5.w
          mul r9.w, r9.w, r12.x
          mad r7.w, r7.w, r8.w, r9.w
          mad r13.xyzw, r15.zyxy, r12.zwzw, r13.xyxy
          sample_c_lz_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r8.w, r13.xyxx, t0.xxxx, s0, r5.w
          mad r7.w, r12.y, r8.w, r7.w
          mul r8.w, r14.y, r14.x
          sample_c_lz_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r5.w, r13.zwzz, t0.xxxx, s0, r5.w
          mad r5.w, r8.w, r5.w, r7.w
          mul r5.w, r5.w, l(0.062500)
        else 
          mov r5.w, l(1.000000)
        endif 
        mul r5.w, r5.w, r10.z
        if_nz r11.x
          if_z r4.y
            mad r11.xy, r11.ywyy, r17.xyxx, r17.zwzz
            sample_l_indexable(texture2d)(float,float,float,float) r11.xyw, r11.xyxx, t0.xywz, s1, l(0.000000)
          else 
            mov r11.xyw, l(1.000000,0,0,1.000000)
          endif 
          mul r11.xyw, r10.zzzz, r11.xyxw
        else 
          mov r11.xyw, r10.zzzz
        endif 
        movc r10.xyz, r11.zzzz, r5.wwww, r11.xywx
      endif 
      dp3 r4.y, r8.xyzx, r3.xyzx
      mad r4.y, -cb1[16].y, r4.y, r3.w
      log r4.y, |r4.y|
      mul r4.y, r4.y, l(1.500000)
      exp r4.y, r4.y
      div r4.y, r4.x, r4.y
      mul r4.y, r4.y, l(0.785398185)
      mul r8.xyz, r9.xyzx, r10.xyzx
      mul r8.xyz, r8.xyzx, cb1[18].xxxx
      mad r7.xyz, r8.xyzx, r4.yyyy, r7.xyzx
      iadd r2.w, r2.w, l(1)
      mov r1.z, r4.z
    endloop 
    mul r1.xyz, r7.xyzx, l(0.200000, 0.200000, 0.200000, 0.000000)
  else 
    mov r1.xyz, l(0,0,0,0)
  endif 
  store_uav_typed u0.xyzw, r0.xyzw, r1.xyzx
endif 
ret 
// Approximately 346 instruction slots used