// asmtool.py --auto-fix-vertex-halo -i --only-autofixed fc8e968e9879b463-vs.txt
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//   using 3Dmigoto v1.3.4 on Mon Mar 05 05:00:25 2018
//
//
// Buffer Definitions:
//
// cbuffer vector_register_block
// {
//
//   float3 gEffectHemisphereVector;    // Offset:    0 Size:    12
//   float3 gEffectHemisphereColor0;    // Offset:   16 Size:    12
//   float3 gEffectHemisphereColor1;    // Offset:   32 Size:    12
//   row_major float3x3 gEffectLightDirection;// Offset:   48 Size:    44
//   row_major float3x3 gEffectLightColorDir;// Offset:   96 Size:    44
//   float4 gEffectLightPosition[4];    // Offset:  144 Size:    64
//   float4 gEffectLightColorPoint[4];  // Offset:  208 Size:    64
//   float3 gEffectIblDiffuseColor;     // Offset:  304 Size:    12
//   row_major float4x4 gEffectWorldViewProj;// Offset:  480 Size:    64
//   row_major float4x4 gEffectShadingMatrix;// Offset:  544 Size:    64
//   float3 gEffectEyePosition;         // Offset:  608 Size:    12
//   float4 gEffectUVOffset;            // Offset:  624 Size:    16
//   float4 gEffectConstantColor;       // Offset:  640 Size:    16
//   float4 gEffectDistanceFade_VThickness;// Offset:  656 Size:    16
//
// }
//
// cbuffer bool_register_block
// {
//
//   bool gEnableMultiUV;               // Offset:    0 Size:     4
//   bool gEnableVertexColor;           // Offset:    4 Size:     4
//   bool gEnableLighting;              // Offset:    8 Size:     4 [unused]
//   bool gEnablePointLight0;           // Offset:   12 Size:     4
//   bool gEnablePointLight1;           // Offset:   16 Size:     4
//   bool gEnablePointLight2;           // Offset:   20 Size:     4
//   bool gEnablePointLight3;           // Offset:   24 Size:     4
//   bool gFogEnable;                   // Offset:   28 Size:     4
//   bool gEnableLightScatter;          // Offset:   32 Size:     4
//   bool gBlendUnDestOne;              // Offset:   36 Size:     4
//   bool gEnableSoftParticle;          // Offset:   40 Size:     4 [unused]
//   int bool_register_block_padding;   // Offset:   44 Size:     4 [unused]
//
// }
//
// cbuffer model_low_frequency_block
// {
//
//   row_major float4x4 gViewProjection;// Offset:    0 Size:    64 [unused]
//   float4 gEyePosition;               // Offset:   64 Size:    16 [unused]
//   row_major float4x4 gViewMatrix;    // Offset:   80 Size:    64 [unused]
//   row_major float4x4 gShadowMatrix;  // Offset:  144 Size:    64 [unused]
//   float4 gClipPlane0;                // Offset:  208 Size:    16 [unused]
//   float4 gLScatterSunColor;          // Offset:  224 Size:    16
//   float4 gLScatterSunDir;            // Offset:  240 Size:    16
//   float4 gLScatterOutTmp;            // Offset:  256 Size:    16
//   float4 gLScatterRayTmp;            // Offset:  272 Size:    16
//   float4 gLScatterMieTmp;            // Offset:  288 Size:    16
//   float4 gFogMiddle;                 // Offset:  304 Size:    16
//   float4 gFogFarMiddle;              // Offset:  320 Size:    16
//   float4 gFogDistance;               // Offset:  336 Size:    16
//   float4 gFogDensity;                // Offset:  352 Size:    16
//   float4 gHeightFogMiddle;           // Offset:  368 Size:    16
//   float4 gHeightFogFarMiddle;        // Offset:  384 Size:    16
//   float4 gHeightFogDistance;         // Offset:  400 Size:    16
//   float4 gHeightFogDensity;          // Offset:  416 Size:    16
//   row_major float4x4 gSecondShadowMatrix;// Offset:  432 Size:    64 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// vector_register_block             cbuffer      NA          NA    0        1
// bool_register_block               cbuffer      NA          NA    1        1
// model_low_frequency_block         cbuffer      NA          NA    9        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyzw
// NORMAL                   0   xyz         1     NONE   float   xyz
// COLOR                    0   xyzw        2     NONE   float   xyzw
// TEXCOORD                 0   xyzw        3     NONE   float   xyzw
//
//
// 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                 5   xyz         2     NONE   float   xyz
// 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
//
vs_4_0
dcl_constantbuffer cb0[42], immediateIndexed
dcl_constantbuffer cb1[3], immediateIndexed
dcl_constantbuffer cb9[27], immediateIndexed
dcl_input v0.xyzw
dcl_input v1.xyz
dcl_input v2.xyzw
dcl_input v3.xyzw
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xyz
dcl_output o3.xyzw
dcl_output o4.xyzw
dcl_output o5.xyzw
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

