//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//   using 3Dmigoto v1.2.31 on Wed Mar 02 08:07:24 2016
//
//
// Buffer Definitions: 
//
// cbuffer CViewportShaderParameterProvider
// {
//
//   float4x4 InvProjectionMatrix;      // Offset:    0 Size:    64 [unused]
//   float4x4 InvViewMatrix;            // Offset:   64 Size:    64 [unused]
//   float4x4 ProjectionMatrix;         // Offset:  128 Size:    64 [unused]
//   float4x4 ViewMatrix;               // Offset:  192 Size:    64 [unused]
//   float4x4 ViewProjectionMatrix;     // Offset:  256 Size:    64 [unused]
//   float4x4 ViewRotProjectionMatrix;  // Offset:  320 Size:    64
//   float4x4 ViewRotProjectionMatrix_Previous;// Offset:  384 Size:    64 [unused]
//   float4 AmbientSHR;                 // Offset:  448 Size:    16 [unused]
//   float4 AmbientSHG;                 // Offset:  464 Size:    16 [unused]
//   float4 AmbientSHB;                 // Offset:  480 Size:    16 [unused]
//   float4 CameraDistances;            // Offset:  496 Size:    16 [unused]
//   float4 CameraNearPlaneSize;        // Offset:  512 Size:    16 [unused]
//   float4 DepthScale;                 // Offset:  528 Size:    16 [unused]
//   float4 DepthTextureScaleOffset;    // Offset:  544 Size:    16 [unused]
//   float4 FogParams;                  // Offset:  560 Size:    16
//   float4 FogSHB;                     // Offset:  576 Size:    16
//   float4 FogSHG;                     // Offset:  592 Size:    16
//   float4 FogSHR;                     // Offset:  608 Size:    16
//   float4 HeightFogParams;            // Offset:  624 Size:    16
//   float4 ViewportSize;               // Offset:  640 Size:    16
//   float3 ViewPoint;                  // Offset:  656 Size:    12 [unused]
//   float3 CameraPosition;             // Offset:  672 Size:    12
//   float3 CameraPosition_Previous;    // Offset:  688 Size:    12 [unused]
//   float3 CameraPositionFractions;    // Offset:  704 Size:    12 [unused]
//   float3 CameraPositionFractions_Previous;// Offset:  720 Size:    12 [unused]
//   float3 CameraRight;                // Offset:  736 Size:    12 [unused]
//   float3 CameraUp;                   // Offset:  752 Size:    12 [unused]
//   float3 CameraDirection;            // Offset:  768 Size:    12 [unused]
//   float3 EnvironmentMapColorOffset;  // Offset:  784 Size:    12 [unused]
//   float3 EnvironmentMapColorScale;   // Offset:  800 Size:    12 [unused]
//   float3 AmbientOcclusionRanges;     // Offset:  816 Size:    12 [unused]
//   float3 DepthTextureRcpSize;        // Offset:  832 Size:    12 [unused]
//   float2 MotionVectorOffsets;        // Offset:  848 Size:     8 [unused]
//   float2 DepthRangeCompression;      // Offset:  856 Size:     8
//   float ShadowProjDepthMinValue;     // Offset:  864 Size:     4 [unused]
//   float DistanceScale;               // Offset:  868 Size:     4 [unused]
//   float WorldSpaceZOffset;           // Offset:  872 Size:     4
//   float WorldSpaceZOffset_Previous;  // Offset:  876 Size:     4 [unused]
//   float CameraFOVDeg;                // Offset:  880 Size:     4 [unused]
//   float EffectsEmissiveEVBias;       // Offset:  884 Size:     4 [unused]
//   float ShadowCSMLastSliceIndex;     // Offset:  888 Size:     4 [unused]
//   float UseNormalization;            // Offset:  892 Size:     4 [unused]
//   float FogUndergroundColorScale;    // Offset:  896 Size:     4
//
// }
//
// cbuffer CUserClipPlaneParameterProvider
// {
//
//   float4 UserClipPlane;              // Offset:    0 Size:    16
//
// }
//
// cbuffer CSceneTerrainSkyOcclusionAtlasPrivateData
// {
//
//   float4 SectorOcclusion_OffsetScale;// Offset:    0 Size:    16
//   float3 SectorOcclusion_DistanceFade;// Offset:   16 Size:    12
//   float2 SectorOcclusion_HeightOffsetScale;// Offset:   32 Size:     8
//
// }
//
// cbuffer CAmbientProvider
// {
//
//   float4 CascadeDistanceScales[5];   // Offset:    0 Size:    80
//   float4 CascadeNearFarSnappedOffsetCamera[5];// Offset:   80 Size:    80
//   float4 CascadeNearFarRcpUVSize[5]; // Offset:  160 Size:    80
//   float4 UndergroundSHR;             // Offset:  240 Size:    16
//   float4 UndergroundSHG;             // Offset:  256 Size:    16
//   float4 UndergroundSHB;             // Offset:  272 Size:    16
//   float InvUndergroundBlendEndHeight;// Offset:  288 Size:     4
//   float IndirectLightingScale;       // Offset:  292 Size:     4 [unused]
//
// }
//
// cbuffer CWaterCameraPlaneParameterProvider
// {
//
//   float4 QuadParams;                 // Offset:    0 Size:    16 [unused]
//   float4 UnderwaterCaustics;         // Offset:   16 Size:    16 [unused]
//   float4 UnderwaterExtinctions;      // Offset:   32 Size:    16
//   float3 UnderwaterColorDeep;        // Offset:   48 Size:    12
//   float3 UnderwaterColorShallow;     // Offset:   64 Size:    12
//   float CausticsIntensity;           // Offset:   76 Size:     4 [unused]
//   float WaterLevel;                  // Offset:   80 Size:     4
//
// }
//
// cbuffer CSceneParticleEmitterRendererParameterProvider
// {
//
//   float4 DebugColor;                 // Offset:    0 Size:    16 [unused]
//   float4 FarSoftDistanceRange_oneOverSoftRange;// Offset:   16 Size:    16 [unused]
//   float4 NearFadeDistanceParams;     // Offset:   32 Size:    16 [unused]
//   float4 SHCoeffB;                   // Offset:   48 Size:    16 [unused]
//   float4 SHCoeffG;                   // Offset:   64 Size:    16 [unused]
//   float4 SHCoeffR;                   // Offset:   80 Size:    16 [unused]
//   float4 SoftClipPlane;              // Offset:   96 Size:    16 [unused]
//   float2 EmitterAttributes;          // Offset:  112 Size:     8 [unused]
//   float2 UVNormalScale;              // Offset:  120 Size:     8 [unused]
//   float3 EmitterWorldPos;            // Offset:  128 Size:    12 [unused]
//   bool AlphaInRedChannel;            // Offset:  140 Size:     4 [unused]
//   float3 LightColorUpNormalUnderwater;// Offset:  144 Size:    12
//
// }
//
// cbuffer CSceneParticleAttributesParameterProvider
// {
//
//   float4 DistortionSpeedTiling;      // Offset:    0 Size:    16 [unused]
//   float4 ParticleAttributes0;        // Offset:   16 Size:    16 [unused]
//   float ForwardScattering;           // Offset:   32 Size:     4 [unused]
//   float BackScattering;              // Offset:   36 Size:     4 [unused]
//   float Smoothness;                  // Offset:   40 Size:     4
//   float Metallic;                    // Offset:   44 Size:     4 [unused]
//   float Reflectance;                 // Offset:   48 Size:     4 [unused]
//
// }
//
// cbuffer CTileLightingBlendedParameterProvider
// {
//
//   float4 CSMSlice0_0;                // Offset:    0 Size:    16 [unused]
//   float4 CSMSlice0_1;                // Offset:   16 Size:    16 [unused]
//   float4 CSMSlice0_2;                // Offset:   32 Size:    16 [unused]
//   float4 CSMSlice1_0;                // Offset:   48 Size:    16 [unused]
//   float4 CSMSlice1_1;                // Offset:   64 Size:    16 [unused]
//   float4 CSMSlice1_2;                // Offset:   80 Size:    16 [unused]
//   float4 CSMSlice2_0;                // Offset:   96 Size:    16 [unused]
//   float4 CSMSlice2_1;                // Offset:  112 Size:    16 [unused]
//   float4 CSMSlice2_2;                // Offset:  128 Size:    16 [unused]
//   float4 CSMSliceFade;               // Offset:  144 Size:    16 [unused]
//   float4 ShadowMapSize;              // Offset:  160 Size:    16 [unused]
//   float4 SunColor;                   // Offset:  176 Size:    16
//   float4 SunDirection;               // Offset:  192 Size:    16
//   int2 NumTiles;                     // Offset:  208 Size:     8
//   int LightCount;                    // Offset:  216 Size:     4 [unused]
//   int ParticlesSmallBufferFactor;    // Offset:  220 Size:     4
//
// }
//
// Resource bind info for SkyParamBuffer
// {
//
//   struct ComputedSkyParameters
//   {
//       
//       float r[9];                    // Offset:    0
//       float g[9];                    // Offset:   36
//       float b[9];                    // Offset:   72
//       float3 sunColor;               // Offset:  108
//       float3 moonColor;              // Offset:  120
//
//   } $Element;                        // Offset:    0 Size:   132
//
// }
//
// Resource bind info for LightsLightingData
// {
//
//   struct LightingData
//   {
//       
//       float4 pos;                    // Offset:    0
//       float4 color;                  // Offset:   16
//       float4 direction;              // Offset:   32
//       float attenuation;             // Offset:   48
//       float2 spotFactors;            // Offset:   52
//       uint flags;                    // Offset:   60
//       float4 clippingInfo;           // Offset:   64
//       float4 clipPlanes[3];          // Offset:   80
//
//   } $Element;                        // Offset:    0 Size:   128
//
// }
//
// Resource bind info for LightIndicesPerTileForBlended
// {
//
//   uint $Element;                     // Offset:    0 Size:     4
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// LinearVolumeSamplerState          sampler      NA          NA    0        1
// SectorHemiMapSamplerStateLinear    sampler      NA          NA    1        1
// SHOccTextureR                     texture  float4          3d    0        1
// SHOccTextureG                     texture  float4          3d    1        1
// SHOccTextureB                     texture  float4          3d    2        1
// SkyParamBuffer                    texture  struct         r/o    3        1
// SectorOcclusion_HeightTexture__TexObj__    texture  float4          2d    4        1
// LightsLightingData                texture  struct         r/o    5        1
// LightIndicesPerTileForBlended     texture  struct         r/o    6        1
// CViewportShaderParameterProvider    cbuffer      NA          NA    0        1
// CUserClipPlaneParameterProvider    cbuffer      NA          NA    1        1
// CSceneTerrainSkyOcclusionAtlasPrivateData    cbuffer      NA          NA    2        1
// CAmbientProvider                  cbuffer      NA          NA    3        1
// CWaterCameraPlaneParameterProvider    cbuffer      NA          NA    4        1
// CSceneParticleEmitterRendererParameterProvider    cbuffer      NA          NA    5        1
// CSceneParticleAttributesParameterProvider    cbuffer      NA          NA    6        1
// CTileLightingBlendedParameterProvider    cbuffer      NA          NA    7        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// position                 0   xyzw        0     NONE   float   xyz 
// color                    0   xyzw        1     NONE   float   xyzw
// texcoord                 0   xy          2     NONE   float   xy  
// texcoord                 1   x           3     NONE   float   x   
// blendweight              0   xyzw        4     NONE   float   xyz 
// normal                   0   xyzw        5     NONE   float   xyzw
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xyzw
// SV_ClipDistance          0   x           1  CLIPDST   float   x   
// TEXCOORD                 0   xyzw        2     NONE   float   xyzw
// TEXCOORD                 1   xyzw        3     NONE   float   xyzw
// TEXCOORD                 2   xyzw        4     NONE   float   xyzw
// TEXCOORD                 3   xyzw        5     NONE   float   xyzw
// TEXCOORD                 4   xyzw        6     NONE   float   xyzw
// TEXCOORD                 5   xyz         7     NONE   float   xyz 
// TEXCOORD                 6   xyz         8     NONE   float   xyz 
// TEXCOORD                 7   xyz         9     NONE   float   xyz 
// TEXCOORD                 8   xyz        10     NONE   float   xyz 
// TEXCOORD                 9   xyzw       11     NONE   float   xyzw
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[57], immediateIndexed
dcl_constantbuffer cb1[1], immediateIndexed
dcl_constantbuffer cb2[3], immediateIndexed
dcl_constantbuffer cb3[19], dynamicIndexed
dcl_constantbuffer cb4[6], immediateIndexed
dcl_constantbuffer cb5[10], immediateIndexed
dcl_constantbuffer cb6[3], immediateIndexed
dcl_constantbuffer cb7[14], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_resource_texture3d (float,float,float,float) t0
dcl_resource_texture3d (float,float,float,float) t1
dcl_resource_texture3d (float,float,float,float) t2
dcl_resource_structured t3, 132 
dcl_resource_texture2d (float,float,float,float) t4
dcl_resource_structured t5, 128 
dcl_resource_structured t6, 4 
dcl_input v0.xyz
dcl_input v1.xyzw
dcl_input v2.xy
dcl_input v3.x
dcl_input v4.xyz
dcl_input v5.xyzw
dcl_output_siv o0.xyzw, position
dcl_output_siv o1.x, clip_distance
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_output o4.xyzw
dcl_output o5.xyzw
dcl_output o6.xyzw
dcl_output o7.xyz
dcl_output o8.xyz
dcl_output o9.xyz
dcl_output o10.xyz
dcl_output o11.xyzw
dcl_temps 16

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

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

