// asmtool.py -I ../.. --auto-fix-vertex-halo --fix-unusual-halo-with-inconsistent-w-optimisation --fix-unity-reflection --fix-unity-frustum-world --only-autofixed ae86273d312a51c5-vs.txt
// 3DMigoto: ae86273d312a51c5 | Matched 48 variants of 2 shaders: Kyoto/Standard/Metallic - Alpha Clipping, Kyoto/Standard/Metallic - Opaque
//
// 000000ffffff:    Unity headers extracted from Metallic_AlphaClipping.shader
// ffffff000000:    Unity headers extracted from Metallic_Opaque.shader
// 000000ffffff:    Shader "Kyoto/Standard/Metallic - Alpha Clipping" {
// ffffff000000:    Shader "Kyoto/Standard/Metallic - Opaque" {
//                    Properties {
// 000000ffffff:       _Cutoff ("Alpha Cutoff", Range(0.000000,1.000000)) = 0.500000
//                    [HideInInspector] [MaterialEnum( Off, 0 , Front, 1, Back, 2 )]  _Culling ("__cull", Float) = 2.000000
//                    [HideInInspector] [MaterialEnum( Off, 0 , Front, 1, Back, 2 )]  _ShadowCulling ("__cull", Float) = 2.000000
//                    [HideInInspector]  _MaterialId ("_MaterialId", Float) = 1.000000
//                     _Color ("Color", Color) = (1.000000,1.000000,1.000000,1.000000)
//                     _MainTex ("Albedo", 2D) = "white" { }
//                     _GlossBiasUI ("Gloss Bias", Range(0.000000,1.000000)) = 0.000000
//                     _GlossScaleUI ("Gloss Scale", Range(0.000000,1.000000)) = 1.000000
//                    [HideInInspector]  _GlossParameters ("Gloss Parameters (Gloss, Bias)", Vector) = (1.000000,0.000000,0.000000,1.000000)
//                     _BumpMap ("Normal Map", 2D) = "bump" { }
// 000000ffffff:       _OcclusionMap ("Occlusion", 2D) = "white" { }
//                     _EmissionMap ("Emission", 2D) = "white" { }
//                     _BumpScaleUI ("Scale", Float) = 1.000000
//                     _OcclusionStrengthUI ("Strength", Range(0.000000,1.000000)) = 1.000000
//                     _EmissionScaleUI ("Emission Scale", Float) = 1.000000
//                    [HideInInspector]  _EmissionScale ("Emission Scale For Script Control", Float) = 1.000000
//                    [HideInInspector]  _ScaleParameters ("Scale Parameters (Normal, Occlusion, Emission)", Vector) = (1.000000,1.000000,1.000000,1.000000)
//                     _EmissionColor ("Color", Color) = (0.000000,0.000000,0.000000,1.000000)
//                     _DetailAlbedoMap ("Detail Albedo x2", 2D) = "grey" { }
//                     _DetailCompMap ("Normal Map", 2D) = "bump" { }
// 000000ffffff:       _DetailNormalScaleUI ("Detail Normal Scale", Float) = 0.000000
// ffffff000000:       _DetailNormalScaleUI ("Detail Normal Scale", Float) = 1.000000
// 000000ffffff:       _DetailOcclusionScaleUI ("Detail Occlusion Scale", Range(0.000000,1.000000)) = 0.000000
// ffffff000000:       _DetailOcclusionScaleUI ("Detail Occlusion Scale", Range(0.000000,1.000000)) = 1.000000
// 000000ffffff:       _DetailGlossScaleUI ("Detail Gloss Scale", Range(0.000000,1.000000)) = 0.000000
// ffffff000000:       _DetailGlossScaleUI ("Detail Gloss Scale", Range(0.000000,1.000000)) = 1.000000
// 000000ffffff:      [HideInInspector]  _DetailScaleParameters ("Detail Scale Parameters (Normal, Occlusion, Gloss)", Vector) = (0.000000,0.000000,0.000000,1.000000)
// ffffff000000:      [HideInInspector]  _DetailScaleParameters ("Detail Scale Parameters (Normal, Occlusion, Gloss)", Vector) = (1.000000,1.000000,1.000000,1.000000)
//                     _UVPrime ("UV Set for primary textures", Float) = 0.000000
//                    [HideInInspector]  _UvConvolutionPrime0 ("", Vector) = (1.000000,0.000000,0.000000,0.000000)
//                    [HideInInspector]  _UvConvolutionPrime1 ("", Vector) = (0.000000,1.000000,0.000000,0.000000)
//                    [HideInInspector]  _UvConvolutionPrime2 ("", Vector) = (0.000000,0.000000,0.000000,0.000000)
//                    [HideInInspector]  _UvConvolutionPrime3 ("", Vector) = (0.000000,0.000000,0.000000,0.000000)
// ffffff000000:       _UVSec ("UV Set for detail textures", Float) = 0.000000
// 000000ffffff:       _UVSec ("UV Set for secondary textures", Float) = 0.000000
//                    [HideInInspector]  _UvConvolutionDetail0 ("", Vector) = (1.000000,0.000000,0.000000,0.000000)
//                    [HideInInspector]  _UvConvolutionDetail1 ("", Vector) = (0.000000,1.000000,0.000000,0.000000)
//                    [HideInInspector]  _UvConvolutionDetail2 ("", Vector) = (0.000000,0.000000,0.000000,0.000000)
//                    [HideInInspector]  _UvConvolutionDetail3 ("", Vector) = (0.000000,0.000000,0.000000,0.000000)
// ffffff000000:       _HeightBiasUI ("Heightmap Bias", Range(-1.000000,1.000000)) = 0.000000
// ffffff000000:       _HeightScaleUI ("Heightmap Scale", Range(-10.000000,10.000000)) = 0.000000
// ffffff000000:      [HideInInspector]  _HeightParameters ("Height Parameters (Bias, Scale)", Vector) = (1.000000,1.000000,1.000000,1.000000)
//                     _Metallic ("Metallic", Range(0.000000,1.000000)) = 1.000000
//                     _CompositeMap ("Comp Map", 2D) = "white" { }
//                     _NonMetalSpecular ("Non-metal specular", Color) = (0.000000,0.000000,0.000000,1.000000)
//                     _MetalDiffuse ("Metal diffuse specular", Color) = (0.000000,0.000000,0.000000,1.000000)
//                    }
//                    Fallback Off
//                    SubShader 1/1 {
//                      LOD 300
// 000000ffffff:        Tags { "QUEUE"="AlphaTest" "RenderType"="Opaque" "PerformanceChecks"="False" }
// ffffff000000:        Tags { "RenderType"="Opaque" "PerformanceChecks"="False" }
//                      Pass 1/2 {
//                        Name "DEFERRED"
// 000000ffffff:          Tags { "LIGHTMODE"="Deferred" "QUEUE"="AlphaTest" "RenderType"="Opaque" "PerformanceChecks"="False" }
// ffffff000000:          Tags { "LIGHTMODE"="Deferred" "RenderType"="Opaque" "PerformanceChecks"="False" }
//                        Cull [_Culling]
// 000000ffffff:          GpuProgramID 38541
// ffffff000000:          GpuProgramID 65108
//                        Program "vp" {
//                          SubProgram "d3d11 " {
// 000001000001:              GpuProgramIndex 0
// 000002000002:              GpuProgramIndex 1
// 000400000400:              GpuProgramIndex 10
// 000800000800:              GpuProgramIndex 11
// 001000001000:              GpuProgramIndex 12
// 002000002000:              GpuProgramIndex 13
// 004000004000:              GpuProgramIndex 14
// 008000008000:              GpuProgramIndex 15
// 010000010000:              GpuProgramIndex 16
// 020000020000:              GpuProgramIndex 17
// 040000040000:              GpuProgramIndex 18
// 080000080000:              GpuProgramIndex 19
// 000004000004:              GpuProgramIndex 2
// 100000100000:              GpuProgramIndex 20
// 200000200000:              GpuProgramIndex 21
// 400000400000:              GpuProgramIndex 22
// 800000800000:              GpuProgramIndex 23
// 000008000008:              GpuProgramIndex 3
// 000010000010:              GpuProgramIndex 4
// 000020000020:              GpuProgramIndex 5
// 000040000040:              GpuProgramIndex 6
// 000080000080:              GpuProgramIndex 7
// 000100000100:              GpuProgramIndex 8
// 000200000200:              GpuProgramIndex 9
//                          }
//                        }
//                      }
//                    }
//                  }
//
// 000000ffffff: Unity 5.3 headers extracted from Metallic_AlphaClipping.shader.decompressed:
// ffffff000000: Unity 5.3 headers extracted from Metallic_Opaque.shader.decompressed:
//                 API d3d11
//                 Shader model vs_4_0
//                 undeciphered1: 201510240 45 0 0
// 000020000020:   Keywords { "LIGHTMAP_OFF" "DIRLIGHTMAP_COMBINED" "DYNAMICLIGHTMAP_OFF" "KYOTO_TEXEL_DENSITY" }
// 000080000080:   Keywords { "LIGHTMAP_OFF" "DIRLIGHTMAP_COMBINED" "DYNAMICLIGHTMAP_OFF" "LIGHTMAP_OCCLUSION_ONLY" "KYOTO_TEXEL_DENSITY" }
// 080000080000:   Keywords { "LIGHTMAP_OFF" "DIRLIGHTMAP_COMBINED" "DYNAMICLIGHTMAP_OFF" "LIGHTMAP_OCCLUSION_ONLY" "UNITY_HDR_ON" "KYOTO_TEXEL_DENSITY" }
// 040000040000:   Keywords { "LIGHTMAP_OFF" "DIRLIGHTMAP_COMBINED" "DYNAMICLIGHTMAP_OFF" "LIGHTMAP_OCCLUSION_ONLY" "UNITY_HDR_ON" }
// 000040000040:   Keywords { "LIGHTMAP_OFF" "DIRLIGHTMAP_COMBINED" "DYNAMICLIGHTMAP_OFF" "LIGHTMAP_OCCLUSION_ONLY" }
// 020000020000:   Keywords { "LIGHTMAP_OFF" "DIRLIGHTMAP_COMBINED" "DYNAMICLIGHTMAP_OFF" "UNITY_HDR_ON" "KYOTO_TEXEL_DENSITY" }
// 010000010000:   Keywords { "LIGHTMAP_OFF" "DIRLIGHTMAP_COMBINED" "DYNAMICLIGHTMAP_OFF" "UNITY_HDR_ON" }
// 000010000010:   Keywords { "LIGHTMAP_OFF" "DIRLIGHTMAP_COMBINED" "DYNAMICLIGHTMAP_OFF" }
// 000002000002:   Keywords { "LIGHTMAP_OFF" "DIRLIGHTMAP_OFF" "DYNAMICLIGHTMAP_OFF" "KYOTO_TEXEL_DENSITY" }
// 000008000008:   Keywords { "LIGHTMAP_OFF" "DIRLIGHTMAP_OFF" "DYNAMICLIGHTMAP_OFF" "LIGHTMAP_OCCLUSION_ONLY" "KYOTO_TEXEL_DENSITY" }
// 008000008000:   Keywords { "LIGHTMAP_OFF" "DIRLIGHTMAP_OFF" "DYNAMICLIGHTMAP_OFF" "LIGHTMAP_OCCLUSION_ONLY" "UNITY_HDR_ON" "KYOTO_TEXEL_DENSITY" }
// 004000004000:   Keywords { "LIGHTMAP_OFF" "DIRLIGHTMAP_OFF" "DYNAMICLIGHTMAP_OFF" "LIGHTMAP_OCCLUSION_ONLY" "UNITY_HDR_ON" }
// 000004000004:   Keywords { "LIGHTMAP_OFF" "DIRLIGHTMAP_OFF" "DYNAMICLIGHTMAP_OFF" "LIGHTMAP_OCCLUSION_ONLY" }
// 002000002000:   Keywords { "LIGHTMAP_OFF" "DIRLIGHTMAP_OFF" "DYNAMICLIGHTMAP_OFF" "UNITY_HDR_ON" "KYOTO_TEXEL_DENSITY" }
// 001000001000:   Keywords { "LIGHTMAP_OFF" "DIRLIGHTMAP_OFF" "DYNAMICLIGHTMAP_OFF" "UNITY_HDR_ON" }
// 000001000001:   Keywords { "LIGHTMAP_OFF" "DIRLIGHTMAP_OFF" "DYNAMICLIGHTMAP_OFF" }
// 000200000200:   Keywords { "LIGHTMAP_OFF" "DIRLIGHTMAP_SEPARATE" "DYNAMICLIGHTMAP_OFF" "KYOTO_TEXEL_DENSITY" }
// 000800000800:   Keywords { "LIGHTMAP_OFF" "DIRLIGHTMAP_SEPARATE" "DYNAMICLIGHTMAP_OFF" "LIGHTMAP_OCCLUSION_ONLY" "KYOTO_TEXEL_DENSITY" }
// 800000800000:   Keywords { "LIGHTMAP_OFF" "DIRLIGHTMAP_SEPARATE" "DYNAMICLIGHTMAP_OFF" "LIGHTMAP_OCCLUSION_ONLY" "UNITY_HDR_ON" "KYOTO_TEXEL_DENSITY" }
// 400000400000:   Keywords { "LIGHTMAP_OFF" "DIRLIGHTMAP_SEPARATE" "DYNAMICLIGHTMAP_OFF" "LIGHTMAP_OCCLUSION_ONLY" "UNITY_HDR_ON" }
// 000400000400:   Keywords { "LIGHTMAP_OFF" "DIRLIGHTMAP_SEPARATE" "DYNAMICLIGHTMAP_OFF" "LIGHTMAP_OCCLUSION_ONLY" }
// 200000200000:   Keywords { "LIGHTMAP_OFF" "DIRLIGHTMAP_SEPARATE" "DYNAMICLIGHTMAP_OFF" "UNITY_HDR_ON" "KYOTO_TEXEL_DENSITY" }
// 100000100000:   Keywords { "LIGHTMAP_OFF" "DIRLIGHTMAP_SEPARATE" "DYNAMICLIGHTMAP_OFF" "UNITY_HDR_ON" }
// 000100000100:   Keywords { "LIGHTMAP_OFF" "DIRLIGHTMAP_SEPARATE" "DYNAMICLIGHTMAP_OFF" }
//                 undeciphered2: 1 0 4 0 0 0
//                 undeciphered3: 159 6 0 0 2 1 1 2 3 4 4 5 7 8
// 000000555555:   ConstBuffer "$Globals" 528
// 555555000000:   ConstBuffer "$Globals" 544
// 000000aaaaaa:   ConstBuffer "$Globals" 608
// aaaaaa000000:   ConstBuffer "$Globals" 624
//                 Vector 224 [_MainTex_ST]
//                 Vector 240 [_UvConvolutionPrime0]
//                 Vector 256 [_UvConvolutionPrime1]
//                 Vector 272 [_UvConvolutionPrime2]
//                 Vector 288 [_UvConvolutionPrime3]
//                 Vector 368 [_DetailCompMap_ST]
//                 Vector 400 [_UvConvolutionDetail0]
//                 Vector 416 [_UvConvolutionDetail1]
//                 Vector 432 [_UvConvolutionDetail2]
//                 Vector 448 [_UvConvolutionDetail3]
//                 ConstBuffer "UnityPerCamera" 144
//                 Vector 64 [_WorldSpaceCameraPos] 3
//                 ConstBuffer "UnityPerDraw" 352
//                 Vector 336 [unity_WorldTransformParams]
//                 Matrix 192 [unity_ObjectToWorld]
//                 Matrix 256 [unity_WorldToObject]
//                 ConstBuffer "UnityPerFrame" 272
//                 Matrix 128 [unity_MatrixVP]
//                 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:03 2018
//
//
// 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   xy
// TEXCOORD                 1   xy          3     NONE   float   xy
// TANGENT                  0   xyzw        4     NONE   float   xyzw
// COLOR                    0   xyzw        5     NONE   float   xyzw
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float   xyzw
// TEXCOORD                 0   xyz         1     NONE   float   xyz
// TEXCOORD                 1   xyzw        2     NONE   float   xyzw
// TEXCOORD                 2   xyzw        3     NONE   float   xyzw
// TEXCOORD                 3   xyzw        4     NONE   float   xyzw
// TEXCOORD                 4   xyzw        5     NONE   float   xyzw
// TEXCOORD                 5   xyz         6     NONE   float   xyz
// TEXCOORD                 6   xyzw        7     NONE   float   xyzw
// TEXCOORD                 7   xyzw        8     NONE   float   xyzw
// COLOR                    0   xyzw        9     NONE   float   xyzw
//
vs_4_0
dcl_constantbuffer cb0[29], immediateIndexed
dcl_constantbuffer cb1[9], immediateIndexed
dcl_constantbuffer cb2[22], immediateIndexed
dcl_constantbuffer cb3[17], immediateIndexed
dcl_input v0.xyzw
dcl_input v1.xyz
dcl_input v2.xy
dcl_input v3.xy
dcl_input v4.xyzw
dcl_input v5.xyzw
dcl_output_siv o0.xyzw, position
dcl_output o1.xyz
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_output o4.xyzw
dcl_output o5.xyzw
dcl_output o6.xyz
dcl_output o7.xyzw
dcl_output o8.xyzw
dcl_output o9.xyzw
dcl_temps 6
dcl_constantbuffer cb10[4], immediateIndexed

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

