//aa8a3f919580e245-ps.txt
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.17672
//
//   using 3Dmigoto v1.2.27 on Fri Jan 29 08:59:11 2016
//
//
// Buffer Definitions: 
//
// cbuffer DrawableBuffer
// {
//
//   float4 FogColor;                   // Offset:    0 Size:    16 [unused]
//   float4 DebugColor;                 // Offset:   16 Size:    16 [unused]
//   float AlphaThreshold;              // Offset:   32 Size:     4
//   float4 __InstancedMaterialOpacity[256];// Offset:   48 Size:  4096
//
// }
//
// cbuffer SceneBuffer
// {
//
//   row_major float4x4 View;           // Offset:    0 Size:    64
//   row_major float4x4 ScreenMatrix;   // Offset:   64 Size:    64 [unused]
//   float2 DepthExportScale;           // Offset:  128 Size:     8 [unused]
//   float2 __padding0;                 // Offset:  136 Size:     8 [unused]
//   float4 FogParams;                  // Offset:  144 Size:    16
//   float3 __CameraPosition;           // Offset:  160 Size:    12
//   float __padding12;                 // Offset:  172 Size:     4 [unused]
//   float3 CameraDirection;            // Offset:  176 Size:    12 [unused]
//   float __padding9;                  // Offset:  188 Size:     4 [unused]
//   float3 DepthFactors;               // Offset:  192 Size:    12 [unused]
//   float __padding10;                 // Offset:  204 Size:     4 [unused]
//   float3 ShadowDepthBiasAndLightType;// Offset:  208 Size:    12 [unused]
//   float __padding11;                 // Offset:  220 Size:     4 [unused]
//   float4 SubframeViewport;           // Offset:  224 Size:    16 [unused]
//   row_major float3x4 DepthToWorld;   // Offset:  240 Size:    48
//   float4 DepthToView;                // Offset:  288 Size:    16
//   float4 OneOverDepthToView;         // Offset:  304 Size:    16 [unused]
//   float4 DepthToW;                   // Offset:  320 Size:    16
//   float4 ClipPlane;                  // Offset:  336 Size:    16 [unused]
//   float2 ViewportDepthScaleOffset;   // Offset:  352 Size:     8 [unused]
//   float2 __padding1;                 // Offset:  360 Size:     8 [unused]
//   float2 ColorDOFDepthScaleOffset;   // Offset:  368 Size:     8 [unused]
//   float2 __padding2;                 // Offset:  376 Size:     8 [unused]
//   float4 TimeVector;                 // Offset:  384 Size:    16
//   float4 FogParams2;                 // Offset:  400 Size:    16
//   float4 FogParams3;                 // Offset:  416 Size:    16
//   float3 GlobalAmbient;              // Offset:  432 Size:    12
//   float __padding8;                  // Offset:  444 Size:     4 [unused]
//   float4 GlobalParams[16];           // Offset:  448 Size:   256
//   float4 ViewToFogH;                 // Offset:  704 Size:    16 [unused]
//   float4 ScreenExtents;              // Offset:  720 Size:    16
//   float2 ScreenResolution;           // Offset:  736 Size:     8 [unused]
//   float2 __padding3;                 // Offset:  744 Size:     8 [unused]
//   float4 PSSMToMap1Lin;              // Offset:  752 Size:    16 [unused]
//   float4 PSSMToMap1Const;            // Offset:  768 Size:    16 [unused]
//   float4 PSSMToMap2Lin;              // Offset:  784 Size:    16 [unused]
//   float4 PSSMToMap2Const;            // Offset:  800 Size:    16 [unused]
//   float4 PSSMToMap3Lin;              // Offset:  816 Size:    16 [unused]
//   float4 PSSMToMap3Const;            // Offset:  832 Size:    16 [unused]
//   float4 PSSMDistances;              // Offset:  848 Size:    16 [unused]
//   row_major float4x4 WorldToPSSM0;   // Offset:  864 Size:    64 [unused]
//   row_major float4x4 PrevViewProject;// Offset:  928 Size:    64 [unused]
//   row_major float4x4 PrevWorld;      // Offset:  992 Size:    64 [unused]
//   row_major float4x4 ViewT;          // Offset: 1056 Size:    64 [unused]
//   float4 PSSMExtents;                // Offset: 1120 Size:    16 [unused]
//   float4 ShadowAtlasResolution;      // Offset: 1136 Size:    16 [unused]
//   float4 UnitRimData[3];             // Offset: 1152 Size:    48 [unused]
//   float3 __CameraPositionForCorrection;// Offset: 1200 Size:    12 [unused]
//   float __padding7;                  // Offset: 1212 Size:     4 [unused]
//   row_major float4x4 CameraViewProject;// Offset: 1216 Size:    64 [unused]
//   float4 BackBufferResolution;       // Offset: 1280 Size:    16 [unused]
//   row_major float4x4 InverseProjection;// Offset: 1296 Size:    64 [unused]
//   float4 StereoOffset;               // Offset: 1360 Size:    16 [unused]
//   row_major float4x4 Projection;     // Offset: 1376 Size:    64 [unused]
//   row_major float4x4 ViewInv;        // Offset: 1440 Size:    64 [unused]
//   float4 ColorSSAO;                  // Offset: 1504 Size:    16
//   float4 GlobalFogColor;             // Offset: 1520 Size:    16
//   float4 VolumetricLightGlobalParams;// Offset: 1536 Size:    16
//   float4 SnowParams01;               // Offset: 1552 Size:    16 [unused]
//   float4 SnowParams02;               // Offset: 1568 Size:    16 [unused]
//   float4 SnowParams03;               // Offset: 1584 Size:    16 [unused]
//   int SSREnabled;                    // Offset: 1600 Size:     4 [unused]
//   int __padding4;                    // Offset: 1604 Size:     4 [unused]
//   int __padding5;                    // Offset: 1608 Size:     4 [unused]
//   int __padding6;                    // Offset: 1612 Size:     4 [unused]
//
// }
//
// cbuffer MaterialBuffer
// {
//
//   float4 MaterialParams[512];        // Offset:    0 Size:  8192
//
// }
//
// cbuffer LightBuffer
// {
//
//   struct Light
//   {
//       
//       float4 position;               // Offset:    0
//       float3 direction;              // Offset:   16
//       float4 attParams;              // Offset:   32
//       float4 spotParams;             // Offset:   48
//       float4 diffuseColor;           // Offset:   64
//       float4 shadowFadeParams;       // Offset:   80
//
//   } ShadowLights[3];                 // Offset:    0 Size:   288 [unused]
//   
//   struct Light
//   {
//       
//       float4 position;               // Offset:  288
//       float3 direction;              // Offset:  304
//       float4 attParams;              // Offset:  320
//       float4 spotParams;             // Offset:  336
//       float4 diffuseColor;           // Offset:  352
//       float4 shadowFadeParams;       // Offset:  368
//
//   } NonShadowLights[3];              // Offset:  288 Size:   288 [unused]
//   
//   struct Light
//   {
//       
//       float4 position;               // Offset:  576
//       float3 direction;              // Offset:  592
//       float4 attParams;              // Offset:  608
//       float4 spotParams;             // Offset:  624
//       float4 diffuseColor;           // Offset:  640
//       float4 shadowFadeParams;       // Offset:  656
//
//   } SunLight;                        // Offset:  576 Size:    96 [unused]
//   row_major float4x4 WorldToShadowMap[3];// Offset:  672 Size:   192 [unused]
//   row_major float3x4 WorldToModulationMapSpot[2];// Offset:  864 Size:    96 [unused]
//   row_major float2x4 WorldToModulationMapSun;// Offset:  960 Size:    32 [unused]
//   bool ShadowLightEnabled[3];        // Offset:  992 Size:    36 [unused]
//   bool NonShadowLightEnabled[3];     // Offset: 1040 Size:    36 [unused]
//   bool SunLightEnabled;              // Offset: 1088 Size:     4 [unused]
//   float4 LightAndProbeSet[24];       // Offset: 1104 Size:   384
//   float4 LightSetInfo;               // Offset: 1488 Size:    16
//   float4 ProbeSetInfo;               // Offset: 1504 Size:    16
//
// }
//
// cbuffer IrradianceBuffer
// {
//
//   float4 IrradianceStateRed0;        // Offset:    0 Size:    16
//   float4 IrradianceStateRed1;        // Offset:   16 Size:    16
//   float4 IrradianceStateGreen0;      // Offset:   32 Size:    16
//   float4 IrradianceStateGreen1;      // Offset:   48 Size:    16
//   float4 IrradianceStateBlue0;       // Offset:   64 Size:    16
//   float4 IrradianceStateBlue1;       // Offset:   80 Size:    16
//   float4 IrradianceStateBase;        // Offset:   96 Size:    16
//   float4 IrradianceConstantData;     // Offset:  112 Size:    16
//
// }
//
// Resource bind info for LightDataBuffer
// {
//
//   struct STiledLightData
//   {
//       
//       float3 vPosition;              // Offset:    0
//       float fSegmentLength;          // Offset:   12
//       float3 vDirection;             // Offset:   16
//       float fMinShadowSpec;          // Offset:   28
//       float4 vAttParams;             // Offset:   32
//       float3 vSpotParams;            // Offset:   48
//       float fIntensity;              // Offset:   60
//       float4 vDiffuseColor;          // Offset:   64
//       float4 vShadowFadeParams;      // Offset:   80
//       uint uRelCen;                  // Offset:   96
//       uint uFxSpecificIdx;           // Offset:  100
//       uint uFxType;                  // Offset:  104
//       float fRadiusSquared;          // Offset:  108
//       float3 vLambertWeights;        // Offset:  112
//       float fSpecularStrength;       // Offset:  124
//       float3 vBoxAxisX;              // Offset:  128
//       uint uLightType;               // Offset:  140
//       float3 vBoxAxisZ;              // Offset:  144
//       uint bShadowEnabled;           // Offset:  156
//       float3 vBoxInnerDistance;      // Offset:  160
//       uint bModulationMapEnabled;    // Offset:  172
//       float3 vBoxInvRange;           // Offset:  176
//       uint uModulationMapIndex;      // Offset:  188
//       row_major float4x4 mViewToShadowMap;// Offset:  192
//       row_major float4x4 mViewToModulationMap;// Offset:  256
//       float3 vRecipOuterColiProxy;   // Offset:  320
//       uint uProbeFlags;              // Offset:  332
//       float3 vColixProxyCen;         // Offset:  336
//       uint bForwardOnly;             // Offset:  348
//       uint uShadowType;              // Offset:  352
//       uint uNumSoftShadowSamples;    // Offset:  356
//       float fSoftShadowRadius;       // Offset:  360
//       float fSoftShadowDepthBias;    // Offset:  364
//       float fSoftShadowExponent;     // Offset:  368
//       float fProbePriority;          // Offset:  372
//       float fUnusedParam[2];         // Offset:  376
//
//   } $Element;                        // Offset:    0 Size:   384
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// SamplerGenericPointClamp          sampler      NA          NA   10        1
// SamplerGenericTrilinearWrap       sampler      NA          NA   11        1
// SamplerGenericBilinearWrap        sampler      NA          NA   12        1
// SamplerGenericBilinearClamp       sampler      NA          NA   13        1
// p_default_Material_n125_n174_fogCube_texture    texture  float4        cube    0        1
// p_default_Setup_47AC6AA019884710_Param_texture    texture  float4          2d    1        1
// p_default_Setup_n24_Texture_texture    texture  float4          2d    3        1
// p_default_Setup_n0_n49_Texture_texture    texture  float4          2d    4        1
// p_default_Material_n116_n145_n150_661830C016465534_cp0_Param_texture    texture  float4          2d    5        1
// GlobalModulationMapTextures[0]    texture  float4          2d   40        1
// AttenuationSampler_texture        texture  float4          2d   44        1
// LightDataBuffer                   texture  struct         r/o   54        1
// ModulationMaps                    texture  float4     2darray   56        1
// ReflCubeMaps                      texture  float4   cubearray   57        1
// VolumetricLightIntensity_texture    texture  float4          3d   59        1
// DrawableBuffer                    cbuffer      NA          NA    1        1
// SceneBuffer                       cbuffer      NA          NA    2        1
// MaterialBuffer                    cbuffer      NA          NA    3        1
// LightBuffer                       cbuffer      NA          NA    4        1
// IrradianceBuffer                  cbuffer      NA          NA    6        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float   xy w
// COLOR                    0   xyzw        1     NONE   float      w
// TEXCOORD                 0   xyzw        2     NONE   float   xy  
// TEXCOORD                 2   xyz         3     NONE   float   xyz 
// PSIZE                    0   x           4     NONE    uint   x   
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_TARGET                0   xyzw        0   TARGET   float   xyzw
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb1[259], dynamicIndexed
dcl_constantbuffer cb2[97], immediateIndexed
dcl_constantbuffer cb3[6], immediateIndexed
dcl_constantbuffer cb4[95], dynamicIndexed
dcl_constantbuffer cb6[8], immediateIndexed
dcl_sampler s10, mode_default
dcl_sampler s11, mode_default
dcl_sampler s12, mode_default
dcl_sampler s13, mode_default
dcl_resource_texturecube (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_resource_texture2d (float,float,float,float) t3
dcl_resource_texture2d (float,float,float,float) t4
dcl_resource_texture2d (float,float,float,float) t5
dcl_resource_texture2d (float,float,float,float) t40
dcl_resource_texture2d (float,float,float,float) t44
dcl_resource_structured t54, 384 
dcl_resource_texture2darray (float,float,float,float) t56
dcl_resource_texturecubearray (float,float,float,float) t57
dcl_resource_texture3d (float,float,float,float) t59
dcl_input_ps_siv linear noperspective v0.xyw, position
dcl_input_ps linear v1.w
dcl_input_ps linear v2.xy
dcl_input_ps linear v3.xyz
dcl_input_ps constant v4.x
dcl_output o0.xyzw
// dcl_temps 27
dcl_temps 29
dcl_resource_texture2d (float,float,float,float) t125
dp3 r0.x, v3.xyzx, v3.xyzx
rsq r0.x, r0.x
mul r0.xyz, r0.xxxx, v3.xyzx
mad r1.xyzw, v0.xyxy, cb2[45].zwzw, cb2[45].xyxy
mul r2.xy, r1.zwzz, v0.wwww
mov r2.z, v0.w
mov r2.w, l(1.000000)

//Screen space correction, therefore need the '0.5'
ld_indexable(texture2d)(float,float,float,float) r28.xyzw, l(0, 0, 0, 0), t125.xyzw
add r28.w, v0.w, -r28.y
mul r28.w, r28.w, r28.x
mul r28.w, r28.w, l(0.5)
add r2.x, r2.x, -r28.w


dp4 r3.x, cb2[15].xyzw, r2.xyzw
dp4 r3.y, cb2[16].xyzw, r2.xyzw
dp4 r3.z, cb2[17].xyzw, r2.xyzw
mad r4.xy, cb2[24].xxxx, cb3[2].xyxx, v2.xyxx
mad r4.zw, cb2[24].xxxx, cb3[4].xxxy, v2.xxxy
mul r4.zw, r4.zzzw, cb3[3].xxxy
sample_indexable(texture2d)(float,float,float,float) r5.xyzw, r4.zwzz, t4.xyzw, s11
mul r5.xyzw, r5.xyzw, cb3[1].xyzw
mul r4.xy, r4.xyxx, cb3[2].zwzz
sample_indexable(texture2d)(float,float,float,float) r4.xy, r4.xyxx, t3.xyzw, s11
mad r4.xy, r4.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
mad r4.xy, cb3[5].yyyy, r4.xyxx, v2.xyxx
sample_indexable(texture2d)(float,float,float,float) r1.w, r4.xyxx, t1.yzwx, s11
mul r1.w, r1.w, r5.w
mul r1.w, r1.w, v1.w
mad r4.xy, r1.xyxx, cb2[18].xyxx, cb2[18].zwzz
mul r2.xy, r4.xyxx, v0.wwww

//View space correction, therefore need the InvProj._m00
ld_indexable(texture2d)(float,float,float,float) r28.xyzw, l(0, 0, 0, 0), t125.xyzw
add r28.w, v0.w, -r28.y
mul r28.w, r28.w, r28.x
mul r28.w, r28.w, cb2[81].x
add r2.x, r2.x, -r28.w


ftou r4.xyz, cb4[93].xyzx
mov r6.xyz, l(0,0,0,0)
mov r3.w, l(0)
loop 
  uge r4.w, r3.w, r4.y
  breakc_nz r4.w
  iadd r4.w, r3.w, r4.z
  ftou r4.w, cb4[r4.w + 69].x
  ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r7.xyz, r4.w, l(16), t54.xyzx
  ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r8.xyz, r4.w, l(64), t54.xyzx
  ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r5.w, r4.w, l(172), t54.xxxx
  dp3 r9.x, -r7.xyzx, cb2[0].xyzx
  dp3 r9.y, -r7.xyzx, cb2[1].xyzx
  dp3 r9.z, -r7.xyzx, cb2[2].xyzx
  if_nz r5.w
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r7.xyzw, r4.w, l(256), t54.xyzw
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r10.xyzw, r4.w, l(272), t54.xyzw
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r11.xyzw, r4.w, l(288), t54.xyzw
    dp4 r4.w, r7.xyzw, r2.xyzw
    dp4 r5.w, r10.xyzw, r2.xyzw
    dp4 r6.w, r11.xyzw, r2.xyzw
    div r7.x, r4.w, r6.w
    div r7.y, r5.w, r6.w
    sample_l_indexable(texture2d)(float,float,float,float) r7.xyz, r7.xyxx, t40.xyzw, s12, l(0.000000)
  else 
    mov r7.xyz, l(1.000000,1.000000,1.000000,0)
  endif 
  dp3_sat r4.w, r9.xyzx, r0.xyzx
  mul r8.xyz, r8.xyzx, r4.wwww
  mad r6.xyz, r8.xyzx, r7.xyzx, r6.xyzx
  iadd r3.w, r3.w, l(1)
endloop 
mov r2.z, v0.w
mov r2.w, l(1.000000)
mov r7.xyz, r6.xyzx
mov r3.w, l(0)
loop 
  uge r4.y, r3.w, r4.z
  breakc_nz r4.y
  ftou r4.y, cb4[r3.w + 69].x
  ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r4.w, r4.y, l(140), t54.xxxx
  mov r8.xyz, r7.xyzx
  mov r5.w, r3.w
  mov r6.w, r4.y
  mov r7.w, r4.w
  loop 
    ult r8.w, r5.w, r4.x
    ieq r9.xy, r7.wwww, l(0, 1, 0, 0)
    or r9.x, r9.y, r9.x
    and r8.w, r8.w, r9.x
    breakc_z r8.w
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r9.xzw, r6.w, l(0), t54.xxyz
    if_nz r9.y
      ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r10.xyzw, r6.w, l(12), t54.xyzw
      add r11.xyz, r2.xyzx, -r9.xzwx
      dp3 r8.w, r11.xyzx, r10.yzwy
      max r8.w, r8.w, l(0.000000)
      min r8.w, r10.x, r8.w
      mad r9.xzw, r8.wwww, r10.yyzw, r9.xxzw
    endif 
    add r9.xyz, -r2.xyzx, r9.xzwx
    dp3 r8.w, r9.xyzx, r9.xyzx
    sqrt r8.w, r8.w
    div r9.xyz, r9.xyzx, r8.wwww
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r10.xyz, r6.w, l(64), t54.xyzx
    dp3 r11.x, r9.xyzx, cb2[0].xyzx
    dp3 r11.y, r9.xyzx, cb2[1].xyzx
    dp3 r11.z, r9.xyzx, cb2[2].xyzx
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r9.x, r6.w, l(32), t54.xxxx
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r12.yz, r6.w, l(40), t54.xxyx
    mad_sat r12.x, r8.w, r9.x, r12.y
    sample_l_indexable(texture2d)(float,float,float,float) r8.w, r12.xzxx, t44.xywz, s13, l(0.000000)
    dp3_sat r9.x, r11.xyzx, r0.xyzx
    mul r9.xyz, r10.xyzx, r9.xxxx
    mad r8.xyz, r9.xyzx, r8.wwww, r8.xyzx
    iadd r5.w, r5.w, l(1)
    ult r8.w, r5.w, r4.x
    if_nz r8.w
      ftou r6.w, cb4[r5.w + 69].x
      ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r7.w, r6.w, l(140), t54.xxxx
    endif 
  endloop 
  mov r9.xyz, r8.xyzx
  mov r4.y, r5.w
  mov r4.w, r6.w
  mov r8.w, r7.w
  loop 
    ult r9.w, r4.y, r4.x
    ieq r10.xy, r8.wwww, l(2, 3, 0, 0)
    or r10.x, r10.y, r10.x
    and r9.w, r9.w, r10.x
    breakc_z r9.w
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r10.xzw, r4.w, l(16), t54.xxyz
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r11.xyz, r4.w, l(0), t54.xyzx
    if_nz r10.y
      ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r12.xyz, r4.w, l(128), t54.xyzx
      ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r9.w, r4.w, l(12), t54.xxxx
      add r13.xyz, r2.xyzx, -r11.xyzx
      dp3 r10.y, r13.xyzx, r12.xyzx
      max r10.y, r10.y, l(0.000000)
      min r9.w, r9.w, r10.y
      mad r11.xyz, r9.wwww, r12.xyzx, r11.xyzx
    endif 
    add r11.xyz, -r2.xyzx, r11.xyzx
    dp3 r9.w, r11.xyzx, r11.xyzx
    sqrt r9.w, r9.w
    div r11.xyz, r11.xyzx, r9.wwww
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r12.xyz, r4.w, l(64), t54.xyzx
    dp3 r13.x, r11.xyzx, cb2[0].xyzx
    dp3 r13.y, r11.xyzx, cb2[1].xyzx
    dp3 r13.z, r11.xyzx, cb2[2].xyzx
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r14.xyz, r4.w, l(32), t54.xyzx
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r15.xyzw, r4.w, l(44), t54.xyzw
    mov r14.w, r15.x
    mad r14.xy, r9.wwww, r14.xyxx, r14.zwzz
    dp3 r10.x, r11.xyzx, -r10.xzwx
    mad_sat r10.y, r10.x, r15.y, r15.z
    mul r10.z, r10.y, r10.y
    mad r10.y, -r10.y, l(2.000000), l(3.000000)
    mul r10.y, r10.y, r10.z
    mul r10.y, r10.y, r10.y
    mul r9.w, r9.w, r10.x
    lt r9.w, r9.w, r15.w
    movc r9.w, r9.w, l(0), r10.y
    sample_l_indexable(texture2d)(float,float,float,float) r10.x, r14.xyxx, t44.zxyw, s13, l(0.000000)
    mul r9.w, r9.w, r10.x
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r10.x, r4.w, l(172), t54.xxxx
    if_nz r10.x
      ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r10.x, r4.w, l(188), t54.xxxx
      ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r11.xyzw, r4.w, l(256), t54.xyzw
      ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r14.xyzw, r4.w, l(272), t54.xyzw
      ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r15.xyzw, r4.w, l(288), t54.xyzw
      dp4 r10.y, r11.xyzw, r2.xyzw
      dp4 r10.z, r14.xyzw, r2.xyzw
      dp4 r10.w, r15.xyzw, r2.xyzw
      div r11.xy, r10.yzyy, r10.wwww
      utof r11.z, r10.x
      sample_l_indexable(texture2darray)(float,float,float,float) r10.xyz, r11.xyzx, t56.xyzw, s12, l(0.000000)
    else 
      mov r10.xyz, l(1.000000,1.000000,1.000000,0)
    endif 
    dp3_sat r10.w, r13.xyzx, r0.xyzx
    mul r11.xyz, r12.xyzx, r10.wwww
    mul r10.xyz, r10.xyzx, r11.xyzx
    mad r9.xyz, r10.xyzx, r9.wwww, r9.xyzx
    iadd r4.y, r4.y, l(1)
    ult r9.w, r4.y, r4.x
    if_nz r9.w
      ftou r4.w, cb4[r4.y + 69].x
      ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r8.w, r4.w, l(140), t54.xxxx
    endif 
  endloop 
  mov r7.xyz, r9.xyzx
  mov r9.w, r4.y
  mov r10.x, r4.w
  mov r10.y, r8.w
  loop 
    ult r10.z, r9.w, r4.x
    ieq r10.w, r10.y, l(4)
    and r10.z, r10.w, r10.z
    breakc_z r10.z
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r11.xyz, r10.x, l(0), t54.xyzx
    add r11.xyz, -r2.xyzx, r11.xyzx
    dp3 r10.z, r11.xyzx, r11.xyzx
    sqrt r10.z, r10.z
    div r12.xyz, r11.xyzx, r10.zzzz
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r13.xyz, r10.x, l(64), t54.xyzx
    dp3 r14.x, r12.xyzx, cb2[0].xyzx
    dp3 r14.y, r12.xyzx, cb2[1].xyzx
    dp3 r14.z, r12.xyzx, cb2[2].xyzx
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r12.xyz, r10.x, l(16), t54.xyzx
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r15.y, r10.x, l(44), t54.xxxx
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r16.xyz, r10.x, l(128), t54.xyzx
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r17.xyz, r10.x, l(144), t54.xyzx
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r18.xyz, r10.x, l(160), t54.xyzx
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r19.xyz, r10.x, l(176), t54.xyzx
    dp3 r16.x, r11.xyzx, r16.xyzx
    dp3 r16.y, r11.xyzx, r12.xyzx
    dp3 r16.z, r11.xyzx, r17.xyzx
    add r11.xyz, -r18.xyzx, |r16.xyzx|
    mul_sat r11.xyz, r19.xyzx, r11.xyzx
    max r10.z, r11.y, r11.x
    max r15.x, r11.z, r10.z
    sample_l_indexable(texture2d)(float,float,float,float) r10.z, r15.xyxx, t44.xyzw, s13, l(0.000000)
    dp3_sat r10.w, r14.xyzx, r0.xyzx
    mul r11.xyz, r13.xyzx, r10.wwww
    mad r7.xyz, r11.xyzx, r10.zzzz, r7.xyzx
    iadd r9.w, r9.w, l(1)
    ult r10.z, r9.w, r4.x
    if_nz r10.z
      ftou r10.x, cb4[r9.w + 69].x
      ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r10.y, r10.x, l(140), t54.xxxx
    endif 
  endloop 
  uge r10.x, r10.y, l(5)
  iadd r3.w, r9.w, -r10.x
endloop 
max r1.w, r1.w, l(0.000000)
mov r2.w, v4.x
mul r3.w, r1.w, cb1[r2.w + 3].x
sample_indexable(texture2d)(float,float,float,float) r4.x, r1.xyxx, t5.xyzw, s10
add r4.y, cb3[4].w, cb3[5].x
add_sat r4.y, -r4.y, l(1.000000)
mul r4.z, r4.x, r4.x
mad r4.x, cb3[4].w, r4.x, r4.y
mad_sat r4.x, r4.z, cb3[5].x, r4.x
add r4.yzw, -cb2[94].xxyz, l(0.000000, 1.000000, 1.000000, 1.000000)
mad_sat r4.xyz, r4.xxxx, r4.yzwy, cb2[94].xyzx
add r6.xyz, r7.xyzx, cb3[0].xyzx
mul r7.xyzw, r0.yzzz, r0.xxyz
mul r4.w, r0.y, r0.y
mad r0.w, r0.x, r0.x, -r4.w
dp4 r8.x, r7.xyzw, cb6[0].xyzw
dp4 r8.y, r7.xyzw, cb6[2].xyzw
dp4 r8.z, r7.xyzw, cb6[4].xyzw
dp4 r7.x, r0.xyzw, cb6[1].xyzw
dp4 r7.y, r0.xyzw, cb6[3].xyzw
dp4 r7.z, r0.xyzw, cb6[5].xyzw
add r7.xyz, r7.xyzx, r8.xyzx
add r7.xyz, r7.xyzx, cb6[6].xyzx
max r7.xyz, r7.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
mad r4.w, r0.z, l(0.500000), l(0.500000)
add r8.xyz, cb2[27].xyzx, -cb2[38].xyzx
mad r8.xyz, r4.wwww, r8.xyzx, cb2[38].xyzx
add r7.xyz, r7.xyzx, r8.xyzx
mul r4.w, cb6[7].x, l(3.14159274)
ftoi r5.w, cb4[94].x
mov r8.w, l(1.000000)
mov r9.w, l(1.000000)
mov r10.xyz, l(0,0,0,0)
mov r11.xyz, l(0,0,0,0)
mov r12.xyz, l(0,0,0,0)
mov r13.xyzw, l(0,0,0,0)
mov r6.w, l(1.000000)
mov r7.w, l(0)
loop 
  uge r12.w, r7.w, r5.w
  breakc_nz r12.w
  ftou r12.w, cb4[r7.w + 69].y
  ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r14.x, r12.w, l(140), t54.xxxx
  mov r15.xyz, r10.xyzx
  mov r16.xyz, r11.xyzx
  mov r14.yzw, r12.xxyz
  mov r17.xyzw, r13.xyzw
  mov r18.x, r6.w
  mov r18.y, r7.w
  mov r18.z, r12.w
  mov r18.w, r14.x
  loop 
    ult r19.x, r18.y, r5.w
    ieq r19.yz, r18.wwww, l(0, 0, 1, 0)
    or r19.y, r19.z, r19.y
    and r19.x, r19.y, r19.x
    breakc_z r19.x
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r20.xyzw, r18.z, l(0), t54.xyzw
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r19.xyw, r18.z, l(16), t54.xyxz
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r21.x, r18.z, l(32), t54.xxxx
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r22.yz, r18.z, l(40), t54.xxyx
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r23.xyzw, r18.z, l(60), t54.xyzw
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r21.yz, r18.z, l(100), t54.xxyx
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r21.w, r18.z, l(332), t54.xxxx
    and r21.w, r21.w, l(3)
    add r20.xyz, r2.xyzx, -r20.xyzx
    dp3 r22.w, r20.xyzx, r19.xywx
    max r22.w, r22.w, l(0.000000)
    min r20.w, r20.w, r22.w
    mad r19.xyw, -r20.wwww, r19.xyxw, r20.xyxz
    movc r19.xyz, r19.zzzz, r19.xywx, r20.xyzx
    dp3 r19.x, r19.xyzx, r19.xyzx
    sqrt r19.x, r19.x
    mad_sat r22.x, r19.x, r21.x, r22.y
    sample_l_indexable(texture2d)(float,float,float,float) r19.x, r22.xzxx, t44.zxyw, s13, l(0.000000)
    ine r19.y, r21.z, l(1)
    movc r19.x, r19.y, l(0), r19.x
    ine r19.y, r21.w, l(2)
    if_nz r19.y
      ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r19.y, r18.z, l(372), t54.xxxx
      mul r19.z, r19.x, r19.x
      mul r19.y, r19.y, r19.z
      ieq r19.zw, r21.wwww, l(0, 0, 1, 3)
      mul r20.x, r4.w, r23.x
      itof r0.w, r21.y
      sample_l_indexable(texturecubearray)(float,float,float,float) r20.yzw, r0.xyzw, t57.wxyz, s12, l(4.000000)
      mul r20.xyz, r20.yzwy, r20.xxxx
      mul r8.xyz, r23.yzwy, r20.xyzx
      mad r20.xyz, r19.yyyy, r8.xyzx, r14.yzwy
      mov r16.w, r17.z
      mad r21.xyzw, r19.yyyy, r8.wxyz, r16.wxyz
      max r22.w, r17.w, r19.y
      mov r15.w, r17.x
      mad r24.xyzw, r19.yyyy, r8.xyzw, r15.xyzw
      max r25.x, r17.y, r19.y
      mov r22.x, r15.w
      mov r22.z, r21.x
      mov r17.x, r24.w
      mov r17.z, r16.w
      movc r26.xzw, r19.zzzz, r22.xxzw, r17.xxzw
      mov r21.x, r17.y
      mov r25.yzw, r16.xxyz
      movc r25.xyzw, r19.zzzz, r21.xyzw, r25.xyzw
      or r8.x, r19.w, r19.z
      movc r15.xyz, r8.xxxx, r15.xyzx, r24.xyzx
      movc r16.xyz, r19.wwww, r16.xyzx, r25.yzwy
      movc r14.yzw, r19.wwww, r20.xxyz, r14.yyzw
      mov r17.x, r22.x
      mov r17.y, r21.x
      mov r26.y, r25.x
      movc r17.xyzw, r19.wwww, r17.xyzw, r26.xyzw
    else 
      add_sat r8.x, -r19.x, l(1.000000)
      mul r8.x, r8.x, r8.x
      add r8.y, -r23.x, l(1.000000)
      mad r8.x, r8.x, r8.y, r23.x
      mul r18.x, r8.x, r18.x
    endif 
    iadd r18.y, r18.y, l(1)
    ult r8.x, r18.y, r5.w
    if_nz r8.x
      ftou r18.z, cb4[r18.y + 69].y
      ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r18.w, r18.z, l(140), t54.xxxx
    endif 
  endloop 
  mov r10.xyz, r15.xyzx
  mov r11.xyz, r16.xyzx
  mov r12.xyz, r14.yzwy
  mov r13.xyzw, r17.xyzw
  mov r6.w, r18.x
  mov r8.xyz, r18.yzwy
  loop 
    ult r12.w, r8.x, r5.w
    ieq r14.x, r8.z, l(4)
    and r12.w, r12.w, r14.x
    breakc_z r12.w
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r19.xyz, r8.y, l(0), t54.xyzx
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r20.xyz, r8.y, l(16), t54.xyzx
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r21.y, r8.y, l(44), t54.xxxx
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r22.xyzw, r8.y, l(60), t54.xyzw
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r21.zw, r8.y, l(100), t54.xxxy
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r23.xyz, r8.y, l(128), t54.xyzx
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r24.xyz, r8.y, l(144), t54.xyzx
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r25.xyz, r8.y, l(160), t54.xyzx
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r26.xyz, r8.y, l(176), t54.xyzx
    ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r12.w, r8.y, l(332), t54.xxxx
    and r12.w, r12.w, l(3)
    add r19.xyz, r2.xyzx, -r19.xyzx
    dp3 r23.y, r19.xyzx, r23.xyzx
    dp3 r23.z, r19.xyzx, r20.xyzx
    dp3 r23.w, r19.xyzx, r24.xyzx
    mul r19.xyz, r25.xyzx, r26.xyzx
    mad r20.xyz, r26.xyzx, r25.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
    div r20.xyz, r26.xyzx, r20.xyzx
    mul r20.xyz, r20.xyzx, r23.yzwy
    max r20.xyz, r20.xyzx, l(-1.000000, -1.000000, -1.000000, 0.000000)
    min r20.xyz, r20.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
    mul r23.yzw, r20.xxyz, r20.xxyz
    mad r14.x, -r20.x, r20.x, l(1.000000)
    mad r14.x, r23.w, r14.x, r23.y
    add r15.w, -r14.x, l(1.000000)
    mad_sat r14.x, r23.z, r15.w, r14.x
    sqrt r14.x, r14.x
    max r23.x, r23.y, l(0.000010)
    dp3 r15.w, r19.xyzx, r23.xzwx
    mad r16.w, r20.y, r20.y, r23.x
    mad r16.w, r20.z, r20.z, r16.w
    div r15.w, r15.w, r16.w
    add r16.w, r15.w, l(1.000000)
    mad_sat r21.x, r14.x, r16.w, -r15.w
    sample_l_indexable(texture2d)(float,float,float,float) r14.x, r21.xyxx, t44.zxyw, s13, l(0.000000)
    ine r15.w, r21.w, l(1)
    movc r14.x, r15.w, l(0), r14.x
    ine r15.w, r12.w, l(2)
    if_nz r15.w
      ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r15.w, r8.y, l(372), t54.xxxx
      mul r16.w, r14.x, r14.x
      mul r15.w, r15.w, r16.w
      ieq r19.xy, r12.wwww, l(1, 3, 0, 0)
      mul r12.w, r4.w, r22.x
      itof r0.w, r21.z
      sample_l_indexable(texturecubearray)(float,float,float,float) r20.xyz, r0.xyzw, t57.xyzw, s12, l(4.000000)
      mul r20.xyz, r12.wwww, r20.xyzx
      mul r9.xyz, r22.yzwy, r20.xyzx
      mad r20.xyz, r15.wwww, r9.xyzx, r12.xyzx
      mov r11.w, r13.z
      mad r21.xyzw, r15.wwww, r9.wxyz, r11.wxyz
      max r23.w, r13.w, r15.w
      mov r10.w, r13.x
      mad r24.xyzw, r15.wwww, r9.xyzw, r10.xyzw
      max r25.x, r13.y, r15.w
      mov r23.x, r10.w
      mov r23.z, r21.x
      mov r13.x, r24.w
      mov r13.z, r11.w
      movc r26.xzw, r19.xxxx, r23.xxzw, r13.xxzw
      mov r21.x, r13.y
      mov r25.yzw, r11.xxyz
      movc r25.xyzw, r19.xxxx, r21.xyzw, r25.xyzw
      or r0.w, r19.y, r19.x
      movc r10.xyz, r0.wwww, r10.xyzx, r24.xyzx
      movc r11.xyz, r19.yyyy, r11.xyzx, r25.yzwy
      movc r12.xyz, r19.yyyy, r20.xyzx, r12.xyzx
      mov r13.x, r23.x
      mov r13.y, r21.x
      mov r26.y, r25.x
      movc r13.xyzw, r19.yyyy, r13.xyzw, r26.xyzw
    else 
      add_sat r0.w, -r14.x, l(1.000000)
      mul r0.w, r0.w, r0.w
      add r9.x, -r22.x, l(1.000000)
      mad r0.w, r0.w, r9.x, r22.x
      mul r6.w, r0.w, r6.w
    endif 
    iadd r8.x, r8.x, l(1)
    ult r0.w, r8.x, r5.w
    if_nz r0.w
      ftou r8.y, cb4[r8.x + 69].y
      ld_structured_indexable(structured_buffer, stride=384)(mixed,mixed,mixed,mixed) r8.z, r8.y, l(140), t54.xxxx
    endif 
  endloop 
  ine r9.xyz, r8.zzzz, l(0, 4, 1, 0)
  and r0.w, r9.y, r9.x
  and r0.w, r9.z, r0.w
  iadd r7.w, -r0.w, r8.x
endloop 
max r0.xw, r13.zzzx, l(1.192092896E-007, 0.000000, 0.000000, 1.192092896E-007)
div r0.xyz, r11.xyzx, r0.xxxx
mov_sat r13.yw, r13.yyyw
add r0.xyz, -r7.xyzx, r0.xyzx
mad r0.xyz, r13.wwww, r0.xyzx, r7.xyzx
div r2.xyz, r10.xyzx, r0.wwww
add r2.xyz, -r0.xyzx, r2.xyzx
mad r0.xyz, r13.yyyy, r2.xyzx, r0.xyzx
add r0.xyz, r12.xyzx, r0.xyzx
mad r0.xyz, r0.xyzx, r6.wwww, r6.xyzx
mul r0.xyz, r0.xyzx, r4.xyzx
mul r0.xyz, r5.xyzx, r0.xyzx
eq r0.w, cb2[95].w, l(0.000000)
movc r2.xyz, r0.wwww, cb2[95].xyzx, cb2[35].xyzx
max r2.xyz, r2.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
log r2.xyz, r2.xyzx
mul r2.xyz, r2.xyzx, cb2[26].yyyy
exp r2.xyz, r2.xyzx
add r4.xyz, r3.xyzx, -cb2[10].xyzx
mad r5.x, r3.z, cb2[9].y, cb2[25].y
mov r5.yw, cb2[25].zzzz
sample_l_indexable(texture2d)(float,float,float,float) r0.w, r5.xyxx, t44.xzwy, s13, l(0.000000)
dp3 r3.x, r4.xyzx, r4.xyzx
sqrt r3.x, r3.x
lt r3.y, l(0.000000), cb2[26].w
if_nz r3.y
  mul r3.yz, r4.xxyx, cb2[9].wwww
  mad r6.x, cb2[25].w, r4.y, r3.y
  mad r6.y, -cb2[25].w, r4.x, r3.z
  mov r6.z, r4.z
  sample_indexable(texturecube)(float,float,float,float) r4.xyz, r6.xyzx, t0.xyzw, s11
  add r4.xyz, r4.xyzx, -cb2[95].xyzx
  mad r4.xyz, cb2[26].wwww, r4.xyzx, cb2[95].xyzx
else 
  mov r4.xyz, cb2[95].xyzx
endif 
max r4.xyz, r4.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
log r4.xyz, r4.xyzx
mul r4.xyz, r4.xyzx, cb2[26].yyyy
exp r4.xyz, r4.xyzx
mad r5.z, r3.x, cb2[9].x, cb2[25].x
sample_l_indexable(texture2d)(float,float,float,float) r3.x, r5.zwzz, t44.xyzw, s13, l(0.000000)
mad r4.xyz, cb2[26].xxxx, r4.xyzx, -r0.xyzx
mad r0.xyz, r3.xxxx, r4.xyzx, r0.xyzx
mad r2.xyz, cb2[26].xxxx, r2.xyzx, -r0.xyzx
mad r0.xyz, r0.wwww, r2.xyzx, r0.xyzx
max r0.xyz, r0.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
div r0.w, l(1.000000, 1.000000, 1.000000, 1.000000), cb2[20].y
add r0.w, -r0.w, v0.w
rcp r2.x, cb2[96].x
mul r0.w, r0.w, r2.x
rsq r0.w, |r0.w|
div r1.z, l(1.000000, 1.000000, 1.000000, 1.000000), r0.w
mov_sat r1.xyz, r1.xyzx
mad r1.xyz, r1.xyzx, l(1.000000, 1.000000, 0.984375, 0.000000), l(0.000000, 0.000000, -0.0117187500, 0.000000)
sample_l_indexable(texture3d)(float,float,float,float) r1.xyz, r1.xyzx, t59.xyzw, s13, l(0.000000)
add o0.xyz, r0.xyzx, r1.xyzx
mad r0.x, cb1[r2.w + 3].x, r1.w, -cb1[2].x
min r0.x, r0.x, l(0.000000)
lt r0.x, r0.x, l(0.000000)
discard_nz r0.x
mov o0.w, r3.w
ret 
// Approximately 510 instruction slots used