add r0.xyz, -v0.xyzx, cb0[42].xyzx
dp3 r0.w, r0.xyzx, r0.xyzx
sqrt r0.w, r0.w
div r0.xyz, r0.xyzx, r0.wwww
add r0.w, r0.w, l(-2000.000000)
mul_sat r0.w, r0.w, l(0.000333333330)
mul r0.w, r0.w, l(250.000000)
mad r0.xyz, r0.xyzx, r0.wwww, v0.xyzx
add r1.xyz, r0.xyzx, -cb0[42].xyzx
dp3 r0.w, r1.xyzx, r1.xyzx
rsq r0.w, r0.w
mul r1.xyz, r0.wwww, r1.xyzx
mad r0.xyz, r1.xyzx, cb0[54].zzzz, r0.xyzx
add r0.xyz, r0.xyzx, -cb0[42].xyzx
dp3 r0.w, r0.xyzx, r0.xyzx
sqrt r1.x, r0.w
add r1.y, r1.x, -cb0[53].z
max r1.y, r1.y, l(0.000000)
add r1.x, -r1.y, r1.x
mad r1.x, r1.y, cb0[53].w, r1.x
rsq r0.w, r0.w
mul r0.xyz, r0.wwww, r0.xyzx
mul r2.xyz, r1.xxxx, r0.xyzx
mad r0.xyz, r0.xyzx, r1.xxxx, cb0[42].xyzx
mov r2.w, l(1.000000)
dp4 r1.x, r2.xyzw, cb0[20].xyzw
dp4 r1.y, r2.xyzw, cb0[21].xyzw
dp4 o0.z, r2.xyzw, cb0[22].xyzw
dp4 r1.w, r2.xyzw, cb0[23].xyzw
mad r3.xyz, v5.xyzx, l(2.000000, 2.000000, 2.000000, 0.000000), l(-1.000000, -1.000000, -1.000000, 0.000000)
lt r4.xy, l(0.000000, 0.000000, 0.000000, 0.000000), cb0[39].zwzz
and r1.z, r4.y, r4.x
if_nz r1.z
  mov o2.xyzw, l(0,0,0,0)
