// asmtool.py -I ../.. --auto-fix-vertex-halo --fix-unusual-halo-with-inconsistent-w-optimisation --fix-unity-reflection --fix-unity-frustum-world --only-autofixed b919f9e2b280bba4-vs.txt
// 3DMigoto: b919f9e2b280bba4 | Matched 2 variants of 2 shaders: Hidden/UberShader/8279FDDAE36E2A3906352B6AB2805127, Hidden/UberShader/CB6CCCF5E5B50FCDCD571F270B3723FE_FB
//
// 1:    Unity headers extracted from 8279FDDAE36E2A3906352B6AB2805127.shader
// 2:    Unity headers extracted from CB6CCCF5E5B50FCDCD571F270B3723FE_FB.shader
// 1:    Shader "Hidden/UberShader/8279FDDAE36E2A3906352B6AB2805127" {
// 2:    Shader "Hidden/UberShader/CB6CCCF5E5B50FCDCD571F270B3723FE_FB" {
//         Properties {
//          _UberShaderColorMask ("Uber color mask", Float) = 15
//          _UberShaderBlendModeDst ("Uber shader blend  mode dst", Float) = 10
//          _Color ("Color", Color) = (1,1,1,1)
//          _DepthFlipScreen ("Depth Flip Screen", Vector) = (0,0,0,0)
// 2:       _InteractionDistortMask ("Interaction Distort Mask", 2D) = "white" { }
// 2:       _InteractionDistortMask_US_ST ("Interaction Distort Mask_US_ST", Vector) = (0,0,0,0)
// 2:       _InteractionRotationPivot ("Interaction Rotation Pivot", Vector) = (0,0,0,0)
// 2:       _InteractionSettingsRotation ("Interaction Settings Rotation", Vector) = (0,0,0,0)
//          _MainTex ("Main Tex", 2D) = "white" { }
//          _MainTex_US_ATLAS ("Main Tex_US_ATLAS", Vector) = (0,0,1,1)
//          _MainTex_US_ATLAS_ST ("Main Tex_US_ATLAS_ST", Vector) = (0,0,1,1)
//          _MainTex_US_ST ("Main Tex_US_ST", Vector) = (0,0,0,0)
//          _MaskStrength ("Mask Strength", Float) = 0
//          _MaskTexture ("Mask Texture", 2D) = "white" { }
//          _MaskTexture_US_ST ("Mask Texture_US_ST", Vector) = (0,0,0,0)
//          _Offset ("Offset", Vector) = (0,0,0,0)
//          _RotationAnimMask ("Rotation Anim Mask", 2D) = "white" { }
//          _RotationAnimMask_US_ST ("Rotation Anim Mask_US_ST", Vector) = (0,0,0,0)
//          _RotationCurve ("Rotation Curve", 2D) = "white" { }
//          _RotationCurve_AnimationSettings ("Rotation Curve_Animation Settings", Vector) = (0,0,0,0)
//          _Screen ("Screen", Vector) = (0,0,0,0)
//          _ScreenMask ("Screen Mask", Vector) = (0,0,0,0)
//          _TurbulenceDistortionBias ("Turbulence Distortion Bias", Vector) = (0,0,0,0)
//          _TurbulenceDistortionMaskTex ("Turbulence Distortion Mask Tex", 2D) = "white" { }
//          _TurbulenceDistortionMaskTex_US_ST ("Turbulence Distortion Mask Tex_US_ST", Vector) = (0,0,0,0)
//          _TurbulenceDistortionScaleVar ("Turbulence Distortion Scale Var", Vector) = (0,0,0,0)
//          _TurbulenceLocalDistortSettings ("Turbulence Local Distort Settings", Vector) = (0,0,0,0)
//         }
//         SubShader 1/1 {
//           Tags { "IGNOREPROJECTOR"="true" "RenderType"="TransparentCutout" "UberShaderShader"="true" }
//           Pass 1/1 {
//             Tags { "IGNOREPROJECTOR"="true" "RenderType"="TransparentCutout" "UberShaderShader"="true" }
//             ZTest Less
//             ZWrite Off
//             Cull Off
//             Blend SrcAlpha [_UberShaderBlendModeDst], One OneMinusSrcAlpha
//             ColorMask [_UberShaderColorMask]
// 2:          GpuProgramID 55983
// 1:          GpuProgramID 62974
//             Program "vp" {
//               SubProgram "d3d11 " {
//                 GpuProgramIndex 1
//               }
//             }
//           }
//         }
//       }
//
// 1: Unity 5.3 headers extracted from 8279FDDAE36E2A3906352B6AB2805127.shader.decompressed:
// 2: Unity 5.3 headers extracted from CB6CCCF5E5B50FCDCD571F270B3723FE_FB.shader.decompressed:
//      API d3d11
//      Shader model vs_4_0
//      undeciphered1: 201509030 79 0 0
//      undeciphered2: 1 3 3 3 0
//      undeciphered3: 9 2 0 0 3 4
//      ConstBuffer "$Globals" 560
//      Float 0 [_FogGradientRange]
//      Float 112 [_GameTime]
//      Float 120 [_GlobalDebugScale]
//      Vector 128 [_DepthFlipScreen]
//      Vector 288 [_MainTex_ST]
//      Vector 304 [_MainTex_US_ST]
//      Vector 368 [_TurbulenceDistortionMaskTex_ST]
//      Vector 384 [_TurbulenceDistortionMaskTex_US_ST]
//      Vector 448 [_RotationCurve_AnimationSettings]
//      Vector 464 [_Offset]
//      Vector 480 [_RotationAnimMask_ST]
//      Vector 496 [_RotationAnimMask_US_ST]
//      Vector 512 [_MaskTexture_ST]
//      Vector 528 [_MaskTexture_US_ST]
//      ConstBuffer "UnityPerDraw" 352
//      Matrix 0 [glstate_matrix_mvp]
//      Matrix 192 [_Object2World]
//      ConstBuffer "UnityPerFrame" 256
//      Vector 64 [glstate_lightmodel_ambient]
//      SetTexture 0 [_RotationAnimMask] 2D 2
//      SetTexture 1 [_RotationCurve] 2D 1
//      SetTexture 2 [_FogGradientTex] 2D 0
//      BindCB "$Globals" 0
//      BindCB "UnityPerDraw" 1
//      BindCB "UnityPerFrame" 2
//
// 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:46:49 2018
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyzw
// TEXCOORD                 0   xyzw        1     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                 1   xyzw        2     NONE   float   xyzw
// TEXCOORD                 2   xyzw        3     NONE   float   xyzw
// TEXCOORD                 3   xyzw        4     NONE   float   xyzw
//
vs_4_0
dcl_constantbuffer cb0[34], immediateIndexed
dcl_constantbuffer cb1[16], immediateIndexed
dcl_constantbuffer cb2[5], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_sampler s2, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_resource_texture2d (float,float,float,float) t2
dcl_input v0.xyzw
dcl_input v1.xyzw
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_output o4.xyzw
dcl_temps 6

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

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

