// asmtool.py -I ../.. --auto-fix-vertex-halo --fix-unusual-halo-with-inconsistent-w-optimisation --fix-unity-reflection --fix-unity-frustum-world --only-autofixed 8f9631b9b030ba9f-vs.txt
// 3DMigoto: 8f9631b9b030ba9f | Matched 5 variants of 5 shaders: Kyoto/Characters/Human Hair, Kyoto/Standard/Metallic - Alpha Clipping, Kyoto/Standard/Metallic - Translucent, Kyoto/VFX/Transparent Diffuse Additive Lit, Kyoto/VFX/Transparent Diffuse Lit
//
// 01:    Unity headers extracted from HumanHair.shader
// 02:    Unity headers extracted from Metallic_AlphaClipping.shader
// 04:    Unity headers extracted from Metallic_Translucent.shader
// 08:    Unity headers extracted from TransparentDiffuseAdditiveLit.shader
// 10:    Unity headers extracted from TransparentDiffuseLit.shader
// 01:    Shader "Kyoto/Characters/Human Hair" {
// 02:    Shader "Kyoto/Standard/Metallic - Alpha Clipping" {
// 04:    Shader "Kyoto/Standard/Metallic - Translucent" {
// 08:    Shader "Kyoto/VFX/Transparent Diffuse Additive Lit" {
// 10:    Shader "Kyoto/VFX/Transparent Diffuse Lit" {
//          Properties {
// 02:       _Cutoff ("Alpha Cutoff", Range(0.000000,1.000000)) = 0.500000
// 18:      [HideInInspector]  _Mode ("__mode", Float) = 2.000000
// 18:      [HideInInspector]  _SrcBlend ("__src", Float) = 1.000000
// 06:      [HideInInspector] [MaterialEnum( Off, 0 , Front, 1, Back, 2 )]  _Culling ("__cull", Float) = 2.000000
// 18:      [HideInInspector]  _DstBlend ("__dst", Float) = 0.000000
// 06:      [HideInInspector] [MaterialEnum( Off, 0 , Front, 1, Back, 2 )]  _ShadowCulling ("__cull", Float) = 2.000000
// 03:      [HideInInspector]  _MaterialId ("_MaterialId", Float) = 1.000000
// 01:      [HideInInspector]  _Cutoff ("Alpha cutoff", Range(0.000000,1.000000)) = 0.500000
//           _Color ("Color", Color) = (1.000000,1.000000,1.000000,1.000000)
//           _MainTex ("Albedo", 2D) = "white" { }
// 18:       _DepthFeatherAmount ("Depth Feather", Range(0.000000,500.000000)) = 1.000000
// 07:       _GlossBiasUI ("Gloss Bias", Range(0.000000,1.000000)) = 0.000000
// 07:       _GlossScaleUI ("Gloss Scale", Range(0.000000,1.000000)) = 1.000000
// 18:       _ShadowProjectionAlphaModulation ("Shadow Alpha Projection Offset", Range(1.000000,20.000000)) = 5.000000
// 18:       _ShadowBias ("Shadow Bias", Range(0.000000,0.900000)) = 0.100000
// 07:      [HideInInspector]  _GlossParameters ("Gloss Parameters (Gloss, Bias)", Vector) = (1.000000,0.000000,0.000000,1.000000)
// 01:       _BumpScale ("Scale", Float) = 1.000000
// 18:       _NormalDirectionalStrength ("Directional light NdotL strength", Range(0.000000,1.000000)) = 1.000000
// 07:       _BumpMap ("Normal Map", 2D) = "bump" { }
// 18:       _WorldSpaceNormalOverrideBias ("World Space Normal Override Bias", Range(0.000000,1.000000)) = 0.000000
// 01:       _OcclusionStrength ("Strength", Range(0.000000,1.000000)) = 1.000000
// 18:       _WorldSpaceNormalOverrideDir ("World Space Normal Direction", Vector) = (0.000000,1.000000,0.000000,1.000000)
// 03:       _OcclusionMap ("Occlusion", 2D) = "white" { }
// 01:       _EmissionColor ("Color", Color) = (0.000000,0.000000,0.000000,1.000000)
// 06:       _EmissionMap ("Emission", 2D) = "white" { }
// 18:      }
// 06:       _BumpScaleUI ("Scale", Float) = 1.000000
// 01:       _EmissionScale ("Emission Scale", Float) = 1.000000
// 01:       _EmissionMap ("Emission", 2D) = "white" { }
// 06:       _OcclusionStrengthUI ("Strength", Range(0.000000,1.000000)) = 1.000000
// 06:       _EmissionScaleUI ("Emission Scale", Float) = 1.000000
// 06:      [HideInInspector]  _EmissionScale ("Emission Scale For Script Control", Float) = 1.000000
// 06:      [HideInInspector]  _ScaleParameters ("Scale Parameters (Normal, Occlusion, Emission)", Vector) = (1.000000,1.000000,1.000000,1.000000)
// 06:       _EmissionColor ("Color", Color) = (0.000000,0.000000,0.000000,1.000000)
// 07:       _DetailAlbedoMap ("Detail Albedo x2", 2D) = "grey" { }
// 01:       _DetailCompMapScale ("Scale", Float) = 1.000000
// 07:       _DetailCompMap ("Normal Map", 2D) = "bump" { }
// 01:       _DetailGlossScale ("Detail Gloss Scale", Range(0.000000,1.000000)) = 1.000000
// 06:       _DetailNormalScaleUI ("Detail Normal Scale", Float) = 0.000000
// 01:       _DetailOcclusionScale ("Detail Occlusion Scale", Range(0.000000,1.000000)) = 1.000000
// 06:       _DetailOcclusionScaleUI ("Detail Occlusion Scale", Range(0.000000,1.000000)) = 0.000000
// 06:       _DetailGlossScaleUI ("Detail Gloss Scale", Range(0.000000,1.000000)) = 0.000000
// 06:      [HideInInspector]  _DetailScaleParameters ("Detail Scale Parameters (Normal, Occlusion, Gloss)", Vector) = (0.000000,0.000000,0.000000,1.000000)
// 07:       _UVPrime ("UV Set for primary textures", Float) = 0.000000
// 06:      [HideInInspector]  _UvConvolutionPrime0 ("", Vector) = (1.000000,0.000000,0.000000,0.000000)
// 01:      [HideInInspector]  _UvPrimeRotation0 ("", Color) = (1.000000,0.000000,0.000000,0.000000)
// 06:      [HideInInspector]  _UvConvolutionPrime1 ("", Vector) = (0.000000,1.000000,0.000000,0.000000)
// 01:      [HideInInspector]  _UvPrimeRotation1 ("", Color) = (0.000000,1.000000,0.000000,0.000000)
// 06:      [HideInInspector]  _UvConvolutionPrime2 ("", Vector) = (0.000000,0.000000,0.000000,0.000000)
// 06:      [HideInInspector]  _UvConvolutionPrime3 ("", Vector) = (0.000000,0.000000,0.000000,0.000000)
// 07:       _UVSec ("UV Set for secondary textures", Float) = 0.000000
// 06:      [HideInInspector]  _UvConvolutionDetail0 ("", Vector) = (1.000000,0.000000,0.000000,0.000000)
// 01:      [HideInInspector]  _UvDetailRotation0 ("", Color) = (1.000000,0.000000,0.000000,0.000000)
// 06:      [HideInInspector]  _UvConvolutionDetail1 ("", Vector) = (0.000000,1.000000,0.000000,0.000000)
// 01:      [HideInInspector]  _UvDetailRotation1 ("", Color) = (0.000000,1.000000,0.000000,0.000000)
// 01:       _SpecColor ("Specular", Color) = (0.200000,0.200000,0.200000,1.000000)
// 06:      [HideInInspector]  _UvConvolutionDetail2 ("", Vector) = (0.000000,0.000000,0.000000,0.000000)
// 01:       _SpecGlossMap ("Specular", 2D) = "white" { }
// 06:      [HideInInspector]  _UvConvolutionDetail3 ("", Vector) = (0.000000,0.000000,0.000000,0.000000)
// 06:       _Metallic ("Metallic", Range(0.000000,1.000000)) = 1.000000
// 06:       _CompositeMap ("Comp Map", 2D) = "white" { }
// 06:       _NonMetalSpecular ("Non-metal specular", Color) = (0.000000,0.000000,0.000000,1.000000)
// 06:       _MetalDiffuse ("Metal diffuse specular", Color) = (0.000000,0.000000,0.000000,1.000000)
// 18:      Fallback Off
// 07:      }
// 07:      Fallback Off
//          SubShader 1/1 {
// 07:        LOD 300
// 18:        Tags { "QUEUE"="Transparent" "IGNOREPROJECTOR"="true" }
// 02:        Tags { "QUEUE"="AlphaTest" "RenderType"="Opaque" "PerformanceChecks"="False" }
// 04:        Tags { "QUEUE"="Transparent" "RenderType"="Opaque" "PerformanceChecks"="False" }
// 01:        Tags { "QUEUE"="Transparent-5" "RenderType"="Transparent" "PerformanceChecks"="False" }
// 12:        Pass 2/2 {
// 0d:        Pass 3/3 {
//              Name "SHADOWCASTER"
// 02:          Tags { "LIGHTMODE"="SHADOWCASTER" "QUEUE"="AlphaTest" "SHADOWSUPPORT"="true" "RenderType"="Opaque" "PerformanceChecks"="False" }
// 18:          Tags { "LIGHTMODE"="SHADOWCASTER" "QUEUE"="Transparent" "IGNOREPROJECTOR"="true" "SHADOWSUPPORT"="true" }
// 04:          Tags { "LIGHTMODE"="SHADOWCASTER" "QUEUE"="Transparent" "SHADOWSUPPORT"="true" "RenderType"="Opaque" "PerformanceChecks"="False" }
// 01:          Tags { "LIGHTMODE"="SHADOWCASTER" "QUEUE"="Transparent-5" "SHADOWSUPPORT"="true" "RenderType"="Transparent" "PerformanceChecks"="False" }
// 19:          Cull Off
// 06:          Cull [_ShadowCulling]
// 10:          GpuProgramID 100753
// 01:          GpuProgramID 135267
// 04:          GpuProgramID 147008
// 08:          GpuProgramID 179724
// 02:          GpuProgramID 68326
//              Program "vp" {
//                SubProgram "d3d11 " {
// 04:              GpuProgramIndex 108
// 10:              GpuProgramIndex 144
// 01:              GpuProgramIndex 174
// 08:              GpuProgramIndex 324
// 02:              GpuProgramIndex 48
//                }
//              }
//            }
//          }
//        }
//
// 01: Unity 5.3 headers extracted from HumanHair.shader.decompressed:
// 02: Unity 5.3 headers extracted from Metallic_AlphaClipping.shader.decompressed:
// 04: Unity 5.3 headers extracted from Metallic_Translucent.shader.decompressed:
// 08: Unity 5.3 headers extracted from TransparentDiffuseAdditiveLit.shader.decompressed:
// 10: Unity 5.3 headers extracted from TransparentDiffuseLit.shader.decompressed:
//       API d3d11
//       Shader model vs_4_0
//       undeciphered1: 201510240 44 0 0
//       Keywords { "SHADOWS_DEPTH" }
//       undeciphered2: 1 0 5 0 0 0
//       undeciphered3: 11 3 0 0 1 2 3 4
//       ConstBuffer "$Globals" 144
//       Vector 128 [_MainTex_ST]
//       ConstBuffer "UnityLighting" 720
//       Vector 0 [_WorldSpaceLightPos0]
//       ConstBuffer "UnityShadows" 416
//       Vector 80 [unity_LightShadowBias]
//       ConstBuffer "UnityPerDraw" 352
//       Matrix 0 [glstate_matrix_mvp]
//       Matrix 192 [unity_ObjectToWorld]
//       Matrix 256 [unity_WorldToObject]
//       ConstBuffer "UnityPerFrame" 272
//       Matrix 128 [unity_MatrixVP]
//       BindCB "$Globals" 0
//       BindCB "UnityLighting" 1
//       BindCB "UnityShadows" 2
//       BindCB "UnityPerDraw" 3
//       BindCB "UnityPerFrame" 4
//
// 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:00 2018
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyz
// NORMAL                   0   xyz         1     NONE   float   xyz
// TEXCOORD                 0   xy          2     NONE   float   xy
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                 1   xy          0     NONE   float   xy
// SV_POSITION              0   xyzw        1      POS   float   xyzw
//
vs_4_0
dcl_constantbuffer cb0[9], immediateIndexed
dcl_constantbuffer cb1[1], immediateIndexed
dcl_constantbuffer cb2[6], immediateIndexed
dcl_constantbuffer cb3[19], immediateIndexed
dcl_constantbuffer cb4[12], immediateIndexed
dcl_input v0.xyz
dcl_input v1.xyz
dcl_input v2.xy
dcl_output o0.xy
dcl_output_siv o1.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

