// asmtool.py -I ../.. --fix-unity-reflection --only-autofixed 0e9c2377261c9a2a-ps.txt
// 3DMigoto: 0e9c2377261c9a2a |    Unity headers extracted from Midnight Hub_Nature_Cliff
//    Shader "Midnight Hub/Nature/Cliff" {
//      CustomEditor "Rendering.Materials.StandarMaterialEditor"
//      Fallback "Diffuse"
//      SubShader 1/1 {
//        Pass 2/5 {
//          Name "FORWARD"
//          Tags { "LIGHTMODE"="FORWARDADD" "SHADOWSUPPORT"="true" }
//          ZWrite Off
//          Program "fp" {
//            SubProgram "d3d11" {
//            }
//          }
//        }
//      }
//    }
//
// Unity 5.3 headers extracted from Midnight Hub_Nature_Cliff:
//   API d3d11
//   Shader model ps_4_0
//   undeciphered1: 201609010 135 10 2
//   undeciphered1a: 9
//   Keywords { "DIRECTIONAL_COOKIE" "SHADOWS_SCREEN" "LOD_FADE_CROSSFADE" "NORMAL_MULTIPLYER" }
//   undeciphered2: 1 10 7 10 0 0
//   undeciphered3: 0 0
//   ConstBuffer "$Globals" 1312
//   Vector 32 [_LightColor0]
//   Float 1152 [_MetalnessMult]
//   Float 1156 [_ShininessMult]
//   Vector 1168 [_Normal_ST]
//   Vector 1200 [_Color]
//   Float 1216 [_NormalMapMultiplyer]
//   Vector 1248 [_DetailNormal_ST]
//   Float 1296 [_Cutoff]
//   Matrix 1088 [unity_WorldToLight]
//   ConstBuffer "UnityPerCamera" 144
//   Vector 64 [_WorldSpaceCameraPos] 3
//   ConstBuffer "UnityLighting" 752
//   Vector 0 [_WorldSpaceLightPos0]
//   Vector 720 [unity_OcclusionMaskSelector]
//   ConstBuffer "UnityShadows" 416
//   Vector 384 [_LightShadowData]
//   Vector 400 [unity_ShadowFadeCenterAndType]
//   ConstBuffer "UnityPerDraw" 160
//   Vector 128 [unity_LODFade]
//   ConstBuffer "UnityPerFrame" 384
//   Matrix 144 [unity_MatrixV]
//   ConstBuffer "UnityProbeVolume" 112
//   Vector 0 [unity_ProbeVolumeParams]
//   Vector 80 [unity_ProbeVolumeSizeInv] 3
//   Vector 96 [unity_ProbeVolumeMin] 3
//   Matrix 16 [unity_ProbeVolumeWorldToObject]
//   SetTexture 0 [_Normal] 2D 4
//   SetTexture 1 [_MainTex] 2D 5
//   SetTexture 2 [_Roughness] 2D 6
//   SetTexture 3 [_DitherMaskLOD2D] 2D 1
//   SetTexture 4 [_DetailAlbedo] 2D 7
//   SetTexture 5 [_DetailNormal] 2D 8
//   SetTexture 6 [_DetailRoughness] 2D 9
//   SetTexture 7 [_ShadowMapTexture] 2D 2
//   SetTexture 8 [_LightTexture0] 2D 3
//   SetTexture 9 [unity_ProbeVolumeSH] 3D 0
//   BindCB "$Globals" 0
//   BindCB "UnityPerCamera" 1
//   BindCB "UnityLighting" 2
//   BindCB "UnityShadows" 3
//   BindCB "UnityPerDraw" 4
//   BindCB "UnityPerFrame" 5
//   BindCB "UnityProbeVolume" 6
//
// Headers extracted with DarkStarSword's extract_unity55_shaders.py
// https://github.com/DarkStarSword/3d-fixes