else 
  dp3 r1.z, r2.xyzx, r2.xyzx
  rsq r2.w, r1.z
  mul r4.yzw, r2.wwww, r2.yyzx
  mov r4.x, l(1.000000)
  dp4 r5.x, cb0[38].xyzw, r4.xyzw
  dp4 r5.y, cb0[37].xyzw, r4.xyzw
  dp4 r5.z, cb0[36].xyzw, r4.xyzw
  max r5.xyz, r5.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
  mad r6.xy, r0.yxyy, cb2[0].yxyy, cb2[0].wzww
  sample_l_indexable(texture2d)(float,float,float,float) r2.w, r6.xyxx, t4.xzwy, s1, l(0.000000)
  mad r2.w, r2.w, cb2[2].x, cb2[2].y
  add r2.w, r0.z, -r2.w
  mul_sat r2.w, -r2.w, cb3[18].x
  sqrt r2.w, r2.w
  dp2 r3.w, r2.xyxx, r2.xyxx
  mad r3.w, cb2[1].x, r3.w, cb2[1].y
  mul_sat r3.w, r3.w, l(3.000000)
  mul r2.w, r2.w, r3.w
  dp4 r6.x, cb3[15].xyzw, r4.xyzw
  dp4 r6.y, cb3[16].xyzw, r4.xyzw
  dp4 r6.z, cb3[17].xyzw, r4.xyzw
  max r4.xyz, r6.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
  mad r4.xyz, r4.xyzx, cb0[56].xxxx, -r5.xyzx
  mad r4.xyz, r2.wwww, r4.xyzx, r5.xyzx
  sqrt r1.z, r1.z
  mad_sat r1.z, r1.z, cb0[35].y, cb0[35].x
  mul r2.w, r2.z, cb0[39].y
  max r2.w, r2.w, l(-125.000000)
  lt r3.w, l(0.000001), |r2.w|
  exp r4.w, -r2.w
  add r4.w, -r4.w, l(1.000000)
  div r2.w, r4.w, r2.w
  movc r2.w, r3.w, r2.w, l(1.000000)
  mad r2.w, r2.w, cb0[39].x, cb0[35].w
  mul r1.z, r1.z, r2.w
  mul r1.z, r1.z, -cb0[35].z
  exp r1.z, r1.z
  mad o2.xyz, -r4.xyzx, r1.zzzz, r4.xyzx
  mov o2.w, r1.z
