//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//   using 3Dmigoto v1.2.31 on Wed Mar 02 08:06:56 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
//   float4 FogParams;                  // Offset:  560 Size:    16 [unused]
//   float4 FogSHB;                     // Offset:  576 Size:    16
//   float4 FogSHG;                     // Offset:  592 Size:    16
//   float4 FogSHR;                     // Offset:  608 Size:    16
//   float4 HeightFogParams;            // Offset:  624 Size:    16
//   float4 ViewportSize;               // Offset:  640 Size:    16 [unused]
//   float3 ViewPoint;                  // Offset:  656 Size:    12 [unused]
//   float3 CameraPosition;             // Offset:  672 Size:    12
//   float3 CameraPosition_Previous;    // Offset:  688 Size:    12 [unused]
//   float3 CameraPositionFractions;    // Offset:  704 Size:    12 [unused]
//   float3 CameraPositionFractions_Previous;// Offset:  720 Size:    12 [unused]
//   float3 CameraRight;                // Offset:  736 Size:    12 [unused]
//   float3 CameraUp;                   // Offset:  752 Size:    12 [unused]
//   float3 CameraDirection;            // Offset:  768 Size:    12
//   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 [unused]
//   float ShadowProjDepthMinValue;     // Offset:  864 Size:     4 [unused]
//   float DistanceScale;               // Offset:  868 Size:     4 [unused]
//   float WorldSpaceZOffset;           // Offset:  872 Size:     4 [unused]
//   float WorldSpaceZOffset_Previous;  // Offset:  876 Size:     4 [unused]
//   float CameraFOVDeg;                // Offset:  880 Size:     4 [unused]
//   float EffectsEmissiveEVBias;       // Offset:  884 Size:     4 [unused]
//   float ShadowCSMLastSliceIndex;     // Offset:  888 Size:     4 [unused]
//   float UseNormalization;            // Offset:  892 Size:     4 [unused]
//   float FogUndergroundColorScale;    // Offset:  896 Size:     4
//
// }
//
// cbuffer CGlobalShaderParameterProvider
// {
//
//   float4 BurnColor;                  // Offset:    0 Size:    16 [unused]
//   float4 BurnParams;                 // Offset:   16 Size:    16 [unused]
//   float4 BurnParams2;                // Offset:   32 Size:    16 [unused]
//   float4 BurnParams3;                // Offset:   48 Size:    16 [unused]
//   float4 CascadedShadowScaleOffsetTile0;// Offset:   64 Size:    16 [unused]
//   float4 CascadedShadowScaleOffsetTile1;// Offset:   80 Size:    16 [unused]
//   float4 WindSimParamsX;             // Offset:   96 Size:    16 [unused]
//   float4 WindSimParamsY;             // Offset:  112 Size:    16 [unused]
//   float VistaNoiseIntensity;         // Offset:  128 Size:     4 [unused]
//   float Time;                        // Offset:  132 Size:     4
//   float WindFactor;                  // Offset:  136 Size:     4 [unused]
//   float FireGlowEV;                  // Offset:  140 Size:     4 [unused]
//   float BurnSpeedScale;              // Offset:  144 Size:     4 [unused]
//   float BurnlineMaskScale;           // Offset:  148 Size:     4 [unused]
//   float BurnlineMaskInfluence;       // Offset:  152 Size:     4 [unused]
//   float WorldSpaceProgressionMaskScale;// Offset:  156 Size:     4 [unused]
//   float WorldSpaceProgressionMaskInfluence;// Offset:  160 Size:     4 [unused]
//   float MaskTransitionSpeedModifier; // Offset:  164 Size:     4 [unused]
//   float GlowMaskScale;               // Offset:  168 Size:     4 [unused]
//   float FireGlowMaskInfluence;       // Offset:  172 Size:     4 [unused]
//   float CenterBurnlineWidth;         // Offset:  176 Size:     4 [unused]
//   float TransitionToBurnlineWidth;   // Offset:  180 Size:     4 [unused]
//   float DissolveCutoffPoint;         // Offset:  184 Size:     4 [unused]
//   float DissolveBlendDistance;       // Offset:  188 Size:     4 [unused]
//   float EyeGlossinessScale;          // Offset:  192 Size:     4 [unused]
//   float EyeSpecIntensityScale;       // Offset:  196 Size:     4 [unused]
//   float EyeIrisGlossinessScale;      // Offset:  200 Size:     4 [unused]
//   float EyeIrisSpecIntensityScale;   // Offset:  204 Size:     4 [unused]
//   float EyeReflectionBoostScale;     // Offset:  208 Size:     4 [unused]
//   bool EyeReflectionMaskEnable;      // Offset:  212 Size:     4 [unused]
//   float4 BurnParams4;                // Offset:  224 Size:    16 [unused]
//   float4 BurnParams5;                // Offset:  240 Size:    16 [unused]
//
// }
//
// cbuffer CSceneDecalMaterial
// {
//
//   float4 Settings;                   // Offset:    0 Size:    16
//   float3 DiffuseColor1;              // Offset:   16 Size:    12
//   float3 DiffuseColor2;              // Offset:   32 Size:    12
//   float3 ShowThroughWallsHighLightColor;// Offset:   48 Size:    12 [unused]
//   float2 ParallaxHeightAndOffset;    // Offset:   64 Size:     8 [unused]
//   float AnimAmplitude;               // Offset:   72 Size:     4
//   float AnimFreq;                    // Offset:   76 Size:     4
//   float AnimOffset;                  // Offset:   80 Size:     4
//   float AnimBlend;                   // Offset:   84 Size:     4 [unused]
//   float MaxLifeTime;                 // Offset:   88 Size:     4
//   float FadeInDuration;              // Offset:   92 Size:     4
//   float RcpFadeInDuration;           // Offset:   96 Size:     4
//   float RcpFadeOutDuration;          // Offset:  100 Size:     4
//   float ShowThroughWallsAlpha;       // Offset:  104 Size:     4 [unused]
//   float HuntingInvestigationLerpFactor;// Offset:  108 Size:     4 [unused]
//
// }
//
// cbuffer CSceneTerrainSkyOcclusionAtlasPrivateData
// {
//
//   float4 SectorOcclusion_OffsetScale;// Offset:    0 Size:    16
//   float3 SectorOcclusion_DistanceFade;// Offset:   16 Size:    12
//   float2 SectorOcclusion_HeightOffsetScale;// Offset:   32 Size:     8
//
// }
//
// cbuffer CAmbientProvider
// {
//
//   float4 CascadeDistanceScales[5];   // Offset:    0 Size:    80 [unused]
//   float4 CascadeNearFarSnappedOffsetCamera[5];// Offset:   80 Size:    80 [unused]
//   float4 CascadeNearFarRcpUVSize[5]; // Offset:  160 Size:    80 [unused]
//   float4 UndergroundSHR;             // Offset:  240 Size:    16
//   float4 UndergroundSHG;             // Offset:  256 Size:    16
//   float4 UndergroundSHB;             // Offset:  272 Size:    16
//   float InvUndergroundBlendEndHeight;// Offset:  288 Size:     4
//   float IndirectLightingScale;       // Offset:  292 Size:     4 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// SectorHemiMapSamplerStateLinear    sampler      NA          NA    0        1
// SectorOcclusion_HeightTexture__TexObj__    texture  float4          2d    0        1
// CViewportShaderParameterProvider    cbuffer      NA          NA    0        1
// CGlobalShaderParameterProvider    cbuffer      NA          NA    1        1
// CSceneDecalMaterial               cbuffer      NA          NA    2        1
// CSceneTerrainSkyOcclusionAtlasPrivateData    cbuffer      NA          NA    3        1
// CAmbientProvider                  cbuffer      NA          NA    4        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// position                 0   xyzw        0     NONE   float   xyz 
// texcoord                 0   xy          1     NONE     int   xy  
// normal                   0   xyzw        2     NONE   float   xyz 
// color                    0   x           3     NONE   float   x   
// texcoord                 3   xy          4     NONE   float   xy  
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xyzw
// TEXCOORD                 0   xyzw        1     NONE   float   xyzw
// TEXCOORD                 1   xyzw        2     NONE   float   xyzw
// TEXCOORD                 2   xyz         3     NONE   float   xyz 
// TEXCOORD                 3   xyz         4     NONE   float   xyz 
// TEXCOORD                 4   xyz         5     NONE   float   xyz 
// TEXCOORD                 5   xyzw        6     NONE   float   xyzw
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[57], immediateIndexed
dcl_constantbuffer cb1[9], immediateIndexed
dcl_constantbuffer cb2[7], immediateIndexed
dcl_constantbuffer cb3[3], immediateIndexed
dcl_constantbuffer cb4[19], immediateIndexed
dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_input v0.xyz
dcl_input v1.xy
dcl_input v2.xyz
dcl_input v3.x
dcl_input v4.xy
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyz
dcl_output o4.xyz
dcl_output o5.xyz
dcl_output o6.xyzw
dcl_temps 7

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

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

