// asmtool.py -i --fix-fcprimal-physical-lighting --only-autofixed -f 7a5cfcc4e5e399d4-cs.txt
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//   using 3Dmigoto v1.2.31 on Wed Mar 02 08:06:55 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 [unused]
//   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 [unused]
//   float4 SunDirection;               // Offset:   64 Size:    16 [unused]
//   float DirectLightOcclusion;        // Offset:   80 Size:     4 [unused]
//   float LightingDebugLineToUse;      // Offset:   84 Size:     4 [unused]
//   bool ExposureLocalLights;          // Offset:   88 Size:     4 [unused]
//   float SunExposureFactor;           // Offset:   92 Size:     4 [unused]
//
// }
//
// 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 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
// 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
// SectorOcclusion_HeightTexture__TexObj__    texture  float4          2d    4        1
// GBufferT0                         texture  float4          2d    5        1
// GBufferT1                         texture  float4          2d    6        1
// GBufferT2                         texture  float4          2d    7        1
// GBufferT3                         texture  float4          2d    8        1
// Depth                             texture   float          2d    9        1
// DeferredAmbientTexture__TexObj__    texture  float4          2d   10        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[6], immediateIndexed
dcl_constantbuffer cb3[2], 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_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_uav_typed_texture2d (float,float,float,float) u0
dcl_input vThreadGroupID.xy
dcl_input vThreadIDInGroup.xy
dcl_temps 18
dcl_thread_group 8, 8, 1

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

ld_indexable(texture2d)(float,float,float,float) r15.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 7a5cfcc4e5e399d4-cs.txt
mul r16.x, r15.x, r15.y
mul r16.x, r16.x, cb0[0].x
mov r16.yzw, l(0.0)
dp4 r17.x, r16.xyzw, cb0[4].xyzw
dp4 r17.y, r16.xyzw, cb0[5].xyzw
dp4 r17.z, r16.xyzw, cb0[6].xyzw
mov r16.xyzw, cb0[42].xyzw
add r16.xyz, r16.xyz, r17.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
  mov r0.zw, l(0,0,0,0)

  ld_indexable(texture2d)(float,float,float,float) r1.z, r0.xyww, t9.yzxw

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

  utof r2.xy, r0.xyxx
  add r2.zw, r2.xxxy, l(0.000000, 0.000000, 0.500000, 0.500000)
  mul r2.zw, r2.zzzw, cb2[5].zzzw
  mad r2.zw, r2.zzzw, l(0.000000, 0.000000, 2.000000, 2.000000), l(0.000000, 0.000000, -1.000000, -1.000000)
  mul r1.xy, r2.zwzz, l(1.000000, -1.000000, 0.000000, 0.000000)
  mov r1.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 7a5cfcc4e5e399d4-cs.txt
