// asmtool.py -I ../.. --fix-unity-lighting-ps --only-autofixed 5b3dddc701488c2c-ps.txt
// 3DMigoto: 5b3dddc701488c2c | Matched 4 variants of 1 shaders: Hidden/Kyoto/KyotoDeferredShading
//
//       Unity headers extracted from KyotoDeferredShading.shader
//       Shader "Hidden/Kyoto/KyotoDeferredShading" {
//         Properties {
//         [HideInInspector]  _LightTexture0 ("", any) = "" { }
//         [HideInInspector]  _LightTextureB0 ("", 2D) = "" { }
//         [HideInInspector]  _ShadowMapTexture ("", any) = "" { }
//         [HideInInspector]  _SrcBlend ("", Float) = 1.000000
//         [HideInInspector]  _DstBlend ("", Float) = 1.000000
//          _SkinDiffusionProfile ("Skin Diffusion Lookup", 2D) = "gray" { }
//         }
//         Fallback Off
//         SubShader 1/1 {
//           Pass 1/2 {
//             Tags { "SHADOWSUPPORT"="true" }
//             ZWrite Off
//             Blend [_SrcBlend] [_DstBlend]
//             GpuProgramID 15946
//             Program "fp" {
//               SubProgram "d3d11 " {
// 5:              GpuProgramIndex 420
// a:              GpuProgramIndex 421
//               }
//             }
//           }
//         }
//       }
//
//    Unity 5.3 headers extracted from KyotoDeferredShading.shader.decompressed:
//      API d3d11
//      Shader model ps_4_0
//      undeciphered1: 201510240 327 4 7
// 5:   Keywords { "DIRECTIONAL" "SHADOWS_DEPTH" "SHADOWS_SOFT" "SPECULAR_ONLY" }
// a:   Keywords { "DIRECTIONAL" "SHADOWS_DEPTH" "SPECULAR_ONLY" }
//      undeciphered2: 1 5 4 5 0 0
//      undeciphered3: 0 0
//      ConstBuffer "$Globals" 368
//      Vector 48 [unity_ColorSpaceLuminance]
//      Vector 112 [_LightDir]
//      Vector 144 [_LightColor]
//      Vector 256 [_ShadowMapTexture_TexelSize]
//      Vector 336 [_ShadowColor]
//      ConstBuffer "UnityPerCamera" 144
//      Vector 64 [_WorldSpaceCameraPos] 3
//      Vector 80 [_ProjectionParams]
//      Vector 112 [_ZBufferParams]
//      ConstBuffer "UnityPerCameraRare" 352
//      Matrix 288 [unity_CameraToWorld]
//      ConstBuffer "UnityShadows" 416
//      Vector 96 [_LightSplitsNear]
//      Vector 112 [_LightSplitsFar]
//      Vector 384 [_LightShadowData]
//      Vector 400 [unity_ShadowFadeCenterAndType]
//      Matrix 128 [unity_WorldToShadow0]
//      Matrix 192 [unity_WorldToShadow1]
//      Matrix 256 [unity_WorldToShadow2]
//      Matrix 320 [unity_WorldToShadow3]
//      SetTexture 0 [_CameraGBufferTexture0] 2D 2
//      SetTexture 1 [_CameraGBufferTexture1] 2D 3
//      SetTexture 2 [_CameraGBufferTexture2] 2D 4
//      SetTexture 3 [_CameraDepthTexture] 2D 0
//      SetTexture 4 [_ShadowMapTexture] 2D 1
//      BindCB "$Globals" 0
//      BindCB "UnityPerCamera" 1
//      BindCB "UnityPerCameraRare" 2
//      BindCB "UnityShadows" 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:58:52 2018
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float
// TEXCOORD                 0   xyzw        1     NONE   float   xy w
// TEXCOORD                 1   xyz         2     NONE   float   xyz
// TEXCOORD                 3      w        2     NONE   float      w
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target                0   xyzw        0   TARGET   float   xyzw
//
ps_4_0
dcl_constantbuffer cb0[22], immediateIndexed
dcl_constantbuffer cb1[9], immediateIndexed
dcl_constantbuffer cb2[22], immediateIndexed
dcl_constantbuffer cb3[26], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_comparison
dcl_sampler s2, mode_default
dcl_sampler s3, mode_default
dcl_sampler s4, 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_input_ps linear v1.xyw
dcl_input_ps linear v2.xyz
dcl_output o0.xyzw
dcl_temps 20