itof r0.xy, v1.xyxx
dp3 r0.z, v2.xyzx, v2.xyzx
rsq r0.z, r0.z
mul o3.xyz, r0.zzzz, v2.xyzx
add r1.xyz, v0.yzxy, -cb0[42].yzxy
dp3 r0.z, -r1.xyzx, -r1.xyzx
sqrt r0.z, r0.z
mul r0.w, r0.z, l(0.031250)
min r0.w, r0.w, l(1.000000)
mul r0.w, r0.w, l(0.375000)
div r2.xyz, -r1.zxyz, r0.zzzz
mad r2.xyz, r0.wwww, r2.xyzx, v0.xyzx
add r2.xyz, r2.xyzx, -cb0[42].xyzx
mov r2.w, l(1.000000)
dp4 r3.x, r2.xyzw, cb0[20].xyzw
dp4 r3.y, r2.xyzw, cb0[21].xyzw
dp4 o0.z, r2.xyzw, cb0[22].xyzw
dp4 r3.w, r2.xyzw, cb0[23].xyzw
mul r0.z, cb2[0].z, l(0.0174532924)
sincos r2.x, r4.x, r0.z
mov r5.x, -r2.x
mad r0.xy, r0.xyxx, l(0.000488296151, 0.000488296151, 0.000000, 0.000000), l(-0.500000, -0.500000, 0.000000, 0.000000)
mov r5.y, r4.x
mov r5.z, r2.x
dp2 r2.x, r0.xyxx, r5.yzyy
dp2 r2.y, r0.xyxx, r5.xyxx
add o6.xy, r2.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000)
add r0.x, -v3.x, cb1[8].y
lt r0.y, r0.x, cb2[5].w
add r0.w, r0.x, -cb2[5].z
mul_sat r0.zw, r0.xxxw, cb2[6].xxxy
add r0.w, -r0.w, l(1.000000)
movc o1.w, r0.y, r0.z, r0.w

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

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

