//0a6b0280b3c318dd-ps.txt
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.17672
//
//   using 3Dmigoto v1.2.27 on Thu Feb 04 22:07:47 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_n139_n198_fogCube_texture    texture  float4        cube    1        1
// p_default_Material_n151_n183_DepthBufferTexture_texture    texture  float4          2d    2        1
// p_default_Material_n151_n178_Texture_texture    texture  float4        cube    3        1
// p_default_Setup_n22_05602DE49167171_Param_texture    texture  float4          2d    4        1
// p_default_Material_n146_n158_DepthBufferTexture_texture    texture  float4          2d    5        1
// p_default_Setup_98031E0013807502_Param_texture    texture  float4          2d    6        1
// p_default_Material_n151_n183_OpaquesOnlyTexture_texture    texture  float4          2d    7        1
// p_default_Setup_98FB7CC08930578_cp0_Param_texture    texture  float4          2d    8        1
// p_default_Setup_n3_8FB12BF0685975_cp0_Param_texture    texture  float4          2d    9        1
// p_default_Setup_n3_DECAB8306147855_cp0_Param_texture    texture  float4          2d   10        1
// p_default_Setup_n16_DepthBufferTexture_texture    texture  float4          2d   11        1
// p_default_Material_n129_DepthBufferTexture_texture    texture  float4          2d   12        1
// p_default_Setup_n3_DECA25A07266119_cp0_Param_texture    texture  float4          2d   13        1
// p_default_Setup_n3_DECB27508110753_cp0_Param_texture    texture  float4          2d   14        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_texturecube (float,float,float,float) t1
dcl_resource_texture2d (float,float,float,float) t2
dcl_resource_texturecube (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) 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_texture2d (float,float,float,float) t11
dcl_resource_texture2d (float,float,float,float) t12
dcl_resource_texture2d (float,float,float,float) t13
dcl_resource_texture2d (float,float,float,float) t14
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 16
dcl_temps 18
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) r17.xyzw, l(0, 0, 0, 0), t125.xyzw
add r17.w, v0.w, -r17.y
mul r17.w, r17.w, r17.x
mul r17.w, r17.w, l(0.5)
add r3.x, r3.x, -r17.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) r17.xyzw, l(0, 0, 0, 0), t125.xyzw
add r17.w, v0.w, -r17.y
mul r17.w, r17.w, r17.x
mul r17.w, r17.w, cb2[81].x
add r5.x, r5.x, -r17.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, t4.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[12].x
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, t11.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 r2.zw, v1.xxxy, cb3[9].xxxy
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 r5.xy, r2.xxxx, r5.yzyy
mul r5.yzw, r3.xxyz, r5.yyyy
mad r5.xyz, r8.zxyz, r5.xxxx, r5.yzwy
lt r1.w, l(0.000000), |r1.w|
dp3 r2.y, r5.xyzx, r5.xyzx
rsq r2.y, r2.y
mul r10.xyw, r2.yyyy, r5.xyxz
movc r5.xyz, r1.wwww, r10.xywx, r5.xyzx
mul r10.xyw, r0.zxzy, r5.yzyx
mad r10.xyw, r0.yzyx, r5.zxzy, -r10.xyxw
mul r11.xyz, r0.zxyz, r8.xyzx
mad r8.xyz, r0.yzxy, r8.yzxy, -r11.xyzx
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, r10.xywx
mul_sat r0.w, r0.w, cb3[3].y
sample_indexable(texture2d)(float,float,float,float) r2.xy, r2.zwzz, t6.xyzw, s11
mad r8.xy, r2.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
mul r8.z, r8.y, cb3[11].w
mov r2.x, cb3[11].w
mov r2.y, l(-1.000000)
mul r2.xy, r2.xyxx, r8.xzxx
sample_indexable(texture2d)(float,float,float,float) r1.w, r2.zwzz, t8.yzwx, s11
mul r1.w, r1.w, cb3[11].z
mad r1.w, cb2[24].x, cb3[13].x, r1.w
frc r1.w, r1.w
mad r2.z, r1.w, l(2.000000), l(-1.000000)
add r8.xyz, r1.wwww, l(-0.500000, -1.000000, 0.500000, 0.000000)
lt r2.w, r8.x, l(0.000000)
movc r2.w, r2.w, r1.w, r8.y
lt r3.w, r1.w, l(0.500000)
movc r3.w, r3.w, r8.z, r8.x
mul r8.yz, r1.wwww, r2.xxyx
mul r10.xy, r2.xyxx, r3.wwww
add r1.w, cb3[13].z, -cb3[14].x
mad r1.w, r0.w, r1.w, cb3[14].x
mad r11.xy, cb3[7].zwzz, r9.xyxx, v1.xyxx
mul r11.zw, r11.xxxy, cb3[10].xxxy
mul r12.xy, cb2[24].xxxx, cb3[8].zwzz
mad r12.xy, r11.xyxx, cb3[11].xyxx, r12.xyxx
sample_indexable(texture2d)(float,float,float,float) r3.w, r12.xyxx, t10.yzwx, s11
mul r12.xyz, r3.wwww, cb3[6].xyzx
mad r13.xy, r11.xyxx, cb3[8].xyxx, -r8.yzyy
mad r13.zw, -r2.wwww, r2.xxxy, r11.zzzw
mad r8.yz, r11.xxyx, cb3[7].xxyx, -r8.yyzy
mad r14.xy, r11.xyxx, cb3[7].xyxx, -r10.xyxx
mad r2.xy, -r8.xxxx, r2.xyxx, r11.zwzz
mad r8.xw, r11.xxxy, cb3[8].xxxy, -r10.xxxy
sample_indexable(texture2d)(float,float,float,float) r10.xy, r13.xyxx, t13.xyzw, s11
mad r11.xy, r10.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
dp2 r2.w, r11.xyxx, r11.xyxx
add r2.w, -r2.w, l(1.000000)
max r2.w, r2.w, l(0.000000)
sqrt r11.z, r2.w
sample_indexable(texture2d)(float,float,float,float) r8.xw, r8.xwxx, t13.xzwy, s11
mad r15.xy, r8.xwxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
dp2 r2.w, r15.xyxx, r15.xyxx
add r2.w, -r2.w, l(1.000000)
max r2.w, r2.w, l(0.000000)
sqrt r15.z, r2.w
add r10.xyw, -r11.xyxz, r15.xyxz
mad r10.xyw, |r2.zzzz|, r10.xyxw, r11.xyxz
sample_indexable(texture2d)(float,float,float,float) r2.xyw, r2.xyxx, t9.xywz, s11
sample_indexable(texture2d)(float,float,float,float) r11.xyz, r13.zwzz, t9.xyzw, s11
add r11.xyz, -r2.xywx, r11.xyzx
mad r2.xyw, |r2.zzzz|, r11.xyxz, r2.xyxw
sample_indexable(texture2d)(float,float,float,float) r8.xy, r8.yzyy, t14.xyzw, s11
mad r8.xy, r8.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
dp2 r3.w, r8.xyxx, r8.xyxx
add r3.w, -r3.w, l(1.000000)
max r3.w, r3.w, l(0.000000)
sqrt r8.z, r3.w
sample_indexable(texture2d)(float,float,float,float) r11.xy, r14.xyxx, t14.xyzw, s11
mad r11.xy, r11.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
dp2 r3.w, r11.xyxx, r11.xyxx
add r3.w, -r3.w, l(1.000000)
max r3.w, r3.w, l(0.000000)
sqrt r11.z, r3.w
add r11.xyz, -r8.xyzx, r11.xyzx
mad r8.xyz, |r2.zzzz|, r11.xyzx, r8.xyzx
add r2.z, -r10.w, l(1.000000)
mul r10.xy, r10.xyxx, cb3[13].wwww
mad r10.w, -cb3[13].w, r2.z, l(1.000000)
dp3 r2.z, r10.xywx, r10.xywx
rsq r2.z, r2.z
mul r10.xyw, r2.zzzz, r10.xyxw
add r2.z, -r8.z, l(1.000000)
mul r8.xy, r8.xyxx, cb3[13].yyyy
mad r8.w, -cb3[13].y, r2.z, l(1.000000)
dp3 r2.z, r8.xywx, r8.xywx
rsq r2.z, r2.z
mad r8.xyz, r8.xywx, r2.zzzz, -r10.xywx
mad r8.xyz, cb3[12].wwww, r8.xyzx, r10.xywx
mov r9.z, l(0)
add r8.xyz, r8.xyzx, r9.xyzx
dp3 r2.z, r8.xyzx, r8.xyzx
rsq r2.z, r2.z
mul r8.xyz, r2.zzzz, r8.xyzx
mul r3.xyz, r3.xyzx, r8.yyyy
mad r3.xyz, r8.xxxx, r5.xyzx, r3.xyzx
mad r0.xyz, r8.zzzz, r0.xyzx, r3.xyzx
dp3 r2.z, r0.xyzx, r0.xyzx
rsq r2.z, r2.z
mul r0.xyz, r0.xyzx, r2.zzzz
and r3.xyz, r0.xyzx, l(0x7f800000, 0x7f800000, 0x7f800000, 0)
ine r3.xyz, r3.xyzx, l(0x7f800000, 0x7f800000, 0x7f800000, 0)
and r0.xyz, r0.xyzx, r3.xyzx
add r3.xyz, r4.xyzx, -cb2[10].xyzx
dp3 r2.z, r3.xyzx, cb2[11].xyzx
sample_indexable(texture2d)(float,float,float,float) r3.w, r1.xyxx, t5.yzwx, s10
mad r3.w, r3.w, cb2[20].x, cb2[20].y
max r3.w, r3.w, l(0.000001)
div r3.w, l(1.000000, 1.000000, 1.000000, 1.000000), r3.w
add r2.z, -r2.z, r3.w
max r2.z, r2.z, l(0.000000)
mul_sat r2.z, r2.z, cb3[1].y
mov r3.w, v3.x
mul r2.z, r2.z, cb1[r3.w + 3].x
add r4.xyw, -cb3[0].xyxz, cb3[2].xyxz
mad r4.xyw, r0.wwww, r4.xyxw, cb3[0].xyxz
add r5.x, cb3[5].w, -cb3[6].w
mad r5.x, r0.w, r5.x, cb3[6].w
add r5.yz, -cb3[9].zzwz, cb3[10].zzwz
mad r5.yz, r0.wwww, r5.yyzy, cb3[9].zzwz
add r0.xyz, r0.xyzx, l(-0.000000, -0.000000, -1.000000, 0.000000)
mad r0.xyz, cb3[12].yyyy, r0.xyzx, l(0.000000, 0.000000, 1.000000, 0.000000)
dp3 r0.w, r6.xyzx, r0.xyzx
mul r9.xyz, r0.xyzx, r0.wwww
mad r6.xyz, r9.xyzx, l(2.000000, 2.000000, 2.000000, 0.000000), -r6.xyzx
sample_indexable(texturecube)(float,float,float,float) r9.xyz, r6.xyzx, t3.xyzw, s11
add_sat r0.w, -r0.w, l(1.000000)
log r0.w, r0.w
mul r0.w, r0.w, cb3[12].z
exp r0.w, r0.w
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 r11.xyzw, r6.yyyy, cb0[1].xyzw
  mad r11.xyzw, r6.xxxx, cb0[0].xyzw, r11.xyzw
  mad r6.xyzw, r6.zzzz, cb0[2].xyzw, r11.xyzw
  add r7.xyz, r7.xyzx, -cb2[10].xyzx
  mul r11.xyzw, r7.yyyy, cb0[1].xyzw
  mad r11.xyzw, r7.xxxx, cb0[0].xyzw, r11.xyzw
  mad r7.xyzw, r7.zzzz, cb0[2].xyzw, r11.xyzw
  add r7.xyzw, r7.xyzw, cb0[3].xyzw
  mul r11.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), r11.xyzw
  mul r11.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), r11.xyzw
  mul r0.x, r0.x, l(0.594822109)
  div r10.xyw, -r7.xyxz, r6.xyxz
  add r11.xyz, -r7.xyzx, r7.wwww
  add r13.xyz, -r6.xyzx, r6.wwww
  div r11.xyz, -r11.xyzx, r13.xyzx
  lt r13.xyz, r10.xywx, l(0.000000, 0.000000, 0.000000, 0.000000)
  movc r10.xyw, r13.xyxz, l(10000000.000000,10000000.000000,0,10000000.000000), r10.xyxw
  lt r13.xyz, r11.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
  movc r11.xyz, r13.xyzx, l(10000000.000000,10000000.000000,10000000.000000,0), r11.xyzx
  min r10.xyw, r10.xyxw, r11.xyxz
  min r0.y, r10.w, r10.y
  min r0.y, r0.y, r10.x
  mov r0.z, l(0)
  mov r5.w, r0.x
  mov r10.x, l(0)
  mov r10.y, v0.z
  mov r11.x, l(0)
  mov r11.y, v0.z
  mov r8.zw, l(0,0,0,0)
  loop 
    ige r9.w, r8.w, l(10)
    breakc_nz r9.w
    add r9.w, r0.z, r5.w
    min r0.z, r0.y, r9.w
    mad r13.xyzw, r0.zzzz, r6.xyzw, r7.xyzw
    mul r5.w, r5.w, l(1.11111116)
    div r13.xyz, r13.xyzx, r13.wwww
    sample_l_indexable(texture2d)(float,float,float,float) r9.w, r13.xyxx, t2.yzwx, s10, l(0.000000)
    add r10.w, -r9.w, r13.z
    lt r10.w, l(0.000000), r10.w
    if_nz r10.w
      mov r8.z, l(1)
      mov r11.x, r0.z
      mov r11.y, r9.w
      break 
    endif 
    mov r10.x, r0.z
    mov r10.y, r9.w
    iadd r8.w, r8.w, l(1)
    mov r11.x, r0.z
    mov r11.y, r9.w
    mov r8.z, l(0)
  endloop 
  ilt r0.x, l(0), r8.z
  if_nz r0.x
    add r0.x, r10.x, r11.x
    mul r0.x, r0.x, l(0.500000)
    mad r13.xyzw, r0.xxxx, r6.xyzw, r7.xyzw
    div r13.xyz, r13.xyzx, r13.wwww
    sample_l_indexable(texture2d)(float,float,float,float) r0.y, r13.xyxx, t2.yxzw, s10, l(0.000000)
    add r0.z, -r0.y, r13.z
    lt r0.z, r0.z, l(0.000000)
    movc r8.zw, r0.zzzz, r0.xxxy, r10.xxxy
    movc r0.xy, r0.zzzz, r11.xyxx, r0.xyxx
    add r0.z, r0.x, r8.z
    mul r10.x, r0.z, l(0.500000)
    mad r11.xyzw, r10.xxxx, r6.xyzw, r7.xyzw
    div r11.xyz, r11.xyzx, r11.wwww
    sample_l_indexable(texture2d)(float,float,float,float) r10.y, r11.xyxx, t2.yxzw, s10, l(0.000000)
    add r0.z, -r10.y, r11.z
    lt r0.z, r0.z, l(0.000000)
    movc r8.zw, r0.zzzz, r10.xxxy, r8.zzzw
    movc r0.xy, r0.zzzz, r0.xyxx, r10.xyxx
    add r0.z, r0.x, r8.z
    mul r10.x, r0.z, l(0.500000)
    mad r11.xyzw, r10.xxxx, r6.xyzw, r7.xyzw
    div r11.xyz, r11.xyzx, r11.wwww
    sample_l_indexable(texture2d)(float,float,float,float) r10.y, r11.xyxx, t2.yxzw, s10, l(0.000000)
    add r0.z, -r10.y, r11.z
    lt r0.z, r0.z, l(0.000000)
    movc r8.zw, r0.zzzz, r10.xxxy, r8.zzzw
    movc r0.xy, r0.zzzz, r0.xyxx, r10.xyxx
    add r0.z, r0.x, r8.z
    mul r10.x, r0.z, l(0.500000)
    mad r11.xyzw, r10.xxxx, r6.xyzw, r7.xyzw
    div r11.xyz, r11.xyzx, r11.wwww
    sample_l_indexable(texture2d)(float,float,float,float) r10.y, r11.xyxx, t2.yxzw, s10, l(0.000000)
    add r0.z, -r10.y, r11.z
    lt r0.z, r0.z, l(0.000000)
    movc r8.zw, r0.zzzz, r10.xxxy, r8.zzzw
    movc r0.xy, r0.zzzz, r0.xyxx, r10.xyxx
    add r0.z, r0.x, r8.z
    mul r10.x, r0.z, l(0.500000)
    mad r11.xyzw, r10.xxxx, r6.xyzw, r7.xyzw
    div r11.xyz, r11.xyzx, r11.wwww
    sample_l_indexable(texture2d)(float,float,float,float) r10.y, r11.xyxx, t2.yxzw, s10, l(0.000000)
    add r0.z, -r10.y, r11.z
    lt r0.z, r0.z, l(0.000000)
    movc r8.zw, r0.zzzz, r10.xxxy, r8.zzzw
    movc r0.xy, r0.zzzz, r0.xyxx, r10.xyxx
    add r0.z, r0.x, r8.z
    mul r10.x, r0.z, l(0.500000)
    mad r11.xyzw, r10.xxxx, r6.xyzw, r7.xyzw
    div r11.xyz, r11.xyzx, r11.wwww
    sample_l_indexable(texture2d)(float,float,float,float) r10.y, r11.xyxx, t2.yxzw, s10, l(0.000000)
    add r0.z, -r10.y, r11.z
    lt r0.z, r0.z, l(0.000000)
    movc r8.zw, r0.zzzz, r10.xxxy, r8.zzzw
    movc r0.xy, r0.zzzz, r0.xyxx, r10.xyxx
    add r0.z, r0.x, r8.z
    mul r10.x, r0.z, l(0.500000)
    mad r11.xyzw, r10.xxxx, r6.xyzw, r7.xyzw
    div r11.xyz, r11.xyzx, r11.wwww
    sample_l_indexable(texture2d)(float,float,float,float) r10.y, r11.xyxx, t2.yxzw, s10, l(0.000000)
    add r0.z, -r10.y, r11.z
    lt r0.z, r0.z, l(0.000000)
    movc r8.zw, r0.zzzz, r10.xxxy, r8.zzzw
    movc r0.xy, r0.zzzz, r0.xyxx, r10.xyxx
    add r0.z, r0.x, r8.z
    mul r10.x, r0.z, l(0.500000)
    mad r11.xyzw, r10.xxxx, r6.xyzw, r7.xyzw
    div r11.xyz, r11.xyzx, r11.wwww
    sample_l_indexable(texture2d)(float,float,float,float) r10.y, r11.xyxx, t2.yxzw, s10, l(0.000000)
    add r0.z, -r10.y, r11.z
    lt r0.z, r0.z, l(0.000000)
    movc r8.zw, r0.zzzz, r10.xxxy, r8.zzzw
    movc r0.xy, r0.zzzz, r0.xyxx, r10.xyxx
    add r0.z, r0.x, r8.z
    mul r10.x, r0.z, l(0.500000)
    mad r11.xyzw, r10.xxxx, r6.xyzw, r7.xyzw
    div r11.xyz, r11.xyzx, r11.wwww
    sample_l_indexable(texture2d)(float,float,float,float) r10.y, r11.xyxx, t2.yxzw, s10, l(0.000000)
    add r0.z, -r10.y, r11.z
    lt r0.z, r0.z, l(0.000000)
    movc r8.zw, r0.zzzz, r10.xxxy, r8.zzzw
    movc r0.xy, r0.zzzz, r0.xyxx, r10.xyxx
    add r0.z, r0.x, r8.z
    mul r10.x, r0.z, l(0.500000)
    mad r11.xyzw, r10.xxxx, r6.xyzw, r7.xyzw
    div r11.xyz, r11.xyzx, r11.wwww
    sample_l_indexable(texture2d)(float,float,float,float) r10.y, r11.xyxx, t2.yxzw, s10, l(0.000000)
    add r0.z, -r10.y, r11.z
    lt r0.z, r0.z, l(0.000000)
    movc r8.zw, r0.zzzz, r10.xxxy, r8.zzzw
    movc r0.xy, r0.zzzz, r0.xyxx, r10.xyxx
    add r0.z, r0.x, r8.z
    mul r10.x, r0.z, l(0.500000)
    mad r11.xyzw, r10.xxxx, r6.xyzw, r7.xyzw
    div r11.xyz, r11.xyzx, r11.wwww
    sample_l_indexable(texture2d)(float,float,float,float) r10.y, r11.xyxx, t2.yxzw, s10, l(0.000000)
    add r0.z, -r10.y, r11.z
    lt r0.z, r0.z, l(0.000000)
    movc r8.zw, r0.zzzz, r10.xxxy, r8.zzzw
    movc r0.xy, r0.zzzz, r0.xyxx, r10.xyxx
    add r0.z, r0.x, r8.z
    mul r10.x, r0.z, l(0.500000)
    mad r11.xyzw, r10.xxxx, r6.xyzw, r7.xyzw
    div r11.xyz, r11.xyzx, r11.wwww
    sample_l_indexable(texture2d)(float,float,float,float) r10.y, r11.xyxx, t2.yxzw, s10, l(0.000000)
    add r0.z, -r10.y, r11.z
    lt r0.z, r0.z, l(0.000000)
    movc r8.zw, r0.zzzz, r10.xxxy, r8.zzzw
    movc r0.xy, r0.zzzz, r0.xyxx, r10.xyxx
    add r0.z, r0.x, r8.z
    mul r10.x, r0.z, l(0.500000)
    mad r11.xyzw, r10.xxxx, r6.xyzw, r7.xyzw
    div r11.xyz, r11.xyzx, r11.wwww
    sample_l_indexable(texture2d)(float,float,float,float) r10.y, r11.xyxx, t2.yxzw, s10, l(0.000000)
    add r0.z, -r10.y, r11.z
    lt r0.z, r0.z, l(0.000000)
    movc r8.zw, r0.zzzz, r10.xxxy, r8.zzzw
    movc r0.xy, r0.zzzz, r0.xyxx, r10.xyxx
    add r0.z, r0.x, r8.z
    mul r10.x, r0.z, l(0.500000)
    mad r11.xyzw, r10.xxxx, r6.xyzw, r7.xyzw
    div r11.xyz, r11.xyzx, r11.wwww
    sample_l_indexable(texture2d)(float,float,float,float) r10.y, r11.xyxx, t2.yxzw, s10, l(0.000000)
    add r0.z, -r10.y, r11.z
    lt r0.z, r0.z, l(0.000000)
    movc r8.zw, r0.zzzz, r10.xxxy, r8.zzzw
    movc r0.xy, r0.zzzz, r0.xyxx, r10.xyxx
    add r0.z, r0.x, r8.z
    mul r10.x, r0.z, l(0.500000)
    mad r11.xyzw, r10.xxxx, r6.xyzw, r7.xyzw
    div r11.xyz, r11.xyzx, r11.wwww
    sample_l_indexable(texture2d)(float,float,float,float) r10.y, r11.xyxx, t2.yxzw, s10, l(0.000000)
    add r0.z, -r10.y, r11.z
    lt r0.z, r0.z, l(0.000000)
    movc r8.zw, r0.zzzz, r10.xxxy, r8.zzzw
    movc r0.xy, r0.zzzz, r0.xyxx, r10.xyxx
    add r0.z, r0.x, r8.z
    mul r10.x, r0.z, l(0.500000)
    mad r11.xyzw, r10.xxxx, r6.xyzw, r7.xyzw
    div r11.xyz, r11.xyzx, r11.wwww
    sample_l_indexable(texture2d)(float,float,float,float) r10.y, r11.xyxx, t2.yxzw, s10, l(0.000000)
    add r0.z, -r10.y, r11.z
    lt r0.z, r0.z, l(0.000000)
    movc r8.zw, r0.zzzz, r10.xxxy, r8.zzzw
    movc r0.xy, r0.zzzz, r0.xyxx, r10.xyxx
    mad r10.xyw, r8.zzzz, r6.xyxw, r7.xyxw
    mad r6.xyz, r0.xxxx, r6.xywx, r7.xywx
    div r7.xy, r10.xyxx, r10.wwww
    div r6.xy, r6.xyxx, r6.zzzz
    mad r0.z, r8.w, cb2[20].x, cb2[20].y
    div r11.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 r11.xy, r11.zzzz, r0.yzyy