endif 
mul o3.w, v1.w, v5.w

// Relocated to here with asmtool.py
mov o0.xyw, r1.xyxw

// Automatic vertex shader halo fix inserted with DarkStarSword's asmtool.py:
// asmtool.py -i --auto-fix-vertex-halo --only-autofixed e2683388e3580e80-vs.txt
ne r15.w, r1.w, l(1.0)
if_nz r15.w
  add r15.w, r1.w, -r15.y
  mad r1.x, r15.w, r15.x, r1.x
endif

div r4.xy, r1.xyxx, r1.wwww
mad r4.xy, r4.xyxx, l(1.000000, -1.000000, 0.000000, 0.000000), l(1.000000, 1.000000, 0.000000, 0.000000)
mul r4.xy, r4.xyxx, cb0[40].xyxx
mul r4.xy, r4.xyxx, l(0.250000, 0.250000, 0.000000, 0.000000)
ftou r4.xy, r4.xyxx
imul null, r4.xy, r4.xyxx, cb7[13].wwww
ushr r4.xy, r4.xyxx, l(3, 3, 0, 0)
imad r1.z, r4.y, cb7[13].x, r4.x
mad r2.w, -cb6[2].z, l(0.990000), l(1.000000)
mul r2.w, r2.w, r2.w
max r2.w, r2.w, l(0.001000)
add r4.xyz, -r0.xyzx, cb0[42].xyzx
dp3 r3.w, r4.xyzx, r4.xyzx
rsq r3.w, r3.w
mul r5.xyz, r3.wwww, r4.xyzx
dp3 r4.w, r3.xyzx, r3.xyzx
rsq r4.w, r4.w
mul r3.xyz, r3.xyzx, r4.wwww
mad r6.xyz, r4.xyzx, r3.wwww, -cb7[12].xyzx
dp3 r4.w, r6.xyzx, r6.xyzx
rsq r4.w, r4.w
mul r6.xyz, r4.wwww, r6.xyzx
dp3_sat r4.w, r3.xyzx, -cb7[12].xyzx
mul r7.xyz, r4.wwww, cb7[11].xyzx
dp3_sat r4.w, -r3.xyzx, cb7[12].xyzx
dp3_sat r5.w, r6.xyzx, r3.xyzx
mul r6.x, r2.w, r2.w
mad r6.y, r2.w, r2.w, l(-1.000000)
mul r5.w, r5.w, r5.w
mad r5.w, r5.w, r6.y, l(1.000000)
div r5.w, r2.w, r5.w
mul r5.w, r5.w, r5.w
mul r8.xyz, r5.wwww, cb7[11].xyzx
mul r8.xyz, r4.wwww, r8.xyzx
dp3_sat r5.x, r5.xyzx, r3.xyzx
mul r5.y, r5.x, r5.x
mad r5.z, -r2.w, r2.w, l(1.000000)
mad r5.y, r5.y, r5.z, r6.x
sqrt r5.y, r5.y
add r5.x, r5.y, r5.x
div r5.x, l(1.000000, 1.000000, 1.000000, 1.000000), r5.x
mul r8.xyz, r5.xxxx, r8.xyzx
mul r5.y, r4.w, r4.w
mad r5.y, r5.y, r5.z, r6.x
sqrt r5.y, r5.y
add r4.w, r4.w, r5.y
div r4.w, l(1.000000, 1.000000, 1.000000, 1.000000), r4.w
mul r8.xyz, r4.wwww, r8.xyzx
ishl r4.w, r1.z, l(1)
ld_structured_indexable(structured_buffer, stride=4)(mixed,mixed,mixed,mixed) r4.w, r4.w, l(0), t6.xxxx
countbits r5.y, r4.w
mov r9.xyz, r7.xyzx
mov r10.xyz, r8.xyzx
mov r5.w, r4.w
mov r6.z, l(0)
loop 
  uge r6.w, r6.z, r5.y
  breakc_nz r6.w
  firstbit_lo r6.w, r5.w
  ishl r7.w, l(1), r6.w
  not r7.w, r7.w
  and r5.w, r5.w, r7.w
  ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r11.xyzw, r6.w, l(48), t5.xyzw
  and r7.w, r11.w, l(1)
  ult r7.w, l(0), r7.w
  ieq r8.w, r7.w, l(0)
  or r8.w, r7.w, r8.w
  if_nz r8.w
    ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r12.xyzw, r6.w, l(0), t5.xyzw
    ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r13.xyz, r6.w, l(16), t5.xyzx
    ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r14.xyz, r6.w, l(32), t5.xyzx
    add r12.xyz, r0.xyzx, -r12.xyzx
    dp3 r6.w, r12.xyzx, r12.xyzx
    max r8.w, r6.w, l(0.000010)
    div r9.w, l(1.000000, 1.000000, 1.000000, 1.000000), r8.w
    min r9.w, r9.w, r12.w
    mul r8.w, r8.w, r8.w
    mad_sat r8.w, -r8.w, r11.x, l(1.000000)
    mul r8.w, r8.w, r8.w
    mul r8.w, r8.w, r9.w
    mul r13.xyz, r8.wwww, r13.xyzx
    rsq r6.w, r6.w
    mul r12.xyz, r6.wwww, r12.xyzx
    dp3 r6.w, r12.xyzx, r14.xyzx
    mad_sat r6.w, r6.w, r11.y, r11.z
    mul r6.w, r6.w, r6.w
    mul r11.xyz, r13.xyzx, r6.wwww
    movc r11.xyz, r7.wwww, r11.xyzx, r13.xyzx
  else 
    mov r12.xyz, l(0,0,1.000000,0)
    mov r11.xyz, l(0,0,0,0)
  endif 
  mad r13.xyz, r4.xyzx, r3.wwww, -r12.xyzx
  dp3 r6.w, r13.xyzx, r13.xyzx
  rsq r6.w, r6.w
  mul r13.xyz, r6.wwww, r13.xyzx
  dp3_sat r6.w, r3.xyzx, -r12.xyzx
  mad r9.xyz, r6.wwww, r11.xyzx, r9.xyzx
  dp3_sat r6.w, -r3.xyzx, r12.xyzx
  dp3_sat r7.w, r13.xyzx, r3.xyzx
  mul r7.w, r7.w, r7.w
  mad r7.w, r7.w, r6.y, l(1.000000)
  div r7.w, r2.w, r7.w
  mul r7.w, r7.w, r7.w
  mul r11.xyz, r7.wwww, r11.xyzx
  mul r11.xyz, r6.wwww, r11.xyzx
  mul r11.xyz, r5.xxxx, r11.xyzx
  mul r7.w, r6.w, r6.w
  mad r7.w, r7.w, r5.z, r6.x
  sqrt r7.w, r7.w
  add r6.w, r6.w, r7.w
  div r6.w, l(1.000000, 1.000000, 1.000000, 1.000000), r6.w
  mad r10.xyz, r11.xyzx, r6.wwww, r10.xyzx
  iadd r6.z, r6.z, l(1)
