// asmtool.py -I ../.. --auto-fix-vertex-halo --fix-unusual-halo-with-inconsistent-w-optimisation --fix-unity-reflection --fix-unity-frustum-world --only-autofixed cf70d9bfe7cbf367-vs.txt
// 3DMigoto: cf70d9bfe7cbf367 |    Unity headers extracted from TMPro_SDF Overlay.shader
//    Shader "TMPro/Distance Field Overlay" {
//      Properties {
//       _FaceTex ("Face Texture", 2D) = "white" { }
//       _FaceUVSpeedX ("Face UV Speed X", Range(-5.000000,5.000000)) = 0.000000
//       _FaceUVSpeedY ("Face UV Speed Y", Range(-5.000000,5.000000)) = 0.000000
//       _FaceColor ("Face Color", Color) = (1.000000,1.000000,1.000000,1.000000)
//       _FaceDilate ("Face Dilate", Range(-1.000000,1.000000)) = 0.000000
//       _OutlineColor ("Outline Color", Color) = (0.000000,0.000000,0.000000,1.000000)
//       _OutlineTex ("Outline Texture", 2D) = "white" { }
//       _OutlineUVSpeedX ("Outline UV Speed X", Range(-5.000000,5.000000)) = 0.000000
//       _OutlineUVSpeedY ("Outline UV Speed Y", Range(-5.000000,5.000000)) = 0.000000
//       _OutlineWidth ("Outline Thickness", Range(0.000000,1.000000)) = 0.000000
//       _OutlineSoftness ("Outline Softness", Range(0.000000,1.000000)) = 0.000000
//       _Bevel ("Bevel", Range(0.000000,1.000000)) = 0.500000
//       _BevelOffset ("Bevel Offset", Range(-0.500000,0.500000)) = 0.000000
//       _BevelWidth ("Bevel Width", Range(-0.500000,0.500000)) = 0.000000
//       _BevelClamp ("Bevel Clamp", Range(0.000000,1.000000)) = 0.000000
//       _BevelRoundness ("Bevel Roundness", Range(0.000000,1.000000)) = 0.000000
//       _LightAngle ("Light Angle", Range(0.000000,6.283185)) = 3.141600
//       _SpecularColor ("Specular", Color) = (1.000000,1.000000,1.000000,1.000000)
//       _SpecularPower ("Specular", Range(0.000000,4.000000)) = 2.000000
//       _Reflectivity ("Reflectivity", Range(5.000000,15.000000)) = 10.000000
//       _Diffuse ("Diffuse", Range(0.000000,1.000000)) = 0.500000
//       _Ambient ("Ambient", Range(1.000000,0.000000)) = 0.500000
//       _BumpMap ("Normal map", 2D) = "bump" { }
//       _BumpOutline ("Bump Outline", Range(0.000000,1.000000)) = 0.000000
//       _BumpFace ("Bump Face", Range(0.000000,1.000000)) = 0.000000
//       _ReflectFaceColor ("Reflection Color", Color) = (0.000000,0.000000,0.000000,1.000000)
//       _ReflectOutlineColor ("Reflection Color", Color) = (0.000000,0.000000,0.000000,1.000000)
//       _Cube ("Reflection Cubemap", CUBE) = "black" { }
//       _EnvMatrixRotation ("Texture Rotation", Vector) = (0.000000,0.000000,0.000000,0.000000)
//       _UnderlayColor ("Border Color", Color) = (0.000000,0.000000,0.000000,0.500000)
//       _UnderlayOffsetX ("Border OffsetX", Range(-1.000000,1.000000)) = 0.000000
//       _UnderlayOffsetY ("Border OffsetY", Range(-1.000000,1.000000)) = 0.000000
//       _UnderlayDilate ("Border Dilate", Range(-1.000000,1.000000)) = 0.000000
//       _UnderlaySoftness ("Border Softness", Range(0.000000,1.000000)) = 0.000000
//       _GlowColor ("Color", Color) = (0.000000,1.000000,0.000000,0.500000)
//       _GlowOffset ("Offset", Range(-1.000000,1.000000)) = 0.000000
//       _GlowInner ("Inner", Range(0.000000,1.000000)) = 0.050000
//       _GlowOuter ("Outer", Range(0.000000,1.000000)) = 0.050000
//       _GlowPower ("Falloff", Range(1.000000,0.000000)) = 0.750000
//       _WeightNormal ("Weight Normal", Float) = 0.000000
//       _WeightBold ("Weight Bold", Float) = 0.500000
//       _ShaderFlags ("Flags", Float) = 0.000000
//       _ScaleRatioA ("Scale RatioA", Float) = 1.000000
//       _ScaleRatioB ("Scale RatioB", Float) = 1.000000
//       _ScaleRatioC ("Scale RatioC", Float) = 1.000000
//       _MainTex ("Font Atlas", 2D) = "white" { }
//       _TextureWidth ("Texture Width", Float) = 512.000000
//       _TextureHeight ("Texture Height", Float) = 512.000000
//       _GradientScale ("Gradient Scale", Float) = 5.000000
//       _ScaleX ("Scale X", Float) = 1.000000
//       _ScaleY ("Scale Y", Float) = 1.000000
//       _PerspectiveFilter ("Perspective Correction", Range(0.000000,1.000000)) = 0.875000
//       _VertexOffsetX ("Vertex OffsetX", Float) = 0.000000
//       _VertexOffsetY ("Vertex OffsetY", Float) = 0.000000
//       _MaskCoord ("Mask Coordinates", Vector) = (0.000000,0.000000,100000.000000,100000.000000)
//       _MaskSoftnessX ("Mask SoftnessX", Float) = 0.000000
//       _MaskSoftnessY ("Mask SoftnessY", Float) = 0.000000
//      }
//      Fallback "TMPro/Mobile/Distance Field"
//      SubShader 1/1 {
//        Tags { "QUEUE"="Overlay" "IGNOREPROJECTOR"="true" "RenderType"="Transparent" }
//        Pass 1/1 {
//          Tags { "QUEUE"="Overlay" "IGNOREPROJECTOR"="true" "RenderType"="Transparent" }
//          ZTest Always
//          ZWrite Off
//          Cull [_CullMode]
//          Blend One OneMinusSrcAlpha
//          GpuProgramID 16467
//          Program "vp" {
//            SubProgram "d3d11 " {
//              GpuProgramIndex 0
//            }
//          }
//        }
//      }
//    }
//
// Unity 5.3 headers extracted from TMPro_SDF Overlay.shader.decompressed:
//   API d3d11
//   Shader model vs_4_0
//   undeciphered1: 201510240 66 0 0
//   undeciphered2: 1 0 4 0 0 0
//   undeciphered3: 31 5 0 0 2 1 1 2 3 4 4 5
//   ConstBuffer "$Globals" 544
//   Vector 112 [_FaceColor]
//   Float 128 [_FaceDilate]
//   Float 132 [_OutlineSoftness]
//   Vector 144 [_OutlineColor]
//   Float 160 [_OutlineWidth]
//   Float 420 [_WeightNormal]
//   Float 424 [_WeightBold]
//   Float 428 [_ScaleRatioA]
//   Float 440 [_VertexOffsetX]
//   Float 444 [_VertexOffsetY]
//   Float 496 [_GradientScale]
//   Float 500 [_ScaleX]
//   Float 504 [_ScaleY]
//   Float 508 [_PerspectiveFilter]
//   Matrix 240 [_EnvMatrix]
//   ConstBuffer "UnityPerCamera" 144
//   Vector 64 [_WorldSpaceCameraPos] 3
//   Vector 96 [_ScreenParams]
//   ConstBuffer "UnityPerDraw" 352
//   Matrix 0 [glstate_matrix_mvp]
//   Matrix 192 [unity_ObjectToWorld]
//   Matrix 256 [unity_WorldToObject]
//   ConstBuffer "UnityPerFrame" 272
//   Matrix 0 [glstate_matrix_projection]
//   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.12 on Thu Dec 06 16:59:07 2018
//
//
// 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   xy          3     NONE   float   xy
// TEXCOORD                 1   xy          4     NONE   float   xy
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float   xyzw
// COLOR                    0   xyzw        1     NONE   float   xyzw
// COLOR                    1   xyzw        2     NONE   float   xyzw
// COLOR                    2   xyzw        3     NONE   float   xyzw
// TEXCOORD                 0   xyzw        4     NONE   float   xyzw
// TEXCOORD                 1   xyzw        5     NONE   float   xyzw
// TEXCOORD                 2   xyzw        6     NONE   float   xyzw
// TEXCOORD                 3   xyz         7     NONE   float   xyz
//
vs_4_0
dcl_constantbuffer cb0[32], immediateIndexed
dcl_constantbuffer cb1[9], immediateIndexed
dcl_constantbuffer cb2[22], immediateIndexed
dcl_constantbuffer cb3[4], immediateIndexed
dcl_input v0.xyzw
dcl_input v1.xyz
dcl_input v2.xyzw
dcl_input v3.xy
dcl_input v4.xy
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_output o4.xyzw
dcl_output o5.xyzw
dcl_output o6.xyzw
dcl_output o7.xyz
dcl_temps 5
dcl_constantbuffer cb10[4], immediateIndexed