//View space correction, therefore need the InvProj._m00
ld_indexable(texture2d)(float,float,float,float) r17.xyzw, l(0, 0, 0, 0), t125.xyzw
add r17.w, r11.z, -r17.y
mul r17.w, r17.w, r17.x
mul r17.w, r17.w, cb2[81].x
add r11.x, r11.x, -r17.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) r17.xyzw, l(0, 0, 0, 0), t125.xyzw
add r17.w, r13.z, -r17.y
mul r17.w, r17.w, r17.x
mul r17.w, r17.w, cb2[81].x
add r13.x, r13.x, -r17.w


    add r7.xyz, r11.xyzx, -r13.xyzx
    dp3 r0.y, r7.xyzx, r7.xyzx
    sqrt r0.y, r0.y
    max r6.zw, r1.xxxy, r6.xxxy
    min r7.xy, r1.xyxx, r6.xyxx
    add r6.zw, -r6.zzzw, l(0.000000, 0.000000, 1.000000, 1.000000)
    mul_sat r7.xy, r7.xyxx, l(10.000000, 10.000000, 0.000000, 0.000000)
    mul_sat r6.zw, r6.zzzw, l(0.000000, 0.000000, 10.000000, 10.000000)
    mul r0.z, r6.z, r7.x
    mul r0.z, r7.y, r0.z
    mul r0.z, r6.w, r0.z
    mul r5.w, r0.x, l(-0.00721347518)
    exp r5.w, r5.w
    mad r5.w, r5.w, l(-99.900002), l(100.000000)
    lt r0.y, r0.y, r5.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, t7.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, -r9.xyzx, r6.xyzx