//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v1.3.16 on Sun Apr 21 17:51:54 2019
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float
// TEXCOORD                 0   xy          1     NONE   float   xy
// TEXCOORD                 1   xyz         2     NONE   float   xyz
// TEXCOORD                 2   xyz         3     NONE   float   xyz
// TEXCOORD                 3   xyz         4     NONE   float   xyz
// TEXCOORD                 4   xyz         5     NONE   float   xyz
// TEXCOORD                 5   xyz         6     NONE   float   xyz
// TEXCOORD                 6   xyzw        7     NONE   float   xy w
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target                0   xyzw        0   TARGET   float   xyzw
//
ps_4_0
dcl_constantbuffer cb0[82], immediateIndexed
dcl_constantbuffer cb1[9], immediateIndexed
dcl_constantbuffer cb2[46], immediateIndexed
dcl_constantbuffer cb3[26], immediateIndexed
dcl_constantbuffer cb4[9], immediateIndexed
dcl_constantbuffer cb5[12], immediateIndexed
dcl_constantbuffer cb6[7], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_sampler s2, mode_default
dcl_sampler s3, mode_default
dcl_sampler s4, mode_default
dcl_sampler s5, mode_default
dcl_sampler s6, mode_default
dcl_sampler s7, mode_default
dcl_sampler s8, mode_default
dcl_sampler s9, 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_resource_texture2d (float,float,float,float) t3
dcl_resource_texture2d (float,float,float,float) t4
dcl_resource_texture2d (float,float,float,float) t5
dcl_resource_texture2d (float,float,float,float) t6
dcl_resource_texture2d (float,float,float,float) t7
dcl_resource_texture2d (float,float,float,float) t8
dcl_resource_texture3d (float,float,float,float) t9
dcl_input_ps linear v1.xy
dcl_input_ps linear v2.xyz
dcl_input_ps linear v3.xyz
dcl_input_ps linear v4.xyz
dcl_input_ps linear v5.xyz
dcl_input_ps linear v6.xyz
dcl_input_ps linear v7.xyw
dcl_output o0.xyzw
dcl_temps 11
dcl_constantbuffer cb10[4], immediateIndexed

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

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


// Unity reflection/specular fix inserted with DarkStarSword's asmtool.py:
// asmtool.py -I ../.. --fix-unity-reflection --only-autofixed 0e9c2377261c9a2a-ps.txt

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