// New input from vertex shader with unity_CameraInvProjection[0].x:
dcl_input_ps linear v2.w
dcl_constantbuffer cb10[4], immediateIndexed

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

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


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

mul r15.w, -r15.x, r15.y
ne r17.x, l(0.0, 0.0, 0.0, 0.0), v2.w
if_nz r17.x
  mul r15.w, r15.w, v2.w
  mad r16.xyz, -r15.wwww, cb2[18].xyzw, cb1[4].xyzw
else
  mad r16.xyz, -r15.wwww, cb10[0].xyzw, cb1[4].xyzw
endif

div r0.xy, v1.xyxx, v1.wwww
sample r1.xyzw, r0.xyxx, t0.xyzw, s2
sample r2.xyzw, r0.xyxx, t1.xyzw, s3
sample r3.xyzw, r0.xyxx, t2.xyzw, s4
div r0.z, cb1[5].z, v2.z
mul r1.xyz, r0.zzzz, v2.xyzx
sample r0.xyzw, r0.xyxx, t3.xyzw, s0
mad r0.x, cb1[7].x, r0.x, cb1[7].y
div r0.x, l(1.000000, 1.000000, 1.000000, 1.000000), r0.x
mul r0.yzw, r0.xxxx, r1.xxyz

// copy depth from r0.w to r18.x:
mov r18.x, r0.w


// Unity light/shadow fix (pixel shader stage) inserted with DarkStarSword's asmtool.py:
// asmtool.py -I ../.. --fix-unity-lighting-ps --only-autofixed 5b3dddc701488c2c-ps.txt

add r19.x, r18.x, -r15.y
mul r19.x, r15.x, r19.x
ne r15.w, l(0.0, 0.0, 0.0, 0.0), v2.w
if_nz r15.w
  mad r0.y, -r19.x, v2.w, r0.y
endif

mul r4.xyz, r0.zzzz, cb2[19].xyzx
mad r4.xyz, cb2[18].xyzx, r0.yyyy, r4.xyzx
mad r4.xyz, cb2[20].xyzx, r0.wwww, r4.xyzx
add r4.xyz, r4.xyzx, cb2[21].xyzx

if_z r15.w
  mad r4.xyz, -r19.xxxx, cb10[0].xyzx, r4.xyzw
endif