mad r0.xyz, r0.xxxx, r6.xyzx, r9.xyzx
mul r0.xyz, r0.wwww, r0.xyzx
mul r0.xyz, r0.xyzx, cb3[5].xyzx
mad_sat r5.yz, r8.xxyx, r5.yyzy, r1.xxyx
sample_indexable(texture2d)(float,float,float,float) r0.w, r5.yzyy, t12.yzwx, s10
mad r0.w, r0.w, cb2[20].x, cb2[20].y
max r0.w, r0.w, l(0.000001)
div r0.w, l(1.000000, 1.000000, 1.000000, 1.000000), r0.w
mul r0.xyz, r12.xyzx, r0.xyzx
mad r0.xyz, r2.xywx, cb3[4].xyzx, r0.xyzx
add r0.w, -r10.z, r0.w
lt r0.w, r0.w, l(0.000000)
movc r2.xy, r0.wwww, r1.xyxx, r5.yzyy
sample_l_indexable(texture2d)(float,float,float,float) r2.xyw, r2.xyxx, t0.xywz, s13, r5.x
mad r2.xyw, r2.xyxw, r4.xyxw, -r0.xyxz
mad r0.xyz, r1.wwww, r2.xywx, r0.xyzx
eq r0.w, cb2[95].w, l(0.000000)
movc r2.xyw, r0.wwww, cb2[95].xyxz, cb2[35].xyxz
max r2.xyw, r2.xyxw, l(0.000000, 0.000000, 0.000000, 0.000000)
log r2.xyw, r2.xyxw
mul r2.xyw, r2.xyxw, cb2[26].yyyy
exp r2.xyw, r2.xyxw
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, r3.xyzx, r3.xyzx
sqrt r1.w, r1.w
lt r4.x, l(0.000000), cb2[26].w
if_nz r4.x
  mul r4.xy, r3.xyxx, cb2[9].wwww
  mad r5.x, cb2[25].w, r3.y, r4.x
  mad r5.y, -cb2[25].w, r3.x, r4.y
  mov r5.z, r3.z
  sample_indexable(texturecube)(float,float,float,float) r3.xyz, r5.xyzx, t1.xyzw, s11
  add r3.xyz, r3.xyzx, -cb2[95].xyzx
  mad r3.xyz, cb2[26].wwww, r3.xyzx, cb2[95].xyzx
else 
  mov r3.xyz, cb2[95].xyzx
endif 
max r3.xyz, r3.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
log r3.xyz, r3.xyzx
mul r3.xyz, r3.xyzx, cb2[26].yyyy
exp r3.xyz, r3.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 r3.xyz, cb2[26].xxxx, r3.xyzx, -r0.xyzx
mad r0.xyz, r1.wwww, r3.xyzx, r0.xyzx
mad r2.xyw, cb2[26].xxxx, r2.xyxw, -r0.xyxz
mad r0.xyz, r0.wwww, r2.xywx, 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.z, cb1[r3.w + 3].x
mad r0.y, r2.z, cb1[r3.w + 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 526 instruction slots used
