// asmtool.py -I ../.. --auto-fix-vertex-halo --fix-unusual-halo-with-inconsistent-w-optimisation --fix-unity-reflection --fix-unity-frustum-world --only-autofixed 39dbe561b03d3750-vs.txt
// 3DMigoto: 39dbe561b03d3750 | Matched 4 variants of 1 shaders: Kyoto/Characters/Human Hair
//
//       Unity headers extracted from HumanHair.shader
//       Shader "Kyoto/Characters/Human Hair" {
//         Properties {
//         [HideInInspector]  _MaterialId ("_MaterialId", Float) = 1.000000
//         [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" { }
//          _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)
//          _BumpScale ("Scale", Float) = 1.000000
//          _BumpMap ("Normal Map", 2D) = "bump" { }
//          _OcclusionStrength ("Strength", Range(0.000000,1.000000)) = 1.000000
//          _OcclusionMap ("Occlusion", 2D) = "white" { }
//          _EmissionColor ("Color", Color) = (0.000000,0.000000,0.000000,1.000000)
//          _EmissionScale ("Emission Scale", Float) = 1.000000
//          _EmissionMap ("Emission", 2D) = "white" { }
//          _DetailAlbedoMap ("Detail Albedo x2", 2D) = "grey" { }
//          _DetailCompMapScale ("Scale", Float) = 1.000000
//          _DetailCompMap ("Normal Map", 2D) = "bump" { }
//          _DetailGlossScale ("Detail Gloss Scale", Range(0.000000,1.000000)) = 1.000000
//          _DetailOcclusionScale ("Detail Occlusion Scale", Range(0.000000,1.000000)) = 1.000000
//          _UVPrime ("UV Set for primary textures", Float) = 0.000000
//         [HideInInspector]  _UvPrimeRotation0 ("", Color) = (1.000000,0.000000,0.000000,0.000000)
//         [HideInInspector]  _UvPrimeRotation1 ("", Color) = (0.000000,1.000000,0.000000,0.000000)
//          _UVSec ("UV Set for secondary textures", Float) = 0.000000
//         [HideInInspector]  _UvDetailRotation0 ("", Color) = (1.000000,0.000000,0.000000,0.000000)
//         [HideInInspector]  _UvDetailRotation1 ("", Color) = (0.000000,1.000000,0.000000,0.000000)
//          _SpecColor ("Specular", Color) = (0.200000,0.200000,0.200000,1.000000)
//          _SpecGlossMap ("Specular", 2D) = "white" { }
//         }
//         Fallback Off
//         SubShader 1/1 {
//           LOD 300
//           Tags { "QUEUE"="Transparent-5" "RenderType"="Transparent" "PerformanceChecks"="False" }
//           Pass 1/3 {
//             Name "FORWARD"
//             Tags { "LIGHTMODE"="ForwardBase" "QUEUE"="Transparent-5" "SHADOWSUPPORT"="true" "RenderType"="Transparent" "PerformanceChecks"="False" }
//             ZWrite Off
//             Blend One OneMinusSrcAlpha
//             GpuProgramID 63414
//             Program "vp" {
//               SubProgram "d3d11 " {
// 2:              GpuProgramIndex 35
// 1:              GpuProgramIndex 5
// 4:              GpuProgramIndex 50
// 8:              GpuProgramIndex 80
//               }
//             }
//           }
//         }
//       }
//
//    Unity 5.3 headers extracted from HumanHair.shader.decompressed:
//      API d3d11
//      Shader model vs_4_0
//      undeciphered1: 201510240 160 0 0
// 2:   Keywords { "DIRECTIONAL" "SHADOWS_DEPTH" "LIGHTMAP_OFF" "DIRLIGHTMAP_OFF" "DYNAMICLIGHTMAP_OFF" "ATMOSPHERIC_SCATTERING" "UNIQUE_SHADOW_LIGHT_COOKIE" }
// 1:   Keywords { "DIRECTIONAL" "SHADOWS_DEPTH" "LIGHTMAP_OFF" "DIRLIGHTMAP_OFF" "DYNAMICLIGHTMAP_OFF" "ATMOSPHERIC_SCATTERING" }
// 8:   Keywords { "DIRECTIONAL" "SHADOWS_DEPTH" "LIGHTMAP_OFF" "DIRLIGHTMAP_OFF" "DYNAMICLIGHTMAP_OFF" "UNITY_HDR_ON" "ATMOSPHERIC_SCATTERING" "UNIQUE_SHADOW_LIGHT_COOKIE" }
// 4:   Keywords { "DIRECTIONAL" "SHADOWS_DEPTH" "LIGHTMAP_OFF" "DIRLIGHTMAP_OFF" "DYNAMICLIGHTMAP_OFF" "UNITY_HDR_ON" "ATMOSPHERIC_SCATTERING" }
//      undeciphered2: 1 0 3 0 0 0
//      undeciphered3: 159 6 0 0 2 1 1 2 3 4 4 5 7 8
//      ConstBuffer "$Globals" 848
//      Vector 48 [unity_ColorSpaceLuminance]
//      Vector 240 [u_SunDirection] 3
//      Float 320 [u_WorldScaleExponent]
//      Float 324 [u_WorldNormalDistanceRcp]
//      Float 328 [u_WorldNearScatterPush]
//      Float 332 [u_WorldRayleighDensity]
//      Float 336 [u_WorldMieDensity]
//      Vector 340 [u_RayleighColorM20] 3
//      Vector 352 [u_RayleighColorM10] 3
//      Vector 368 [u_RayleighColorO00] 3
//      Vector 384 [u_RayleighColorP10] 3
//      Vector 400 [u_RayleighColorP20] 3
//      Vector 432 [u_MieColorM20] 3
//      Vector 448 [u_MieColorO00] 3
//      Vector 464 [u_MieColorP20] 3
//      Float 492 [u_HeightNormalDistanceRcp]
//      Float 496 [u_HeightNearScatterPush]
//      Float 500 [u_HeightRayleighDensity]
//      Float 504 [u_HeightMieDensity]
//      Float 508 [u_HeightSeaLevel]
//      Vector 512 [u_HeightPlaneShift] 3
//      Float 524 [u_HeightDistanceRcp]
//      Vector 544 [u_RayleighInScatterPct] 2
//      Float 572 [u_MiePhaseAnisotropy]
//      Float 576 [u_HeightExtinctionFactor]
//      Float 580 [u_RayleighExtinctionFactor]
//      Float 584 [u_MieExtinctionFactor]
//      Vector 592 [u_HeightRayleighColor]
//      Vector 608 [_DistanceFogColor] 3
//      Float 620 [_DistanceFogThickness]
//      Vector 656 [_MainTex_ST]
//      Vector 672 [_UvPrimeRotation0]
//      Vector 688 [_UvPrimeRotation1]
//      Vector 784 [_DetailCompMap_ST]
//      Vector 800 [_UvDetailRotation0]
//      Vector 816 [_UvDetailRotation1]
//      ConstBuffer "UnityPerCamera" 144
//      Vector 64 [_WorldSpaceCameraPos] 3
//      Vector 80 [_ProjectionParams]
//      ConstBuffer "UnityPerDraw" 352
//      Vector 336 [unity_WorldTransformParams]
//      Matrix 0 [glstate_matrix_mvp]
//      Matrix 64 [glstate_matrix_modelview0]
//      Matrix 192 [unity_ObjectToWorld]
//      Matrix 256 [unity_WorldToObject]
//      BindCB "$Globals" 0
//      BindCB "UnityPerCamera" 1
//      BindCB "UnityPerDraw" 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.12 on Thu Dec 06 16:58:47 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   xyzw        6     NONE   float   xyzw
// TEXCOORD                 6   xyzw        7     NONE   float   xyzw
// TEXCOORD                 7   xyz         8     NONE   float   xyz
// TEXCOORD                 8   xyzw        9     NONE   float   xyzw
// TEXCOORD                 9   xyz        10     NONE   float   xyz
// TEXCOORD                10   xyzw       11     NONE   float   xyzw
// TEXCOORD                11   xyzw       12     NONE   float   xyzw
// COLOR                    0   xyzw       13     NONE   float   xyzw
//
vs_4_0
dcl_constantbuffer cb0[52], immediateIndexed
dcl_constantbuffer cb1[9], immediateIndexed
dcl_constantbuffer cb2[22], 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.xyzw
dcl_output o7.xyzw
dcl_output o8.xyz
dcl_output o9.xyzw
dcl_output o10.xyz
dcl_output o11.xyzw
dcl_output o12.xyzw
dcl_output o13.xyzw
dcl_temps 9