add r5.xyz, r4.xyzx, -cb3[25].xyzx
dp3 r0.y, r5.xyzx, r5.xyzx
sqrt r0.y, r0.y
mad r0.y, -r1.z, r0.x, r0.y
mad r0.y, cb3[25].w, r0.y, r0.w
mad_sat r0.y, r0.y, cb3[24].z, cb3[24].w
ge r5.xyzw, r0.wwww, cb3[6].xyzw
and r5.xyzw, r5.xyzw, l(0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000)
lt r6.xyzw, r0.wwww, cb3[7].xyzw
and r6.xyzw, r6.xyzw, l(0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000)
mul r5.xyzw, r5.xyzw, r6.xyzw
mul r6.xyz, r4.yyyy, cb3[9].xyzx
mad r6.xyz, cb3[8].xyzx, r4.xxxx, r6.xyzx
mad r6.xyz, cb3[10].xyzx, r4.zzzz, r6.xyzx
add r6.xyz, r6.xyzx, cb3[11].xyzx
mul r7.xyz, r4.yyyy, cb3[13].xyzx
mad r7.xyz, cb3[12].xyzx, r4.xxxx, r7.xyzx
mad r7.xyz, cb3[14].xyzx, r4.zzzz, r7.xyzx
add r7.xyz, r7.xyzx, cb3[15].xyzx
mul r8.xyz, r4.yyyy, cb3[17].xyzx
mad r8.xyz, cb3[16].xyzx, r4.xxxx, r8.xyzx
mad r8.xyz, cb3[18].xyzx, r4.zzzz, r8.xyzx
add r8.xyz, r8.xyzx, cb3[19].xyzx
mul r9.xyz, r4.yyyy, cb3[21].xyzx
mad r9.xyz, cb3[20].xyzx, r4.xxxx, r9.xyzx
mad r9.xyz, cb3[22].xyzx, r4.zzzz, r9.xyzx
add r9.xyz, r9.xyzx, cb3[23].xyzx
mul r10.xyz, r5.yyyy, r7.xyzx
mad r6.xyz, r6.xyzx, r5.xxxx, r10.xyzx
mad r6.xyz, r8.xyzx, r5.zzzz, r6.xyzx
mad r6.xyz, r9.xyzx, r5.wwww, r6.xyzx
mad r1.xy, r6.xyxx, cb0[16].zwzz, l(0.500000, 0.500000, 0.000000, 0.000000)
round_ni r6.xy, r1.xyxx
add r6.xy, r6.xyxx, l(-0.500000, -0.500000, 0.000000, 0.000000)
frc r1.xy, r1.xyxx
mul r0.z, r1.x, l(3.000000)
mad r10.xy, -r1.xyxx, l(3.000000, 3.000000, 0.000000, 0.000000), l(4.000000, 4.000000, 0.000000, 0.000000)
mad r10.zw, r1.xxxy, l(0.000000, 0.000000, 3.000000, 3.000000), l(0.000000, 0.000000, 1.000000, 1.000000)
mad r11.xy, -r1.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(3.000000, 3.000000, 0.000000, 0.000000)
div r11.xy, r11.xyxx, r10.xyxx
add r11.xy, r11.xyxx, l(-2.000000, -2.000000, 0.000000, 0.000000)
add r12.xy, r1.xyxx, l(3.000000, 3.000000, 0.000000, 0.000000)
mul r12.xy, r12.xyxx, cb0[16].xyxx
div r1.xy, r1.xyxx, r10.zwzz
add r1.xy, r1.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000)
mov r11.z, r12.x
mov r11.w, r1.x
mov r13.xz, cb0[16].xxxx
mov r13.y, l(0.142857149)
mul r13.xyz, r11.xzwx, r13.xyzx
mov r12.z, r11.y
mov r12.w, r1.y
mov r11.xz, cb0[16].yyyy
mov r11.y, l(0.142857149)
mul r11.xyw, r11.xyxz, r12.zyzw
mad r12.xz, r0.zzzz, l(-1.000000, 0.000000, 1.000000, 0.000000), l(4.000000, 0.000000, 1.000000, 0.000000)
mov r12.y, l(7.000000)
mul r10.xyz, r10.yyyy, r12.xyzx
mov r13.w, r11.x
mad r14.xyzw, r6.xyxy, cb0[16].xyxy, r13.xwyw
sample_c_lz r0.z, r14.xyxx, t4.xxxx, s1, r6.z
sample_c_lz r1.x, r14.zwzz, t4.xxxx, s1, r6.z
mul r1.x, r1.x, r10.y
mad r0.z, r10.x, r0.z, r1.x
mad r1.xy, r6.xyxx, cb0[16].xyxx, r13.zwzz
sample_c_lz r1.x, r1.xyxx, t4.xxxx, s1, r6.z
mad r0.z, r10.z, r1.x, r0.z
mul r1.xy, r12.xzxx, l(7.000000, 7.000000, 0.000000, 0.000000)
mov r11.z, r13.x
mad r14.xyzw, r6.xyxy, cb0[16].xyxy, r11.zyzw
sample_c_lz r4.w, r14.xyxx, t4.xxxx, s1, r6.z
mad r0.z, r1.x, r4.w, r0.z
mov r11.xz, r13.yyzy
mad r13.xyzw, r6.xyxy, cb0[16].xyxy, r11.xyzy
sample_c_lz r1.x, r13.xyxx, t4.xxxx, s1, r6.z
mad r0.z, r1.x, l(49.000000), r0.z
sample_c_lz r1.x, r13.zwzz, t4.xxxx, s1, r6.z
mad r0.z, r1.y, r1.x, r0.z
mul r10.xyz, r10.wwww, r12.xyzx
sample_c_lz r1.x, r14.zwzz, t4.xxxx, s1, r6.z
mad r0.z, r10.x, r1.x, r0.z
mad r11.xyzw, r6.xyxy, cb0[16].xyxy, r11.xwzw
sample_c_lz r1.x, r11.xyxx, t4.xxxx, s1, r6.z
mad r0.z, r10.y, r1.x, r0.z
sample_c_lz r1.x, r11.zwzz, t4.xxxx, s1, r6.z
mad r0.z, r10.z, r1.x, r0.z
mul r0.z, r0.z, l(0.00694444450)
add r1.x, -cb3[24].x, l(1.000000)
mad r0.z, r0.z, r1.x, cb3[24].x
mad r6.xyzw, r1.zzzz, r0.xxxx, -cb3[6].xyzw
add r10.xyzw, -cb3[6].xyzw, cb3[7].xyzw
div r6.xyzw, r6.xyzw, r10.xyzw
mul r6.xyzw, r5.xyzw, r6.xyzw
dp4 r0.x, r6.xyzw, l(1.000000, 1.000000, 1.000000, 1.000000)
lt r1.y, l(0.900000), r0.x
if_nz r1.y
  add r0.x, r0.x, l(-0.900000)
  mul r0.x, r0.x, l(10.000000)
  mul r6.xyz, r5.yyyy, r8.xyzx
  mad r5.xyw, r7.xyxz, r5.xxxx, r6.xyxz
  mad r5.xyz, r9.xyzx, r5.zzzz, r5.xywx
  mad r1.yz, r5.xxyx, cb0[16].zzwz, l(0.000000, 0.500000, 0.500000, 0.000000)
  round_ni r5.xy, r1.yzyy
  add r5.xy, r5.xyxx, l(-0.500000, -0.500000, 0.000000, 0.000000)
  frc r1.yz, r1.yyzy
  mad r6.xy, -r1.zyzz, l(2.000000, 2.000000, 0.000000, 0.000000), l(3.000000, 3.000000, 0.000000, 0.000000)
  mad r6.zw, r1.yyyz, l(0.000000, 0.000000, 2.000000, 2.000000), l(0.000000, 0.000000, 1.000000, 1.000000)
  add r7.xy, -r1.yzyy, l(2.000000, 2.000000, 0.000000, 0.000000)
  div r7.xy, r7.xyxx, r6.yxyy
  add r7.xy, r7.xyxx, l(-1.000000, -1.000000, 0.000000, 0.000000)
  div r1.yz, r1.yyzy, r6.zzwz
  add r7.zw, r1.yyyz, l(0.000000, 0.000000, 1.000000, 1.000000)
  mul r7.xyzw, r7.xzyw, cb0[16].xxyy
  mul r1.y, r6.w, r6.z
  mad r8.xyzw, r5.xyxy, cb0[16].xyxy, r7.ywxz
  sample_c_lz r1.z, r8.xyxx, t4.xxxx, s1, r5.z
  mul r4.w, r6.x, r6.y
  sample_c_lz r5.w, r8.zwzz, t4.xxxx, s1, r5.z
  mul r4.w, r4.w, r5.w
  mad r1.y, r1.y, r1.z, r4.w
  mul r6.xy, r6.xyxx, r6.zwzz
  mad r7.xyzw, r5.xyxy, cb0[16].xyxy, r7.yzxw
  sample_c_lz r1.z, r7.xyxx, t4.xxxx, s1, r5.z
  mad r1.y, r6.x, r1.z, r1.y
  sample_c_lz r1.z, r7.zwzz, t4.xxxx, s1, r5.z
  mad r1.y, r6.y, r1.z, r1.y
  mul r1.y, r1.y, l(0.062500)
  mad r1.x, r1.y, r1.x, cb3[24].x
  add r1.x, -r0.z, r1.x
  mad r0.z, r0.x, r1.x, r0.z