mul r0.xyzw, v0.yyyy, cb0[31].xyzw
mad r0.xyzw, v0.xxxx, cb0[30].xyzw, r0.xyzw
mad r0.xyzw, v0.zzzz, cb0[32].xyzw, r0.xyzw
add r0.xyzw, r0.xyzw, cb0[33].xyzw
add r1.xyz, v0.xyzx, -cb0[38].xyzx
dp3 r1.w, r1.xyzx, r1.xyzx
sqrt r1.w, r1.w
div r1.xyz, r1.xyzx, r1.wwww
add r2.xyzw, v3.xyzw, cb0[39].xyzw
movc o3.xyzw, cb1[0].xxxx, r2.xyzw, r2.xyxy
dp3 r2.x, v1.xyzx, cb0[0].xyzx
mad r2.xyz, r2.xxxx, cb0[2].xyzx, cb0[1].xyzx
dp3_sat r2.w, cb0[3].xyzx, v1.xyzx
dp3_sat r3.x, cb0[4].xyzx, v1.xyzx
dp3_sat r3.y, cb0[5].xyzx, v1.xyzx
mul r3.xzw, r3.xxxx, cb0[7].xxyz
mad r3.xzw, r2.wwww, cb0[6].xxyz, r3.xxzw
mad r3.xyz, r3.yyyy, cb0[8].xyzx, r3.xzwx
add r2.xyz, r2.xyzx, r3.xyzx
if_nz cb1[0].w
  add r3.xyz, -v0.xyzx, cb0[9].xyzx
  dp3 r2.w, r3.xyzx, r3.xyzx
  rsq r3.w, r2.w
  mul r3.xyz, r3.wwww, r3.xyzx
  mad r2.w, -r2.w, r3.w, cb0[9].w
  mul_sat r2.w, r2.w, cb0[13].w
  mul r2.w, r2.w, r2.w
  mul r4.xyz, r2.wwww, cb0[13].xyzx
  dp3_sat r2.w, v1.xyzx, r3.xyzx
  mul r3.xyz, r4.xyzx, r2.wwww
  if_nz cb1[1].x
    add r4.xyz, -v0.xyzx, cb0[10].xyzx
    dp3 r2.w, r4.xyzx, r4.xyzx
    rsq r3.w, r2.w
    mul r4.xyz, r3.wwww, r4.xyzx
    mad r2.w, -r2.w, r3.w, cb0[10].w
    mul_sat r2.w, r2.w, cb0[14].w
    mul r2.w, r2.w, r2.w
    mul r5.xyz, r2.wwww, cb0[14].xyzx
    dp3_sat r2.w, v1.xyzx, r4.xyzx
    mad r3.xyz, r2.wwww, r5.xyzx, r3.xyzx
    if_nz cb1[1].y
      add r4.xyz, -v0.xyzx, cb0[11].xyzx
      dp3 r2.w, r4.xyzx, r4.xyzx
      rsq r3.w, r2.w
      mul r4.xyz, r3.wwww, r4.xyzx
      mad r2.w, -r2.w, r3.w, cb0[11].w
      mul_sat r2.w, r2.w, cb0[15].w
      mul r2.w, r2.w, r2.w
      mul r5.xyz, r2.wwww, cb0[15].xyzx
      dp3_sat r2.w, v1.xyzx, r4.xyzx
      mad r3.xyz, r2.wwww, r5.xyzx, r3.xyzx
      if_nz cb1[1].z
        add r4.xyz, -v0.xyzx, cb0[12].xyzx
        dp3 r2.w, r4.xyzx, r4.xyzx
        rsq r3.w, r2.w
        mul r4.xyz, r3.wwww, r4.xyzx
        mad r2.w, -r2.w, r3.w, cb0[12].w
        mul_sat r2.w, r2.w, cb0[16].w
        mul r2.w, r2.w, r2.w
        mul r5.xyz, r2.wwww, cb0[16].xyzx
        dp3_sat r2.w, v1.xyzx, r4.xyzx
        mad r3.xyz, r2.wwww, r5.xyzx, r3.xyzx
      endif
    endif
  endif
