// asmtool.py -I ../.. --auto-fix-vertex-halo --fix-unusual-halo-with-inconsistent-w-optimisation --fix-unity-reflection --fix-unity-frustum-world --only-autofixed 326d056d9c8119e6-vs.txt
// 3DMigoto: 326d056d9c8119e6 | Matched 3 variants of 2 shaders: Double Sided, Standard
//
// 4:    Unity headers extracted from Double Sided
// 3:    Unity headers extracted from Standard
// 4:    Shader "Double Sided" {
// 3:    Shader "Standard" {
//         CustomEditor "StandardShaderGUI"
//         Fallback "VertexLit"
//    1:   SubShader 1/2 {
//    2:   SubShader 2/2 {
//    2:     LOD 150
//    1:     LOD 300
//           Tags { "PerformanceChecks"="False" "RenderType"="Opaque" }
//    2:     Pass 3/4 {
//    1:     Pass 3/5 {
//             Name "SHADOWCASTER"
//             Tags { "LIGHTMODE"="SHADOWCASTER" "PerformanceChecks"="False" "RenderType"="Opaque" "SHADOWSUPPORT"="true" }
//             Program "vp" {
//               SubProgram "d3d11" {
//               }
//             }
//           }
//         }
//       }
//
// 4: Unity 5.3 headers extracted from Double Sided:
// 3: Unity 5.3 headers extracted from Standard:
//      API d3d11
//      Shader model vs_4_0
//      undeciphered1: 201609010 31 0 0
//      undeciphered1a: 3
// 2:   Keywords { "SHADOWS_DEPTH" "_METALLICGLOSSMAP" }
// 5:   Keywords { "SHADOWS_DEPTH" }
//      undeciphered2: 1 0 4 0 0 0
//      undeciphered3: 3 2 0 0 1 2
//      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 "UnityLighting" 0
//      BindCB "UnityShadows" 1
//      BindCB "UnityPerDraw" 2
//      BindCB "UnityPerFrame" 3
//
// 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 17:53:48 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   xy          2     NONE   float
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float   xyzw
//
vs_4_0
dcl_constantbuffer cb0[1], immediateIndexed
dcl_constantbuffer cb1[6], immediateIndexed
dcl_constantbuffer cb2[7], immediateIndexed
dcl_constantbuffer cb3[21], immediateIndexed
dcl_input v0.xyzw
dcl_input v1.xyz
dcl_output_siv o0.xyzw, position
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, cb2[4].xyzx
dp3 r0.y, v1.xyzx, cb2[5].xyzx
dp3 r0.z, v1.xyzx, cb2[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, cb2[1].xyzw
mad r1.xyzw, cb2[0].xyzw, v0.xxxx, r1.xyzw
mad r1.xyzw, cb2[2].xyzw, v0.zzzz, r1.xyzw
mad r1.xyzw, cb2[3].xyzw, v0.wwww, r1.xyzw
mad r2.xyz, -r1.xyzx, cb0[0].wwww, cb0[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, cb1[5].z
mad r0.xyz, -r0.xyzx, r0.wwww, r1.xyzx
ne r0.w, cb1[5].z, l(0.000000)
movc r0.xyz, r0.wwww, r0.xyzx, r1.xyzx
mul r2.xyzw, r0.yyyy, cb3[18].xyzw
mad r2.xyzw, cb3[17].xyzw, r0.xxxx, r2.xyzw
mad r0.xyzw, cb3[19].xyzw, r0.zzzz, r2.xyzw
mad r0.xyzw, cb3[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 326d056d9c8119e6-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, cb1[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, cb1[5].y, r0.x, r0.z
ret
// Approximately 0 instruction slots used