endif
mad_sat r0.x, r0.w, cb3[24].z, cb3[24].w
add r0.x, r0.x, r0.z
add_sat r0.x, r0.y, r0.x
mad r0.yzw, r3.xxyz, l(0.000000, 2.000000, 2.000000, 2.000000), l(0.000000, -1.000000, -1.000000, -1.000000)
dp3 r1.x, r0.yzwy, r0.yzwy
rsq r1.x, r1.x
mul r0.yzw, r0.yyzw, r1.xxxx
eq r1.x, r3.w, l(1.000000)
if_nz r1.x
  add r1.x, -r1.w, l(1.000000)
  mad r1.xyz, -cb0[21].xyzx, r1.xxxx, cb0[9].xyzx
  mul r3.xyz, r1.wwww, cb0[21].xyzx
  mad r1.xyz, -cb0[21].xyzx, r1.wwww, r1.xyzx
  mad r1.xyz, r0.xxxx, r1.xyzx, r3.xyzx
  add r3.xyz, r4.xyzx, -r16.xyzx
  dp3 r4.w, r3.xyzx, r3.xyzx
  rsq r4.w, r4.w
  mul r5.xyz, r3.xyzx, r4.wwww
  add r6.xyzw, -r2.wxyz, l(1.000000, 1.000000, 1.000000, 1.000000)
  mad r3.xyz, -r3.xyzx, r4.wwww, -cb0[7].xyzx
  dp3 r4.w, r3.xyzx, r3.xyzx
  max r4.w, r4.w, l(0.001000)
  rsq r4.w, r4.w
  mul r3.xyz, r3.xyzx, r4.wwww
  dp3 r4.w, r0.yzwy, -r5.xyzx
  lt r5.w, r4.w, l(0.000000)
  add r4.w, -r4.w, l(0.000010)
  mad r7.xyz, -r5.xyzx, r4.wwww, r0.yzwy
  movc r7.xyz, r5.wwww, r7.xyzx, r0.yzwy
  dp3 r4.w, r7.xyzx, -cb0[7].xyzx
  max r4.w, r4.w, l(0.000000)
  dp3 r5.w, r7.xyzx, r3.xyzx
  dp3 r5.x, r7.xyzx, -r5.xyzx
  max r5.xw, r5.xxxw, l(0.000000, 0.000000, 0.000000, 0.000000)
  dp3 r3.x, -cb0[7].xyzx, r3.xyzx
  mul r3.y, r6.x, r6.x
  mad r3.z, -r6.x, r6.x, l(1.000000)
  mad r5.y, r5.x, r3.z, r3.y
  mad r3.z, r4.w, r3.z, r3.y
  mul r3.z, r3.z, r5.x
  mad r3.z, r4.w, r5.y, r3.z
  add r3.z, r3.z, l(0.000010)
  div r3.z, l(2.000000), r3.z
  mul r5.x, r3.y, r3.y
  mul r5.y, r5.w, r5.w
  mad r3.y, r3.y, r3.y, l(-1.000000)
  mad r3.y, r5.y, r3.y, l(1.000000)
  mul r5.y, r3.y, l(3.14159274)
  mad r3.y, r5.y, r3.y, l(1.000000012E-007)
  div r3.y, r5.x, r3.y
  mul r3.y, r3.y, r3.z
  mul r3.y, r3.y, l(0.785398185)
  eq r3.z, cb0[3].w, l(0.000000)
  max r5.x, r3.y, l(0.000100)
  sqrt r5.x, r5.x
  movc r3.y, r3.z, r5.x, r3.y
  mul r3.y, r4.w, r3.y
  max r3.xy, r3.xyxx, l(0.000000, 0.000000, 0.000000, 0.000000)
  mul r1.xyz, r1.xyzx, r3.yyyy
  add r3.x, -r3.x, l(1.000000)
  mul r3.y, r3.x, r3.x
  mul r3.y, r3.y, r3.y
  mul r3.x, r3.x, r3.y
  mad r3.xyz, r6.yzwy, r3.xxxx, r2.xyzx
  mul r1.xyz, r1.xyzx, r3.xyzx
  min r5.xyz, r1.xyzx, l(8.000000, 8.000000, 8.000000, 0.000000)
