// asmtool.py -i --fix-fcprimal-physical-lighting --only-autofixed -f 22c181c8914a7be1-cs.txt
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//   using 3Dmigoto v1.2.31 on Wed Mar 02 08:06:30 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 [unused]
//   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
//   float4 FogSHB;                     // Offset:  576 Size:    16
//   float4 FogSHG;                     // Offset:  592 Size:    16
//   float4 FogSHR;                     // Offset:  608 Size:    16
//   float4 HeightFogParams;            // Offset:  624 Size:    16
//   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
//   float3 EnvironmentMapColorScale;   // Offset:  800 Size:    12
//   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
//   float ShadowCSMLastSliceIndex;     // Offset:  888 Size:     4 [unused]
//   float UseNormalization;            // Offset:  892 Size:     4
//   float FogUndergroundColorScale;    // Offset:  896 Size:     4
//
// }
//
// cbuffer CGlobalShaderParameterProvider
// {
//
//   float4 BurnColor;                  // Offset:    0 Size:    16 [unused]
//   float4 BurnParams;                 // Offset:   16 Size:    16 [unused]
//   float4 BurnParams2;                // Offset:   32 Size:    16 [unused]
//   float4 BurnParams3;                // Offset:   48 Size:    16 [unused]
//   float4 CascadedShadowScaleOffsetTile0;// Offset:   64 Size:    16 [unused]
//   float4 CascadedShadowScaleOffsetTile1;// Offset:   80 Size:    16 [unused]
//   float4 WindSimParamsX;             // Offset:   96 Size:    16 [unused]
//   float4 WindSimParamsY;             // Offset:  112 Size:    16 [unused]
//   float VistaNoiseIntensity;         // Offset:  128 Size:     4 [unused]
//   float Time;                        // Offset:  132 Size:     4 [unused]
//   float WindFactor;                  // Offset:  136 Size:     4 [unused]
//   float FireGlowEV;                  // Offset:  140 Size:     4
//   float BurnSpeedScale;              // Offset:  144 Size:     4 [unused]
//   float BurnlineMaskScale;           // Offset:  148 Size:     4 [unused]
//   float BurnlineMaskInfluence;       // Offset:  152 Size:     4 [unused]
//   float WorldSpaceProgressionMaskScale;// Offset:  156 Size:     4 [unused]
//   float WorldSpaceProgressionMaskInfluence;// Offset:  160 Size:     4 [unused]
//   float MaskTransitionSpeedModifier; // Offset:  164 Size:     4 [unused]
//   float GlowMaskScale;               // Offset:  168 Size:     4 [unused]
//   float FireGlowMaskInfluence;       // Offset:  172 Size:     4 [unused]
//   float CenterBurnlineWidth;         // Offset:  176 Size:     4 [unused]
//   float TransitionToBurnlineWidth;   // Offset:  180 Size:     4 [unused]
//   float DissolveCutoffPoint;         // Offset:  184 Size:     4 [unused]
//   float DissolveBlendDistance;       // Offset:  188 Size:     4 [unused]
//   float EyeGlossinessScale;          // Offset:  192 Size:     4 [unused]
//   float EyeSpecIntensityScale;       // Offset:  196 Size:     4 [unused]
//   float EyeIrisGlossinessScale;      // Offset:  200 Size:     4 [unused]
//   float EyeIrisSpecIntensityScale;   // Offset:  204 Size:     4 [unused]
//   float EyeReflectionBoostScale;     // Offset:  208 Size:     4 [unused]
//   bool EyeReflectionMaskEnable;      // Offset:  212 Size:     4 [unused]
//   float4 BurnParams4;                // Offset:  224 Size:    16 [unused]
//   float4 BurnParams5;                // Offset:  240 Size:    16 [unused]
//
// }
//
// cbuffer CTileLightCullingParameterProvider
// {
//
//   float4x4 InvViewProjection;        // Offset:    0 Size:    64
//   float4 DepthValueScale;            // Offset:   64 Size:    16 [unused]
//   float4 OutputTextureSize;          // Offset:   80 Size:    16
//   int4 NumTiles;                     // Offset:   96 Size:    16
//   int LightCount;                    // Offset:  112 Size:     4 [unused]
//
// }
//
// cbuffer CTileLightingParameterProvider
// {
//
//   float4 DistanceBoostParameters;    // Offset:    0 Size:    16
//   float4 ForceAlbedoOnlyDisableShadows;// Offset:   16 Size:    16
//   float4 LightingOutputTextureSize;  // Offset:   32 Size:    16 [unused]
//   float4 SunColor;                   // Offset:   48 Size:    16
//   float4 SunDirection;               // Offset:   64 Size:    16
//   float DirectLightOcclusion;        // Offset:   80 Size:     4
//   float LightingDebugLineToUse;      // Offset:   84 Size:     4 [unused]
//   bool ExposureLocalLights;          // Offset:   88 Size:     4
//   float SunExposureFactor;           // Offset:   92 Size:     4
//
// }
//
// cbuffer CSceneTerrainSkyOcclusionAtlasPrivateData
// {
//
//   float4 SectorOcclusion_OffsetScale;// Offset:    0 Size:    16
//   float3 SectorOcclusion_DistanceFade;// Offset:   16 Size:    12
//   float2 SectorOcclusion_HeightOffsetScale;// Offset:   32 Size:     8
//
// }
//
// cbuffer CAmbientProvider
// {
//
//   float4 CascadeDistanceScales[5];   // Offset:    0 Size:    80 [unused]
//   float4 CascadeNearFarSnappedOffsetCamera[5];// Offset:   80 Size:    80 [unused]
//   float4 CascadeNearFarRcpUVSize[5]; // Offset:  160 Size:    80 [unused]
//   float4 UndergroundSHR;             // Offset:  240 Size:    16
//   float4 UndergroundSHG;             // Offset:  256 Size:    16
//   float4 UndergroundSHB;             // Offset:  272 Size:    16
//   float InvUndergroundBlendEndHeight;// Offset:  288 Size:     4
//   float IndirectLightingScale;       // Offset:  292 Size:     4 [unused]
//
// }
//
// Resource bind info for ExposureBuffer
// {
//
//   float4 $Element;                   // Offset:    0 Size:    16
//
// }
//
// Resource bind info for SkyParamBuffer
// {
//
//   struct ComputedSkyParameters
//   {
//       
//       float r[9];                    // Offset:    0
//       float g[9];                    // Offset:   36
//       float b[9];                    // Offset:   72
//       float3 sunColor;               // Offset:  108
//       float3 moonColor;              // Offset:  120
//
//   } $Element;                        // Offset:    0 Size:   132
//
// }
//
// 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 LightIndicesPerTile
// {
//
//   uint $Element;                     // Offset:    0 Size:     4
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// EnvironmentMapTexture__SampObj__    sampler      NA          NA    0        1
// EnvironmentMapBRDFTexture__SampObj__    sampler      NA          NA    1        1
// SectorHemiMapSamplerStateLinear    sampler      NA          NA    2        1
// SkinDiffusePreIntegrated__SampObj__    sampler      NA          NA    3        1
// EnvironmentMapTexture__TexObj__    texture  float4        cube    0        1
// EnvironmentMapBRDFTexture__TexObj__    texture  float4          2d    1        1
// ExposureBuffer                    texture  struct         r/o    2        1
// SkyParamBuffer                    texture  struct         r/o    3        1
// DeferredLighting_DeferredShadowTexture    texture  float4          2d    4        1
// SectorOcclusion_HeightTexture__TexObj__    texture  float4          2d    5        1
// GBufferT0                         texture  float4          2d    6        1
// GBufferT1                         texture  float4          2d    7        1
// GBufferT2                         texture  float4          2d    8        1
// GBufferT3                         texture  float4          2d    9        1
// Depth                             texture   float          2d   10        1
// LightsLightingData                texture  struct         r/o   11        1
// LightIndicesPerTile               texture  struct         r/o   12        1
// SkinDiffusePreIntegrated__TexObj__    texture  float4          2d   13        1
// DeferredAmbientTexture__TexObj__    texture  float4          2d   14        1
// OutputTexture                         UAV  float4          2d    0        1
// CViewportShaderParameterProvider    cbuffer      NA          NA    0        1
// CGlobalShaderParameterProvider    cbuffer      NA          NA    1        1
// CTileLightCullingParameterProvider    cbuffer      NA          NA    2        1
// CTileLightingParameterProvider    cbuffer      NA          NA    3        1
// CSceneTerrainSkyOcclusionAtlasPrivateData    cbuffer      NA          NA    4        1
// CAmbientProvider                  cbuffer      NA          NA    5        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[57], immediateIndexed
dcl_constantbuffer cb1[9], immediateIndexed
dcl_constantbuffer cb2[7], immediateIndexed
dcl_constantbuffer cb3[6], immediateIndexed
dcl_constantbuffer cb4[3], immediateIndexed
dcl_constantbuffer cb5[19], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_sampler s2, mode_default
dcl_sampler s3, mode_default
dcl_resource_texturecube (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_resource_structured t2, 16 
dcl_resource_structured t3, 132 
dcl_resource_texture2d (float,float,float,float) t4
dcl_resource_texture2d (float,float,float,float) t5
dcl_resource_texture2d (float,float,float,float) t6
dcl_resource_texture2d (float,float,float,float) t7
dcl_resource_texture2d (float,float,float,float) t8
dcl_resource_texture2d (float,float,float,float) t9
dcl_resource_texture2d (float,float,float,float) t10
dcl_resource_structured t11, 128 
dcl_resource_structured t12, 4 
dcl_resource_texture2d (float,float,float,float) t13
dcl_resource_texture2d (float,float,float,float) t14
dcl_uav_typed_texture2d (float,float,float,float) u0
dcl_input vThreadGroupID.xy
dcl_input vThreadIDInGroup.xy
dcl_temps 37
dcl_thread_group 8, 8, 1

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

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


// Camera Position (environment reflections, etc) adjustment inserted with DarkStarSword's asmtool.py:
// asmtool.py -i --fix-fcprimal-physical-lighting --only-autofixed -f 22c181c8914a7be1-cs.txt
mul r35.x, r34.x, r34.y
mul r35.x, r35.x, cb0[0].x
mov r35.yzw, l(0.0)
dp4 r36.x, r35.xyzw, cb0[4].xyzw
dp4 r36.y, r35.xyzw, cb0[5].xyzw
dp4 r36.z, r35.xyzw, cb0[6].xyzw
mov r35.xyzw, cb0[42].xyzw
add r35.xyz, r35.xyz, r36.xyz

imad r0.xy, vThreadGroupID.xyxx, l(8, 8, 0, 0), vThreadIDInGroup.xyxx
ftou r1.xy, cb2[5].xyxx
ult r1.xy, r0.xyxx, r1.xyxx
and r1.x, r1.y, r1.x
if_nz r1.x
  imad r1.x, vThreadGroupID.y, cb2[6].x, vThreadGroupID.x
  mov r0.zw, l(0,0,0,0)

  ld_indexable(texture2d)(float,float,float,float) r2.z, r0.xyww, t10.yzxw

// Use DepthScale & CameraDistances.z to get world Z:
mad r34.z, r2.z, cb0[33].y, cb0[33].x
div r34.z, l(1.0), r34.z
mul r34.z, r34.z, cb0[31].z

  utof r1.yz, r0.xxyx
  add r3.xy, r1.yzyy, l(0.500000, 0.500000, 0.000000, 0.000000)
  mul r3.xy, r3.xyxx, cb2[5].zwzz
  mad r3.xy, r3.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
  mul r2.xy, r3.xyxx, l(1.000000, -1.000000, 0.000000, 0.000000)
  mov r2.w, l(1.000000)

// Far Cry Primal Physical Lighting Fix inserted with DarkStarSword's asmtool.py:
// asmtool.py -i --fix-fcprimal-physical-lighting --only-autofixed -f 22c181c8914a7be1-cs.txt
add r34.w, r34.z, -r34.y
div r34.w, r34.w, r34.z
mad r2.x, r34.w, -r34.x, r2.x

  dp4 r3.x, r2.xyzw, cb2[0].xyzw
  dp4 r3.y, r2.xyzw, cb2[1].xyzw
  dp4 r3.z, r2.xyzw, cb2[2].xyzw
  dp4 r1.w, r2.xyzw, cb2[3].xyzw
  div r2.xyz, r3.xyzx, r1.wwww
  ld_indexable(texture2d)(float,float,float,float) r3.xyzw, r0.xyww, t6.xyzw
  ld_indexable(texture2d)(float,float,float,float) r4.xyzw, r0.xyww, t7.xyzw
  ld_indexable(texture2d)(float,float,float,float) r5.xyzw, r0.xyww, t8.xyzw
  ld_indexable(texture2d)(float,float,float,float) r6.xyzw, r0.xyww, t9.ywzx
  iadd r7.xy, r0.xyxx, l(1, 1, 0, 0)
  add r7.zw, cb2[5].xxxy, l(0.000000, 0.000000, -1.000000, -1.000000)
  ftou r7.zw, r7.zzzw
  ult r7.xy, r7.xyxx, r7.zwzz
  if_nz r7.x
    ld_aoffimmi_indexable(1,0,0)(texture2d)(float,float,float,float) r8.xw, r0.xyww, t6.xzwy
    mov r9.w, r8.x
  else 
    mov r9.w, r3.x
    mov r8.w, r3.y
  endif 
  ult r7.xz, l(1, 0, 1, 0), r0.xxyx
  if_nz r7.x
    ld_aoffimmi_indexable(-1,0,0)(texture2d)(float,float,float,float) r8.xz, r0.xyww, t6.xzyw
    mov r9.z, r8.x
  else 
    mov r9.z, r3.x
    mov r8.z, r3.y
  endif 
  if_nz r7.y
    ld_aoffimmi_indexable(0,1,0)(texture2d)(float,float,float,float) r8.xy, r0.xyww, t6.xyzw
    mov r9.y, r8.x
  else 
    mov r9.y, r3.x
    mov r8.y, r3.y
  endif 
  if_nz r7.z
    ld_aoffimmi_indexable(0,-1,0)(texture2d)(float,float,float,float) r7.xy, r0.xyww, t6.xyzw
    mov r9.x, r7.x
    mov r8.x, r7.y
  else 
    mov r9.x, r3.x
    mov r8.x, r3.y
  endif 
  add r7.xyzw, -r3.xxxx, r9.xyzw
  mad r7.xyzw, |r7.xyzw|, l(10.000000, 10.000000, 10.000000, 10.000000), l(0.100000, 0.100000, 0.100000, 0.100000)
  rcp r7.xyzw, r7.xyzw
  dp4 r1.w, r7.xyzw, l(1.000000, 1.000000, 1.000000, 1.000000)
  rcp r1.w, r1.w
  mul r7.xyzw, r1.wwww, r7.xyzw
  dp4 r7.y, r8.xyzw, r7.xyzw
  ftoi r1.yz, r1.yyzy
  and r1.yz, r1.yyzy, l(0, 1, 1, 0)
  ine r1.y, r1.y, r1.z
  mov r7.xz, r3.xxyx
  movc r7.yz, r1.yyyy, r7.yyzy, r7.zzyz
  add r1.yzw, r7.xxyz, l(0.000000, -0.000000, -0.498039216, -0.498039216)
  add r7.yw, r1.wwwz, r1.yyyy
  add r7.x, -r1.w, r7.w
  add r1.y, -r1.z, r1.y
  add r7.z, -r1.w, r1.y
  mov_sat r7.xyz, r7.xyzx
  mul r1.yzw, r7.xxyz, r7.xxyz
  mul r2.w, r3.w, l(255.000000)
  ftou r2.w, r2.w
  ubfe r3.x, l(1), l(3), r2.w
  and r2.w, r2.w, l(7)
  mul r3.y, r4.w, l(3.000000)
  ftou r3.y, r3.y
  mad r4.xyz, r4.xyzx, l(1.41421354, 1.41421354, 1.41421354, 0.000000), l(-0.707106769, -0.707106769, -0.707106769, 0.000000)
  dp3 r3.w, r4.xyzx, r4.xyzx
  min r3.w, r3.w, l(1.000000)
  add r3.w, -r3.w, l(1.000000)
  sqrt r3.w, r3.w
  swapc r4.x, r8.x, r3.y, r4.x, r3.w
  ieq r8.yz, r3.yyyy, l(0, 1, 2, 0)
  movc r9.xy, r8.yzyy, r3.wwww, r4.yzyy
  movc r3.y, r8.y, r4.y, r4.x
  movc r9.z, r8.z, r4.z, r3.y
  mul r4.xyzw, r9.xxyy, l(-2.000000, 2.000000, -2.000000, 2.000000)
  mov r9.w, r8.x
  mad r8.yzw, r4.xxyy, r9.xxwz, l(0.000000, 1.000000, 0.000000, 0.000000)
  mad r8.yzw, r4.zzzw, r9.yyzw, r8.yyzw
  mad r10.xyz, r4.wzww, r9.xyzx, l(0.000000, 1.000000, 0.000000, 0.000000)
  mul r11.xyz, r8.xxxx, l(2.000000, -2.000000, 2.000000, 0.000000)
  mad r10.xyz, r11.yyzy, r9.zwxz, r10.xyzx
  mad r11.xyz, r11.xyzx, r9.ywzy, l(0.000000, 1.000000, 0.000000, 0.000000)
  mad r4.xyz, r4.xxyx, r9.zxyz, r11.xyzx
  mul r3.yw, r5.xxxy, l(0.000000, 255.000000, 0.000000, 255.000000)
  ftou r3.yw, r3.yyyw
  ushr r9.xy, r3.ywyy, l(4, 2, 0, 0)
  utof r9.xy, r9.xyxx
  and r3.yw, r3.yyyw, l(0, 15, 0, 3)
  utof r3.xyw, r3.xyxw
  mul r9.xy, r9.xyxx, l(0.0666666701, 0.0158730168, 0.000000, 0.000000)
  mul r3.yw, r3.yyyw, l(0.000000, 0.0666666701, 0.000000, 0.333333343)
  mad r11.xyz, r6.xyzx, l(2.000000, 2.000000, 2.000000, 0.000000), l(-1.000000, -1.000000, -1.000000, 0.000000)
  dp3 r4.w, r11.xyzx, r11.xyzx
  rsq r4.w, r4.w
  mul r11.xyz, r4.wwww, r11.xyzx
  ieq r12.xyzw, r2.wwww, l(1, 3, 4, 5)
  mov r6.z, r5.w
  mov r6.xy, l(1.000000,0,0,0)
  movc r13.xw, r12.wwww, r6.xxxz, r6.zzzy
  mov r13.yz, l(0,0,0,0)
  movc r13.xyzw, r12.zzzz, r6.zywy, r13.xyzw
  or r4.w, r12.y, r12.z
  movc r11.xyz, r4.wwww, r11.xyzx, r4.xyzx
  movc r14.yzw, r12.yyyy, l(0,0,0,0), r13.yyzw
  mov r13.yw, l(0,0,0,1.000000)
  movc r13.xz, r12.yyyy, r6.zzwz, r13.xxyx
  movc r11.xyz, r12.xxxx, r4.xyzx, r11.xyzx
  mov r6.xy, l(0,0.150000,0,0)
  mov r13.y, r3.y
  movc r6.xyz, r12.xxxx, r6.xyzx, r13.xywx
  mov r9.z, r3.w
  mov r9.w, l(0)
  mov r13.xy, r5.yxyy
  movc r9.yzw, r12.xxxx, r9.yyzw, r13.xxxz
  mov r13.xzw, l(0,0,0,0)
  mov r14.x, r9.x
  movc r13.xyzw, r12.xxxx, r13.xyzw, r14.xyzw
  add r5.xyw, -r2.xzxy, r35.xzxy
  dp3 r3.y, r5.xywx, r5.xywx
  sqrt r3.y, r3.y
  div r5.xyw, r5.xyxw, r3.yyyy
  dp3 r3.w, r4.xyzx, r5.xywx
  mad r14.xy, -r3.zzzz, l(0.990000, 6.000000, 0.000000, 0.000000), l(1.000000, 6.000000, 0.000000, 0.000000)
  mul r4.w, r6.z, l(255.000000)
  mad r6.w, -r6.x, l(0.990000), l(1.000000)
  sqrt r6.w, r6.w
  mul r7.w, r14.x, r14.x
  div r8.x, r7.w, r6.w
  max r8.x, r8.x, l(0.001000)
  mul r6.w, r6.w, r7.w
  max r6.w, r6.w, l(0.001000)
  add r9.x, r13.w, r13.w
  dp3 r15.x, r8.ywzy, r5.xywx
  dp3 r15.y, r10.zxyz, r5.xywx
  mov_sat r10.w, r3.w
  movc r11.w, r12.w, |r3.w|, r10.w
  mul r14.xz, r15.xxyx, r15.xxyx
  mul r12.y, r8.x, r8.x
  mul r13.w, r6.w, r6.w
  mul r14.z, r14.z, r13.w
  mad r14.x, r12.y, r14.x, r14.z
  mad r11.w, r11.w, r11.w, r14.x
  sqrt r11.w, r11.w
  mad r6.y, r6.y, l(0.082000), l(0.018000)
  mad r7.xyz, r7.xyzx, r7.xyzx, -r6.yyyy
  mad r7.xyz, r13.xxxx, r7.xyzx, r6.yyyy
  add r13.x, -r13.x, l(1.000000)
  mul r14.xzw, r1.yyzw, r13.xxxx
  ieq r15.xy, r2.wwww, l(2, 6, 0, 0)
  if_nz r15.x
    ld_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r2.w, r0.xyww, t4.yzwx
    max r2.w, r2.w, cb3[1].y
    dp3_sat r13.x, -r4.xzyx, cb3[4].xyzx
    add r15.x, r10.w, r13.x
    mad r15.x, -r13.x, r10.w, r15.x
    max r15.x, r15.x, l(0.010000)
    div r15.x, l(1.000000, 1.000000, 1.000000, 1.000000), r15.x
    add r16.xyz, r5.xwyx, -cb3[4].xyzx
    dp3 r15.z, r16.xyzx, r16.xyzx
    rsq r15.z, r15.z
    mul r16.xyz, r15.zzzz, r16.xyzx
    dp3 r15.z, r16.xzyx, r5.xywx
    add r15.z, -r15.z, l(1.000000)
    mul r15.w, r15.z, r15.z
    mul r15.w, r15.w, r15.w
    mul r15.z, r15.z, r15.w
    add r17.xyz, -r7.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
    mad r18.xyz, r17.xyzx, r15.zzzz, r7.xyzx
    dp3_sat r15.z, r4.xzyx, -cb3[4].xyzx
    mul r19.xyz, r15.zzzz, cb3[3].xyzx
    mul r19.xyz, r2.wwww, r19.xyzx
    mul r18.xyz, r2.wwww, r18.xyzx
    mul r18.xyz, r13.xxxx, r18.xyzx
    mul r15.xzw, r15.xxxx, r18.xxyz
    dp3_sat r2.w, r16.xzyx, r4.xyzx
    mul r2.w, r2.w, r2.w
    min r2.w, r2.w, l(0.999999)
    add r13.x, -r2.w, l(1.000000)
    div r2.w, r2.w, r13.x
    mul r13.x, r13.x, r13.x
    mul r16.x, r7.w, r7.w
    mad r16.x, r16.x, l(4.000000), l(1.000000)
    div r16.x, l(1.000000, 1.000000, 1.000000, 1.000000), r16.x
    mad r16.y, r7.w, r7.w, l(0.000001)
    div r2.w, -r2.w, r16.y
    mul r2.w, r2.w, l(1.442695)
    exp r2.w, r2.w
    mul r2.w, r2.w, l(4.000000)
    div r2.w, r2.w, r13.x
    add r2.w, r2.w, l(1.000000)
    mul r2.w, r2.w, r16.x
    mul r18.xyz, r2.wwww, cb3[3].xyzx
    mul r15.xzw, r15.xxzw, r18.xxyz
    mul r18.xyz, r19.xyzx, cb3[5].wwww
    ishl r2.w, r1.x, l(1)
    ld_structured_indexable(structured_buffer, stride=4)(mixed,mixed,mixed,mixed) r2.w, r2.w, l(0), t12.xxxx
    countbits r13.x, r2.w
    mov r20.xyz, r19.xyzx
    mov r21.xyz, r15.xzwx
    mov r22.xyz, r18.xyzx
    mov r16.z, r2.w
    mov r16.w, l(0)
    loop 
      uge r17.w, r16.w, r13.x
      breakc_nz r17.w
      firstbit_lo r17.w, r16.z
      ishl r18.w, l(1), r17.w
      not r18.w, r18.w
      and r18.w, r16.z, r18.w
      ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r23.xyzw, r17.w, l(0), t11.xyzw
      ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r24.xyz, r17.w, l(32), t11.xyzx
      ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r25.xyzw, r17.w, l(48), t11.xyzw
      and r19.w, r25.w, l(1)
      ult r19.w, l(0), r19.w
      add r23.xyz, -r2.xyzx, r23.xyzx
      dp3 r20.w, r23.xyzx, r23.xyzx
      max r20.w, r20.w, l(0.000010)
      rsq r21.w, r20.w
      div r22.w, l(1.000000, 1.000000, 1.000000, 1.000000), r20.w
      min r22.w, r22.w, r23.w
      mul r26.xyz, r21.wwww, r23.xyzx
      mul r20.w, r20.w, r20.w
      mad_sat r20.w, -r20.w, r25.x, l(1.000000)
      mul r20.w, r20.w, r20.w
      mul r20.w, r20.w, r22.w
      dp3 r22.w, r26.xyzx, -r24.xyzx
      mad_sat r22.w, r22.w, r25.y, r25.z
      movc r19.w, r19.w, r22.w, l(1.000000)
      mul r19.w, r19.w, r19.w
      mul r19.w, r20.w, r19.w
      lt r20.w, r19.w, l(0.000100)
      iadd r22.w, r16.w, -r20.w
      mov r16.z, r18.w
      mov r16.w, r22.w
      continuec_nz r20.w
      ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r24.xyz, r17.w, l(16), t11.xyzx
      and r17.w, r25.w, l(2)
      ult r17.w, l(0), r17.w
      mul r24.xyz, r19.wwww, r24.xyzx
      dp3_sat r19.w, r11.xzyx, r26.xyzx
      mad r20.xyz, r19.wwww, r24.xyzx, r20.xyzx
      mad r23.xyz, r23.xyzx, r21.wwww, r5.xwyx
      dp3 r20.w, r23.xyzx, r23.xyzx
      rsq r20.w, r20.w
      mul r23.xyz, r20.wwww, r23.xyzx
      dp3 r20.w, r23.xzyx, r5.xywx
      add r20.w, -r20.w, l(1.000000)
      mul r21.w, r20.w, r20.w
      mul r21.w, r21.w, r21.w
      mul r20.w, r20.w, r21.w
      mad r25.xyz, r17.xyzx, r20.wwww, r7.xyzx
      dp3_sat r20.w, r4.xzyx, r26.xyzx
      add r21.w, r10.w, r20.w
      mad r21.w, -r20.w, r10.w, r21.w
      max r21.w, r21.w, l(0.010000)
      div r21.w, l(1.000000, 1.000000, 1.000000, 1.000000), r21.w
      mul r25.xyz, r21.wwww, r25.xyzx
      mul r25.xyz, r20.wwww, r25.xyzx
      dp3_sat r20.w, r23.xzyx, r4.xyzx
      mul r20.w, r20.w, r20.w
      min r20.w, r20.w, l(0.999999)
      add r21.w, -r20.w, l(1.000000)
      div r20.w, r20.w, r21.w
      mul r21.w, r21.w, r21.w
      div r20.w, -r20.w, r16.y
      mul r20.w, r20.w, l(1.442695)
      exp r20.w, r20.w
      mul r20.w, r20.w, l(4.000000)
      div r20.w, r20.w, r21.w
      add r20.w, r20.w, l(1.000000)
      mul r20.w, r16.x, r20.w
      mul r23.xyz, r20.wwww, r24.xyzx
      mad r21.xyz, r25.xyzx, r23.xyzx, r21.xyzx
      mad r23.xyz, r19.wwww, r24.xyzx, r22.xyzx
      movc r22.xyz, r17.wwww, r23.xyzx, r22.xyzx
      iadd r16.w, r16.w, l(1)
      mov r16.z, r18.w
    endloop 
    bfi r2.w, l(31), l(1), r1.x, l(1)
    ld_structured_indexable(structured_buffer, stride=4)(mixed,mixed,mixed,mixed) r2.w, r2.w, l(0), t12.xxxx
    countbits r13.x, r2.w
    mov r15.xzw, r20.xxyz
    mov r18.xyz, r21.xyzx
    mov r19.xyz, r22.xyzx
    mov r16.z, r2.w
    mov r16.w, l(0)
    loop 
      uge r17.w, r16.w, r13.x
      breakc_nz r17.w
      firstbit_lo r17.w, r16.z
      ishl r18.w, l(1), r17.w
      not r18.w, r18.w
      and r18.w, r16.z, r18.w
      iadd r17.w, l(32), r17.w
      ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r23.xyzw, r17.w, l(0), t11.xyzw
      ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r24.xyz, r17.w, l(32), t11.xyzx
      ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r25.xyzw, r17.w, l(48), t11.xyzw
      and r19.w, r25.w, l(1)
      ult r19.w, l(0), r19.w
      add r23.xyz, -r2.xyzx, r23.xyzx
      dp3 r20.w, r23.xyzx, r23.xyzx
      max r20.w, r20.w, l(0.000010)
      rsq r21.w, r20.w
      div r22.w, l(1.000000, 1.000000, 1.000000, 1.000000), r20.w
      min r22.w, r22.w, r23.w
      mul r26.xyz, r21.wwww, r23.xyzx
      mul r20.w, r20.w, r20.w
      mad_sat r20.w, -r20.w, r25.x, l(1.000000)
      mul r20.w, r20.w, r20.w
      mul r20.w, r20.w, r22.w
      dp3 r22.w, r26.xyzx, -r24.xyzx
      mad_sat r22.w, r22.w, r25.y, r25.z
      movc r19.w, r19.w, r22.w, l(1.000000)
      mul r19.w, r19.w, r19.w
      mul r19.w, r20.w, r19.w
      lt r20.w, r19.w, l(0.000100)
      iadd r22.w, r16.w, -r20.w
      mov r16.z, r18.w
      mov r16.w, r22.w
      continuec_nz r20.w
      ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r24.xyz, r17.w, l(16), t11.xyzx
      and r17.w, r25.w, l(2)
      ult r17.w, l(0), r17.w
      mul r24.xyz, r19.wwww, r24.xyzx
      dp3_sat r19.w, r11.xzyx, r26.xyzx
      mad r15.xzw, r19.wwww, r24.xxyz, r15.xxzw
      mad r23.xyz, r23.xyzx, r21.wwww, r5.xwyx
      dp3 r20.w, r23.xyzx, r23.xyzx
      rsq r20.w, r20.w
      mul r23.xyz, r20.wwww, r23.xyzx
      dp3 r20.w, r23.xzyx, r5.xywx
      add r20.w, -r20.w, l(1.000000)
      mul r21.w, r20.w, r20.w
      mul r21.w, r21.w, r21.w
      mul r20.w, r20.w, r21.w
      mad r25.xyz, r17.xyzx, r20.wwww, r7.xyzx
      dp3_sat r20.w, r4.xzyx, r26.xyzx
      add r21.w, r10.w, r20.w
      mad r21.w, -r20.w, r10.w, r21.w
      max r21.w, r21.w, l(0.010000)
      div r21.w, l(1.000000, 1.000000, 1.000000, 1.000000), r21.w
      mul r25.xyz, r21.wwww, r25.xyzx
      mul r25.xyz, r20.wwww, r25.xyzx
      dp3_sat r20.w, r23.xzyx, r4.xyzx
      mul r20.w, r20.w, r20.w
      min r20.w, r20.w, l(0.999999)
      add r21.w, -r20.w, l(1.000000)
      div r20.w, r20.w, r21.w
      mul r21.w, r21.w, r21.w
      div r20.w, -r20.w, r16.y
      mul r20.w, r20.w, l(1.442695)
      exp r20.w, r20.w
      mul r20.w, r20.w, l(4.000000)
      div r20.w, r20.w, r21.w
      add r20.w, r20.w, l(1.000000)
      mul r20.w, r16.x, r20.w
      mul r23.xyz, r20.wwww, r24.xyzx
      mad r18.xyz, r25.xyzx, r23.xyzx, r18.xyzx
      mad r23.xyz, r19.wwww, r24.xyzx, r19.xyzx
      movc r19.xyz, r17.wwww, r23.xyzx, r19.xyzx
      iadd r16.w, r16.w, l(1)
      mov r16.z, r18.w
    endloop 
    mov r16.xyz, l(0,0,0,0)
  else 
    if_nz r12.z
      ld_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r2.w, r0.xyww, t4.yzwx
      max r2.w, r2.w, cb3[1].y
      dp3_sat r13.x, r11.xzyx, -cb3[4].xyzx
      add r17.xyz, -r4.xzyx, r11.xzyx
      mad r20.xyz, r17.xyzx, l(0.100000, 0.100000, 0.100000, 0.000000), r4.xzyx
      dp3 r16.w, r20.xyzx, r20.xyzx
      rsq r16.w, r16.w
      mul r20.xyz, r16.wwww, r20.xyzx
      mad r17.xyz, r17.xyzx, l(0.300000, 0.300000, 0.300000, 0.000000), r4.xzyx
      dp3 r16.w, r17.xyzx, r17.xyzx
      rsq r16.w, r16.w
      mul r17.xyz, r16.wwww, r17.xyzx
      dp3 r16.w, r4.xzyx, -cb3[4].xyzx
      dp3 r17.w, r20.xyzx, -cb3[4].xyzx
      dp3 r18.w, r17.xyzx, -cb3[4].xyzx
      mad r21.z, r16.w, l(0.500000), l(0.500000)
      mov r21.w, r13.z
      mad r22.xy, r21.zwzz, l(0.984375, 0.984375, 0.000000, 0.000000), l(0.00781250000, 0.00781250000, 0.000000, 0.000000)
      sample_l_indexable(texture2d)(float,float,float,float) r22.x, r22.xyxx, t13.xyzw, s3, l(0.000000)
      mad r21.y, r17.w, l(0.500000), l(0.500000)
      mad r23.xy, r21.ywyy, l(0.984375, 0.984375, 0.000000, 0.000000), l(0.00781250000, 0.00781250000, 0.000000, 0.000000)
      sample_l_indexable(texture2d)(float,float,float,float) r22.y, r23.xyxx, t13.xyzw, s3, l(0.000000)
      mad r21.x, r18.w, l(0.500000), l(0.500000)
      mad r23.xy, r21.xwxx, l(0.984375, 0.984375, 0.000000, 0.000000), l(0.00781250000, 0.00781250000, 0.000000, 0.000000)
      sample_l_indexable(texture2d)(float,float,float,float) r22.z, r23.xyxx, t13.xyzw, s3, l(0.000000)
      add r23.xyz, r5.xwyx, -cb3[4].xyzx
      dp3 r13.z, r23.xyzx, r23.xyzx
      rsq r13.z, r13.z
      mul r23.xyz, r13.zzzz, r23.xyzx
      dp3 r13.z, r23.xzyx, r5.xywx
      add r13.z, -r13.z, l(1.000000)
      mul r16.w, r13.z, r13.z
      mul r16.w, r16.w, r16.w
      mul r13.z, r13.z, r16.w
      add r24.xyz, -r7.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
      mad r25.xyz, r24.xyzx, r13.zzzz, r7.xyzx
      mul r13.z, r13.x, r13.x
      mul r16.w, r7.w, r7.w
      mad r17.w, -r7.w, r7.w, l(1.000000)
      mad r13.z, r13.z, r17.w, r16.w
      sqrt r13.z, r13.z
      mul r13.z, r10.w, r13.z
      mad r13.z, r13.x, r11.w, r13.z
      add r13.z, r13.z, r13.z
      max r13.z, r13.z, l(0.000100)
      div r13.z, l(1.000000, 1.000000, 1.000000, 1.000000), r13.z
      mul r26.xyz, r2.wwww, cb3[3].xyzx
      mul r22.xyz, r22.xyzx, r26.xyzx
      mul r25.xyz, r2.wwww, r25.xyzx
      mul r25.xyz, r13.xxxx, r25.xyzx
      mul r25.xyz, r13.zzzz, r25.xyzx
      dp3_sat r2.w, r23.xzyx, r11.xyzx
      mad r13.x, r7.w, r7.w, l(-1.000000)
      mul r2.w, r2.w, r2.w
      mad r2.w, r2.w, r13.x, l(1.000000)
      div r2.w, r7.w, r2.w
      mul r2.w, r2.w, r2.w
      mul r23.xyz, r2.wwww, cb3[3].xyzx
      mul r23.xyz, r23.xyzx, r25.xyzx
      mul r25.xyz, r22.xyzx, cb3[5].wwww
      ishl r2.w, r1.x, l(1)
      ld_structured_indexable(structured_buffer, stride=4)(mixed,mixed,mixed,mixed) r2.w, r2.w, l(0), t12.xxxx
      countbits r13.z, r2.w
      mov r26.xyz, r22.xyzx
      mov r27.xyz, r23.xyzx
      mov r28.xyz, r25.xyzx
      mov r18.w, r2.w
      mov r19.w, l(0)
      loop 
        uge r20.w, r19.w, r13.z
        breakc_nz r20.w
        firstbit_lo r20.w, r18.w
        ishl r22.w, l(1), r20.w
        not r22.w, r22.w
        and r22.w, r18.w, r22.w
        ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r29.xyzw, r20.w, l(0), t11.xyzw
        ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r30.xyz, r20.w, l(32), t11.xyzx
        ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r31.xyzw, r20.w, l(48), t11.xyzw
        and r23.w, r31.w, l(1)
        ult r23.w, l(0), r23.w
        add r29.xyz, -r2.xyzx, r29.xyzx
        dp3 r24.w, r29.xyzx, r29.xyzx
        max r24.w, r24.w, l(0.000010)
        rsq r25.w, r24.w
        div r26.w, l(1.000000, 1.000000, 1.000000, 1.000000), r24.w
        min r26.w, r26.w, r29.w
        mul r32.xyz, r25.wwww, r29.xyzx
        mul r24.w, r24.w, r24.w
        mad_sat r24.w, -r24.w, r31.x, l(1.000000)
        mul r24.w, r24.w, r24.w
        mul r24.w, r24.w, r26.w
        dp3 r26.w, r32.xyzx, -r30.xyzx
        mad_sat r26.w, r26.w, r31.y, r31.z
        movc r23.w, r23.w, r26.w, l(1.000000)
        mul r23.w, r23.w, r23.w
        mul r23.w, r24.w, r23.w
        lt r24.w, r23.w, l(0.000100)
        iadd r26.w, r19.w, -r24.w
        mov r18.w, r22.w
        mov r19.w, r26.w
        continuec_nz r24.w
        ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r30.xyz, r20.w, l(16), t11.xyzx
        and r20.w, r31.w, l(2)
        ult r20.w, l(0), r20.w
        mad r29.xyz, r29.xyzx, r25.wwww, r5.xwyx
        dp3 r24.w, r29.xyzx, r29.xyzx
        rsq r24.w, r24.w
        mul r29.xyz, r24.wwww, r29.xyzx
        dp3 r24.w, r29.xzyx, r5.xywx
        add r24.w, -r24.w, l(1.000000)
        mul r25.w, r24.w, r24.w
        mul r25.w, r25.w, r25.w
        mul r24.w, r24.w, r25.w
        mad r31.xyz, r24.xyzx, r24.wwww, r7.xyzx
        dp3_sat r24.w, r11.xzyx, r32.xyzx
        mul r25.w, r24.w, r24.w
        mad r25.w, r25.w, r17.w, r16.w
        sqrt r25.w, r25.w
        mul r25.w, r10.w, r25.w
        mad r25.w, r24.w, r11.w, r25.w
        add r25.w, r25.w, r25.w
        max r25.w, r25.w, l(0.000100)
        div r25.w, l(1.000000, 1.000000, 1.000000, 1.000000), r25.w
        dp3 r26.w, r4.xzyx, r32.xyzx
        dp3 r27.w, r20.xyzx, r32.xyzx
        dp3 r28.w, r17.xyzx, r32.xyzx
        mad r21.z, r26.w, l(0.500000), l(0.500000)
        mad r32.xy, r21.zwzz, l(0.984375, 0.984375, 0.000000, 0.000000), l(0.00781250000, 0.00781250000, 0.000000, 0.000000)
        sample_l_indexable(texture2d)(float,float,float,float) r32.x, r32.xyxx, t13.xyzw, s3, l(0.000000)
        mad r21.y, r27.w, l(0.500000), l(0.500000)
        mad r33.xy, r21.ywyy, l(0.984375, 0.984375, 0.000000, 0.000000), l(0.00781250000, 0.00781250000, 0.000000, 0.000000)
        sample_l_indexable(texture2d)(float,float,float,float) r32.y, r33.xyxx, t13.xyzw, s3, l(0.000000)
        mad r21.x, r28.w, l(0.500000), l(0.500000)
        mad r33.xy, r21.xwxx, l(0.984375, 0.984375, 0.000000, 0.000000), l(0.00781250000, 0.00781250000, 0.000000, 0.000000)
        sample_l_indexable(texture2d)(float,float,float,float) r32.z, r33.xyxx, t13.xyzw, s3, l(0.000000)
        mul r30.xyz, r23.wwww, r30.xyzx
        mad r26.xyz, r30.xyzx, r32.xyzx, r26.xyzx
        mul r31.xyz, r25.wwww, r31.xyzx
        mul r31.xyz, r24.wwww, r31.xyzx
        dp3_sat r23.w, r29.xzyx, r11.xyzx
        mul r23.w, r23.w, r23.w
        mad r23.w, r23.w, r13.x, l(1.000000)
        div r23.w, r7.w, r23.w
        mul r23.w, r23.w, r23.w
        mul r29.xyz, r23.wwww, r30.xyzx
        mad r27.xyz, r31.xyzx, r29.xyzx, r27.xyzx
        mad r29.xyz, r30.xyzx, r32.xyzx, r28.xyzx
        movc r28.xyz, r20.wwww, r29.xyzx, r28.xyzx
        iadd r19.w, r19.w, l(1)
        mov r18.w, r22.w
      endloop 
      bfi r2.w, l(31), l(1), r1.x, l(1)
      ld_structured_indexable(structured_buffer, stride=4)(mixed,mixed,mixed,mixed) r2.w, r2.w, l(0), t12.xxxx
      countbits r13.z, r2.w
      mov r15.xzw, r26.xxyz
      mov r18.xyz, r27.xyzx
      mov r19.xyz, r28.xyzx
      mov r18.w, r2.w
      mov r19.w, l(0)
      loop 
        uge r20.w, r19.w, r13.z
        breakc_nz r20.w
        firstbit_lo r20.w, r18.w
        ishl r22.x, l(1), r20.w
        not r22.x, r22.x
        and r22.x, r18.w, r22.x
        iadd r20.w, l(32), r20.w
        ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r23.xyzw, r20.w, l(0), t11.xyzw
        ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r22.yzw, r20.w, l(32), t11.xxyz
        ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r25.xyzw, r20.w, l(48), t11.xyzw
        and r24.w, r25.w, l(1)
        ult r24.w, l(0), r24.w
        add r23.xyz, -r2.xyzx, r23.xyzx
        dp3 r26.w, r23.xyzx, r23.xyzx
        max r26.w, r26.w, l(0.000010)
        rsq r27.w, r26.w
        div r28.w, l(1.000000, 1.000000, 1.000000, 1.000000), r26.w
        min r23.w, r23.w, r28.w
        mul r29.xyz, r23.xyzx, r27.wwww
        mul r26.w, r26.w, r26.w
        mad_sat r25.x, -r26.w, r25.x, l(1.000000)
        mul r25.x, r25.x, r25.x
        mul r23.w, r23.w, r25.x
        dp3 r22.y, r29.xyzx, -r22.yzwy
        mad_sat r22.y, r22.y, r25.y, r25.z
        movc r22.y, r24.w, r22.y, l(1.000000)
        mul r22.y, r22.y, r22.y
        mul r22.y, r23.w, r22.y
        lt r22.z, r22.y, l(0.000100)
        iadd r22.w, r19.w, -r22.z
        mov r18.w, r22.x
        mov r19.w, r22.w
        continuec_nz r22.z
        ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r25.xyz, r20.w, l(16), t11.xyzx
        and r20.w, r25.w, l(2)
        ult r20.w, l(0), r20.w
        mad r23.xyz, r23.xyzx, r27.wwww, r5.xwyx
        dp3 r22.z, r23.xyzx, r23.xyzx
        rsq r22.z, r22.z
        mul r23.xyz, r22.zzzz, r23.xyzx
        dp3 r22.z, r23.xzyx, r5.xywx
        add r22.z, -r22.z, l(1.000000)
        mul r22.w, r22.z, r22.z
        mul r22.w, r22.w, r22.w
        mul r22.z, r22.z, r22.w
        mad r30.xyz, r24.xyzx, r22.zzzz, r7.xyzx
        dp3_sat r22.z, r11.xzyx, r29.xyzx
        mul r22.w, r22.z, r22.z
        mad r22.w, r22.w, r17.w, r16.w
        sqrt r22.w, r22.w
        mul r22.w, r10.w, r22.w
        mad r22.w, r22.z, r11.w, r22.w
        add r22.w, r22.w, r22.w
        max r22.w, r22.w, l(0.000100)
        div r22.w, l(1.000000, 1.000000, 1.000000, 1.000000), r22.w
        dp3 r23.w, r4.xzyx, r29.xyzx
        dp3 r24.w, r20.xyzx, r29.xyzx
        dp3 r25.w, r17.xyzx, r29.xyzx
        mad r21.z, r23.w, l(0.500000), l(0.500000)
        mad r29.xy, r21.zwzz, l(0.984375, 0.984375, 0.000000, 0.000000), l(0.00781250000, 0.00781250000, 0.000000, 0.000000)
        sample_l_indexable(texture2d)(float,float,float,float) r29.x, r29.xyxx, t13.xyzw, s3, l(0.000000)
        mad r21.y, r24.w, l(0.500000), l(0.500000)
        mad r21.yz, r21.yywy, l(0.000000, 0.984375, 0.984375, 0.000000), l(0.000000, 0.00781250000, 0.00781250000, 0.000000)
        sample_l_indexable(texture2d)(float,float,float,float) r29.y, r21.yzyy, t13.xyzw, s3, l(0.000000)
        mad r21.x, r25.w, l(0.500000), l(0.500000)
        mad r21.xy, r21.xwxx, l(0.984375, 0.984375, 0.000000, 0.000000), l(0.00781250000, 0.00781250000, 0.000000, 0.000000)
        sample_l_indexable(texture2d)(float,float,float,float) r29.z, r21.xyxx, t13.xyzw, s3, l(0.000000)
        mul r21.xyz, r22.yyyy, r25.xyzx
        mad r15.xzw, r21.xxyz, r29.xxyz, r15.xxzw
        mul r25.xyz, r22.wwww, r30.xyzx
        mul r22.yzw, r22.zzzz, r25.xxyz
        dp3_sat r23.x, r23.xzyx, r11.xyzx
        mul r23.x, r23.x, r23.x
        mad r23.x, r23.x, r13.x, l(1.000000)
        div r23.x, r7.w, r23.x
        mul r23.x, r23.x, r23.x
        mul r23.xyz, r21.xyzx, r23.xxxx
        mad r18.xyz, r22.yzwy, r23.xyzx, r18.xyzx
        mad r21.xyz, r21.xyzx, r29.xyzx, r19.xyzx
        movc r19.xyz, r20.wwww, r21.xyzx, r19.xyzx
        iadd r19.w, r19.w, l(1)
        mov r18.w, r22.x
      endloop 
      mov r16.xyz, l(0,0,0,0)
    else 
      if_nz r12.w
        ld_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r2.w, r0.xyww, t4.yzwx
        max r2.w, r2.w, cb3[1].y
        dp3_sat r7.w, r11.xzyx, -cb3[4].xyzx
        mul r17.xyz, r7.wwww, cb3[3].xyzx
        mul r17.xyz, r2.wwww, r17.xyzx
        dp3 r7.w, r4.xzyx, -cb3[4].xyzx
        add r20.xyz, r5.xwyx, -cb3[4].xyzx
        dp3 r12.w, r20.xyzx, r20.xyzx
        rsq r12.w, r12.w
        mul r20.xyz, r12.wwww, r20.xyzx
        dp3 r12.w, r20.xzyx, r5.xywx
        add r12.w, -r12.w, l(1.000000)
        mul r13.x, r12.w, r12.w
        mul r13.x, r13.x, r13.x
        mul r12.w, r12.w, r13.x
        add r21.xyz, -r7.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
        mad r22.xyz, r21.xyzx, r12.wwww, r7.xyzx
        dp3 r23.x, r8.yzwy, -cb3[4].xyzx
        dp3 r23.y, r10.zyxz, -cb3[4].xyzx
        mov r12.w, |r7.w|
        mul r13.xz, r23.xxyx, r23.xxyx
        mul r13.z, r13.z, r13.w
        mad r13.x, r12.y, r13.x, r13.z
        mad r13.x, r12.w, r12.w, r13.x
        sqrt r13.x, r13.x
        mul r13.x, |r3.w|, r13.x
        mad r12.w, r12.w, r11.w, r13.x
        add r12.w, r12.w, r12.w
        max r12.w, r12.w, l(0.000100)
        div r12.w, l(1.000000, 1.000000, 1.000000, 1.000000), r12.w
        mul r22.xyz, r2.wwww, r22.xyzx
        mov_sat r7.w, r7.w
        mul r22.xyz, r7.wwww, r22.xyzx
        mul r22.xyz, r12.wwww, r22.xyzx
        dp3 r23.x, r20.xyzx, r8.yzwy
        dp3 r23.y, r20.zyxz, r10.xyzx
        dp3 r13.x, r20.xzyx, r4.xyzx
        mul r20.xy, r23.xyxx, r23.xyxx
        div r13.z, r20.x, r12.y
        mad r13.x, r13.x, r13.x, r13.z
        div r13.z, r20.y, r13.w
        add r13.x, r13.z, r13.x
        mul r13.z, r6.w, r8.x
        mul r13.x, r13.x, r13.x
        mul r13.x, r13.z, r13.x
        div r13.x, l(1.000000, 1.000000, 1.000000, 1.000000), r13.x
        mul r20.xyz, r13.xxxx, cb3[3].xyzx
        mul r20.xyz, r20.xyzx, r22.xyzx
        mul r22.xyz, r9.xxxx, r10.zyxz
        mul r23.xyz, r22.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000)
        mad r22.xyz, r22.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000), -cb3[4].xyzx
        dp3 r9.x, r22.xyzx, r22.xyzx
        rsq r9.x, r9.x
        mad r22.xyz, r22.xyzx, r9.xxxx, r5.xwyx
        dp3 r9.x, r22.xyzx, r22.xyzx
        rsq r9.x, r9.x
        mul r22.xyz, r9.xxxx, r22.xyzx
        mul r24.xyz, r1.yzwy, r6.yyyy
        dp3 r9.x, r22.xzyx, r5.xywx
        add r9.x, -r9.x, l(1.000000)
        mul r13.x, r9.x, r9.x
        mul r13.x, r13.x, r13.x
        mul r9.x, r9.x, r13.x
        mad r1.yzw, -r6.yyyy, r1.yyzw, l(0.000000, 1.000000, 1.000000, 1.000000)
        mad r25.xyz, r1.yzwy, r9.xxxx, r24.xyzx
        add r26.xyz, -r25.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
        mul r25.xyz, r2.wwww, r25.xyzx
        mul r25.xyz, r7.wwww, r25.xyzx
        mul r25.xyz, r12.wwww, r25.xyzx
        add r2.w, r8.x, r8.x
        add r7.w, r6.w, r6.w
        dp3 r27.x, r22.xyzx, r8.yzwy
        dp3 r27.y, r22.zyxz, r10.xyzx
        dp3 r9.x, r22.xzyx, r4.xyzx
        mul r22.xy, r27.xyxx, r27.xyxx
        mul r12.w, r2.w, r2.w
        div r13.x, r22.x, r12.w
        mad r9.x, r9.x, r9.x, r13.x
        mul r13.x, r7.w, r7.w
        div r16.w, r22.y, r13.x
        add r9.x, r9.x, r16.w
        mul r2.w, r2.w, r7.w
        mul r7.w, r9.x, r9.x
        mul r7.w, r2.w, r7.w
        div r7.w, l(1.000000, 1.000000, 1.000000, 1.000000), r7.w
        mul r22.xyz, r7.wwww, cb3[3].xyzx
        mul r22.xyz, r22.xyzx, r25.xyzx
        mad r20.xyz, r20.xyzx, r26.xyzx, r22.xyzx
        mul r22.xyz, r17.xyzx, cb3[5].wwww
        ishl r7.w, r1.x, l(1)
        ld_structured_indexable(structured_buffer, stride=4)(mixed,mixed,mixed,mixed) r7.w, r7.w, l(0), t12.xxxx
        countbits r9.x, r7.w
        mov r25.xyz, r17.xyzx
        mov r26.xyz, r20.xyzx
        mov r27.xyz, r22.xyzx
        mov r16.w, r7.w
        mov r17.w, l(0)
        loop 
          uge r18.w, r17.w, r9.x
          breakc_nz r18.w
          firstbit_lo r18.w, r16.w
          ishl r19.w, l(1), r18.w
          not r19.w, r19.w
          and r19.w, r16.w, r19.w
          ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r28.xyzw, r18.w, l(0), t11.xyzw
          ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r29.xyz, r18.w, l(32), t11.xyzx
          ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r30.xyzw, r18.w, l(48), t11.xyzw
          and r20.w, r30.w, l(1)
          ult r20.w, l(0), r20.w
          add r28.xyz, -r2.xyzx, r28.xyzx
          dp3 r21.w, r28.xyzx, r28.xyzx
          max r21.w, r21.w, l(0.000010)
          rsq r22.w, r21.w
          div r23.w, l(1.000000, 1.000000, 1.000000, 1.000000), r21.w
          min r23.w, r23.w, r28.w
          mul r31.xyz, r22.wwww, r28.xyzx
          mul r21.w, r21.w, r21.w
          mad_sat r21.w, -r21.w, r30.x, l(1.000000)
          mul r21.w, r21.w, r21.w
          mul r21.w, r21.w, r23.w
          dp3 r23.w, r31.xyzx, -r29.xyzx
          mad_sat r23.w, r23.w, r30.y, r30.z
          movc r20.w, r20.w, r23.w, l(1.000000)
          mul r20.w, r20.w, r20.w
          mul r20.w, r21.w, r20.w
          lt r21.w, r20.w, l(0.000100)
          iadd r23.w, r17.w, -r21.w
          mov r16.w, r19.w
          mov r17.w, r23.w
          continuec_nz r21.w
          ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r29.xyz, r18.w, l(16), t11.xyzx
          and r18.w, r30.w, l(2)
          ult r18.w, l(0), r18.w
          mul r29.xyz, r20.wwww, r29.xyzx
          dp3 r20.w, r11.xzyx, r31.xyzx
          mov_sat r21.w, r20.w
          mad r25.xyz, r21.wwww, r29.xyzx, r25.xyzx
          mad r30.xyz, r28.xyzx, r22.wwww, r5.xwyx
          dp3 r23.w, r30.xyzx, r30.xyzx
          rsq r23.w, r23.w
          mul r30.xyz, r23.wwww, r30.xyzx
          dp3 r23.w, r30.xzyx, r5.xywx
          add r23.w, -r23.w, l(1.000000)
          mul r24.w, r23.w, r23.w
          mul r24.w, r24.w, r24.w
          mul r23.w, r23.w, r24.w
          mad r32.xyz, r21.xyzx, r23.wwww, r7.xyzx
          dp3 r33.x, r8.yzwy, r31.xyzx
          dp3 r33.y, r10.zyxz, r31.xyzx
          mov r20.w, |r20.w|
          mul r31.xy, r33.xyxx, r33.xyxx
          mul r23.w, r13.w, r31.y
          mad r23.w, r12.y, r31.x, r23.w
          mad r23.w, r20.w, r20.w, r23.w
          sqrt r23.w, r23.w
          mul r23.w, |r3.w|, r23.w
          mad r20.w, r20.w, r11.w, r23.w
          add r20.w, r20.w, r20.w
          max r20.w, r20.w, l(0.000100)
          div r20.w, l(1.000000, 1.000000, 1.000000, 1.000000), r20.w
          mul r31.xyz, r20.wwww, r32.xyzx
          mul r31.xyz, r21.wwww, r31.xyzx
          dp3 r32.x, r30.xyzx, r8.yzwy
          dp3 r32.y, r30.zyxz, r10.xyzx
          dp3 r23.w, r30.xzyx, r4.xyzx
          mul r30.xy, r32.xyxx, r32.xyxx
          div r24.w, r30.x, r12.y
          mad r24.w, r23.w, r23.w, r24.w
          div r25.w, r30.y, r13.w
          add r24.w, r24.w, r25.w
          mul r24.w, r24.w, r24.w
          mul r24.w, r13.z, r24.w
          div r24.w, l(1.000000, 1.000000, 1.000000, 1.000000), r24.w
          mul r32.xyz, r24.wwww, r29.xyzx
          mul r31.xyz, r31.xyzx, r32.xyzx
          mad r28.xyz, r28.xyzx, r22.wwww, r23.xyzx
          dp3 r22.w, r28.xyzx, r28.xyzx
          rsq r22.w, r22.w
          mad r28.xyz, r28.xyzx, r22.wwww, r5.xwyx
          dp3 r22.w, r28.xyzx, r28.xyzx
          rsq r22.w, r22.w
          mul r28.xyz, r22.wwww, r28.xyzx
          dp3 r22.w, r28.xzyx, r5.xywx
          add r22.w, -r22.w, l(1.000000)
          mul r24.w, r22.w, r22.w
          mul r24.w, r24.w, r24.w
          mul r22.w, r22.w, r24.w
          mad r28.xyz, r1.yzwy, r22.wwww, r24.xyzx
          add r32.xyz, -r28.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
          mul r28.xyz, r20.wwww, r28.xyzx
          mul r28.xyz, r21.wwww, r28.xyzx
          div r20.w, r30.x, r12.w
          mad r20.w, r23.w, r23.w, r20.w
          div r22.w, r30.y, r13.x
          add r20.w, r20.w, r22.w
          mul r20.w, r20.w, r20.w
          mul r20.w, r2.w, r20.w
          div r20.w, l(1.000000, 1.000000, 1.000000, 1.000000), r20.w
          mul r30.xyz, r20.wwww, r29.xyzx
          mul r28.xyz, r28.xyzx, r30.xyzx
          mad r28.xyz, r31.xyzx, r32.xyzx, r28.xyzx
          add r26.xyz, r26.xyzx, r28.xyzx
          mad r28.xyz, r21.wwww, r29.xyzx, r27.xyzx
          movc r27.xyz, r18.wwww, r28.xyzx, r27.xyzx
          iadd r17.w, r17.w, l(1)
          mov r16.w, r19.w
        endloop 
        bfi r7.w, l(31), l(1), r1.x, l(1)
        ld_structured_indexable(structured_buffer, stride=4)(mixed,mixed,mixed,mixed) r7.w, r7.w, l(0), t12.xxxx
        countbits r9.x, r7.w
        mov r15.xzw, r25.xxyz
        mov r18.xyz, r26.xyzx
        mov r19.xyz, r27.xyzx
        mov r16.w, r7.w
        mov r17.x, l(0)
        loop 
          uge r17.y, r17.x, r9.x
          breakc_nz r17.y
          firstbit_lo r17.y, r16.w
          ishl r17.z, l(1), r17.y
          not r17.z, r17.z
          and r17.z, r16.w, r17.z
          iadd r17.y, l(32), r17.y
          ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r20.xyzw, r17.y, l(0), t11.xyzw
          ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r22.xyz, r17.y, l(32), t11.xyzx
          ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r28.xyzw, r17.y, l(48), t11.xyzw
          and r17.w, r28.w, l(1)
          ult r17.w, l(0), r17.w
          add r20.xyz, -r2.xyzx, r20.xyzx
          dp3 r18.w, r20.xyzx, r20.xyzx
          max r18.w, r18.w, l(0.000010)
          rsq r19.w, r18.w
          div r21.w, l(1.000000, 1.000000, 1.000000, 1.000000), r18.w
          min r20.w, r20.w, r21.w
          mul r29.xyz, r19.wwww, r20.xyzx
          mul r18.w, r18.w, r18.w
          mad_sat r18.w, -r18.w, r28.x, l(1.000000)
          mul r18.w, r18.w, r18.w
          mul r18.w, r18.w, r20.w
          dp3 r20.w, r29.xyzx, -r22.xyzx
          mad_sat r20.w, r20.w, r28.y, r28.z
          movc r17.w, r17.w, r20.w, l(1.000000)
          mul r17.w, r17.w, r17.w
          mul r17.w, r18.w, r17.w
          lt r18.w, r17.w, l(0.000100)
          iadd r20.w, r17.x, -r18.w
          mov r16.w, r17.z
          mov r17.x, r20.w
          continuec_nz r18.w
          ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r22.xyz, r17.y, l(16), t11.xyzx
          and r17.y, r28.w, l(2)
          ult r17.y, l(0), r17.y
          mul r22.xyz, r17.wwww, r22.xyzx
          dp3 r17.w, r11.xzyx, r29.xyzx
          mov_sat r18.w, r17.w
          mad r15.xzw, r18.wwww, r22.xxyz, r15.xxzw
          mad r28.xyz, r20.xyzx, r19.wwww, r5.xwyx
          dp3 r20.w, r28.xyzx, r28.xyzx
          rsq r20.w, r20.w
          mul r28.xyz, r20.wwww, r28.xyzx
          dp3 r20.w, r28.xzyx, r5.xywx
          add r20.w, -r20.w, l(1.000000)
          mul r21.w, r20.w, r20.w
          mul r21.w, r21.w, r21.w
          mul r20.w, r20.w, r21.w
          mad r30.xyz, r21.xyzx, r20.wwww, r7.xyzx
          dp3 r31.x, r8.yzwy, r29.xyzx
          dp3 r31.y, r10.zyxz, r29.xyzx
          mov r17.w, |r17.w|
          mul r29.xy, r31.xyxx, r31.xyxx
          mul r20.w, r13.w, r29.y
          mad r20.w, r12.y, r29.x, r20.w
          mad r20.w, r17.w, r17.w, r20.w
          sqrt r20.w, r20.w
          mul r20.w, |r3.w|, r20.w
          mad r17.w, r17.w, r11.w, r20.w
          add r17.w, r17.w, r17.w
          max r17.w, r17.w, l(0.000100)
          div r17.w, l(1.000000, 1.000000, 1.000000, 1.000000), r17.w
          mul r29.xyz, r17.wwww, r30.xyzx
          mul r29.xyz, r18.wwww, r29.xyzx
          dp3 r30.x, r28.xyzx, r8.yzwy
          dp3 r30.y, r28.zyxz, r10.xyzx
          dp3 r20.w, r28.xzyx, r4.xyzx
          mul r28.xy, r30.xyxx, r30.xyxx
          div r21.w, r28.x, r12.y
          mad r21.w, r20.w, r20.w, r21.w
          div r22.w, r28.y, r13.w
          add r21.w, r21.w, r22.w
          mul r21.w, r21.w, r21.w
          mul r21.w, r13.z, r21.w
          div r21.w, l(1.000000, 1.000000, 1.000000, 1.000000), r21.w
          mul r30.xyz, r21.wwww, r22.xyzx
          mul r29.xyz, r29.xyzx, r30.xyzx
          mad r20.xyz, r20.xyzx, r19.wwww, r23.xyzx
          dp3 r19.w, r20.xyzx, r20.xyzx
          rsq r19.w, r19.w
          mad r20.xyz, r20.xyzx, r19.wwww, r5.xwyx
          dp3 r19.w, r20.xyzx, r20.xyzx
          rsq r19.w, r19.w
          mul r20.xyz, r19.wwww, r20.xyzx
          dp3 r19.w, r20.xzyx, r5.xywx
          add r19.w, -r19.w, l(1.000000)
          mul r20.x, r19.w, r19.w
          mul r20.x, r20.x, r20.x
          mul r19.w, r19.w, r20.x
          mad r20.xyz, r1.yzwy, r19.wwww, r24.xyzx
          add r30.xyz, -r20.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
          mul r20.xyz, r17.wwww, r20.xyzx
          mul r20.xyz, r18.wwww, r20.xyzx
          div r17.w, r28.x, r12.w
          mad r17.w, r20.w, r20.w, r17.w
          div r19.w, r28.y, r13.x
          add r17.w, r17.w, r19.w
          mul r17.w, r17.w, r17.w
          mul r17.w, r2.w, r17.w
          div r17.w, l(1.000000, 1.000000, 1.000000, 1.000000), r17.w
          mul r28.xyz, r17.wwww, r22.xyzx
          mul r20.xyz, r20.xyzx, r28.xyzx
          mad r20.xyz, r29.xyzx, r30.xyzx, r20.xyzx
          add r18.xyz, r18.xyzx, r20.xyzx
          mad r20.xyz, r18.wwww, r22.xyzx, r19.xyzx
          movc r19.xyz, r17.yyyy, r20.xyzx, r19.xyzx
          iadd r17.x, r17.x, l(1)
          mov r16.w, r17.z
        endloop 
        mov r16.xyz, l(0,0,0,0)
      else 
        ld_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r1.y, r0.xyww, t4.yxzw
        max r1.y, r1.y, cb3[1].y
        dp3 r1.z, r4.xzyx, cb3[4].xyzx
        mov_sat r1.z, -r1.z
        add r17.xyz, r5.xwyx, -cb3[4].xyzx
        dp3 r1.w, r17.xyzx, r17.xyzx
        rsq r1.w, r1.w
        mul r17.xyz, r1.wwww, r17.xyzx
        dp3 r1.w, r17.xzyx, r5.xywx
        add r1.w, -r1.w, l(1.000000)
        mul r2.w, r1.w, r1.w
        mul r2.w, r2.w, r2.w
        mul r1.w, r1.w, r2.w
        add r20.xyz, -r7.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
        mad r21.xyz, r20.xyzx, r1.wwww, r7.xyzx
        dp3 r22.x, r8.yzwy, -cb3[4].xyzx
        dp3 r22.y, r10.zyxz, -cb3[4].xyzx
        mul r13.xz, r22.xxyx, r22.xxyx
        mul r1.w, r13.z, r13.w
        mad r1.w, r12.y, r13.x, r1.w
        mad r1.w, r1.z, r1.z, r1.w
        sqrt r1.w, r1.w
        mul r1.w, r1.w, r10.w
        mad r1.w, r1.z, r11.w, r1.w
        add r1.w, r1.w, r1.w
        max r1.w, r1.w, l(0.000100)
        div r1.w, l(1.000000, 1.000000, 1.000000, 1.000000), r1.w
        mul r21.xyz, r1.yyyy, r21.xyzx
        mul r21.xyz, r1.zzzz, r21.xyzx
        mul r21.xyz, r1.wwww, r21.xyzx
        dp3 r22.x, r17.xyzx, r8.yzwy
        dp3 r22.y, r17.zyxz, r10.xyzx
        dp3 r1.z, r17.xzyx, r4.xyzx
        mul r13.xz, r22.xxyx, r22.xxyx
        div r1.w, r13.x, r12.y
        mad r1.z, r1.z, r1.z, r1.w
        div r1.w, r13.z, r13.w
        add r1.z, r1.w, r1.z
        mul r1.w, r6.w, r8.x
        mul r1.z, r1.z, r1.z
        mul r1.z, r1.w, r1.z
        div r1.z, l(1.000000, 1.000000, 1.000000, 1.000000), r1.z
        mul r17.xyz, r1.zzzz, cb3[3].xyzx
        mul r17.xyz, r17.xyzx, r21.xyzx
        dp3 r1.z, r11.xzyx, -cb3[4].xyzx
        mul r21.xyz, r1.yyyy, cb3[3].xyzx
        mov_sat r1.y, r1.z
        mul r22.xyz, r1.yyyy, r21.xyzx
        mov_sat r1.z, -r1.z
        mul r21.xyz, r1.zzzz, r21.xyzx
        and r21.xyz, r12.xxxx, r21.xyzx
        mul r23.xyz, r22.xyzx, cb3[5].wwww
        ishl r1.y, r1.x, l(1)
        ld_structured_indexable(structured_buffer, stride=4)(mixed,mixed,mixed,mixed) r1.y, r1.y, l(0), t12.xxxx
        countbits r1.z, r1.y
        mov r24.xyz, r22.xyzx
        mov r25.xyz, r17.xyzx
        mov r26.xyz, r21.xyzx
        mov r27.xyz, r23.xyzx
        mov r2.w, r1.y
        mov r6.w, l(0)
        loop 
          uge r7.w, r6.w, r1.z
          breakc_nz r7.w
          firstbit_lo r7.w, r2.w
          ishl r8.x, l(1), r7.w
          not r8.x, r8.x
          and r8.x, r2.w, r8.x
          ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r28.xyzw, r7.w, l(0), t11.xyzw
          ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r29.xyz, r7.w, l(32), t11.xyzx
          ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r30.xyzw, r7.w, l(48), t11.xyzw
          and r9.x, r30.w, l(1)
          ult r9.x, l(0), r9.x
          add r28.xyz, -r2.xyzx, r28.xyzx
          dp3 r12.w, r28.xyzx, r28.xyzx
          max r12.w, r12.w, l(0.000010)
          rsq r13.x, r12.w
          div r13.z, l(1.000000, 1.000000, 1.000000, 1.000000), r12.w
          min r13.z, r13.z, r28.w
          mul r31.xyz, r13.xxxx, r28.xyzx
          mul r12.w, r12.w, r12.w
          mad_sat r12.w, -r12.w, r30.x, l(1.000000)
          mul r12.w, r12.w, r12.w
          mul r12.w, r12.w, r13.z
          dp3 r13.z, r31.xyzx, -r29.xyzx
          mad_sat r13.z, r13.z, r30.y, r30.z
          movc r9.x, r9.x, r13.z, l(1.000000)
          mul r9.x, r9.x, r9.x
          mul r9.x, r12.w, r9.x
          lt r12.w, r9.x, l(0.000100)
          iadd r13.z, r6.w, -r12.w
          mov r2.w, r8.x
          mov r6.w, r13.z
          continuec_nz r12.w
          ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r29.xyz, r7.w, l(16), t11.xyzx
          and r7.w, r30.w, l(2)
          ult r7.w, l(0), r7.w
          mul r29.xyz, r9.xxxx, r29.xyzx
          dp3_sat r9.x, r11.xzyx, r31.xyzx
          mad r24.xyz, r9.xxxx, r29.xyzx, r24.xyzx
          mad r28.xyz, r28.xyzx, r13.xxxx, r5.xwyx
          dp3 r12.w, r28.xyzx, r28.xyzx
          rsq r12.w, r12.w
          mul r28.xyz, r12.wwww, r28.xyzx
          dp3 r12.w, r28.xzyx, r5.xywx
          add r12.w, -r12.w, l(1.000000)
          mul r13.x, r12.w, r12.w
          mul r13.x, r13.x, r13.x
          mul r12.w, r12.w, r13.x
          mad r30.xyz, r20.xyzx, r12.wwww, r7.xyzx
          dp3_sat r12.w, r4.xzyx, r31.xyzx
          dp3 r32.x, r8.yzwy, r31.xyzx
          dp3 r32.y, r10.zyxz, r31.xyzx
          mul r13.xz, r32.xxyx, r32.xxyx
          mul r13.z, r13.z, r13.w
          mad r13.x, r12.y, r13.x, r13.z
          mad r13.x, r12.w, r12.w, r13.x
          sqrt r13.x, r13.x
          mul r13.x, r10.w, r13.x
          mad r13.x, r12.w, r11.w, r13.x
          add r13.x, r13.x, r13.x
          max r13.x, r13.x, l(0.000100)
          div r13.x, l(1.000000, 1.000000, 1.000000, 1.000000), r13.x
          mul r30.xyz, r13.xxxx, r30.xyzx
          mul r30.xyz, r12.wwww, r30.xyzx
          dp3 r31.x, r28.xyzx, r8.yzwy
          dp3 r31.y, r28.zyxz, r10.xyzx
          dp3 r12.w, r28.xzyx, r4.xyzx
          mul r13.xz, r31.xxyx, r31.xxyx
          div r13.x, r13.x, r12.y
          mad r12.w, r12.w, r12.w, r13.x
          div r13.x, r13.z, r13.w
          add r12.w, r12.w, r13.x
          mul r12.w, r12.w, r12.w
          mul r12.w, r1.w, r12.w
          div r12.w, l(1.000000, 1.000000, 1.000000, 1.000000), r12.w
          mul r28.xyz, r12.wwww, r29.xyzx
          mad r25.xyz, r30.xyzx, r28.xyzx, r25.xyzx
          mad r28.xyz, r9.xxxx, r29.xyzx, r27.xyzx
          movc r27.xyz, r7.wwww, r28.xyzx, r27.xyzx
          iadd r6.w, r6.w, l(1)
          mov r2.w, r8.x
        endloop 
        bfi r1.x, l(31), l(1), r1.x, l(1)
        ld_structured_indexable(structured_buffer, stride=4)(mixed,mixed,mixed,mixed) r1.x, r1.x, l(0), t12.xxxx
        countbits r1.y, r1.x
        mov r15.xzw, r24.xxyz
        mov r18.xyz, r25.xyzx
        mov r16.xyz, r26.xyzx
        mov r19.xyz, r27.xyzx
        mov r1.z, r1.x
        mov r2.w, l(0)
        loop 
          uge r6.w, r2.w, r1.y
          breakc_nz r6.w
          firstbit_lo r6.w, r1.z
          ishl r7.w, l(1), r6.w
          not r7.w, r7.w
          and r7.w, r1.z, r7.w
          iadd r6.w, l(32), r6.w
          ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r17.xyzw, r6.w, l(0), t11.xyzw
          ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r21.xyz, r6.w, l(32), t11.xyzx
          ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r22.xyzw, r6.w, l(48), t11.xyzw
          and r8.x, r22.w, l(1)
          ult r8.x, l(0), r8.x
          add r17.xyz, -r2.xyzx, r17.xyzx
          dp3 r9.x, r17.xyzx, r17.xyzx
          max r9.x, r9.x, l(0.000010)
          rsq r12.w, r9.x
          div r13.x, l(1.000000, 1.000000, 1.000000, 1.000000), r9.x
          min r13.x, r13.x, r17.w
          mul r23.xyz, r12.wwww, r17.xyzx
          mul r9.x, r9.x, r9.x
          mad_sat r9.x, -r9.x, r22.x, l(1.000000)
          mul r9.x, r9.x, r9.x
          mul r9.x, r9.x, r13.x
          dp3 r13.x, r23.xyzx, -r21.xyzx
          mad_sat r13.x, r13.x, r22.y, r22.z
          movc r8.x, r8.x, r13.x, l(1.000000)
          mul r8.x, r8.x, r8.x
          mul r8.x, r9.x, r8.x
          lt r9.x, r8.x, l(0.000100)
          iadd r13.x, r2.w, -r9.x
          mov r1.z, r7.w
          mov r2.w, r13.x
          continuec_nz r9.x
          ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r21.xyz, r6.w, l(16), t11.xyzx
          and r6.w, r22.w, l(2)
          ult r6.w, l(0), r6.w
          mul r21.xyz, r8.xxxx, r21.xyzx
          dp3_sat r8.x, r11.xzyx, r23.xyzx
          mad r15.xzw, r8.xxxx, r21.xxyz, r15.xxzw
          mad r17.xyz, r17.xyzx, r12.wwww, r5.xwyx
          dp3 r9.x, r17.xyzx, r17.xyzx
          rsq r9.x, r9.x
          mul r17.xyz, r9.xxxx, r17.xyzx
          dp3 r9.x, r17.xzyx, r5.xywx
          add r9.x, -r9.x, l(1.000000)
          mul r12.w, r9.x, r9.x
          mul r12.w, r12.w, r12.w
          mul r9.x, r9.x, r12.w
          mad r22.xyz, r20.xyzx, r9.xxxx, r7.xyzx
          dp3_sat r9.x, r4.xzyx, r23.xyzx
          dp3 r28.x, r8.yzwy, r23.xyzx
          dp3 r28.y, r10.zyxz, r23.xyzx
          mul r13.xz, r28.xxyx, r28.xxyx
          mul r12.w, r13.z, r13.w
          mad r12.w, r12.y, r13.x, r12.w
          mad r12.w, r9.x, r9.x, r12.w
          sqrt r12.w, r12.w
          mul r12.w, r10.w, r12.w
          mad r12.w, r9.x, r11.w, r12.w
          add r12.w, r12.w, r12.w
          max r12.w, r12.w, l(0.000100)
          div r12.w, l(1.000000, 1.000000, 1.000000, 1.000000), r12.w
          mul r22.xyz, r12.wwww, r22.xyzx
          mul r22.xyz, r9.xxxx, r22.xyzx
          dp3 r23.x, r17.xyzx, r8.yzwy
          dp3 r23.y, r17.zyxz, r10.xyzx
          dp3 r9.x, r17.xzyx, r4.xyzx
          mul r13.xz, r23.xxyx, r23.xxyx
          div r12.w, r13.x, r12.y
          mad r9.x, r9.x, r9.x, r12.w
          div r12.w, r13.z, r13.w
          add r9.x, r9.x, r12.w
          mul r9.x, r9.x, r9.x
          mul r9.x, r1.w, r9.x
          div r9.x, l(1.000000, 1.000000, 1.000000, 1.000000), r9.x
          mul r17.xyz, r9.xxxx, r21.xyzx
          mad r18.xyz, r22.xyzx, r17.xyzx, r18.xyzx
          mad r17.xyz, r8.xxxx, r21.xyzx, r19.xyzx
          movc r19.xyz, r6.wwww, r17.xyzx, r19.xyzx
          iadd r2.w, r2.w, l(1)
          mov r1.z, r7.w
        endloop 
      endif 
    endif 
  endif 
  ld_indexable(texture2d)(float,float,float,float) r1.xyzw, r0.xyzw, t14.xyzw
  ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r0.z, l(0), l(12), t2.xxxx
  mul r1.xyz, r0.zzzz, r1.xyzx
  mad_sat r0.z, r3.y, cb3[0].x, cb3[0].y
  mul r0.z, r0.z, cb3[0].z
  mul r0.z, r3.x, r0.z
  mad r1.xyz, r1.yyyy, r0.zzzz, r1.xyzx
  and r0.z, r12.x, l(0x3e800000)
  mov r2.yzw, -r5.wwyx
  mul r8.xyz, r3.yyyy, r2.wyzw
  mad r13.xzw, r2.wwyz, r3.yyyy, r35.xxyz
  mov r2.x, l(1.000000)
  dp4 r17.x, cb0[38].xyzw, r2.xyzw
  dp4 r17.y, cb0[37].xyzw, r2.xyzw
  dp4 r17.z, cb0[36].xyzw, r2.xyzw
  max r17.xyz, r17.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
  mad r12.yw, r13.zzzx, cb4[0].yyyx, cb4[0].wwwz
  sample_l_indexable(texture2d)(float,float,float,float) r0.w, r12.ywyy, t5.xzwy, s2, l(0.000000)
  mad r0.w, r0.w, cb4[2].x, cb4[2].y
  add r0.w, -r0.w, r13.w
  mul_sat r0.w, -r0.w, cb5[18].x
  sqrt r0.w, r0.w
  dp2 r3.x, r8.xyxx, r8.xyxx
  mad r3.x, cb4[1].x, r3.x, cb4[1].y
  mul_sat r3.x, r3.x, l(3.000000)
  mul r0.w, r0.w, r3.x
  dp4 r20.x, cb5[15].xyzw, r2.xyzw
  dp4 r20.y, cb5[16].xyzw, r2.xyzw
  dp4 r20.z, cb5[17].xyzw, r2.xyzw
  max r2.xyz, r20.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
  mad r2.xyz, r2.xyzx, cb0[56].xxxx, -r17.xyzx
  mad r2.xyz, r0.wwww, r2.xyzx, r17.xyzx
  mad_sat r0.w, r3.y, cb0[35].y, cb0[35].x
  mul r2.w, r8.z, cb0[39].y
  max r2.w, r2.w, l(-125.000000)
  lt r3.x, l(0.000001), |r2.w|
  exp r3.y, -r2.w
  add r3.y, -r3.y, l(1.000000)
  div r2.w, r3.y, r2.w
  movc r2.w, r3.x, r2.w, l(1.000000)
  mad r2.w, r2.w, cb0[39].x, cb0[35].w
  mul r0.w, r0.w, r2.w
  mul r0.w, r0.w, -cb0[35].z
  exp r0.w, r0.w
  mad r2.xyz, -r2.xyzx, r0.wwww, r2.xyzx
  movc r4.xyz, r12.zzzz, r11.xyzx, r4.xyzx
  mul r8.xyz, r10.xyzx, r5.xywx
  mad r8.xyz, r5.ywxy, r10.zxyz, -r8.xyzx
  mul r11.xyz, r8.xyzx, r10.xyzx
  mad r8.xyz, r10.yzxy, r8.zxyz, -r11.xyzx
  add r8.xyz, -r4.xyzx, r8.xyzx
  mad r4.xyz, r6.xxxx, r8.xyzx, r4.xyzx
  dp3 r2.w, r4.xyzx, r4.xyzx
  rsq r2.w, r2.w
  mul r4.xyz, r2.wwww, r4.xyzx
  dp3 r2.w, r4.xyzx, r5.xywx
  add r2.w, r2.w, r2.w
  mad r4.xyz, -r2.wwww, r4.xyzx, r5.xywx
  mov r4.xyz, -r4.xyzx
  sample_l_indexable(texturecube)(float,float,float,float) r4.xyz, r4.xyzx, t0.xyzw, s0, r14.y
  ld_structured_indexable(structured_buffer, stride=132)(mixed,mixed,mixed,mixed) r8.xyzw, l(0), l(108), t3.xywz
  dp3 r2.w, r8.xywx, l(0.212600, 0.715200, 0.072200, 0.000000)
  ld_structured_indexable(structured_buffer, stride=132)(mixed,mixed,mixed,mixed) r8.xy, l(0), l(124), t3.xyxx
  dp3 r3.x, r8.zxyz, l(0.212600, 0.715200, 0.072200, 0.000000)
  max r2.w, r2.w, r3.x
  ld_structured_indexable(structured_buffer, stride=132)(mixed,mixed,mixed,mixed) r3.x, l(0), l(0), t3.xxxx
  ld_structured_indexable(structured_buffer, stride=132)(mixed,mixed,mixed,mixed) r3.y, l(0), l(36), t3.xxxx
  ld_structured_indexable(structured_buffer, stride=132)(mixed,mixed,mixed,mixed) r5.x, l(0), l(72), t3.xxxx
  max r3.y, r3.y, r5.x
  max r3.x, r3.y, r3.x
  add r2.w, r2.w, r3.x
  add r2.w, r2.w, l(-1.000000)
  mad r2.w, cb0[55].w, r2.w, l(1.000000)
  mul r4.xyz, r2.wwww, r4.xyzx
  mad r4.xyz, r4.xyzx, cb0[50].xyzx, cb0[49].xyzx
  mad r3.x, |r3.w|, l(0.968750), l(0.015625)
  mad r3.y, r3.z, l(0.968750), l(0.015625)
  sample_l_indexable(texture2d)(float,float,float,float) r3.xy, r3.xyxx, t1.xyzw, s1, l(0.000000)
  mad_sat r3.xyz, r7.xyzx, r3.yyyy, r3.xxxx
  mul r3.xyz, r3.xyzx, r4.xyzx
  movc r2.w, r12.x, l(0.750000), l(1.000000)
  mad_sat r0.z, r1.w, r2.w, r0.z
  mul r1.w, r0.z, r5.z
  movc r2.w, r15.y, l(1.200000), cb3[5].x
  add r3.w, r0.z, l(-1.000000)
  mad_sat r2.w, r2.w, r3.w, l(1.000000)
  mad r4.xyz, r15.xzwx, r2.wwww, r16.xyzx
  mul r5.xyz, r1.wwww, r1.xyzx
  mad r4.xyz, r1.xyzx, r1.wwww, r4.xyzx
  mad r7.xyz, r19.xyzx, r2.wwww, r5.xyzx
  dp3 r1.w, r7.xyzx, l(0.212600, 0.715200, 0.072200, 0.000000)
  mul r7.xyz, r9.yyyy, r18.xyzx
  dp3 r1.x, r1.xyzx, l(0.212600, 0.715200, 0.072200, 0.000000)
  mul r1.xyz, r1.xxxx, r3.xyzx
  mul r1.xyz, r9.zzzz, r1.xyzx
  mul r1.xyz, r0.zzzz, r1.xyzx
  mad r0.z, r9.w, l(256.000000), l(1.000000)
  mul r1.xyz, r0.zzzz, r1.xyzx
  add r0.z, -r6.y, l(1.000000)
  add r3.x, -r6.z, l(1.000000)
  ftou r3.y, r4.w
  and r3.y, r3.y, l(1)
  utof r3.y, r3.y
  mad r3.yzw, r3.yyyy, l(0.000000, -0.500000, -0.300000, -0.800000), l(0.000000, 1.000000, 1.000000, 1.000000)
  mul r3.xyz, r3.xxxx, r3.yzwy
  mul r3.xyz, r3.xyzx, r14.xzwx
  mad r5.xyz, r15.xzwx, r2.wwww, r5.xyzx
  mul r5.xyz, r5.xyzx, r14.xzwx
  mul r3.xyz, r16.xyzx, r3.xyzx
  mul r3.xyz, r0.zzzz, r3.xyzx
  mad r3.xyz, r5.xyzx, r0.zzzz, r3.xyzx
  mad r1.xyz, r7.xyzx, r2.wwww, r1.xyzx
  mad r0.z, cb1[8].w, r13.y, cb0[55].y
  exp r0.z, r0.z
  mul r0.z, r0.z, l(0.000183015567)
  mad r3.xyz, r14.xzwx, r0.zzzz, r3.xyzx
  add r1.xyz, r1.xyzx, r3.xyzx
  mad r1.xyz, r1.xyzx, r0.wwww, r2.xyzx
  ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r0.z, l(0), l(0), t2.xxxx
  mul r1.xyz, r0.zzzz, r1.xyzx
  max r1.xyz, r1.xyzx, l(0.0000610351999, 0.0000610351999, 0.0000610351999, 0.000000)
  min r1.xyz, r1.xyzx, l(8192.000000, 8192.000000, 8192.000000, 0.000000)
  lt r0.w, l(0.500000), cb3[1].x
  movc r2.xyz, r0.wwww, r14.xzwx, r1.xyzx
  dp3 r0.w, r4.xyzx, l(0.212600, 0.715200, 0.072200, 0.000000)
  movc r0.w, cb3[5].z, r0.w, r1.w
  mul r0.z, r0.z, r0.w
  max r0.z, r0.z, l(0.0000610351999)
  min r2.w, r0.z, l(8192.000000)
  store_uav_typed u0.xyzw, r0.xyyy, r2.xyzw
endif 
ret 
// Approximately 1328 instruction slots used