endloop 
bfi r1.z, l(31), l(1), r1.z, l(1)
ld_structured_indexable(structured_buffer, stride=4)(mixed,mixed,mixed,mixed) r1.z, r1.z, l(0), t6.xxxx
countbits r4.w, r1.z
mov r7.xyz, r9.xyzx
mov r8.xyz, r10.xyzx
mov r5.y, r1.z
mov r5.w, l(0)
loop 
  uge r6.z, r5.w, r4.w
  breakc_nz r6.z
  firstbit_lo r6.z, r5.y
  ishl r6.w, l(1), r6.z
  not r6.w, r6.w
  and r5.y, r5.y, r6.w
  iadd r6.z, l(32), r6.z
  ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r11.xyzw, r6.z, l(48), t5.xyzw
  and r6.w, r11.w, l(1)
  ult r6.w, l(0), r6.w
  ieq r7.w, r6.w, l(0)
  or r7.w, r6.w, r7.w
  if_nz r7.w
    ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r12.xyzw, r6.z, l(0), t5.xyzw
    ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r13.xyz, r6.z, l(16), t5.xyzx
    ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r14.xyz, r6.z, l(32), t5.xyzx
    add r12.xyz, r0.xyzx, -r12.xyzx
    dp3 r6.z, r12.xyzx, r12.xyzx
    max r7.w, r6.z, l(0.000010)
    div r8.w, l(1.000000, 1.000000, 1.000000, 1.000000), r7.w
    min r8.w, r8.w, r12.w
    mul r7.w, r7.w, r7.w
    mad_sat r7.w, -r7.w, r11.x, l(1.000000)
    mul r7.w, r7.w, r7.w
    mul r7.w, r7.w, r8.w
    mul r13.xyz, r7.wwww, r13.xyzx
    rsq r6.z, r6.z
    mul r12.xyz, r6.zzzz, r12.xyzx
    dp3 r6.z, r12.xyzx, r14.xyzx
    mad_sat r6.z, r6.z, r11.y, r11.z
    mul r6.z, r6.z, r6.z
    mul r11.xyz, r13.xyzx, r6.zzzz
    movc r11.xyz, r6.wwww, r11.xyzx, r13.xyzx
  else 
    mov r12.xyz, l(0,0,1.000000,0)
    mov r11.xyz, l(0,0,0,0)
  endif 
  mad r13.xyz, r4.xyzx, r3.wwww, -r12.xyzx
  dp3 r6.z, r13.xyzx, r13.xyzx
  rsq r6.z, r6.z
  mul r13.xyz, r6.zzzz, r13.xyzx
  dp3_sat r6.z, r3.xyzx, -r12.xyzx
  mad r7.xyz, r6.zzzz, r11.xyzx, r7.xyzx
  dp3_sat r6.z, -r3.xyzx, r12.xyzx
  dp3_sat r6.w, r13.xyzx, r3.xyzx
  mul r6.w, r6.w, r6.w
  mad r6.w, r6.w, r6.y, l(1.000000)
  div r6.w, r2.w, r6.w
  mul r6.w, r6.w, r6.w
  mul r11.xyz, r6.wwww, r11.xyzx
  mul r11.xyz, r6.zzzz, r11.xyzx
  mul r11.xyz, r5.xxxx, r11.xyzx
  mul r6.w, r6.z, r6.z
  mad r6.w, r6.w, r5.z, r6.x
  sqrt r6.w, r6.w
  add r6.z, r6.w, r6.z
  div r6.z, l(1.000000, 1.000000, 1.000000, 1.000000), r6.z
  mad r8.xyz, r11.xyzx, r6.zzzz, r8.xyzx
  iadd r5.w, r5.w, l(1)
