//0970199921bdd436-ps.txt
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.17672
//
//   using 3Dmigoto v1.2.27 on Sun Feb 14 01:37:51 2016
//
//
// Buffer Definitions: 
//
// cbuffer WorldBuffer
// {
//
//   struct WorldStruct
//   {
//       
//       row_major float4x4 ViewProject;// Offset:    0
//       
//       struct WorldStruct_PerInstanceData
//       {
//           
//           row_major float4x4 World;  // Offset:   64
//           row_major float4x4 WorldViewProject;// Offset:  128
//
//       } PerInstance[256];            // Offset:   64
//
//   } WorldParameters;                 // Offset:    0 Size: 32832
//
// }
//
// 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
//   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 [unused]
//   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 [unused]
//   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
//   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 InstanceBuffer
// {
//
//   struct InstanceStruct
//   {
//       
//       float4 InstanceParams[8];      // Offset:    0
//
//   } InstanceParameters[256];         // Offset:    0 Size: 32768
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// SamplerGenericPointClamp          sampler      NA          NA   10        1
// SamplerGenericTrilinearWrap       sampler      NA          NA   11        1
// SamplerGenericBilinearClamp       sampler      NA          NA   13        1
// p_default_Material_41DEFF20563185_Param_texture    texture  float4          2d    0        1
// p_default_Material_n123_DepthBufferTexture_texture    texture  float4          2d    1        1
// p_default_Setup_n3_8FB12BF0685975_cp0_Param_texture    texture  float4          2d    2        1
// p_default_Setup_n22_05602DE49167171_Param_texture    texture  float4          2d    3        1
// p_default_Material_n150_n200_fogCube_texture    texture  float4        cube    4        1
// p_default_Setup_n17_DepthBufferTexture_texture    texture  float4          2d    5        1
// p_default_Material_n133_n160_DepthBufferTexture_texture    texture  float4          2d    6        1
// p_default_Setup_n3_DECAB8306147855_cp0_Param_texture    texture  float4          2d    7        1
// p_default_Setup_n3_DECA25A07266119_cp0_Param_texture    texture  float4          2d    8        1
// p_default_Material_n157_n185_OpaquesOnlyTexture_texture    texture  float4          2d    9        1
// p_default_Material_n157_n180_Texture_texture    texture  float4        cube   10        1
// p_default_Material_n157_n185_DepthBufferTexture_texture    texture  float4          2d   11        1
// p_default_Setup_n3_DECB27508110753_cp0_Param_texture    texture  float4          2d   12        1
// AttenuationSampler_texture        texture  float4          2d   44        1
// VolumetricLightIntensity_texture    texture  float4          3d   59        1
// WorldBuffer                       cbuffer      NA          NA    0        1
// DrawableBuffer                    cbuffer      NA          NA    1        1
// SceneBuffer                       cbuffer      NA          NA    2        1
// MaterialBuffer                    cbuffer      NA          NA    3        1
// InstanceBuffer                    cbuffer      NA          NA    5        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float   xyzw
// TEXCOORD                 0   xyzw        1     NONE   float   xy  
// TEXCOORD                 2   xyz         2     NONE   float   xyz 
// PSIZE                    0   x           3     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 cb0[4], immediateIndexed
dcl_constantbuffer cb1[259], dynamicIndexed
dcl_constantbuffer cb2[101], immediateIndexed
dcl_constantbuffer cb3[15], immediateIndexed
dcl_constantbuffer cb5[2046], dynamicIndexed
dcl_sampler s10, mode_default
dcl_sampler s11, mode_default
dcl_sampler s13, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_resource_texture2d (float,float,float,float) t2
dcl_resource_texture2d (float,float,float,float) t3
dcl_resource_texturecube (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_texturecube (float,float,float,float) t10
dcl_resource_texture2d (float,float,float,float) t11
dcl_resource_texture2d (float,float,float,float) t12
dcl_resource_texture2d (float,float,float,float) t44
dcl_resource_texture3d (float,float,float,float) t59
dcl_input_ps_siv linear noperspective v0.xyzw, position
dcl_input_ps linear v1.xy
dcl_input_ps linear v2.xyz
dcl_input_ps constant v3.x
dcl_output o0.xyzw
// dcl_temps 15
dcl_temps 17
dcl_resource_texture2d (float,float,float,float) t125
dp3 r0.x, v2.xyzx, v2.xyzx
rsq r0.x, r0.x
mul r0.xyz, r0.xxxx, v2.xyzx
mad r1.xyzw, v0.xyxy, cb2[45].zwzw, cb2[45].xyxy
mul r2.xyzw, r1.zwxy, v0.wwww
mov r3.xy, r2.xyxx
mov r3.z, v0.w

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


mov r3.w, l(1.000000)
dp4 r4.x, cb2[15].xyzw, r3.xyzw
dp4 r4.y, cb2[16].xyzw, r3.xyzw
dp4 r4.z, cb2[17].xyzw, r3.xyzw
mad r2.xy, r1.xyxx, cb2[18].xyxx, cb2[18].zwzz
mul r5.xy, r2.xyxx, v0.wwww
mov r5.z, v0.w

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


dp3 r0.w, -r5.xyzx, -r5.xyzx
rsq r0.w, r0.w
mul r5.xyz, r0.wwww, -r5.xyzx
dp3 r6.x, r5.xyzx, cb2[0].xyzx
dp3 r6.y, r5.xyzx, cb2[1].xyzx
dp3 r6.z, r5.xyzx, cb2[2].xyzx
deriv_rty_fine r5.xy, v1.xyxx
deriv_rtx_fine r2.xy, v1.xyxx
mov r3.xy, r2.zwzz
dp4 r7.x, cb2[15].xyzw, r3.xyzw
dp4 r7.y, cb2[16].xyzw, r3.xyzw
dp4 r7.z, cb2[17].xyzw, r3.xyzw
deriv_rty_fine r3.xyz, r7.xyzx
deriv_rtx_fine r8.xyz, r7.yzxy
ishl r0.w, v3.x, l(3)
mad r2.zw, r4.xxxy, cb5[r0.w + 4].xxxy, cb5[r0.w + 4].zzzw
sample_indexable(texture2d)(float,float,float,float) r9.xy, r2.zwzz, t3.xyzw, s11
mad r9.xy, r9.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
dp2 r1.w, r9.xyxx, r9.xyxx
add r1.w, -r1.w, l(1.000000)
max r1.w, r1.w, l(0.000000)
sqrt r9.z, r1.w
lt r1.w, l(0.000000), cb5[r0.w + 5].x
add r2.zw, r2.zzzw, l(0.000000, 0.000000, -0.500000, -0.500000)
dp2 r2.z, r2.zwzz, r2.zwzz
sqrt r2.z, r2.z
add r2.w, l(1.000000), -cb5[r0.w + 5].y
mad r2.z, r2.z, l(2.000000), -r2.w
div_sat r0.w, r2.z, cb5[r0.w + 5].y
add r0.w, -r0.w, l(1.000000)
mul r0.w, r0.w, r0.w
movc r0.w, r1.w, r0.w, l(1.000000)
mov r10.x, cb3[14].y
mov r10.zw, l(0,0,1.000000,1.000000)
mul r9.xyz, r9.xyzx, r10.xxzx
dp3 r1.w, r9.xyzx, r9.xyzx
rsq r1.w, r1.w
mul r2.zw, r1.wwww, r9.xxxy
mul r9.xy, r0.wwww, r2.zwzz
sample_indexable(texture2d)(float,float,float,float) r0.w, r1.xyxx, t5.yzwx, s10
mad r0.w, r0.w, cb2[20].x, cb2[20].y
max r0.w, r0.w, l(0.000001)
div r10.z, l(1.000000, 1.000000, 1.000000, 1.000000), r0.w
mul r10.xy, r1.xyxx, r10.zzzz
dp4 r0.w, cb2[17].xyzw, r10.xyzw
add r0.w, -r0.w, r7.z
dp3 r1.w, r8.zxyz, r0.xyzx
mad r8.xyz, -r1.wwww, r0.yzxy, r8.xyzx
dp3 r1.w, r3.xyzx, r0.xyzx
mad r3.xyz, -r1.wwww, r0.xyzx, r3.xyzx
mul r1.w, r5.x, r2.y
mad r1.w, r2.x, r5.y, -r1.w
lt r2.x, r1.w, l(0.000000)
movc r2.x, r2.x, l(-1.000000), l(1.000000)
mov r5.z, -r2.y
mul r2.yz, r2.xxxx, r5.yyzy
mul r5.xyz, r2.zzzz, r3.xyzx
mad r2.yzw, r8.zzxy, r2.yyyy, r5.xxyz
lt r1.w, l(0.000000), |r1.w|
dp3 r3.w, r2.yzwy, r2.yzwy
rsq r3.w, r3.w
mul r5.xyz, r2.yzwy, r3.wwww
movc r2.yzw, r1.wwww, r5.xxyz, r2.yyzw
mul r5.xyz, r0.zxyz, r2.zwyz
mad r5.xyz, r0.yzxy, r2.wyzw, -r5.xyzx
mul r10.xyw, r0.zxzy, r8.xyxz
mad r8.xyz, r0.yzxy, r8.yzxy, -r10.xywx
dp3 r1.w, r3.xyzx, r8.xyzx
lt r1.w, r1.w, l(0.000000)
movc r1.w, r1.w, l(-1.000000), l(1.000000)
mul r1.w, r1.w, r2.x
mul r3.xyz, r1.wwww, r5.xyzx
mul_sat r0.w, r0.w, cb3[2].y
add r1.w, -cb3[14].w, cb3[14].z
mad r1.w, r0.w, r1.w, cb3[14].w
mad r5.xyzw, cb3[9].xyxy, r9.xyxy, v1.xyxy
mul r5.xy, r5.xyxx, cb3[10].xyxx
mul r8.xyzw, cb2[24].xxxx, cb3[8].xyzw
mad r8.xy, r5.zwzz, cb3[12].xyxx, r8.xyxx
mad r5.xy, cb2[24].xxxx, cb3[11].xyxx, r5.xyxx
mul r10.xy, cb2[24].xxxx, cb3[7].xyxx
mad r10.xy, cb3[7].zwzz, r5.zwzz, r10.xyxx
mad r5.zw, r5.zzzw, cb3[10].zzzw, r8.zzzw
sample_indexable(texture2d)(float,float,float,float) r2.x, r5.xyxx, t7.xyzw, s11
sample_indexable(texture2d)(float,float,float,float) r5.xy, r8.xyxx, t12.xyzw, s11
mad r5.xy, r5.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
dp2 r3.w, r5.xyxx, r5.xyxx
add r3.w, -r3.w, l(1.000000)
max r3.w, r3.w, l(0.000000)
sqrt r3.w, r3.w
sample_indexable(texture2d)(float,float,float,float) r5.zw, r5.zwzz, t8.zwxy, s11
mad r5.zw, r5.zzzw, l(0.000000, 0.000000, 2.000000, 2.000000), l(0.000000, 0.000000, -1.000000, -1.000000)
dp2 r4.w, r5.zwzz, r5.zwzz
add r4.w, -r4.w, l(1.000000)
max r4.w, r4.w, l(0.000000)
sqrt r4.w, r4.w
add r3.w, -r3.w, l(1.000000)
mul r8.xy, r5.xyxx, cb3[14].xxxx
mad r8.w, -cb3[14].x, r3.w, l(1.000000)
dp3 r3.w, r8.xywx, r8.xywx
rsq r3.w, r3.w
add r4.w, -r4.w, l(1.000000)
mul r5.xy, r5.zwzz, cb3[13].wwww
mad r5.w, -cb3[13].w, r4.w, l(1.000000)
dp3 r4.w, r5.xywx, r5.xywx
rsq r4.w, r4.w
mul r5.xyz, r4.wwww, r5.xywx
mul r11.xyz, r2.xxxx, cb3[6].xyzx
mad r8.xyz, r8.xywx, r3.wwww, -r5.xyzx
mad r5.xyz, cb3[13].zzzz, r8.xyzx, r5.xyzx
mov r9.z, l(0)
add r5.xyz, r5.xyzx, r9.xyzx
dp3 r2.x, r5.xyzx, r5.xyzx
rsq r2.x, r2.x
mul r5.xyz, r2.xxxx, r5.xyzx
mad r8.xy, cb3[12].wwww, r5.xyxx, r10.xyxx
sample_indexable(texture2d)(float,float,float,float) r8.xyz, r8.xyxx, t2.xyzw, s11
mul r3.xyz, r3.xyzx, r5.yyyy
mad r2.xyz, r5.xxxx, r2.yzwy, r3.xyzx
mad r0.xyz, r5.zzzz, r0.xyzx, r2.xyzx
dp3 r2.x, r0.xyzx, r0.xyzx
rsq r2.x, r2.x
mul r0.xyz, r0.xyzx, r2.xxxx
and r2.xyz, r0.xyzx, l(0x7f800000, 0x7f800000, 0x7f800000, 0)
ine r2.xyz, r2.xyzx, l(0x7f800000, 0x7f800000, 0x7f800000, 0)
and r0.xyz, r0.xyzx, r2.xyzx
add r2.xyz, r4.xyzx, -cb2[10].xyzx
dp3 r2.w, r2.xyzx, cb2[11].xyzx
sample_indexable(texture2d)(float,float,float,float) r3.x, r1.xyxx, t6.xyzw, s10
mad r3.x, r3.x, cb2[20].x, cb2[20].y
max r3.x, r3.x, l(0.000001)
div r3.x, l(1.000000, 1.000000, 1.000000, 1.000000), r3.x
add r2.w, -r2.w, r3.x
max r2.w, r2.w, l(0.000000)
mul_sat r2.w, r2.w, cb3[0].y
mov r3.x, v3.x
mul r2.w, r2.w, cb1[r3.x + 3].x
dp3 r3.y, r0.xyzx, r6.xyzx
add r3.zw, -cb3[9].zzzw, cb3[11].zzzw
mad r3.zw, r0.wwww, r3.zzzw, cb3[9].zzzw
add r4.x, -cb3[5].w, cb3[12].z
mad r4.x, r0.w, r4.x, cb3[5].w
max r3.y, r3.y, l(0.000000)
log r3.y, r3.y
mul r3.y, r3.y, cb3[6].w
exp r3.y, r3.y
add r9.xyz, -cb3[1].xyzx, cb3[4].xyzx
mad r9.xyz, r0.wwww, r9.xyzx, cb3[1].xyzx
add r3.y, -r3.y, l(1.000000)
add r0.xyz, r0.xyzx, l(-0.000000, -0.000000, -1.000000, 0.000000)
mad r0.xyz, cb3[13].xxxx, r0.xyzx, l(0.000000, 0.000000, 1.000000, 0.000000)
dp3 r4.y, r6.xyzx, r0.xyzx
mul r10.xyw, r0.xyxz, r4.yyyy
mad r6.xyz, r10.xywx, l(2.000000, 2.000000, 2.000000, 0.000000), -r6.xyzx
sample_indexable(texturecube)(float,float,float,float) r10.xyw, r6.xyzx, t10.xywz, s11
add_sat r4.y, -r4.y, l(1.000000)
log r4.y, r4.y
mul r4.y, r4.y, cb3[13].y
exp r4.y, r4.y
if_nz cb2[100].x
  dp3 r0.x, r6.xyzx, r0.xyzx
  mul r0.x, r0.x, l(10.000000)
  div r0.x, l(1600.000000), r0.x
  mul r12.xyzw, r6.yyyy, cb0[1].xyzw
  mad r12.xyzw, r6.xxxx, cb0[0].xyzw, r12.xyzw
  mad r6.xyzw, r6.zzzz, cb0[2].xyzw, r12.xyzw
  add r7.xyz, r7.xyzx, -cb2[10].xyzx
  mul r12.xyzw, r7.yyyy, cb0[1].xyzw
  mad r12.xyzw, r7.xxxx, cb0[0].xyzw, r12.xyzw
  mad r7.xyzw, r7.zzzz, cb0[2].xyzw, r12.xyzw
  add r7.xyzw, r7.xyzw, cb0[3].xyzw
  mul r12.xyzw, r6.wwww, l(0.500000, 0.500000, 0.000000, 0.000000)
  mad r6.xyzw, r6.xyzw, l(0.500000, -0.500000, 0.980000, 1.000000), r12.xyzw
  mul r12.xyzw, r7.wwww, l(0.500000, 0.500000, 0.000000, 0.000000)
  mad r7.xyzw, r7.xyzw, l(0.500000, -0.500000, 0.980000, 1.000000), r12.xyzw
  mul r0.x, r0.x, l(0.594822109)
  div r12.xyz, -r7.xyzx, r6.xyzx
  add r13.xyz, -r7.xyzx, r7.wwww
  add r14.xyz, -r6.xyzx, r6.wwww
  div r13.xyz, -r13.xyzx, r14.xyzx
  lt r14.xyz, r12.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
  movc r12.xyz, r14.xyzx, l(10000000.000000,10000000.000000,10000000.000000,0), r12.xyzx
  lt r14.xyz, r13.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
  movc r13.xyz, r14.xyzx, l(10000000.000000,10000000.000000,10000000.000000,0), r13.xyzx
  min r12.xyz, r12.xyzx, r13.xyzx
  min r0.y, r12.z, r12.y
  min r0.y, r0.y, r12.x
  mov r0.z, l(0)
  mov r4.w, r0.x
  mov r12.x, l(0)
  mov r12.y, v0.z
  mov r13.x, l(0)
  mov r13.y, v0.z
  mov r5.zw, l(0,0,0,0)
  loop 
    ige r8.w, r5.w, l(10)
    breakc_nz r8.w
    add r8.w, r0.z, r4.w
    min r0.z, r0.y, r8.w
    mad r14.xyzw, r0.zzzz, r6.xyzw, r7.xyzw
    mul r4.w, r4.w, l(1.11111116)
    div r14.xyz, r14.xyzx, r14.wwww
    sample_l_indexable(texture2d)(float,float,float,float) r8.w, r14.xyxx, t11.yzwx, s10, l(0.000000)
    add r9.w, -r8.w, r14.z
    lt r9.w, l(0.000000), r9.w
    if_nz r9.w
      mov r5.z, l(1)
      mov r13.x, r0.z
      mov r13.y, r8.w
      break 
    endif 
    mov r12.x, r0.z
    mov r12.y, r8.w
    iadd r5.w, r5.w, l(1)
    mov r13.x, r0.z
    mov r13.y, r8.w
    mov r5.z, l(0)
  endloop 
  ilt r0.x, l(0), r5.z
  if_nz r0.x
    add r0.x, r12.x, r13.x
    mul r0.x, r0.x, l(0.500000)
    mad r14.xyzw, r0.xxxx, r6.xyzw, r7.xyzw
    div r14.xyz, r14.xyzx, r14.wwww
    sample_l_indexable(texture2d)(float,float,float,float) r0.y, r14.xyxx, t11.yxzw, s10, l(0.000000)
    add r0.z, -r0.y, r14.z
    lt r0.z, r0.z, l(0.000000)
    movc r5.zw, r0.zzzz, r0.xxxy, r12.xxxy
    movc r0.xy, r0.zzzz, r13.xyxx, r0.xyxx
    add r0.z, r0.x, r5.z
    mul r12.x, r0.z, l(0.500000)
    mad r13.xyzw, r12.xxxx, r6.xyzw, r7.xyzw
    div r13.xyz, r13.xyzx, r13.wwww
    sample_l_indexable(texture2d)(float,float,float,float) r12.y, r13.xyxx, t11.yxzw, s10, l(0.000000)
    add r0.z, -r12.y, r13.z
    lt r0.z, r0.z, l(0.000000)
    movc r5.zw, r0.zzzz, r12.xxxy, r5.zzzw
    movc r0.xy, r0.zzzz, r0.xyxx, r12.xyxx
    add r0.z, r0.x, r5.z
    mul r12.x, r0.z, l(0.500000)
    mad r13.xyzw, r12.xxxx, r6.xyzw, r7.xyzw
    div r13.xyz, r13.xyzx, r13.wwww
    sample_l_indexable(texture2d)(float,float,float,float) r12.y, r13.xyxx, t11.yxzw, s10, l(0.000000)
    add r0.z, -r12.y, r13.z
    lt r0.z, r0.z, l(0.000000)
    movc r5.zw, r0.zzzz, r12.xxxy, r5.zzzw
    movc r0.xy, r0.zzzz, r0.xyxx, r12.xyxx
    add r0.z, r0.x, r5.z
    mul r12.x, r0.z, l(0.500000)
    mad r13.xyzw, r12.xxxx, r6.xyzw, r7.xyzw
    div r13.xyz, r13.xyzx, r13.wwww
    sample_l_indexable(texture2d)(float,float,float,float) r12.y, r13.xyxx, t11.yxzw, s10, l(0.000000)
    add r0.z, -r12.y, r13.z
    lt r0.z, r0.z, l(0.000000)
    movc r5.zw, r0.zzzz, r12.xxxy, r5.zzzw
    movc r0.xy, r0.zzzz, r0.xyxx, r12.xyxx
    add r0.z, r0.x, r5.z
    mul r12.x, r0.z, l(0.500000)
    mad r13.xyzw, r12.xxxx, r6.xyzw, r7.xyzw
    div r13.xyz, r13.xyzx, r13.wwww
    sample_l_indexable(texture2d)(float,float,float,float) r12.y, r13.xyxx, t11.yxzw, s10, l(0.000000)
    add r0.z, -r12.y, r13.z
    lt r0.z, r0.z, l(0.000000)
    movc r5.zw, r0.zzzz, r12.xxxy, r5.zzzw
    movc r0.xy, r0.zzzz, r0.xyxx, r12.xyxx
    add r0.z, r0.x, r5.z
    mul r12.x, r0.z, l(0.500000)
    mad r13.xyzw, r12.xxxx, r6.xyzw, r7.xyzw
    div r13.xyz, r13.xyzx, r13.wwww
    sample_l_indexable(texture2d)(float,float,float,float) r12.y, r13.xyxx, t11.yxzw, s10, l(0.000000)
    add r0.z, -r12.y, r13.z
    lt r0.z, r0.z, l(0.000000)
    movc r5.zw, r0.zzzz, r12.xxxy, r5.zzzw
    movc r0.xy, r0.zzzz, r0.xyxx, r12.xyxx
    add r0.z, r0.x, r5.z
    mul r12.x, r0.z, l(0.500000)
    mad r13.xyzw, r12.xxxx, r6.xyzw, r7.xyzw
    div r13.xyz, r13.xyzx, r13.wwww
    sample_l_indexable(texture2d)(float,float,float,float) r12.y, r13.xyxx, t11.yxzw, s10, l(0.000000)
    add r0.z, -r12.y, r13.z
    lt r0.z, r0.z, l(0.000000)
    movc r5.zw, r0.zzzz, r12.xxxy, r5.zzzw
    movc r0.xy, r0.zzzz, r0.xyxx, r12.xyxx
    add r0.z, r0.x, r5.z
    mul r12.x, r0.z, l(0.500000)
    mad r13.xyzw, r12.xxxx, r6.xyzw, r7.xyzw
    div r13.xyz, r13.xyzx, r13.wwww
    sample_l_indexable(texture2d)(float,float,float,float) r12.y, r13.xyxx, t11.yxzw, s10, l(0.000000)
    add r0.z, -r12.y, r13.z
    lt r0.z, r0.z, l(0.000000)
    movc r5.zw, r0.zzzz, r12.xxxy, r5.zzzw
    movc r0.xy, r0.zzzz, r0.xyxx, r12.xyxx
    add r0.z, r0.x, r5.z
    mul r12.x, r0.z, l(0.500000)
    mad r13.xyzw, r12.xxxx, r6.xyzw, r7.xyzw
    div r13.xyz, r13.xyzx, r13.wwww
    sample_l_indexable(texture2d)(float,float,float,float) r12.y, r13.xyxx, t11.yxzw, s10, l(0.000000)
    add r0.z, -r12.y, r13.z
    lt r0.z, r0.z, l(0.000000)
    movc r5.zw, r0.zzzz, r12.xxxy, r5.zzzw
    movc r0.xy, r0.zzzz, r0.xyxx, r12.xyxx
    add r0.z, r0.x, r5.z
    mul r12.x, r0.z, l(0.500000)
    mad r13.xyzw, r12.xxxx, r6.xyzw, r7.xyzw
    div r13.xyz, r13.xyzx, r13.wwww
    sample_l_indexable(texture2d)(float,float,float,float) r12.y, r13.xyxx, t11.yxzw, s10, l(0.000000)
    add r0.z, -r12.y, r13.z
    lt r0.z, r0.z, l(0.000000)
    movc r5.zw, r0.zzzz, r12.xxxy, r5.zzzw
    movc r0.xy, r0.zzzz, r0.xyxx, r12.xyxx
    add r0.z, r0.x, r5.z
    mul r12.x, r0.z, l(0.500000)
    mad r13.xyzw, r12.xxxx, r6.xyzw, r7.xyzw
    div r13.xyz, r13.xyzx, r13.wwww
    sample_l_indexable(texture2d)(float,float,float,float) r12.y, r13.xyxx, t11.yxzw, s10, l(0.000000)
    add r0.z, -r12.y, r13.z
    lt r0.z, r0.z, l(0.000000)
    movc r5.zw, r0.zzzz, r12.xxxy, r5.zzzw
    movc r0.xy, r0.zzzz, r0.xyxx, r12.xyxx
    add r0.z, r0.x, r5.z
    mul r12.x, r0.z, l(0.500000)
    mad r13.xyzw, r12.xxxx, r6.xyzw, r7.xyzw
    div r13.xyz, r13.xyzx, r13.wwww
    sample_l_indexable(texture2d)(float,float,float,float) r12.y, r13.xyxx, t11.yxzw, s10, l(0.000000)
    add r0.z, -r12.y, r13.z
    lt r0.z, r0.z, l(0.000000)
    movc r5.zw, r0.zzzz, r12.xxxy, r5.zzzw
    movc r0.xy, r0.zzzz, r0.xyxx, r12.xyxx
    add r0.z, r0.x, r5.z
    mul r12.x, r0.z, l(0.500000)
    mad r13.xyzw, r12.xxxx, r6.xyzw, r7.xyzw
    div r13.xyz, r13.xyzx, r13.wwww
    sample_l_indexable(texture2d)(float,float,float,float) r12.y, r13.xyxx, t11.yxzw, s10, l(0.000000)
    add r0.z, -r12.y, r13.z
    lt r0.z, r0.z, l(0.000000)
    movc r5.zw, r0.zzzz, r12.xxxy, r5.zzzw
    movc r0.xy, r0.zzzz, r0.xyxx, r12.xyxx
    add r0.z, r0.x, r5.z
    mul r12.x, r0.z, l(0.500000)
    mad r13.xyzw, r12.xxxx, r6.xyzw, r7.xyzw
    div r13.xyz, r13.xyzx, r13.wwww
    sample_l_indexable(texture2d)(float,float,float,float) r12.y, r13.xyxx, t11.yxzw, s10, l(0.000000)
    add r0.z, -r12.y, r13.z
    lt r0.z, r0.z, l(0.000000)
    movc r5.zw, r0.zzzz, r12.xxxy, r5.zzzw
    movc r0.xy, r0.zzzz, r0.xyxx, r12.xyxx
    add r0.z, r0.x, r5.z
    mul r12.x, r0.z, l(0.500000)
    mad r13.xyzw, r12.xxxx, r6.xyzw, r7.xyzw
    div r13.xyz, r13.xyzx, r13.wwww
    sample_l_indexable(texture2d)(float,float,float,float) r12.y, r13.xyxx, t11.yxzw, s10, l(0.000000)
    add r0.z, -r12.y, r13.z
    lt r0.z, r0.z, l(0.000000)
    movc r5.zw, r0.zzzz, r12.xxxy, r5.zzzw
    movc r0.xy, r0.zzzz, r0.xyxx, r12.xyxx
    add r0.z, r0.x, r5.z
    mul r12.x, r0.z, l(0.500000)
    mad r13.xyzw, r12.xxxx, r6.xyzw, r7.xyzw
    div r13.xyz, r13.xyzx, r13.wwww
    sample_l_indexable(texture2d)(float,float,float,float) r12.y, r13.xyxx, t11.yxzw, s10, l(0.000000)
    add r0.z, -r12.y, r13.z
    lt r0.z, r0.z, l(0.000000)
    movc r5.zw, r0.zzzz, r12.xxxy, r5.zzzw
    movc r0.xy, r0.zzzz, r0.xyxx, r12.xyxx
    mad r12.xyz, r5.zzzz, r6.xywx, r7.xywx
    mad r6.xyz, r0.xxxx, r6.xywx, r7.xywx
    div r7.xy, r12.xyxx, r12.zzzz
    div r6.xy, r6.xyxx, r6.zzzz
    mad r0.z, r5.w, cb2[20].x, cb2[20].y
    div r12.z, l(1.000000, 1.000000, 1.000000, 1.000000), r0.z
    mad r0.y, r0.y, cb2[20].x, cb2[20].y
    div r13.z, l(1.000000, 1.000000, 1.000000, 1.000000), r0.y
    mad r0.yz, r7.xxyx, cb2[18].xxyx, cb2[18].zzwz
    mul r12.xy, r12.zzzz, r0.yzyy

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


    mad r0.yz, r6.xxyx, cb2[18].xxyx, cb2[18].zzwz
    mul r13.xy, r13.zzzz, r0.yzyy

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


    add r7.xyz, r12.xyzx, -r13.xyzx
    dp3 r0.y, r7.xyzx, r7.xyzx
    sqrt r0.y, r0.y
    max r5.zw, r1.xxxy, r6.xxxy
    min r6.zw, r1.xxxy, r6.xxxy
    add r5.zw, -r5.zzzw, l(0.000000, 0.000000, 1.000000, 1.000000)
    mul_sat r6.zw, r6.zzzw, l(0.000000, 0.000000, 10.000000, 10.000000)
    mul_sat r5.zw, r5.zzzw, l(0.000000, 0.000000, 10.000000, 10.000000)
    mul r0.z, r5.z, r6.z
    mul r0.z, r6.w, r0.z
    mul r0.z, r5.w, r0.z
    mul r4.w, r0.x, l(-0.00721347518)
    exp r4.w, r4.w
    mad r4.w, r4.w, l(-99.900002), l(100.000000)
    lt r0.y, r0.y, r4.w
    if_nz r0.y
      mul_sat r0.x, r0.x, l(0.000625)
      mul r0.x, r0.x, r0.x
      mul r0.x, r0.x, r0.x
      mul r0.x, r0.x, r0.x
      mul r0.x, r0.x, l(-14.426950)
      exp r0.x, r0.x
      mul r0.x, r0.x, r0.z
      sample_l_indexable(texture2d)(float,float,float,float) r6.xyz, r6.xyxx, t9.xyzw, s13, l(0.000000)
    else 
      mov r6.xyz, l(0,0,0,0)
      mov r0.x, l(0)
    endif 
  else 
    mov r6.xyz, l(0,0,0,0)
    mov r0.x, l(0)
  endif 
else 
  mov r6.xyz, l(0,0,0,0)
  mov r0.x, l(0)
endif 
add r6.xyz, -r10.xywx, r6.xyzx
mad r0.xyz, r0.xxxx, r6.xyzx, r10.xywx
mul r0.xyz, r4.yyyy, r0.xyzx
mul r0.xyz, r0.xyzx, cb3[5].xyzx
mad_sat r3.zw, r5.xxxy, r3.zzzw, r1.xxxy
sample_indexable(texture2d)(float,float,float,float) r4.y, r3.zwzz, t1.yxzw, s10
mad r4.y, r4.y, cb2[20].x, cb2[20].y
max r4.y, r4.y, l(0.000001)
div r4.y, l(1.000000, 1.000000, 1.000000, 1.000000), r4.y
mul r0.xyz, r11.xyzx, r0.xyzx
mad r0.xyz, r8.xyzx, cb3[3].xyzx, r0.xyzx
add r4.y, -r10.z, r4.y
lt r4.y, r4.y, l(0.000000)
movc r3.zw, r4.yyyy, r1.xxxy, r3.zzzw
sample_l_indexable(texture2d)(float,float,float,float) r4.xyw, r3.zwzz, t0.xywz, s13, r4.x
mul r5.xyz, r9.xyzx, r4.xywx
mad r6.xyz, r4.xywx, r9.xyzx, -r0.xyzx
mad r0.xyz, r1.wwww, r6.xyzx, r0.xyzx
mad r4.xyw, -r4.xyxw, r9.xyxz, r0.xyxz
mad r4.xyw, r0.wwww, r4.xyxw, r5.xyxz
add r0.xyz, r0.xyzx, -r4.xywx
mad r0.xyz, r3.yyyy, r0.xyzx, r4.xywx
eq r0.w, cb2[95].w, l(0.000000)
movc r3.yzw, r0.wwww, cb2[95].xxyz, cb2[35].xxyz
max r3.yzw, r3.yyzw, l(0.000000, 0.000000, 0.000000, 0.000000)
log r3.yzw, r3.yyzw
mul r3.yzw, r3.yyzw, cb2[26].yyyy
exp r3.yzw, r3.yyzw
mad r4.x, r4.z, cb2[9].y, cb2[25].y
mov r4.yw, cb2[25].zzzz
sample_l_indexable(texture2d)(float,float,float,float) r0.w, r4.xyxx, t44.xzwy, s13, l(0.000000)
dp3 r1.w, r2.xyzx, r2.xyzx
sqrt r1.w, r1.w
lt r4.x, l(0.000000), cb2[26].w
if_nz r4.x
  mul r4.xy, r2.xyxx, cb2[9].wwww
  mad r5.x, cb2[25].w, r2.y, r4.x
  mad r5.y, -cb2[25].w, r2.x, r4.y
  mov r5.z, r2.z
  sample_indexable(texturecube)(float,float,float,float) r2.xyz, r5.xyzx, t4.xyzw, s11
  add r2.xyz, r2.xyzx, -cb2[95].xyzx
  mad r2.xyz, cb2[26].wwww, r2.xyzx, cb2[95].xyzx
else 
  mov r2.xyz, cb2[95].xyzx
endif 
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
mad r4.z, r1.w, cb2[9].x, cb2[25].x
sample_l_indexable(texture2d)(float,float,float,float) r1.w, r4.zwzz, t44.yzwx, s13, l(0.000000)
mad r2.xyz, cb2[26].xxxx, r2.xyzx, -r0.xyzx
mad r0.xyz, r1.wwww, r2.xyzx, r0.xyzx
mad r2.xyz, cb2[26].xxxx, r3.yzwy, -r0.xyzx
mad r0.xyz, r0.wwww, r2.xyzx, r0.xyzx
div r0.w, l(1.000000, 1.000000, 1.000000, 1.000000), cb2[20].y
add r0.w, -r0.w, v0.w
rcp r1.w, cb2[96].x
mul r0.w, r0.w, r1.w
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
mul r0.x, r2.w, cb1[r3.x + 3].x
mad r0.y, r2.w, cb1[r3.x + 3].x, -cb1[2].x
min r0.y, r0.y, l(0.000000)
lt r0.y, r0.y, l(0.000000)
discard_nz r0.y
mov o0.w, r0.x
ret 
// Approximately 498 instruction slots used