else
  lt r1.x, l(0.600000), r3.w
  if_nz r1.x
    add r1.x, -r1.w, l(1.000000)
    mad r1.xyz, -cb0[21].xyzx, r1.xxxx, cb0[9].xyzx
    mul r3.xyz, r1.wwww, cb0[21].xyzx
    mad r1.xyz, -cb0[21].xyzx, r1.wwww, r1.xyzx
    mad r1.xyz, r0.xxxx, r1.xyzx, r3.xyzx
    add r3.xyz, r4.xyzx, -r16.xyzx
    dp3 r4.w, r3.xyzx, r3.xyzx
    rsq r4.w, r4.w
    mul r6.xyz, r3.xyzx, r4.wwww
    dp3 r6.w, r0.yzwy, -cb0[7].xyzx
    add r7.xy, -r2.wxww, l(1.000000, 1.000000, 0.000000, 0.000000)
    mad r3.xyz, -r3.xyzx, r4.wwww, -cb0[7].xyzx
    dp3 r4.w, r3.xyzx, r3.xyzx
    rsq r4.w, r4.w
    mul r3.xyz, r3.xyzx, r4.wwww
    dp3 r4.w, r0.yzwy, r3.xyzx
    max r4.w, r4.w, l(0.000000)
    dp3 r6.x, r0.yzwy, -r6.xyzx
    max r6.xw, r6.xxxw, l(0.000000, 0.000000, 0.000000, 0.000000)
    dp3 r3.x, -cb0[7].xyzx, r3.xyzx
    mul r3.y, r7.x, r7.x
    mul r3.z, r3.y, l(0.500000)
    mad r6.y, -r3.y, l(0.500000), l(1.000000)
    mad r6.z, r6.w, r6.y, r3.z
    mad r3.z, r6.x, r6.y, r3.z
    mad r3.z, r6.z, r3.z, l(0.000010)
    div r3.z, l(1.000000, 1.000000, 1.000000, 1.000000), r3.z
    mul r6.x, r3.y, r3.y
    mul r4.w, r4.w, r4.w
    mad r3.y, r3.y, r3.y, l(-1.000000)
    mad r3.y, r4.w, r3.y, l(1.000000)
    mul r4.w, r3.y, l(3.14159274)
    mad r3.y, r4.w, r3.y, l(1.000000012E-007)
    div r3.y, r6.x, r3.y
    mul r3.y, r3.y, r3.z
    mul r3.y, r6.w, r3.y
    eq r3.z, cb0[3].w, l(0.000000)
    movc r3.z, r3.z, l(0.616850257), l(0.785398185)
    mul r3.y, r3.z, r3.y
    max r3.xy, r3.xyxx, l(0.000000, 0.000000, 0.000000, 0.000000)
    mul r1.xyz, r1.xyzx, r3.yyyy
    add r3.x, -r3.x, l(1.000000)
    mul r3.y, r3.x, r3.x
    mul r3.y, r3.y, r3.y
    mul r3.x, r3.x, r3.y
    mad r3.x, r7.y, r3.x, r2.x
    mul r5.xyz, r1.xyzx, r3.xxxx
  else
    lt r1.x, l(0.300000), r3.w
    if_nz r1.x
      add r1.x, -r1.w, l(1.000000)
      mad r1.xyz, -cb0[21].xyzx, r1.xxxx, cb0[9].xyzx
      mul r3.xyz, r1.wwww, cb0[21].xyzx
      mad r1.xyz, -cb0[21].xyzx, r1.wwww, r1.xyzx
      mad r1.xyz, r0.xxxx, r1.xyzx, r3.xyzx
      add r3.xyz, r4.xyzx, -r16.xyzx
      dp3 r3.w, r3.xyzx, r3.xyzx
      rsq r3.w, r3.w
      mul r6.xyz, r3.wwww, r3.xyzx
      max r4.w, r2.y, r2.x
      max r4.w, r2.z, r4.w
      mad r3.xyz, -r3.xyzx, r3.wwww, -cb0[7].xyzx
      dp3 r3.w, r3.xyzx, r3.xyzx
      rsq r3.w, r3.w
      mul r3.xyz, r3.wwww, r3.xyzx
      dp3_sat r3.w, r3.xyzx, -r6.xyzx
      dp3 r3.x, r0.yzwy, r3.xyzx
      max r3.x, r3.x, l(0.000000)
      min r3.x, r3.x, l(0.999999)
      mul r3.y, r3.x, r3.x
      dp3_sat r3.z, r0.yzwy, -r6.xyzx
      dp3_sat r6.x, r0.yzwy, -cb0[7].xyzx
      add r6.y, -r2.w, l(1.000000)
      add r6.z, -r4.w, l(1.000000)
      add r3.w, -r3.w, l(1.000000)
      mul r6.w, r3.w, r3.w
      mul r6.w, r6.w, r6.w
      mul r3.w, r3.w, r6.w
      mad r3.w, r6.z, r3.w, r4.w
      mad r3.x, -r3.x, r3.x, l(1.000000)
      div r3.y, r3.y, r3.x
      mul r3.x, r3.x, r3.x
      mad r4.w, r6.y, r6.y, l(0.000001)
      mad r6.y, r4.w, l(4.000000), l(1.000000)
      mul r6.y, r6.y, l(3.14159274)
      div r6.y, l(1.000000, 1.000000, 1.000000, 1.000000), r6.y
      div r3.y, -r3.y, r4.w
      mul r3.y, r3.y, l(1.442695)
      exp r3.y, r3.y
      mul r3.y, r3.y, l(4.000000)
      div r3.x, r3.y, r3.x
      add r3.x, r3.x, l(1.000000)
      mul r3.x, r3.x, r6.y
      add r3.y, r3.z, r6.x
      mad r3.y, -r6.x, r3.z, r3.y
      mul r3.y, r3.y, l(4.000000)
      div r3.y, l(1.000000, 1.000000, 1.000000, 1.000000), r3.y
      mul r3.x, r3.w, r3.x
      mul r3.x, r3.y, r3.x
      min r3.x, r3.x, l(4.000000)
      mul r3.x, r6.x, r3.x
      mul r3.xyz, r2.xyzx, r3.xxxx
      mul r1.xyz, r1.xyzx, r3.xyzx
      mul r5.xyz, r6.xxxx, r1.xyzx
    else
      add r1.x, -r1.w, l(1.000000)
      mad r1.xyz, -cb0[21].xyzx, r1.xxxx, cb0[9].xyzx
      mul r3.xyz, r1.wwww, cb0[21].xyzx
      mad r1.xyz, -cb0[21].xyzx, r1.wwww, r1.xyzx
      mad r1.xyz, r0.xxxx, r1.xyzx, r3.xyzx
      add r3.xyzw, -r2.wxyz, l(1.000000, 1.000000, 1.000000, 1.000000)
      add r4.xyz, r4.xyzx, -r16.xyzx
      dp3 r0.x, r4.xyzx, r4.xyzx
      rsq r0.x, r0.x
      mul r6.xyz, r0.xxxx, r4.xyzx
      dp3 r1.w, r0.yzwy, -cb0[7].xyzx
      max r1.w, r1.w, l(0.000000)
      mad r4.xyz, -r4.xyzx, r0.xxxx, -cb0[7].xyzx
      dp3 r0.x, r4.xyzx, r4.xyzx
      max r0.x, r0.x, l(0.001000)
      rsq r0.x, r0.x
      mul r4.xyz, r0.xxxx, r4.xyzx
      dp3 r0.x, r0.yzwy, r4.xyzx
      dp3 r0.y, r0.yzwy, -r6.xyzx
      dp3 r0.z, -cb0[7].xyzx, r4.xyzx
      max r0.xyz, r0.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
      max r0.w, r3.x, l(0.010000)
      mul r2.w, r0.w, r0.w
      mad r0.w, -r0.w, r0.w, l(1.000000)
      mad r3.x, r0.y, r0.w, r2.w
      mad r0.w, r1.w, r0.w, r2.w
      mul r0.xy, r0.xwxx, r0.xyxx
      mad r0.y, r1.w, r3.x, r0.y
      add r0.y, r0.y, l(0.000010)
      div r0.y, l(2.000000), r0.y
      mul r0.w, r2.w, r2.w
      mad r2.w, r2.w, r2.w, l(-1.000000)
      mad r0.x, r0.x, r2.w, l(1.000000)
      mul r2.w, r0.x, l(3.14159274)
      mad r0.x, r2.w, r0.x, l(1.000000012E-007)
      div r0.x, r0.w, r0.x
      mul r0.x, r0.x, r0.y
      mul r0.x, r0.x, l(0.785398185)
      mul r0.x, r1.w, r0.x
      max r0.x, r0.x, l(0.000000)
      add r0.y, -r0.z, l(1.000000)
      mul r0.z, r0.y, r0.y
      mul r0.z, r0.z, r0.z
      mul r0.y, r0.y, r0.z
      mad r0.yzw, r3.yyzw, r0.yyyy, r2.xxyz
      mul r0.yzw, r0.yyzw, r1.xxyz
      mul r5.xyz, r0.xxxx, r0.yzwy
    endif
  endif
endif
mov r5.w, l(1.000000)
exp o0.xyzw, -r5.xyzw
ret
// Approximately 0 instruction slots used