mad o0.xy, v2.xyxx, cb0[8].xyxx, cb0[8].zwzz
mul r0.x, v1.x, cb3[16].x
mul r0.y, v1.x, cb3[17].x
mul r0.z, v1.x, cb3[18].x
mul r1.x, v1.y, cb3[16].y
mul r1.y, v1.y, cb3[17].y
mul r1.z, v1.y, cb3[18].y
add r0.xyz, r0.xyzx, r1.xyzx
mul r1.x, v1.z, cb3[16].z
mul r1.y, v1.z, cb3[17].z
mul r1.z, v1.z, cb3[18].z
add r0.xyz, r0.xyzx, r1.xyzx
dp3 r0.w, r0.xyzx, r0.xyzx
rsq r0.w, r0.w
mul r0.xyz, r0.wwww, r0.xyzx
mul r1.xyz, v0.yyyy, cb3[13].xyzx
mad r1.xyz, cb3[12].xyzx, v0.xxxx, r1.xyzx
mad r1.xyz, cb3[14].xyzx, v0.zzzz, r1.xyzx
add r1.xyz, r1.xyzx, cb3[15].xyzx
mad r2.xyz, -r1.xyzx, cb1[0].wwww, cb1[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, cb2[5].z
mad r0.xyz, -r0.xyzx, r0.wwww, r1.xyzx
mul r1.xyzw, r0.yyyy, cb4[9].xyzw
mad r1.xyzw, cb4[8].xyzw, r0.xxxx, r1.xyzw
mad r0.xyzw, cb4[10].xyzw, r0.zzzz, r1.xyzw
add r0.xyzw, r0.xyzw, cb4[11].xyzw
mul r1.xyzw, v0.yyyy, cb3[1].xyzw
mad r1.xyzw, cb3[0].xyzw, v0.xxxx, r1.xyzw
mad r1.xyzw, cb3[2].xyzw, v0.zzzz, r1.xyzw
add r1.xyzw, r1.xyzw, cb3[3].xyzw
ne r2.x, cb2[5].z, l(0.000000)
movc r0.xyzw, r2.xxxx, r0.xyzw, r1.xyzw

// Relocated to here with asmtool.py
mov o1.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 8f9631b9b030ba9f-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, cb2[5].x, r0.w
max r1.x, r1.x, l(-1.000000)
min r1.x, r1.x, l(0.000000)
add r0.z, r0.z, r1.x
min r1.x, r0.w, r0.z

// mov o1.xyw, r0.xyxw // Relocated from here with asmtool.py

add r0.x, -r0.z, r1.x
mad o1.z, cb2[5].y, r0.x, r0.z
ret
// Approximately 0 instruction slots used