// asmtool.py -I ../.. --auto-fix-vertex-halo --fix-unusual-halo-with-inconsistent-w-optimisation --fix-unity-reflection --fix-unity-frustum-world --only-autofixed 57b86e2be9c3df0d-vs.txt
// 3DMigoto: 57b86e2be9c3df0d |    Unity headers extracted from SeinWaterLavaShader.shader
//    Shader "SeinWater/Lava" {
//      Properties {
//       _LavaGradient ("Lava gradient", 2D) = "gray" { }
//       _GradientPow ("Gradient power", Float) = 1.5
//       _LavaColor ("Lava color", Color) = (0.25,0.25,0.25,0.25)
//       _WaveScale ("Wave scale", Range(0.2,1.5)) = 0.5
//       _WaveSpeed ("Wave speed (map1 x,y; map2 x,y)", Vector) = (19,9,-16,-7)
//       _PxSizeX ("Internal Pix size x", Float) = 0
//       _PxSizeY ("Internal Pix size y", Float) = 0
//       _Height ("Internal height", Float) = 0
//       _DispUv ("Internal disp uv", Float) = 0
//       _MaxWaveHeight ("Internal max height", Float) = 0
//       _WavePower ("Internal wave power", Float) = 0
//       _DispTex ("Internal disp tex", 2D) = "white" { }
//       _WaterPlaneCoords ("Internal water coords", Vector) = (0,0,0,0)
//       _WaveScale4 ("Internal wave scale vec", Vector) = (0,0,0,0)
//       _WaveOffset ("Internal wave scale offset", Vector) = (0,0,0,0)
//       _TransformScale ("Trans scale", Vector) = (1,1,0,0)
//      }
//      SubShader 1/1 {
//        Tags { "QUEUE"="Transparent" "RenderType"="Transparent" }
//        Pass 1/1 {
//          Tags { "QUEUE"="Transparent" "RenderType"="Transparent" }
//          ZTest Always
//          Cull Off
//          ColorMask RGB
//          GpuProgramID 59901
//          Program "vp" {
//            SubProgram "d3d11 " {
//              GpuProgramIndex 1
//            }
//          }
//        }
//      }
//    }
//
// Unity 5.3 headers extracted from SeinWaterLavaShader.shader.decompressed:
//   API d3d11
//   Shader model vs_4_0
//   undeciphered1: 201509030 32 0 0
//   undeciphered2: 1 0 4 0 0
//   undeciphered3: 13 3 0 0 2 1 3 4
//   ConstBuffer "$Globals" 304
//   Float 128 [_FogGradientRange]
//   ConstBuffer "UnityPerCamera" 144
//   Vector 80 [_ProjectionParams]
//   ConstBuffer "UnityPerDraw" 352
//   Matrix 0 [glstate_matrix_mvp]
//   Matrix 64 [glstate_matrix_modelview0]
//   Matrix 192 [_Object2World]
//   ConstBuffer "UnityPerFrame" 256
//   Vector 64 [glstate_lightmodel_ambient]
//   BindCB "$Globals" 0
//   BindCB "UnityPerCamera" 1
//   BindCB "UnityPerDraw" 2
//   BindCB "UnityPerFrame" 3
//
// Headers extracted with DarkStarSword's extract_unity53_shaders.py
// https://github.com/DarkStarSword/3d-fixes

//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v1.3.2 on Mon Jul 23 23:44:10 2018
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyzw
// TANGENT                  0   xyzw        1     NONE   float
// NORMAL                   0   xyz         2     NONE   float
// TEXCOORD                 0   xyzw        3     NONE   float   xy
// TEXCOORD                 1   xyzw        4     NONE   float
// TEXCOORD                 2   xyzw        5     NONE   float
// TEXCOORD                 3   xyzw        6     NONE   float
// COLOR                    0   xyzw        7     NONE   float
//
//
// 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                 2   xy          2     NONE   float   xy
// TEXCOORD                 4     z         2     NONE   float     z
// TEXCOORD                 5      w        2     NONE   float      w
//
vs_4_0
dcl_constantbuffer cb0[9], immediateIndexed
dcl_constantbuffer cb1[6], immediateIndexed
dcl_constantbuffer cb2[16], immediateIndexed
dcl_constantbuffer cb3[5], immediateIndexed
dcl_input v0.xyzw
dcl_input v3.xy
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xy
dcl_output o2.z
dcl_output o2.w
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

mul r0.x, v0.y, cb2[13].z
mad r0.x, cb2[12].z, v0.x, r0.x
mad r0.x, cb2[14].z, v0.z, r0.x
mad r0.x, cb2[15].z, v0.w, r0.x
add r0.y, r0.x, l(200.050003)
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

// 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 --fix-unusual-halo-with-inconsistent-w-optimisation --fix-unity-reflection --fix-unity-frustum-world --only-autofixed 57b86e2be9c3df0d-vs.txt
ne r3.w, r1.w, l(1.0)
if_nz r3.w
  add r3.w, r1.w, -r3.y
  mad r1.x, r3.w, r3.x, r1.x
endif

mul r0.y, r0.y, r1.w
mul o0.z, r0.y, l(0.000833333354)

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

mov o1.w, r1.w
mul r0.y, r1.y, cb1[5].x
mul r2.w, r0.y, l(0.500000)
mul r2.xz, r1.xxwx, l(0.500000, 0.000000, 0.500000, 0.000000)
dp4 r0.y, r1.xyzw, r1.xyzw
sqrt r0.y, r0.y
add o1.xy, r2.zzzz, r2.xwxx
mul r0.z, v0.y, cb2[5].z
mad r0.z, cb2[4].z, v0.x, r0.z
mad r0.z, cb2[6].z, v0.z, r0.z
mad r0.z, cb2[7].z, v0.w, r0.z
mov o1.z, -r0.z
mul r0.zw, cb3[4].wwww, l(0.000000, 0.000000, 0.200000, 4.060000)
round_ni r0.w, r0.w
add r0.w, -r0.w, l(1.000000)
mul r0.z, r0.w, r0.z
mul r0.y, r0.z, r0.y
exp r0.y, -|r0.y|
mad o2.z, -r0.y, r0.y, l(1.000000)
add r0.y, cb0[8].x, cb0[8].x
div r0.x, r0.x, r0.y
add o2.w, r0.x, l(0.500000)
mov o2.xy, v3.xyxx
ret
// Approximately 0 instruction slots used