mul r2.xyzw, r3.xyww, cb0[34].xyzw
add o2.xy, r2.zwzz, r2.xyxx
dp3 o2.w, r1.zxyz, cb0[48].xyzx
mul r0.x, r0.x, cb2[4].w
sincos r0.x, null, r0.x
mad r0.x, cb2[4].z, r0.x, cb2[5].x
add r0.yzw, -cb2[1].xxyz, cb2[2].xxyz
mad o4.xyz, r0.xxxx, r0.yzwy, cb2[1].xyzx
lt r0.xy, l(0.000000, 0.000000, 0.000000, 0.000000), cb0[39].zwzz
and r0.x, r0.y, r0.x
if_nz r0.x
  mov o1.xyz, l(0,0,0,0)
else 
  dp3 r0.x, r1.xyzx, r1.xyzx
  rsq r0.x, r0.x
  mul r0.yzw, r0.xxxx, r1.xxyz
  mov r0.x, l(1.000000)
  dp4 r1.x, cb0[38].xyzw, r0.xyzw
  dp4 r1.y, cb0[37].xyzw, r0.xyzw
  dp4 r1.z, cb0[36].xyzw, r0.xyzw
  max r1.xyz, r1.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
  mad r2.xy, v0.yxyy, cb3[0].yxyy, cb3[0].wzww
  sample_l_indexable(texture2d)(float,float,float,float) r1.w, r2.xyxx, t0.xzwy, s0, l(0.000000)
  mad r1.w, r1.w, cb3[2].x, cb3[2].y
  add r1.w, -r1.w, v0.z
  mul_sat r1.w, -r1.w, cb4[18].x
  sqrt r1.w, r1.w
  add r2.xy, v0.xyxx, -cb0[42].xyxx
  dp2 r2.x, r2.xyxx, r2.xyxx
  mad r2.x, cb3[1].x, r2.x, cb3[1].y
  mul_sat r2.x, r2.x, l(3.000000)
  mul r1.w, r1.w, r2.x
  dp4 r2.x, cb4[15].xyzw, r0.xyzw
  dp4 r2.y, cb4[16].xyzw, r0.xyzw
  dp4 r2.z, cb4[17].xyzw, r0.xyzw
  max r0.xyz, r2.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
  mad r0.xyz, r0.xyzx, cb0[56].xxxx, -r1.xyzx
  mad o1.xyz, r1.wwww, r0.xyzx, r1.xyzx
endif 

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

mov o2.z, r3.w
mov o6.zw, v4.xxxy
mov o5.xyz, v0.xyzx
ret 
// Approximately 77 instruction slots used