add r0.xyz, -v5.xyzx, r10.xyzx
dp3 r0.w, r0.xyzx, r0.xyzx
rsq r0.w, r0.w
mul r1.xyz, r0.wwww, r0.xyzx
mad r2.xy, v1.xyxx, cb0[73].xyxx, cb0[73].zwzz
sample r3.xyzw, r2.xyxx, t0.xyzw, s4
add r4.xy, r3.wyww, r3.wyww
mad r2.zw, r3.wwwy, l(0.000000, 0.000000, 2.000000, 2.000000), l(0.000000, 0.000000, -1.000000, -1.000000)
dp2 r1.w, r2.zwzz, r2.zwzz
min r1.w, r1.w, l(1.000000)
add r1.w, -r1.w, l(1.000000)
sqrt r4.z, r1.w
sample r3.xyzw, r2.xyxx, t1.xyzw, s5
sample r2.xyzw, r2.xyxx, t2.xyzw, s6
add r4.xyz, r4.xyzx, l(-1.000000, -1.000000, -1.000000, 0.000000)
mad r4.xyz, cb0[76].xxxx, r4.xyzx, l(0.000000, 0.000000, 1.000000, 0.000000)
dp3 r1.w, r4.xyzx, r4.xyzx
rsq r1.w, r1.w
mul r4.xyz, r1.wwww, r4.xyzx
mul r3.xyz, r3.xyzx, cb0[75].xyzx
div r5.xy, v6.xyxx, v6.zzzz
frc r1.w, r5.y
mad r5.z, r1.w, l(0.062500), cb4[8].y
sample r5.xyzw, r5.xzxx, t3.xyzw, s1
add r1.w, r5.w, l(-0.500000)
lt r1.w, r1.w, l(0.000000)
discard_nz r1.w
mad r2.zw, v1.xxxy, cb0[78].xxxy, cb0[78].zzzw
sample r5.xyzw, r2.zwzz, t4.xyzw, s7
mul r6.xyz, r3.xyzx, r5.xyzx
sample r7.xyzw, r2.zwzz, t5.xyzw, s8
mad r7.xy, r7.wyww, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
dp2 r1.w, r7.xyxx, r7.xyxx
min r1.w, r1.w, l(1.000000)
add r1.w, -r1.w, l(1.000000)
sqrt r1.w, r1.w
sample r8.xyzw, r2.zwzz, t6.xyzw, s9
mul r8.xyz, r8.xyxx, cb0[72].xyxx
mad r2.xyz, r2.xyxx, cb0[72].xyxx, r8.xyzx
mul r2.x, r2.x, l(0.500000)
mov r4.w, -r4.x
mul r8.xyz, r4.xzyx, l(1.000000, 1.000000, -1.000000, 0.000000)
mul r7.yzw, r7.yyyy, r8.xxyz
mad r7.xyz, r7.xxxx, r4.zywz, r7.yzwy
mad r4.xyz, r1.wwww, r4.xyzx, r7.xyzx
dp3 r1.w, r4.xyzx, r4.xyzx
rsq r1.w, r1.w
mul r4.xyz, r1.wwww, r4.xyzx
add r1.w, -cb0[81].x, l(1.000000)
lt r1.w, r1.w, l(0.000000)
discard_nz r1.w
mul r7.xy, v5.yyyy, cb0[69].xyxx
mad r7.xy, cb0[68].xyxx, v5.xxxx, r7.xyxx
mad r7.xy, cb0[70].xyxx, v5.zzzz, r7.xyxx
add r7.xy, r7.xyxx, cb0[71].xyxx
mov r8.x, cb5[9].z
mov r8.y, cb5[10].z
mov r8.z, cb5[11].z
dp3 r1.w, r0.xyzx, r8.xyzx
add r8.xyz, v5.xyzx, -cb3[25].xyzx
dp3 r2.w, r8.xyzx, r8.xyzx
sqrt r2.w, r2.w
add r2.w, -r1.w, r2.w
mad r1.w, cb3[25].w, r2.w, r1.w
mad_sat r1.w, r1.w, cb3[24].z, cb3[24].w
eq r2.w, cb6[0].x, l(1.000000)
if_nz r2.w
  eq r2.w, cb6[0].y, l(1.000000)
  mul r8.xyz, v5.yyyy, cb6[2].xyzx
  mad r8.xyz, cb6[1].xyzx, v5.xxxx, r8.xyzx
  mad r8.xyz, cb6[3].xyzx, v5.zzzz, r8.xyzx
  add r8.xyz, r8.xyzx, cb6[4].xyzx
  movc r8.xyz, r2.wwww, r8.xyzx, v5.xyzx
  add r8.xyz, r8.xyzx, -cb6[6].xyzx
  mul r8.yzw, r8.xxyz, cb6[5].xxyz
  mad r2.w, r8.y, l(0.250000), l(0.750000)
  mad r3.w, cb6[0].z, l(0.500000), l(0.750000)
  max r8.x, r2.w, r3.w
  sample r8.xyzw, r8.xzwx, t9.xyzw, s0
else
  mov r8.xyzw, l(1.000000,1.000000,1.000000,1.000000)