add r15.w, r15.z, -r15.y
div r15.w, r15.w, r15.z
mad r1.x, r15.w, -r15.x, r1.x

  dp4 r3.x, r1.xyzw, cb2[0].xyzw
  dp4 r3.z, r1.xyzw, cb2[1].xyzw
  dp4 r3.y, r1.xyzw, cb2[2].xyzw
  dp4 r1.x, r1.xyzw, cb2[3].xyzw
  div r1.xyz, r3.xyzx, r1.xxxx
  ld_indexable(texture2d)(float,float,float,float) r3.xyzw, r0.xyww, t5.xyzw
  ld_indexable(texture2d)(float,float,float,float) r4.xyzw, r0.xyww, t6.xyzw
  ld_indexable(texture2d)(float,float,float,float) r5.xyzw, r0.xyww, t7.yxzw
  ld_indexable(texture2d)(float,float,float,float) r6.xyzw, r0.xyww, t8.yzxw
  iadd r2.zw, r0.xxxy, l(0, 0, 1, 1)
  add r7.xy, cb2[5].xyxx, l(-1.000000, -1.000000, 0.000000, 0.000000)
  ftou r7.xy, r7.xyxx
  ult r2.zw, r2.zzzw, r7.xxxy
  if_nz r2.z
    ld_aoffimmi_indexable(1,0,0)(texture2d)(float,float,float,float) r7.xw, r0.xyww, t5.xzwy
    mov r8.w, r7.x
  else 
    mov r8.w, r3.x
    mov r7.w, r3.y
  endif 
  ult r9.xy, l(1, 1, 0, 0), r0.xyxx
  if_nz r9.x
    ld_aoffimmi_indexable(-1,0,0)(texture2d)(float,float,float,float) r7.xz, r0.xyww, t5.xzyw
    mov r8.z, r7.x
  else 
    mov r8.z, r3.x
    mov r7.z, r3.y
  endif 
  if_nz r2.w
    ld_aoffimmi_indexable(0,1,0)(texture2d)(float,float,float,float) r7.xy, r0.xyww, t5.xyzw
    mov r8.y, r7.x
  else 
    mov r8.y, r3.x
    mov r7.y, r3.y
  endif 
  if_nz r9.y
    ld_aoffimmi_indexable(0,-1,0)(texture2d)(float,float,float,float) r2.zw, r0.xyww, t5.zwxy
    mov r8.x, r2.z
    mov r7.x, r2.w
  else 
    mov r8.x, r3.x
    mov r7.x, r3.y
  endif 
  add r8.xyzw, -r3.xxxx, r8.xyzw
  mad r8.xyzw, |r8.xyzw|, l(10.000000, 10.000000, 10.000000, 10.000000), l(0.100000, 0.100000, 0.100000, 0.100000)
  rcp r8.xyzw, r8.xyzw
  dp4 r1.w, r8.xyzw, l(1.000000, 1.000000, 1.000000, 1.000000)
  rcp r1.w, r1.w
  mul r8.xyzw, r1.wwww, r8.xyzw
  dp4 r7.y, r7.xyzw, r8.xyzw
  ftoi r2.xy, r2.xyxx
  and r2.xy, r2.xyxx, l(1, 1, 0, 0)
  ine r1.w, r2.x, r2.y
  mov r7.z, r3.y
  movc r2.yz, r1.wwww, r7.yyzy, r7.zzyz
  mov r2.x, r3.x
  add r2.xyz, r2.xyzx, l(-0.000000, -0.498039216, -0.498039216, 0.000000)
  add r7.yw, r2.zzzy, r2.xxxx
  add r7.x, -r2.z, r7.w
  add r1.w, -r2.y, r2.x
  add r7.z, -r2.z, r1.w
  mov_sat r7.xyz, r7.xyzx
  mul r2.xyz, r7.xyzx, r7.xyzx
  mul r1.w, r3.w, l(255.000000)
  ftou r1.w, r1.w
  ubfe r2.w, l(1), l(3), r1.w
  utof r2.w, r2.w
  and r1.w, r1.w, l(7)
  mul r3.x, r4.w, l(3.000000)
  ftou r3.x, r3.x
  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.y, r4.xyzx, r4.xyzx
  min r3.y, r3.y, l(1.000000)
  add r3.y, -r3.y, l(1.000000)
  sqrt r3.y, r3.y
  swapc r4.x, r8.x, r3.x, r4.x, r3.y
  ieq r3.xw, r3.xxxx, l(1, 0, 0, 2)
  movc r9.xy, r3.xwxx, r3.yyyy, r4.yzyy
  movc r3.x, r3.x, r4.y, r4.x
  movc r4.x, r3.w, r4.z, r3.x
  mov r9.z, l(2.000000)
  mul r3.xyw, r9.yyyy, r9.zyzz
  mov r4.z, l(-2.000000)
  mov r4.y, r9.x
  mad r3.xyw, r3.xyxw, r4.yzyx, l(0.000000, 1.000000, 0.000000, 0.000000)
  mul r8.yzw, r8.xxxx, l(0.000000, 2.000000, -2.000000, 2.000000)
  mov r4.w, r8.x
  mad r3.xyw, r8.zzzw, r4.xwxy, r3.xyxw
  mov r10.x, r9.y
  mov r10.yz, r4.xxwx
  mad r8.xyz, r8.yzwy, r10.xzyx, l(0.000000, 1.000000, 0.000000, 0.000000)
  mov r10.w, l(-2.000000)
  mul r9.xyz, r9.xxxx, r10.wwxw
  mov r4.z, l(2.000000)
  mad r4.xyz, r9.xyzx, r4.xyzx, r8.xyzx
  mul r8.xy, r5.yxyy, l(255.000000, 255.000000, 0.000000, 0.000000)
  ftou r8.xy, r8.xyxx
  ushr r4.w, r8.x, l(4)
  utof r4.w, r4.w
  mul r9.y, r4.w, l(0.0666666701)
  and r8.xy, r8.xyxx, l(15, 3, 0, 0)
  utof r8.xy, r8.xyxx
  mul r8.xy, r8.xyxx, l(0.0666666701, 0.333333343, 0.000000, 0.000000)
  mad r10.xyz, r6.xwyx, l(2.000000, 2.000000, 2.000000, 0.000000), l(-1.000000, -1.000000, -1.000000, 0.000000)
  dp3 r4.w, r10.xyzx, r10.xyzx
  rsq r4.w, r4.w
  mul r10.xyz, r4.wwww, r10.xyzx
  ieq r11.xyzw, r1.wwww, l(1, 3, 4, 5)
  movc r1.w, r11.w, l(1.000000), r5.w
  movc r12.x, r11.z, r5.w, r1.w
  or r1.w, r11.y, r11.z
  movc r10.xyz, r1.wwww, r10.xyzx, r4.xyzx
  mov r6.x, r5.w
  mov r12.z, l(0)
  movc r9.xz, r11.yyyy, r6.xxzx, r12.xxzx
  movc r6.xyz, r11.xxxx, r4.xyzx, r10.xyzx
  mov r8.zw, l(0,0,0,0)
  mov r9.w, r5.x
  movc r8.yz, r11.xxxx, r8.yyzy, r9.wwzw
  mov r5.x, l(0.150000)
  movc r5.xy, r11.xxxx, r5.xyxx, r8.xwxx
  movc r8.xw, r11.xxxx, l(0,0,0,0), r9.xxxy
  add r1.xyz, -r1.xyzx, r16.xzyx
  dp3 r1.w, r1.xyzx, r1.xyzx
  sqrt r1.w, r1.w
  div r1.xyz, r1.xyzx, r1.wwww
  dp3 r4.w, r4.xyzx, r1.xyzx
  mad r5.x, r5.x, l(0.082000), l(0.018000)
  mad r7.xyz, r7.xyzx, r7.xyzx, -r5.xxxx
  mad r7.xyz, r8.wwww, r7.xyzx, r5.xxxx
  add r5.w, -r8.w, l(1.000000)
  mul r2.xyz, r2.xyzx, r5.wwww
  ld_indexable(texture2d)(float,float,float,float) r9.xyzw, r0.xyzw, t10.xyzw
  ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) r0.z, l(0), l(12), t2.xxxx
  mul r9.xyz, r0.zzzz, r9.xyzx
  mad_sat r0.z, r1.w, cb3[0].x, cb3[0].y
  mul r0.z, r0.z, cb3[0].z
  mul r0.z, r2.w, r0.z
  mad r9.xyz, r9.yyyy, r0.zzzz, r9.xyzx
  and r0.z, r11.x, l(0x3e800000)
  mov r10.yzw, -r1.zzyx
  mul r12.xyz, r1.wwww, r10.wyzw
  mad r13.xyz, r10.wyzw, r1.wwww, r16.xyzx
  mov r10.x, l(1.000000)
  dp4 r14.x, cb0[38].xyzw, r10.xyzw
  dp4 r14.y, cb0[37].xyzw, r10.xyzw
  dp4 r14.z, cb0[36].xyzw, r10.xyzw
  max r14.xyz, r14.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
  mad r11.yw, r13.yyyx, cb4[0].yyyx, cb4[0].wwwz
  sample_l_indexable(texture2d)(float,float,float,float) r0.w, r11.ywyy, t4.xzwy, s2, l(0.000000)
  mad r0.w, r0.w, cb4[2].x, cb4[2].y
  add r0.w, -r0.w, r13.z
  mul_sat r0.w, -r0.w, cb5[18].x
  sqrt r0.w, r0.w
  dp2 r2.w, r12.xyxx, r12.xyxx
  mad r2.w, cb4[1].x, r2.w, cb4[1].y
  mul_sat r2.w, r2.w, l(3.000000)
  mul r0.w, r0.w, r2.w
  dp4 r13.x, cb5[15].xyzw, r10.xyzw
  dp4 r13.y, cb5[16].xyzw, r10.xyzw
  dp4 r13.z, cb5[17].xyzw, r10.xyzw
  max r10.xyz, r13.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
  mad r10.xyz, r10.xyzx, cb0[56].xxxx, -r14.xyzx
  mad r10.xyz, r0.wwww, r10.xyzx, r14.xyzx
  mad_sat r0.w, r1.w, cb0[35].y, cb0[35].x
  mul r1.w, r12.z, cb0[39].y
  max r1.w, r1.w, l(-125.000000)
  lt r2.w, l(0.000001), |r1.w|
  exp r5.w, -r1.w
  add r5.w, -r5.w, l(1.000000)
  div r1.w, r5.w, r1.w
  movc r1.w, r2.w, r1.w, l(1.000000)
  mad r1.w, r1.w, cb0[39].x, cb0[35].w
  mul r0.w, r0.w, r1.w
  mul r0.w, r0.w, -cb0[35].z
  exp r0.w, r0.w
  mad r10.xyz, -r10.xyzx, r0.wwww, r10.xyzx
  movc r4.xyz, r11.zzzz, r6.xyzx, r4.xyzx
  mul r6.xyz, r3.xywx, r1.xyzx
  mad r6.xyz, r1.yzxy, r3.wxyw, -r6.xyzx
  mul r11.yzw, r3.xxyw, r6.xxyz
  mad r3.xyw, r3.ywyx, r6.zxzy, -r11.yzyw
  add r3.xyw, -r4.xyxz, r3.xyxw
  mad r3.xyw, r8.xxxx, r3.xyxw, r4.xyxz
  dp3 r1.w, r3.xywx, r3.xywx
  rsq r1.w, r1.w
  mul r3.xyw, r1.wwww, r3.xyxw
  dp3 r1.w, r3.xywx, r1.xyzx
  add r1.w, r1.w, r1.w
  mad r1.xyz, -r1.wwww, r3.xywx, r1.xyzx
  mov r1.xyz, -r1.xyzx
  mad r1.w, -r3.z, l(6.000000), l(6.000000)
  sample_l_indexable(texturecube)(float,float,float,float) r1.xyz, r1.xyzx, t0.xyzw, s0, r1.w
  ld_structured_indexable(structured_buffer, stride=132)(mixed,mixed,mixed,mixed) r6.xyzw, l(0), l(108), t3.xywz
  dp3 r1.w, r6.xywx, l(0.212600, 0.715200, 0.072200, 0.000000)
  ld_structured_indexable(structured_buffer, stride=132)(mixed,mixed,mixed,mixed) r6.xy, l(0), l(124), t3.xyxx
  dp3 r2.w, r6.zxyz, l(0.212600, 0.715200, 0.072200, 0.000000)
  max r1.w, r1.w, r2.w
  ld_structured_indexable(structured_buffer, stride=132)(mixed,mixed,mixed,mixed) r2.w, l(0), l(0), t3.xxxx
  ld_structured_indexable(structured_buffer, stride=132)(mixed,mixed,mixed,mixed) r3.x, l(0), l(36), t3.xxxx
  ld_structured_indexable(structured_buffer, stride=132)(mixed,mixed,mixed,mixed) r3.y, l(0), l(72), t3.xxxx
  max r3.x, r3.y, r3.x
  max r2.w, r2.w, r3.x
  add r1.w, r1.w, r2.w
  add r1.w, r1.w, l(-1.000000)
  mad r1.w, cb0[55].w, r1.w, l(1.000000)
  mul r1.xyz, r1.wwww, r1.xyzx
  mad r1.xyz, r1.xyzx, cb0[50].xyzx, cb0[49].xyzx
  mad r3.x, |r4.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 r1.xyz, r1.xyzx, r3.xyzx
  movc r1.w, r11.x, l(0.750000), l(1.000000)
  mad_sat r0.z, r9.w, r1.w, r0.z
  mul r1.w, r0.z, r5.z
  mul r3.xyz, r1.wwww, r9.xyzx
  dp3 r1.w, r3.xyzx, l(0.212600, 0.715200, 0.072200, 0.000000)
  dp3 r2.w, r9.xyzx, l(0.212600, 0.715200, 0.072200, 0.000000)
  mul r1.xyz, r1.xyzx, r2.wwww
  mul r1.xyz, r8.yyyy, r1.xyzx
  mul r1.xyz, r0.zzzz, r1.xyzx
  mad r0.z, r8.z, l(256.000000), l(1.000000)
  add r2.w, -r5.x, l(1.000000)
  mul r3.xyz, r2.xyzx, r3.xyzx
  mul r3.xyz, r2.wwww, r3.xyzx
  mad r2.w, cb1[8].w, r5.y, cb0[55].y
  exp r2.w, r2.w
  mul r2.w, r2.w, l(0.000183015567)
  mad r3.xyz, r2.xyzx, r2.wwww, r3.xyzx
  mad r1.xyz, r1.xyzx, r0.zzzz, r3.xyzx
  mad r1.xyz, r1.xyzx, r0.wwww, r10.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, r2.xyzx, r1.xyzx
  mul r0.z, r0.z, r1.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 257 instruction slots used