ld_indexable(texture2d)(float,float,float,float) r4.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 ae86273d312a51c5-vs.txt

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

mul r0.xyzw, v0.yyyy, cb2[13].xyzw
mad r0.xyzw, cb2[12].xyzw, v0.xxxx, r0.xyzw
mad r0.xyzw, cb2[14].xyzw, v0.zzzz, r0.xyzw
mad r0.xyzw, cb2[15].xyzw, v0.wwww, r0.xyzw
mul r1.xyzw, r0.yyyy, cb3[9].xyzw
mad r1.xyzw, cb3[8].xyzw, r0.xxxx, r1.xyzw
mad r1.xyzw, cb3[10].xyzw, r0.zzzz, r1.xyzw
mad o0.xyzw, cb3[11].xyzw, r0.wwww, r1.xyzw
add o1.xyz, r0.xyzx, -r5.xyzx
mul r1.xyz, v4.yyyy, cb2[13].xyzx
mad r1.xyz, cb2[12].xyzx, v4.xxxx, r1.xyzx
mad r1.xyz, cb2[14].xyzx, v4.zzzz, r1.xyzx
dp3 r0.w, r1.xyzx, r1.xyzx
rsq r0.w, r0.w
mul r1.xyz, r0.wwww, r1.xyzx
mov o2.xyz, r1.xyzx
mov o2.w, l(0)
mul r2.x, v1.x, cb2[16].x
mul r2.y, v1.x, cb2[17].x
mul r2.z, v1.x, cb2[18].x
mul r3.x, v1.y, cb2[16].y
mul r3.y, v1.y, cb2[17].y
mul r3.z, v1.y, cb2[18].y
add r2.xyz, r2.xyzx, r3.xyzx
mul r3.x, v1.z, cb2[16].z
mul r3.y, v1.z, cb2[17].z
mul r3.z, v1.z, cb2[18].z
add r2.xyz, r2.xyzx, r3.xyzx
dp3 r0.w, r2.xyzx, r2.xyzx
rsq r0.w, r0.w
mul r2.xyz, r0.wwww, r2.xyzx
mul r3.xyz, r1.yzxy, r2.zxyz
mad r1.xyz, r2.yzxy, r1.zxyz, -r3.xyzx
mov o4.xyz, r2.xyzx
mul r0.w, v4.w, cb2[21].w
mul o3.xyz, r0.wwww, r1.xyzx
mov o3.w, l(0)
mov o4.w, l(0)
mov o5.xyzw, l(0,0,0,0)
mov o6.xyz, r0.xyzx
dp3 r1.x, cb0[17].xyzx, r0.xyzx
dp3 r1.y, cb0[18].xyzx, r0.xyzx
mov r2.xy, v2.xyxx
mov r2.zw, v3.xxxy
dp4 r3.x, cb0[15].xyzw, r2.xyzw
dp4 r3.y, cb0[16].xyzw, r2.xyzw
add r1.xy, r1.xyxx, r3.xyxx
mad o7.xy, r1.xyxx, cb0[14].xyxx, cb0[14].zwzz
dp3 r1.z, cb0[27].xyzx, r0.xyzx
dp3 r1.w, cb0[28].xyzx, r0.xyzx
dp4 r0.z, cb0[25].xyzw, r2.xyzw
dp4 r0.w, cb0[26].xyzw, r2.xyzw
add r0.xy, r0.zwzz, r1.zwzz
mad o7.zw, r0.xxxy, cb0[23].xxxy, cb0[23].zzzw
mov o8.xyzw, l(0,0,0,0)
mov o9.xyzw, v5.xyzw
ret
// Approximately 0 instruction slots used