// 3DMigoto StereoParams:
dcl_resource_texture2d (float,float,float,float) t125
dcl_constantbuffer cb10[4], immediateIndexed

ld_indexable(texture2d)(float,float,float,float) r7.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 39dbe561b03d3750-vs.txt

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

mul r0.xyzw, v0.yyyy, cb2[1].xyzw
mad r0.xyzw, cb2[0].xyzw, v0.xxxx, r0.xyzw
mad r0.xyzw, cb2[2].xyzw, v0.zzzz, r0.xyzw
mad r0.xyzw, cb2[3].xyzw, v0.wwww, r0.xyzw
mov o0.xyzw, r0.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 39dbe561b03d3750-vs.txt
ne r7.w, r0.w, l(1.0)
if_nz r7.w
  add r7.w, r0.w, -r7.y
  mad r0.x, r7.w, r7.x, r0.x
endif

mul r1.xyz, v0.yyyy, cb2[13].xyzx
mad r1.xyz, cb2[12].xyzx, v0.xxxx, r1.xyzx
mad r1.xyz, cb2[14].xyzx, v0.zzzz, r1.xyzx
mad r1.xyz, cb2[15].xyzx, v0.wwww, r1.xyzx
add r2.xyz, r1.xyzx, -r8.xyzx
mov o1.xyz, r2.xyzx
mul r3.xyz, v4.yyyy, cb2[13].xyzx
mad r3.xyz, cb2[12].xyzx, v4.xxxx, r3.xyzx
mad r3.xyz, cb2[14].xyzx, v4.zzzz, r3.xyzx
dp3 r1.w, r3.xyzx, r3.xyzx
rsq r1.w, r1.w
mul r3.xyz, r1.wwww, r3.xyzx
mov o2.xyz, r3.xyzx
mov o2.w, l(0)
mul r4.x, v1.x, cb2[16].x
mul r4.y, v1.x, cb2[17].x
mul r4.z, v1.x, cb2[18].x
mul r5.x, v1.y, cb2[16].y
mul r5.y, v1.y, cb2[17].y
mul r5.z, v1.y, cb2[18].y
add r4.xyz, r4.xyzx, r5.xyzx
mul r5.x, v1.z, cb2[16].z
mul r5.y, v1.z, cb2[17].z
mul r5.z, v1.z, cb2[18].z
add r4.xyz, r4.xyzx, r5.xyzx
dp3 r1.w, r4.xyzx, r4.xyzx
rsq r1.w, r1.w
mul r4.xyz, r1.wwww, r4.xyzx
mul r5.xyz, r3.yzxy, r4.zxyz
mad r3.xyz, r4.yzxy, r3.zxyz, -r5.xyzx
mov o4.xyz, r4.xyzx
mul r1.w, v4.w, cb2[21].w
mul o3.xyz, r1.wwww, r3.xyzx
mov o3.w, l(0)
mov o4.w, l(0)
mov o5.xyzw, l(0,0,0,0)
mul r0.y, r0.y, cb1[5].x
mul r3.xzw, r0.xxwy, l(0.500000, 0.000000, 0.500000, 0.500000)
mov o6.zw, r0.zzzw
add o6.xy, r3.zzzz, r3.xwxx
mul r0.x, v0.y, cb2[5].z
mad r0.x, cb2[4].z, v0.x, r0.x
mad r0.x, cb2[6].z, v0.z, r0.x
mad r0.x, cb2[7].z, v0.w, r0.x
mov o7.w, -r0.x
mov o7.xyz, r1.xyzx
mov o8.xyz, r1.xyzx
lt r0.xy, l(0.000000, 0.000000, 0.000000, 0.000000), r1.xzxx
lt r0.zw, r1.xxxz, l(0.000000, 0.000000, 0.000000, 0.000000)
iadd r0.xy, -r0.xyxx, r0.zwzz
itof r0.xy, r0.xyxx
log r0.zw, |r1.xxxz|
mul r0.zw, r0.zzzw, cb0[20].xxxx
exp r0.zw, r0.zzzw
mul r1.xz, r0.zzwz, r0.xxyx
lt r0.xy, l(0.000000, 0.000000, 0.000000, 0.000000), r8.xzxx
lt r0.zw, r8.xxxz, l(0.000000, 0.000000, 0.000000, 0.000000)
iadd r0.xy, -r0.xyxx, r0.zwzz
itof r0.xy, r0.xyxx
log r0.zw, |r8.xxxz|
mul r0.zw, r0.zzzw, cb0[20].xxxx
exp r0.zw, r0.zzzw
mul r0.xz, r0.zzwz, r0.xxyx
mov r0.y, r8.y
add r0.xyz, -r0.xyzx, r1.xyzx
dp3 r0.w, r0.xyzx, r0.xyzx
sqrt r0.w, r0.w
div r1.x, r0.y, r0.w
dp3 r0.x, r0.xyzx, cb0[32].xyzx
add r0.x, -r0.x, r1.y
add r0.x, r0.x, -cb0[31].w
mul r0.x, r0.x, cb0[32].w
mul r0.xy, r0.xwxx, l(-1.442695, 0.004000, 0.000000, 0.000000)
exp r0.x, r0.x
min r0.y, r0.y, l(1.000000)
mul r0.z, r0.y, r1.x
mad r1.xyzw, r1.xxxx, r0.yyyy, l(-0.116000, 0.116000, 0.216000, 0.216000)
mul r1.xyzw, r1.xzwy, l(10.000000, 10.000000, 4.62962961, 8.620690)
mul r3.xy, r0.zzzz, l(4.62962961, 8.620690, 0.000000, 0.000000)
ge r4.xyz, r0.zzzz, l(0.116000, 0.000000, -0.116000, 0.000000)
add r5.xyz, -cb0[23].xyzx, cb0[24].xyzx
mad r3.yzw, r3.yyyy, r5.xxyz, cb0[23].xxyz
add r5.xyz, -cb0[22].xyzx, cb0[23].xyzx
mad r5.xyz, r1.wwww, r5.xyzx, cb0[22].xyzx
mov_sat r1.xyz, r1.xyzx
add r6.xyz, -cb0[21].yzwy, cb0[22].xyzx
mad r6.xyz, r1.yyyy, r6.xyzx, cb0[21].yzwy
movc r5.xyz, r4.zzzz, r5.xyzx, r6.xyzx
movc r3.yzw, r4.yyyy, r3.yyzw, r5.xxyz
add r5.xyz, -cb0[24].xyzx, cb0[25].xyzx
mad r1.xyw, r1.xxxx, r5.xyxz, cb0[24].xyxz
movc r1.xyw, r4.xxxx, r1.xyxw, r3.yzyw
mul r3.yzw, r1.xxyw, cb0[3].xxyz
add r0.yz, r3.zzwz, r3.yyyy
mul r0.z, r0.z, r3.z
mad r0.y, r1.w, cb0[3].z, r0.y
sqrt r0.z, r0.z
dp2 r0.z, cb0[3].wwww, r0.zzzz
add r0.y, r0.z, r0.y
add r1.xyw, -r0.yyyy, r1.xyxw
add r0.z, r0.w, cb0[20].z
max r0.z, r0.z, l(0.000000)
mul r3.yz, r0.zzzz, cb0[20].yywy
mul r0.z, r0.z, cb0[21].x
mul r0.z, r0.z, l(1.442695)
exp r0.z, r0.z
add r0.z, -r0.z, l(1.000000)
mov_sat r3.xy, r3.xyxx
mul r2.w, r3.z, l(1.442695)
exp r2.w, r2.w
add r2.w, -r2.w, l(1.000000)
mad r1.xyw, r3.yyyy, r1.xyxw, r0.yyyy
dp3 r0.y, r2.xyzx, r2.xyzx
rsq r0.y, r0.y
mul r2.xyz, r0.yyyy, r2.xyzx
dp3 r0.y, r2.xyzx, cb0[15].xyzx
mul r2.x, r0.y, r0.y
mad r2.x, r2.x, l(0.0596831031), l(0.0596831031)
mul r2.x, r2.x, l(12.000000)
min r2.x, r2.x, l(1.000000)
mul r2.x, r2.x, r2.w
mul r1.xyw, r1.xyxw, r2.xxxx
mad r2.x, -r2.x, cb0[36].y, l(1.000000)
add r2.yzw, -cb0[28].xxyz, cb0[29].xxyz
mad r2.yzw, r3.xxxx, r2.yyzw, cb0[28].xxyz
add r3.xyz, -cb0[27].xyzx, cb0[28].xyzx
mad r3.xyz, r1.zzzz, r3.xyzx, cb0[27].xyzx
movc r2.yzw, r4.yyyy, r2.yyzw, r3.xxyz
mad r1.z, r0.y, r0.y, l(1.000000)
add r3.x, cb0[35].w, cb0[35].w
mad r3.yz, cb0[35].wwww, cb0[35].wwww, l(0.000000, 2.000000, 1.000000, 0.000000)
mad r0.y, -r3.x, r0.y, r3.z
log r0.y, r0.y
mul r0.y, r0.y, l(1.500000)
exp r0.y, r0.y
div r0.y, r1.z, r0.y
mad r1.z, -cb0[35].w, cb0[35].w, l(1.000000)
div r1.z, r1.z, r3.y
mul r0.y, r0.y, r1.z
mul r0.y, r0.y, l(0.119366206)
add r1.z, r0.w, cb0[31].x
mul_sat o11.w, r0.w, cb0[38].w
max r0.w, r1.z, l(0.000000)
mul r3.xy, r0.wwww, cb0[31].yzyy
mul_sat r0.w, r0.w, cb0[30].w
mul r3.xy, r3.xyxx, l(1.442695, 1.442695, 0.000000, 0.000000)
exp r3.xy, r3.xyxx
add r3.xy, -r3.xyxx, l(1.000000, 1.000000, 0.000000, 0.000000)
mul r3.xy, r0.xxxx, r3.xyxx
mul_sat r0.x, r0.y, r3.y
mul r0.y, r0.y, r0.z
mul r3.yzw, r2.yyzw, r0.xxxx
mad r2.yzw, r0.yyyy, r2.yyzw, r3.yyzw
mad r0.x, -r0.y, cb0[36].z, l(1.000000)
mad o9.xyz, r1.xywx, cb0[34].xxxx, r2.yzwy
mul r1.xyz, r1.xywx, cb0[34].yyyy
mad r0.y, -r3.x, cb0[36].x, r2.x
mov_sat r3.x, r3.x
max r0.xy, r0.xyxx, l(0.000000, 0.000000, 0.000000, 0.000000)
mul o9.w, r0.x, r0.y
mul r0.xyz, cb0[3].xyzx, cb0[37].xyzx
add r0.xz, r0.yyzy, r0.xxxx
mul r0.y, r0.z, r0.y
mad r0.x, cb0[37].z, cb0[3].z, r0.x
sqrt r0.y, r0.y
dp2 r0.y, cb0[3].wwww, r0.yyyy
add r0.x, r0.y, r0.x
add r2.xyz, -r0.xxxx, cb0[37].xyzx
mad r0.xyz, r0.wwww, r2.xyzx, r0.xxxx
mad o10.xyz, r3.xxxx, r0.xyzx, r1.xyzx
mov o11.xyz, cb0[38].xyzx
mov r0.xy, v2.xyxx
mov r0.zw, v3.xxxy
dp4 r1.x, cb0[42].xyzw, r0.xyzw
dp4 r1.y, cb0[43].xyzw, r0.xyzw
mad o12.xy, r1.xyxx, cb0[41].xyxx, cb0[41].zwzz
dp4 r1.z, cb0[50].xyzw, r0.xyzw
dp4 r1.w, cb0[51].xyzw, r0.xyzw
mad o12.zw, r1.zzzw, cb0[49].xxxy, cb0[49].zzzw
mov o13.xyzw, v5.xyzw
ret
// Approximately 0 instruction slots used