// asmtool.py -I ../.. --auto-fix-vertex-halo --fix-unusual-halo-with-inconsistent-w-optimisation --fix-unity-reflection --fix-unity-frustum-world --only-autofixed e3157f2c70a80779-vs.txt
// 3DMigoto: e3157f2c70a80779 |    Unity headers extracted from Legacy Shaders_Transparent_Cutout_VertexLit
//    Shader "Legacy Shaders/Transparent/Cutout/VertexLit" {
//      SubShader 1/1 {
//        LOD 100
//        Tags { "IGNOREPROJECTOR"="true" "QUEUE"="AlphaTest" "RenderType"="TransparentCutout" }
//        Pass 4/4 {
//          Name "CASTER"
//          Tags { "IGNOREPROJECTOR"="true" "LIGHTMODE"="SHADOWCASTER" "QUEUE"="AlphaTest" "RenderType"="TransparentCutout" "SHADOWSUPPORT"="true" }
//          Program "vp" {
//            SubProgram "d3d11" {
//            }
//          }
//        }
//      }
//    }
//
// Unity 5.3 headers extracted from Legacy Shaders_Transparent_Cutout_VertexLit:
//   API d3d11
//   Shader model vs_4_0
//   undeciphered1: 201609010 32 0 0
//   undeciphered1a: 3
//   Keywords { "SHADOWS_DEPTH" }
//   undeciphered2: 1 0 5 0 0 0
//   undeciphered3: 11 3 0 0 1 2 3 4
//   ConstBuffer "$Globals" 80
//   Vector 32 [_MainTex_ST]
//   ConstBuffer "UnityLighting" 752
//   Vector 0 [_WorldSpaceLightPos0]
//   ConstBuffer "UnityShadows" 416
//   Vector 80 [unity_LightShadowBias]
//   ConstBuffer "UnityPerDraw" 160
//   Matrix 0 [unity_ObjectToWorld]
//   Matrix 64 [unity_WorldToObject]
//   ConstBuffer "UnityPerFrame" 384
//   Matrix 272 [unity_MatrixVP]
//   BindCB "$Globals" 0
//   BindCB "UnityLighting" 1
//   BindCB "UnityShadows" 2
//   BindCB "UnityPerDraw" 3
//   BindCB "UnityPerFrame" 4
//
// Headers extracted with DarkStarSword's extract_unity55_shaders.py
// https://github.com/DarkStarSword/3d-fixes

//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v1.3.16 on Sun Apr 21 18:03:23 2019
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyzw
// NORMAL                   0   xyz         1     NONE   float   xyz
// TEXCOORD                 0   xyzw        2     NONE   float   xy
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float   xyzw
// TEXCOORD                 1   xy          1     NONE   float   xy
//
vs_4_0
dcl_constantbuffer cb0[3], immediateIndexed
dcl_constantbuffer cb1[1], immediateIndexed
dcl_constantbuffer cb2[6], immediateIndexed
dcl_constantbuffer cb3[7], immediateIndexed
dcl_constantbuffer cb4[21], immediateIndexed
dcl_input v0.xyzw
dcl_input v1.xyz
dcl_input v2.xy
dcl_output_siv o0.xyzw, position
dcl_output o1.xy
dcl_temps 4

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

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

dp3 r0.x, v1.xyzx, cb3[4].xyzx
dp3 r0.y, v1.xyzx, cb3[5].xyzx
dp3 r0.z, v1.xyzx, cb3[6].xyzx
dp3 r0.w, r0.xyzx, r0.xyzx
rsq r0.w, r0.w
mul r0.xyz, r0.wwww, r0.xyzx
mul r1.xyzw, v0.yyyy, cb3[1].xyzw
mad r1.xyzw, cb3[0].xyzw, v0.xxxx, r1.xyzw
mad r1.xyzw, cb3[2].xyzw, v0.zzzz, r1.xyzw
mad r1.xyzw, cb3[3].xyzw, v0.wwww, r1.xyzw
mad r2.xyz, -r1.xyzx, cb1[0].wwww, cb1[0].xyzx
dp3 r0.w, r2.xyzx, r2.xyzx
rsq r0.w, r0.w
mul r2.xyz, r0.wwww, r2.xyzx
dp3 r0.w, r0.xyzx, r2.xyzx
mad r0.w, -r0.w, r0.w, l(1.000000)
sqrt r0.w, r0.w
mul r0.w, r0.w, cb2[5].z
mad r0.xyz, -r0.xyzx, r0.wwww, r1.xyzx
ne r0.w, cb2[5].z, l(0.000000)
movc r0.xyz, r0.wwww, r0.xyzx, r1.xyzx
mul r2.xyzw, r0.yyyy, cb4[18].xyzw
mad r2.xyzw, cb4[17].xyzw, r0.xxxx, r2.xyzw
mad r0.xyzw, cb4[19].xyzw, r0.zzzz, r2.xyzw
mad r0.xyzw, cb4[20].xyzw, r1.wwww, r0.xyzw

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

// Automatic vertex shader halo fix inserted with DarkStarSword's asmtool.py:
// asmtool.py -I ../.. --auto-fix-vertex-halo --fix-unusual-halo-with-inconsistent-w-optimisation --fix-unity-reflection --fix-unity-frustum-world --only-autofixed e3157f2c70a80779-vs.txt
ne r3.w, r0.w, l(1.0)
if_nz r3.w
  add r3.w, r0.w, -r3.y
  mad r0.x, r3.w, r3.x, r0.x
endif

div r1.x, cb2[5].x, r0.w
min r1.x, r1.x, l(0.000000)
max r1.x, r1.x, l(-1.000000)
add r0.z, r0.z, r1.x
min r1.x, r0.w, r0.z

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

add r0.x, -r0.z, r1.x
mad o0.z, cb2[5].y, r0.x, r0.z
mad o1.xy, v2.xyxx, cb0[2].xyxx, cb0[2].zwzz
ret
// Approximately 0 instruction slots used