div r0.x, cb0[7].x, cb0[28].y
add r0.x, r0.x, cb0[28].z
mov r0.yw, l(0,0,0,0)
sample_l r1.xyzw, r0.xyxx, t1.xyzw, s1, l(0.000000)
mad r0.x, r1.w, l(2.000000), l(-1.000000)
mul r0.x, r0.x, cb0[28].x
mul r0.x, r0.x, l(0.0174527783)
mad r0.y, cb0[31].w, cb0[7].x, cb0[31].z
sincos r1.x, r2.x, r0.y
add r1.yz, v1.yyxy, l(0.000000, -0.500000, -0.500000, 0.000000)
mul r1.xw, r1.xxxx, r1.yyyz
mad r0.y, r1.z, r2.x, -r1.x
mad r1.x, r1.y, r2.x, r1.w
add r1.x, r1.x, l(0.500000)
mad r1.x, r1.x, cb0[30].y, cb0[30].w
mad r2.y, cb0[31].y, cb0[7].x, r1.x
add r0.y, r0.y, l(0.500000)
mad r0.y, r0.y, cb0[30].x, cb0[30].z
mad r2.x, cb0[31].x, cb0[7].x, r0.y
sample_l r2.xyzw, r2.xyxx, t0.xyzw, s2, l(0.000000)
mul r0.x, r0.x, r2.x
sincos r0.x, r1.x, r0.x
mov r2.xy, cb0[29].zwzz
mad r3.xy, v0.yxyy, r2.yxyy, -cb0[29].yxyy
mul r0.xy, r0.xxxx, r3.xyxx
mad r4.x, r3.y, r1.x, -r0.x
mad r4.y, r3.x, r1.x, r0.y
add r3.xy, r4.xyxx, cb0[29].xyxx
mov r2.zw, l(0,0,1.000000,1.000000)
mov r3.zw, v0.zzzw
div r2.xyzw, r3.xyzw, r2.xyzw
add r0.x, cb0[7].z, l(1.000000)
mul r0.xy, r0.xxxx, r2.xyxx
mul r3.xyz, r0.yyyy, cb1[1].xywx
mad r3.xyz, cb1[0].xywx, r0.xxxx, r3.xyzx
mad r2.xyz, cb1[2].xywx, r2.zzzz, r3.xyzx
mad r2.xyw, cb1[3].xyxw, r2.wwww, r2.xyxz
add r0.x, cb0[8].x, l(200.000000)

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