endloop 
mov o7.xyz, r7.xyzx
mov o8.xyz, r8.xyzx
dp2 r1.z, r2.xyxx, r2.xyxx
sqrt r2.w, r1.z
lt r3.x, r2.w, cb3[2].y
movc r3.x, r3.x, l(2), l(3)
lt r3.y, r2.w, cb3[1].y
movc r3.x, r3.y, l(1), r3.x
lt r3.y, r2.w, cb3[0].y
movc r3.x, r3.y, l(0), r3.x
add r4.xyzw, r0.xyxy, -cb3[r3.x + 5].xyzw
mul r4.xyzw, r4.xyzw, cb3[r3.x + 10].xxyy
utof r3.y, r3.x
add r3.yz, r3.yyyy, l(0.000000, 0.500000, 1.500000, 0.000000)
mul r5.xz, r3.yyzy, l(0.200000, 0.000000, 0.200000, 0.000000)
mov r5.yw, r4.xxxy
sample_l_indexable(texture3d)(float,float,float,float) r6.xyzw, r5.ywxy, t0.xyzw, s0, l(0.000000)
sample_l_indexable(texture3d)(float,float,float,float) r7.xyzw, r5.ywxy, t1.xyzw, s0, l(0.000000)
sample_l_indexable(texture3d)(float,float,float,float) r8.xyzw, r5.ywxy, t2.xyzw, s0, l(0.000000)
mov r5.xy, r4.zwzz
sample_l_indexable(texture3d)(float,float,float,float) r4.xyzw, r5.xyzx, t0.xyzw, s0, l(0.000000)
sample_l_indexable(texture3d)(float,float,float,float) r9.xyzw, r5.xyzx, t1.xyzw, s0, l(0.000000)
sample_l_indexable(texture3d)(float,float,float,float) r5.xyzw, r5.xyzx, t2.xyzw, s0, l(0.000000)
mad_sat r2.w, r2.w, cb3[r3.x + 0].z, cb3[r3.x + 0].w
add r3.xyzw, -r6.xyzw, r4.xyzw
mad r3.xyzw, r2.wwww, r3.xyzw, r6.xyzw
add r4.xyzw, -r7.xyzw, r9.xyzw
mad r4.xyzw, r2.wwww, r4.xyzw, r7.xyzw
add r5.xyzw, -r8.xyzw, r5.xyzw
mad r5.xyzw, r2.wwww, r5.xyzw, r8.xyzw
ld_structured_indexable(structured_buffer, stride=132)(mixed,mixed,mixed,mixed) r6.xyzw, l(0), l(108), t3.xywz
dp3 r2.w, r6.xywx, l(0.212600, 0.715200, 0.072200, 0.000000)
ld_structured_indexable(structured_buffer, stride=132)(mixed,mixed,mixed,mixed) r6.xy, l(0), l(124), t3.xyxx
dp3 r6.x, r6.zxyz, l(0.212600, 0.715200, 0.072200, 0.000000)
max r2.w, r2.w, r6.x
ld_structured_indexable(structured_buffer, stride=132)(mixed,mixed,mixed,mixed) r6.x, l(0), l(0), t3.xxxx
ld_structured_indexable(structured_buffer, stride=132)(mixed,mixed,mixed,mixed) r6.y, l(0), l(36), t3.xxxx
ld_structured_indexable(structured_buffer, stride=132)(mixed,mixed,mixed,mixed) r6.z, l(0), l(72), t3.xxxx
max r6.y, r6.z, r6.y
max r6.x, r6.y, r6.x
add r2.w, r2.w, r6.x
mul r3.xyzw, r2.wwww, r3.xyzw
mul r4.xyzw, r2.wwww, r4.xyzw
mul r5.xyzw, r2.wwww, r5.xyzw
mov r6.x, l(1.000000)
mad r6.yzw, v5.yyzx, l(0.000000, 2.000000, 2.000000, 2.000000), l(0.000000, -1.000000, -1.000000, -1.000000)
mul r6.xyzw, r6.xyzw, l(0.282094806, 0.488602519, 0.488602519, 0.488602519)
dp4 r3.x, r3.xyzw, r6.xyzw
dp4 r3.y, r4.xyzw, r6.xyzw
dp4 r3.z, r5.xyzw, r6.xyzw
max r3.xyz, r3.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
dp4 r4.x, cb3[15].xyzw, r6.xyzw
dp4 r4.y, cb3[16].xyzw, r6.xyzw
dp4 r4.z, cb3[17].xyzw, r6.xyzw
max r4.xyz, r4.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
mad r5.xy, r0.yxyy, cb2[0].yxyy, cb2[0].wzww
sample_l_indexable(texture2d)(float,float,float,float) r2.w, r5.xyxx, t4.xzwy, s1, l(0.000000)
mad r2.w, r2.w, cb2[2].x, cb2[2].y
add r2.w, r0.z, -r2.w
mul_sat r2.w, -r2.w, cb3[18].x
sqrt r2.w, r2.w
mad r1.z, cb2[1].x, r1.z, cb2[1].y
mul_sat r1.z, r1.z, l(3.000000)
mul r3.w, r2.w, r1.z
add r4.xyz, -r3.xyzx, r4.xyzx
mad o6.xyz, r3.wwww, r4.xyzx, r3.xyzx
mov r0.w, l(1.000000)
dp4 o1.x, cb1[0].xyzw, r0.xyzw
dp3 r0.w, r2.xyzx, r2.xyzx
sqrt r0.w, r0.w
mul r2.x, r0.w, -cb4[2].z
exp r2.x, r2.x
add r2.y, -r0.z, cb4[5].x
mul r2.y, r2.y, -cb4[2].w
exp r2.y, r2.y
min r2.y, r2.y, l(1.000000)
mul o6.w, r2.y, r2.x
mul r0.w, r0.w, l(-0.0432808511)
exp r0.w, r0.w
add r0.w, -r0.w, l(1.000000)
add r2.xyz, cb4[3].xyzx, -cb4[4].xyzx
mad o9.xyz, r0.wwww, r2.xyzx, cb4[4].xyzx
mad r0.w, -r1.z, r2.w, l(1.000000)
mul o10.xyz, r0.wwww, cb5[9].xyzx

// mov o0.xyw, r1.xyxw // Relocated from here with asmtool.py

mov o3.xyz, v1.xyzx
mov o4.xyz, r0.xyzx
mov o4.w, v3.x
mad o5.xyz, v5.xyzx, l(2.000000, 2.000000, 2.000000, 0.000000), l(-1.000000, -1.000000, -1.000000, 0.000000)
mov o5.w, v4.z
mov o11.xy, v2.xyxx
mov o11.zw, v4.xxxy
ret 
// Approximately 352 instruction slots used