else
  mov r3.xyz, l(0,0,0,0)
endif
add r2.xyz, r2.xyzx, r3.xyzx
mul r3.xyz, v1.yyyy, cb0[35].xyzx
mad r3.xyz, v1.xxxx, cb0[34].xyzx, r3.xyzx
mad o6.xyz, v1.zzzz, cb0[36].xyzx, r3.xyzx

// Relocated to here with asmtool.py
mov o0.xyzw, r0.xyzw

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

mad o4.w, cb0[41].x, r0.w, cb0[41].y
mul r3.xyz, r1.yyyy, cb0[35].xyzx
mad r3.xyz, r1.xxxx, cb0[34].xyzx, r3.xyzx
mad r1.xyz, r1.zzzz, cb0[36].xyzx, r3.xyzx
dp3 r2.w, r1.xyzx, r1.xyzx
rsq r2.w, r2.w
mul r1.xyz, r1.xyzx, r2.wwww
mul r3.xyz, r1.wwww, cb9[16].xyzx
exp r3.xyz, r3.xyzx
dp3 r1.x, cb9[15].xyzx, r1.xyzx
mad r1.y, r1.x, r1.x, l(1.000000)
mad r1.x, cb9[18].w, r1.x, cb9[17].w
mul r1.z, r1.x, r1.x
mul r1.x, r1.x, r1.z
sqrt r1.x, r1.x
div r1.xzw, cb9[18].xxyz, r1.xxxx
mad r1.xyz, cb9[17].xyzx, r1.yyyy, r1.xzwx
add r4.xyz, -r3.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
mul r1.xyz, r1.xyzx, r4.xyzx
mul r1.xyz, r1.xyzx, cb9[14].xyzx
movc r3.xyz, cb1[2].xxxx, r3.xyzx, l(1.000000,1.000000,1.000000,0)
movc r1.xyz, cb1[2].xxxx, r1.xyzx, l(0,0,0,0)
movc r1.xyz, cb1[2].yyyy, r1.xyzx, l(0,0,0,0)
movc r4.xy, cb1[1].wwww, cb9[22].xyxx, l(0,0,0,0)
add r4.zw, r0.wwww, -cb9[21].xxxy
mul_sat r4.zw, r4.zzzw, cb9[21].zzzw
dp2 r1.w, r4.zwzz, r4.xyxx
mad r4.xyz, cb9[20].xyzx, r4.wwww, cb9[19].xyzx
add r2.w, -r1.w, l(1.000000)
mul r4.xyz, r1.wwww, r4.xyzx
movc r5.xy, cb1[1].wwww, cb9[26].xyxx, l(0,0,0,0)
add r5.zw, v0.yyyy, -cb9[25].xxxy
mul_sat r5.zw, r5.zzzw, cb9[25].zzzw
dp2 r1.w, r5.zwzz, r5.xyxx
mad r5.xyz, cb9[24].xyzx, r5.wwww, cb9[23].xyzx
add r3.w, -r1.w, l(1.000000)
mul r5.xyz, r1.wwww, r5.xyzx
mul r3.xyz, r3.wwww, r3.xyzx
mul r3.xyz, r2.wwww, r3.xyzx
mad r1.xyz, r1.xyzx, r3.wwww, r5.xyzx
mad r1.xyz, r1.xyzx, r2.wwww, r4.xyzx
movc o4.xyz, cb1[2].yyyy, r1.xyzx, l(0,0,0,0)
mul r1.yzw, r3.xxyz, cb0[19].xxyz
mul r3.xyz, r2.xyzx, v2.xyzx
mul r4.yzw, r1.yyzw, v2.xxyz
movc o1.xyz, cb1[0].yyyy, r3.xyzx, r2.xyzx
mov r4.x, v2.w
mov r1.x, l(1.000000)
movc r1.xyzw, cb1[0].yyyy, r4.xyzw, r1.xyzw
mul o1.w, r1.x, cb0[40].w
mul r2.xy, r0.xyxx, l(0.500000, -0.500000, 0.000000, 0.000000)
div r2.xy, r2.xyxx, r0.wwww
add r2.xy, r2.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000)
mov r2.z, r0.w
mul o5.xyz, r0.wwww, r2.xyzx
mad r1.x, v0.w, cb0[41].z, cb0[41].w
max o6.w, r1.x, l(0.000488281250)

// mov o0.xyzw, r0.xyzw // Relocated from here with asmtool.py

mov o5.w, r2.z
mov o2.xyz, r1.yzwy
ret
// Approximately 134 instruction slots used