// 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


// Unity reflection/specular 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 cf70d9bfe7cbf367-vs.txt

mul r3.w, -r3.x, r3.y
mad r4.xyz, -r3.wwww, cb10[0].xyzw, cb1[4].xyzw

add r0.xy, v0.xyxx, cb0[27].zwzz
mul r1.xyzw, r0.yyyy, cb2[1].xyzw
mad r1.xyzw, cb2[0].xyzw, r0.xxxx, r1.xyzw
mad r1.xyzw, cb2[2].xyzw, v0.zzzz, r1.xyzw
mad r1.xyzw, cb2[3].xyzw, v0.wwww, r1.xyzw
mov o0.xyzw, r1.xyzw
mov o1.xyzw, v2.xyzw
mul o2.xyzw, v2.xyzw, cb0[7].xyzw
mul o3.w, v2.w, cb0[9].w
mov o3.xyz, cb0[9].xyzx
round_ni r0.z, v4.x
mul o4.z, r0.z, l(0.00122070313)
frc r0.z, v4.x
mul o4.w, r0.z, l(5.000000)
mov o4.xy, v3.xyxx
mul r1.x, v1.x, cb2[16].x
mul r1.y, v1.x, cb2[17].x
mul r1.z, v1.x, cb2[18].x
mul r2.x, v1.y, cb2[16].y
mul r2.y, v1.y, cb2[17].y
mul r2.z, v1.y, cb2[18].y
add r1.xyz, r1.xyzx, r2.xyzx
mul r2.x, v1.z, cb2[16].z
mul r2.y, v1.z, cb2[17].z
mul r2.z, v1.z, cb2[18].z
add r1.xyz, r1.xyzx, r2.xyzx
dp3 r0.z, r1.xyzx, r1.xyzx
rsq r0.z, r0.z
mul r1.xyz, r0.zzzz, r1.xyzx
mul r2.xyz, r0.yyyy, cb2[13].xyzx
mad r2.xyz, cb2[12].xyzx, r0.xxxx, r2.xyzx
mov o6.xy, r0.xyxx
mad r0.xyz, cb2[14].xyzx, v0.zzzz, r2.xyzx
mad r0.xyz, cb2[15].xyzx, v0.wwww, r0.xyzx
add r0.xyz, -r0.xyzx, r4.xyzx
dp3 r0.w, r0.xyzx, r0.xyzx
rsq r0.w, r0.w
mul r2.xyz, r0.wwww, r0.xyzx
dp3 r0.w, r1.xyzx, r2.xyzx
mul r1.xy, cb1[6].yyyy, cb3[1].xyxx
mad r1.xy, cb3[0].xyxx, cb1[6].xxxx, r1.xyxx
mul r1.xy, |r1.xyxx|, cb0[31].yzyy
div r1.xy, r1.wwww, r1.xyxx
dp2 r1.z, r1.xyxx, r1.xyxx
div o6.zw, l(0.000000, 0.000000, 0.500000, 0.500000), r1.xxxy
rsq r1.x, r1.z
mul r1.x, r1.x, |v4.y|
mul r1.x, r1.x, cb0[31].x
mul r1.y, r1.x, l(1.500000)
add r1.z, -cb0[31].w, l(1.000000)
mul r1.z, r1.z, r1.y
mad r1.x, r1.x, l(1.500000), -r1.z
mad r0.w, |r0.w|, r1.x, r1.z
eq r1.x, cb3[3].w, l(0.000000)
movc r1.y, r1.x, r0.w, r1.y
ge r0.w, l(0.000000), v4.y
and r0.w, r0.w, l(0x3f800000)
add r1.x, -cb0[26].y, cb0[26].z
mad r0.w, r0.w, r1.x, cb0[26].y
div r0.w, r0.w, cb0[31].x
mul r1.x, cb0[8].x, cb0[26].w
mad r1.w, r1.x, l(0.500000), r0.w
mov o5.yw, r1.yyyw
div r0.w, l(0.500000), r1.y
mad r1.x, -cb0[10].x, cb0[26].w, l(1.000000)
mad r1.x, -cb0[8].y, cb0[26].w, r1.x
mad r1.x, r1.x, l(0.500000), -r0.w
add o5.x, -r1.w, r1.x
add r1.x, -r1.w, l(0.500000)
add o5.z, r0.w, r1.x
mul r1.xyz, r0.yyyy, cb0[16].xyzx
mad r0.xyw, cb0[15].xyxz, r0.xxxx, r1.xyxz
mad o7.xyz, cb0[17].xyzx, r0.zzzz, r0.xywx
ret
// Approximately 0 instruction slots used