// 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 b919f9e2b280bba4-vs.txt
ne r5.w, r2.w, l(1.0)
if_nz r5.w
  add r5.w, r2.w, -r5.y
  mad r2.x, r5.w, r5.x, r2.x
endif

mul r0.x, r2.w, r0.x
mul r2.z, r0.x, l(0.000833333354)

// mov o0.xyzw, r2.xyzw // Relocated from here with asmtool.py
// Inserted by asmtool.py
mov o0.z, r2.z

dp4 r0.x, r2.xyzw, r2.xyzw
sqrt r0.x, r0.x
mov o1.zw, v1.zzzw
mad r0.y, cb0[19].w, cb0[7].x, cb0[19].z
sincos r1.x, r2.x, r0.y
mul r1.xw, r1.xxxx, r1.yyyz
mad r0.y, r1.z, r2.x, -r1.x
mad r1.x, r1.y, r2.x, r1.w
add r1.x, r1.x, l(0.500000)
mad r1.x, r1.x, cb0[18].y, cb0[18].w
mad o1.y, cb0[19].y, cb0[7].x, r1.x
add r0.y, r0.y, l(0.500000)
mad r0.y, r0.y, cb0[18].x, cb0[18].z
mad o1.x, cb0[19].x, cb0[7].x, r0.y
mad r0.y, cb0[24].w, cb0[7].x, cb0[24].z
sincos r1.x, r2.x, r0.y
mul r1.xw, r1.xxxx, r1.yyyz
mad r0.y, r1.z, r2.x, -r1.x
mad r1.x, r1.y, r2.x, r1.w
add r1.x, r1.x, l(0.500000)
mad r1.x, r1.x, cb0[23].y, cb0[23].w
mad o2.y, cb0[24].y, cb0[7].x, r1.x
add r0.y, r0.y, l(0.500000)
mad r0.y, r0.y, cb0[23].x, cb0[23].z
mad o2.x, cb0[24].x, cb0[7].x, r0.y
mad r0.y, cb0[33].w, cb0[7].x, cb0[33].z
sincos r1.x, r2.x, r0.y
mul r1.xw, r1.xxxx, r1.yyyz
mad r0.y, r1.z, r2.x, -r1.x
mad r1.x, r1.y, r2.x, r1.w
add r1.x, r1.x, l(0.500000)
mad r1.x, r1.x, cb0[32].y, cb0[32].w
mad o2.w, cb0[33].y, cb0[7].x, r1.x
add r0.y, r0.y, l(0.500000)
mad r0.y, r0.y, cb0[32].x, cb0[32].z
mad o2.z, cb0[33].x, cb0[7].x, r0.y
mul r1.xy, cb2[4].wwww, l(0.200000, 4.000000, 0.000000, 0.000000)
round_ni r0.y, r1.y
add r0.y, -r0.y, l(1.000000)
mul r1.x, r0.y, r1.x
mul r0.x, r0.x, r1.x
exp r0.x, -|r0.x|
mad o3.w, -r0.x, r0.x, l(1.000000)
mul o3.xyz, cb2[4].xyzx, l(4.000000, 4.000000, 4.000000, 0.000000)
mul r0.x, v0.y, cb1[13].z
mad r0.x, cb1[12].z, v0.x, r0.x
mad r0.x, cb1[14].z, v0.z, r0.x
mad r0.x, cb1[15].z, v0.w, r0.x
div r0.x, r0.x, cb0[0].x
add r0.z, r0.x, l(0.500000)
sample_l r1.xyzw, r0.zwzz, t2.xyzw, s0, l(0.000000)
mul o4.w, r0.y, r1.w
mov o4.xyz, r1.xyzx
ret
// Approximately 0 instruction slots used