endif
dp4_sat r2.w, r8.xyzw, cb2[45].xyzw
div r7.zw, v7.xxxy, v7.wwww
sample r8.xyzw, r7.zwzz, t7.xyzw, s2
add r2.w, r2.w, -r8.x
mad r1.w, r1.w, r2.w, r8.x
sample r7.xyzw, r7.xyxx, t8.xyzw, s3
mul r1.w, r1.w, r7.w
dp3 r7.x, v2.xyzx, r4.xyzx
dp3 r7.y, v3.xyzx, r4.xyzx
dp3 r7.z, v4.xyzx, r4.xyzx
mul r4.xyz, r1.wwww, cb0[2].xyzx
dp3 r1.w, r7.xyzx, r7.xyzx
rsq r1.w, r1.w
mul r7.xyz, r1.wwww, r7.xyzx
mad r3.xyz, r3.xyzx, r5.xyzx, l(-0.040000, -0.040000, -0.040000, 0.000000)
mad r3.xyz, r2.xxxx, r3.xyzx, l(0.040000, 0.040000, 0.040000, 0.000000)
mad r2.xy, -r2.zyzz, l(0.480000, 0.500000, 0.000000, 0.000000), l(0.960000, 1.000000, 0.000000, 0.000000)
mul r2.xzw, r2.xxxx, r6.xxyz
mad r0.xyz, r0.xyzx, r0.wwww, cb2[0].xyzx
dp3 r0.w, r0.xyzx, r0.xyzx
max r0.w, r0.w, l(0.001000)
rsq r0.w, r0.w
mul r0.xyz, r0.wwww, r0.xyzx
dp3 r0.w, r7.xyzx, r1.xyzx
dp3_sat r1.x, r7.xyzx, cb2[0].xyzx
dp3_sat r1.y, r7.xyzx, r0.xyzx
dp3_sat r0.x, cb2[0].xyzx, r0.xyzx
mul r0.y, r0.x, r0.x
dp2 r0.y, r0.yyyy, r2.yyyy
add r0.y, r0.y, l(-0.500000)
add r0.z, -r1.x, l(1.000000)
mul r1.z, r0.z, r0.z
mul r1.z, r1.z, r1.z
mul r0.z, r0.z, r1.z
mad r0.z, r0.y, r0.z, l(1.000000)
add r1.z, -|r0.w|, l(1.000000)
mul r1.w, r1.z, r1.z
mul r1.w, r1.w, r1.w
mul r1.z, r1.z, r1.w
mad r0.y, r0.y, r1.z, l(1.000000)
mul r0.y, r0.y, r0.z
mul r0.z, r2.y, r2.y
mad r1.z, -r2.y, r2.y, l(1.000000)
mad r1.w, |r0.w|, r1.z, r0.z
mad r1.z, r1.x, r1.z, r0.z
mul r0.w, |r0.w|, r1.z
mad r0.w, r1.x, r1.w, r0.w
add r0.w, r0.w, l(0.000010)
div r0.w, l(0.500000), r0.w
mul r0.z, r0.z, r0.z
mad r1.z, r1.y, r0.z, -r1.y
mad r1.y, r1.z, r1.y, l(1.000000)
mul r0.z, r0.z, l(0.318309873)
mad r1.y, r1.y, r1.y, l(1.000000012E-007)
div r0.z, r0.z, r1.y
mul r0.z, r0.z, r0.w
mul r0.z, r0.z, l(3.14159274)
mul r0.yz, r1.xxxx, r0.yyzy
max r0.z, r0.z, l(0.000000)
dp3 r0.w, r3.xyzx, r3.xyzx
ne r0.w, r0.w, l(0.000000)
and r0.w, r0.w, l(0x3f800000)
mul r0.z, r0.w, r0.z
mul r1.xyz, r0.yyyy, r4.xyzx
mul r0.yzw, r4.xxyz, r0.zzzz
add r0.x, -r0.x, l(1.000000)
mul r1.w, r0.x, r0.x
mul r1.w, r1.w, r1.w
mul r0.x, r0.x, r1.w
add r4.xyz, -r3.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
mad r3.xyz, r4.xyzx, r0.xxxx, r3.xyzx
mul r0.xyz, r0.yzwy, r3.xyzx
mad o0.xyz, r2.xzwx, r1.xyzx, r0.xyzx
mov o0.w, l(1.000000)
ret
// Approximately 0 instruction slots used