// MANUALLY DUMPED [ShaderRegex_LightingPS1] P5S water haloing PS 4.
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//   using 3Dmigoto v1.3.16 on Thu Mar 17 20:57:32 2022
//
//
// Buffer Definitions:
//
// cbuffer $Globals
// {
//
//   float4 litDir[4];                  // Index:    0 1 2 3          Components:    16
//   float4 litCol[4];                  // Index:    4 5 6 7          Components:    16
//   float4 litOcc;                     // Index:    8.xyzw           Components:     4
//   float4 ambLit;                     // Index:    9.xyzw           Components:     4
//   int nDirLit;                       // Index:   10.x              Components:     1
//   float4 vEye;                       // Index:   11.xyzw           Components:     4
//   float2 vOccRate;                   // Index:   12.xy             Components:     2
//      = 0x3f800000 0x3f800000
//   float3 vCameraPos;                 // Index:   13.xyz            Components:     3
//   float3 vCameraDir;                 // Index:   14.xyz            Components:     3
//   float2 vD2Z;                       // Index:   15.xy             Components:     2
//   float4 mRrW2T[3];                  // Index:   16 17 18          Components:    12
//   row_major float4x4 mV2W;           // Index:   19 20 21 22       Components:    16
//   row_major float4x4 mP2W;           // Index:   23 24 25 26       Components:    16
//   float fAmbMapsDORate;              // Index:   27.x              Components:     1
//      = 0x00000000
//   float4 vAmbDifScl;                 // Index:   28.xyzw           Components:     4
//      = 0x3f800000 0x3f800000 0x3f800000 0x3f800000
//   float4 vAmbSpcScl;                 // Index:   29.xyzw           Components:     4
//      = 0x3f800000 0x3f800000 0x3f800000 0x3f800000
//   float4 vTsbViewPort;               // Index:   30.xyzw           Components:     4
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// __smpsDepthMap                    sampler      NA          NA    0        1
// __smpsGxAmbLut                    sampler      NA          NA    1        1
// __smpsAmbSpc                      sampler      NA          NA    2        1
// __smpsTrnsSpc                     sampler      NA          NA    3        1
// sDepthMap                         texture  float4          2d    0        1
// sGxAmbLut                         texture  float4          2d    1        1
// sAmbSpc                           texture  float4        cube    2        1
// sTrnsSpc                          texture  float4          2d    3        1
// sDepth                            texture  float4          2d    4        1
// sGBuf0                            texture  float4          2d    5        1
// sGBuf1                            texture  float4     2darray    6        1
// sGBuf2                            texture  float4          2d    7        1
// sGBuf3                            texture  float4     2darray    8        1
// $Globals                          cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xy
// TEXCOORD                 0   xyzw        1     NONE   float   xy w
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target                0   xyzw        0   TARGET   float   xyzw
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[31], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_sampler s2, mode_default
dcl_sampler s3, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_resource_texturecube (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_texture2darray (float,float,float,float) t6
dcl_resource_texture2d (float,float,float,float) t7
dcl_resource_texture2darray (float,float,float,float) t8
dcl_input_ps_siv linear noperspective v0.xy, position
dcl_input_ps linear v1.xyw
dcl_output o0.xyzw
dcl_temps 31
dcl_resource_texture2d (float,float,float,float) t125
ftoi r0.xy, v0.xyxx
mov r0.zw, l(0,0,1,0)
ld_indexable(texture2d)(float,float,float,float) r1.xyzw, r0.xyww, t5.xyzw
ld_indexable(texture2darray)(float,float,float,float) r2.xyzw, r0.xyww, t6.xyzw
ld_indexable(texture2d)(float,float,float,float) r3.xyz, r0.xyww, t7.xyzw
ld_indexable(texture2darray)(float,float,float,float) r4.xyz, r0.xyww, t8.xyzw
ld_indexable(texture2darray)(float,float,float,float) r5.xyz, r0.xyzw, t8.xyzw
mov r0.z, l(3)
ld_indexable(texture2darray)(float,float,float,float) r6.xyz, r0.xyzw, t6.xywz
ld_indexable(texture2d)(float,float,float,float) r0.x, r0.xyww, t4.xyzw

ld_indexable(texture2d)(float,float,float,float) r26.xyzw, l(0, 0, 0, 0), t125.xyzw
mov r27.x, v1.x
mul r28.xyzw, v1.yyyy, cb0[24].xyzw
mad r28.xyzw, r27.xxxx, cb0[23].xyzw, r28.xyzw
mad r28.xyzw, r0.xxxx, cb0[25].xyzw, r28.xyzw
add r28.xyzw, r28.xyzw, cb0[26].xyzw
add r27.x, -r26.x, r27.x
mul r29.xyzw, v1.yyyy, cb0[24].xyzw
mad r29.xyzw, r27.xxxx, cb0[23].xyzw, r29.xyzw
mad r29.xyzw, r0.xxxx, cb0[25].xyzw, r29.xyzw
add r29.xyzw, r29.xyzw, cb0[26].xyzw
div r29.xyz, r29.xyzx, r29.wwww
mul r30.w, r26.y, r28.w
mad r27.x, r26.x, r30.w, r27.x
mul r7.xyzw, v1.yyyy, cb0[24].xyzw
mad r7.xyzw, r27.xxxx, cb0[23].xyzw, r7.xyzw
mad r0.xyzw, r0.xxxx, cb0[25].xyzw, r7.xyzw
add r0.xyzw, r0.xyzw, cb0[26].xyzw
div r0.xyz, r0.xyzx, r0.wwww
add r7.xyz, -r29.xyzx, cb0[11].xyzx
dp3 r0.w, r7.xyzx, r7.xyzx
rsq r0.w, r0.w
mul r8.xyz, r0.wwww, r7.xyzx
add r3.w, r2.w, r2.w
mad r3.xy, r3.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
add r9.xyz, -|r3.xyxx|, l(1.000000, 1.000000, 1.000000, 0.000000)
add r10.z, -|r3.y|, r9.x
ge r4.w, r10.z, l(0.000000)
ge r9.xw, r3.xxxy, l(0.000000, 0.000000, 0.000000, 0.000000)
movc r9.xw, r9.xxxw, l(1.000000,0,0,1.000000), l(-1.000000,0,0,-1.000000)
mul r9.xy, r9.xwxx, r9.yzyy
movc r10.xy, r4.wwww, r3.xyxx, r9.xyxx
dp3 r3.x, r10.xyzx, r10.xyzx
rsq r3.x, r3.x
mul r9.xyz, r3.xxxx, r10.xyzx
mul r10.xyz, r9.yyyy, cb0[20].xyzx
mad r9.xyw, r9.xxxx, cb0[19].xyxz, r10.xyxz
mad r9.xyz, r9.zzzz, cb0[21].xyzx, r9.xywx
mul r3.x, r3.z, l(65535.000000)
ftou r3.x, r3.x
ushr r3.x, r3.x, l(8)
utof r3.x, r3.x
mul r3.y, r3.x, l(0.00392156886)
mad r3.x, r3.x, l(0.00392156886), l(1.000000)

add r10.xyz, -r29.xyzx, cb0[13].xyzx
max r11.xyz, r1.xyzx, l(0.000100, 0.000100, 0.000100, 0.000000)
min r11.xyz, r11.xyzx, l(0.999900, 0.999900, 0.999900, 0.000000)
log r11.xyz, r11.xyzx
mul r11.xyz, r11.xyzx, l(0.693147182, 0.693147182, 0.693147182, 0.000000)
max r5.yw, r5.yyyz, l(0.000000, 0.000100, 0.000000, 0.000000)
div r11.xyz, -r11.xyzx, r5.yyyy
mul r11.xyz, r5.wwww, -r11.xyzx
mul r11.xyz, r11.xyzx, l(1.442695, 1.442695, 1.442695, 0.000000)
exp r11.xyz, r11.xyzx
dp3 r12.x, r9.xyzx, r8.xyzx
mov_sat r3.z, r12.x
add r4.w, r1.w, r3.z
mad r4.w, r4.w, r4.w, r1.w
add_sat r4.w, r4.w, l(-1.000000)
dp3 r13.x, r9.xyzx, -cb0[0].xyzx
lt r5.y, r13.x, l(0.000000)
lt r5.w, l(1.000000), r3.x
and r5.y, r5.w, r5.y
add r6.w, r13.x, r13.x
mad r14.yzw, r9.xxyz, r6.wwww, cb0[0].xxyz
mov r14.x, -r13.x
mul r15.xyz, r11.xyzx, cb0[4].xyzx
mad r16.xyz, r7.xyzx, r0.wwww, -r14.yzwy
dp3 r6.w, r16.xyzx, r16.xyzx
rsq r6.w, r6.w
mul r16.xyz, r6.wwww, r16.xyzx
dp3_sat r6.w, r8.xyzx, r16.xyzx
add r16.xyz, -r2.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
add r6.w, -r6.w, l(1.000000)
mul r7.w, r6.w, r6.w
mul r7.w, r7.w, r7.w
mul r6.w, r6.w, r7.w
mad r17.xyz, r16.xyzx, r6.wwww, r2.xyzx
add r18.xyz, -r17.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
add r3.x, -r3.x, l(2.000000)
mul r19.xyz, r3.xxxx, r18.xyzx
mad r17.xyz, r18.xyzx, r3.xxxx, r17.xyzx
add r17.xyz, -r17.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
mul r18.xyz, r3.yyyy, r19.xyzx
movc r17.xyz, r5.yyyy, r17.xyzx, l(-1.000000,-1.000000,-1.000000,0)
movc r18.xyz, r5.yyyy, r18.xyzx, l(-1.000000,-1.000000,-1.000000,0)
movc r15.xyz, r5.yyyy, r15.xyzx, cb0[4].xyzx
mov r13.yzw, cb0[0].xxyz
movc r14.xyzw, r5.yyyy, r14.xyzw, r13.xyzw
mad r14.yzw, r7.xxyz, r0.wwww, -r14.yyzw
dp3 r5.y, r14.yzwy, r14.yzwy
rsq r5.y, r5.y
mul r14.yzw, r5.yyyy, r14.yyzw
dp3 r5.y, r8.xyzx, r14.yzwy
ge r6.w, r17.x, l(0.000000)
mov_sat r7.w, r5.y
add r7.w, -r7.w, l(1.000000)
mul r8.w, r7.w, r7.w
mul r8.w, r8.w, r8.w
mul r7.w, r7.w, r8.w
mad r19.xyz, r16.xyzx, r7.wwww, r2.xyzx
movc r19.xyz, r6.wwww, r17.xyzx, r19.xyzx
mul r3.w, r3.w, r3.w
mul r7.w, r3.w, r3.w
dp3 r8.w, r9.xyzx, r14.yzwy
mul r9.w, r7.w, r7.w
mul r8.w, r8.w, r8.w
mad r10.w, r7.w, r7.w, l(-1.000000)
mad r8.w, r8.w, r10.w, l(1.000000)
max r8.w, r8.w, l(0.000100)
mul r8.w, r8.w, r8.w
mul r8.w, r8.w, l(4.000000)
div r8.w, r9.w, r8.w
mul r11.w, r7.w, l(0.500000)
mad r7.w, -r7.w, l(0.500000), l(1.000000)
mad r5.y, r5.y, r7.w, r11.w
mul r5.y, r5.y, r5.y
div r5.y, l(1.000000, 1.000000, 1.000000, 1.000000), r5.y
mul r5.y, r5.y, r8.w
mul r14.yzw, r5.yyyy, r19.xxyz
mul r14.yzw, r15.xxyz, r14.yyzw
mov_sat r14.x, r14.x
mul r12.zw, cb0[8].xxxx, cb0[12].yyyx
mad r13.zw, -cb0[12].yyyx, cb0[8].xxxx, l(0.000000, 0.000000, 1.000000, 1.000000)
mad r5.y, r4.w, r12.z, r13.z
mul r5.y, r5.y, r14.x
mul r14.yzw, r5.yyyy, r14.yyzw
mul r15.xyz, r14.xxxx, r15.xyzx
mul r19.xyz, r3.xxxx, r16.xyzx
movc r20.xyz, r6.wwww, r18.xyzx, r19.xyzx
mul r15.xyz, r15.xyzx, r20.xyzx
mad r5.y, r1.w, r12.w, r13.w
mul r15.xyz, r5.yyyy, r15.xyzx
mul r15.xyz, r6.zzzz, r15.xyzx
mul r14.xyz, r6.zzzz, r14.yzwy
ilt r5.y, l(0), cb0[10].x
if_nz r5.y
  dp3 r20.x, r9.xyzx, -cb0[1].xyzx
  lt r5.y, r20.x, l(0.000000)
  and r5.y, r5.w, r5.y
  add r6.w, r20.x, r20.x
  mad r21.yzw, r9.xxyz, r6.wwww, cb0[1].xxyz
  mov r21.x, -r20.x
  mul r22.xyz, r11.xyzx, cb0[5].xyzx
  mad r23.xyz, r7.xyzx, r0.wwww, -r21.yzwy
  dp3 r6.w, r23.xyzx, r23.xyzx
  rsq r6.w, r6.w
  mul r23.xyz, r6.wwww, r23.xyzx
  dp3_sat r6.w, r8.xyzx, r23.xyzx
  add r6.w, -r6.w, l(1.000000)
  mul r8.w, r6.w, r6.w
  mul r8.w, r8.w, r8.w
  mul r6.w, r6.w, r8.w
  mad r23.xyz, r16.xyzx, r6.wwww, r2.xyzx
  add r24.xyz, -r23.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
  mul r25.xyz, r3.xxxx, r24.xyzx
  mad r23.xyz, r24.xyzx, r3.xxxx, r23.xyzx
  add r23.xyz, -r23.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
  mul r24.xyz, r3.yyyy, r25.xyzx
  mov r17.w, l(-1.000000)
  movc r17.xyz, r5.yyyy, r23.xyzx, r17.wyzw
  movc r18.xyz, r5.yyyy, r24.xyzx, r18.xyzx
  movc r22.xyz, r5.yyyy, r22.xyzx, cb0[5].xyzx
  mov r20.yzw, cb0[1].xxyz
  movc r20.xyzw, r5.yyyy, r21.xyzw, r20.xyzw
  mad r20.yzw, r7.xxyz, r0.wwww, -r20.yyzw
  dp3 r5.y, r20.yzwy, r20.yzwy
  rsq r5.y, r5.y
  mul r20.yzw, r5.yyyy, r20.yyzw
  dp3 r5.y, r8.xyzx, r20.yzwy
  ge r6.w, r17.x, l(0.000000)
  mov_sat r8.w, r5.y
  add r8.w, -r8.w, l(1.000000)
  mul r12.z, r8.w, r8.w
  mul r12.z, r12.z, r12.z
  mul r8.w, r8.w, r12.z
  mad r21.xyz, r16.xyzx, r8.wwww, r2.xyzx
  movc r21.xyz, r6.wwww, r17.xyzx, r21.xyzx
  dp3 r8.w, r9.xyzx, r20.yzwy
  mul r8.w, r8.w, r8.w
  mad r8.w, r8.w, r10.w, l(1.000000)
  max r8.w, r8.w, l(0.000100)
  mul r8.w, r8.w, r8.w
  mul r8.w, r8.w, l(4.000000)
  div r8.w, r9.w, r8.w
  mad r5.y, r5.y, r7.w, r11.w
  mul r5.y, r5.y, r5.y
  div r5.y, l(1.000000, 1.000000, 1.000000, 1.000000), r5.y
  mul r5.y, r5.y, r8.w
  mul r20.yzw, r5.yyyy, r21.xxyz
  mul r20.yzw, r22.xxyz, r20.yyzw
  mov_sat r20.x, r20.x
  mul r12.zw, cb0[8].yyyy, cb0[12].yyyx
  mad r13.zw, -cb0[12].yyyx, cb0[8].yyyy, l(0.000000, 0.000000, 1.000000, 1.000000)
  mad r5.y, r4.w, r12.z, r13.z
  mul r5.y, r5.y, r20.x
  mad r14.xyz, r20.yzwy, r5.yyyy, r14.xyzx
  mul r20.xyz, r20.xxxx, r22.xyzx
  movc r21.xyz, r6.wwww, r18.xyzx, r19.xyzx
  mul r20.xyz, r20.xyzx, r21.xyzx
  mad r5.y, r1.w, r12.w, r13.w
  mad r15.xyz, r20.xyzx, r5.yyyy, r15.xyzx
  ilt r5.y, l(1), cb0[10].x
  if_nz r5.y
    dp3 r20.x, r9.xyzx, -cb0[2].xyzx
    lt r5.y, r20.x, l(0.000000)
    and r5.y, r5.w, r5.y
    add r6.w, r20.x, r20.x
    mad r21.yzw, r9.xxyz, r6.wwww, cb0[2].xxyz
    mov r21.x, -r20.x
    mul r22.xyz, r11.xyzx, cb0[6].xyzx
    mad r23.xyz, r7.xyzx, r0.wwww, -r21.yzwy
    dp3 r6.w, r23.xyzx, r23.xyzx
    rsq r6.w, r6.w
    mul r23.xyz, r6.wwww, r23.xyzx
    dp3_sat r6.w, r8.xyzx, r23.xyzx
    add r6.w, -r6.w, l(1.000000)
    mul r8.w, r6.w, r6.w
    mul r8.w, r8.w, r8.w
    mul r6.w, r6.w, r8.w
    mad r23.xyz, r16.xyzx, r6.wwww, r2.xyzx
    add r24.xyz, -r23.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
    mul r25.xyz, r3.xxxx, r24.xyzx
    mad r23.xyz, r24.xyzx, r3.xxxx, r23.xyzx
    add r23.xyz, -r23.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
    mul r24.xyz, r3.yyyy, r25.xyzx
    mov r17.w, l(-1.000000)
    movc r17.xyz, r5.yyyy, r23.xyzx, r17.wyzw
    movc r18.xyz, r5.yyyy, r24.xyzx, r18.xyzx
    movc r22.xyz, r5.yyyy, r22.xyzx, cb0[6].xyzx
    mov r20.yzw, cb0[2].xxyz
    movc r20.xyzw, r5.yyyy, r21.xyzw, r20.xyzw
    mad r20.yzw, r7.xxyz, r0.wwww, -r20.yyzw
    dp3 r5.y, r20.yzwy, r20.yzwy
    rsq r5.y, r5.y
    mul r20.yzw, r5.yyyy, r20.yyzw
    dp3 r5.y, r8.xyzx, r20.yzwy
    ge r6.w, r17.x, l(0.000000)
    mov_sat r8.w, r5.y
    add r8.w, -r8.w, l(1.000000)
    mul r12.z, r8.w, r8.w
    mul r12.z, r12.z, r12.z
    mul r8.w, r8.w, r12.z
    mad r21.xyz, r16.xyzx, r8.wwww, r2.xyzx
    movc r21.xyz, r6.wwww, r17.xyzx, r21.xyzx
    dp3 r8.w, r9.xyzx, r20.yzwy
    mul r8.w, r8.w, r8.w
    mad r8.w, r8.w, r10.w, l(1.000000)
    max r8.w, r8.w, l(0.000100)
    mul r8.w, r8.w, r8.w
    mul r8.w, r8.w, l(4.000000)
    div r8.w, r9.w, r8.w
    mad r5.y, r5.y, r7.w, r11.w
    mul r5.y, r5.y, r5.y
    div r5.y, l(1.000000, 1.000000, 1.000000, 1.000000), r5.y
    mul r5.y, r5.y, r8.w
    mul r20.yzw, r5.yyyy, r21.xxyz
    mul r20.yzw, r22.xxyz, r20.yyzw
    mov_sat r20.x, r20.x
    mul r12.zw, cb0[8].zzzz, cb0[12].yyyx
    mad r13.zw, -cb0[12].yyyx, cb0[8].zzzz, l(0.000000, 0.000000, 1.000000, 1.000000)
    mad r5.y, r4.w, r12.z, r13.z
    mul r5.y, r5.y, r20.x
    mad r14.xyz, r20.yzwy, r5.yyyy, r14.xyzx
    mul r20.xyz, r20.xxxx, r22.xyzx
    movc r21.xyz, r6.wwww, r18.xyzx, r19.xyzx
    mul r20.xyz, r20.xyzx, r21.xyzx
    mad r5.y, r1.w, r12.w, r13.w
    mad r15.xyz, r20.xyzx, r5.yyyy, r15.xyzx
    ilt r5.y, l(2), cb0[10].x
    if_nz r5.y
      dp3 r20.x, r9.xyzx, -cb0[3].xyzx
      lt r5.y, r20.x, l(0.000000)
      and r5.y, r5.w, r5.y
      add r6.w, r20.x, r20.x
      mad r21.yzw, r9.xxyz, r6.wwww, cb0[3].xxyz
      mov r21.x, -r20.x
      mul r22.xyz, r11.xyzx, cb0[7].xyzx
      mad r23.xyz, r7.xyzx, r0.wwww, -r21.yzwy
      dp3 r6.w, r23.xyzx, r23.xyzx
      rsq r6.w, r6.w
      mul r23.xyz, r6.wwww, r23.xyzx
      dp3_sat r6.w, r8.xyzx, r23.xyzx
      add r6.w, -r6.w, l(1.000000)
      mul r8.w, r6.w, r6.w
      mul r8.w, r8.w, r8.w
      mul r6.w, r6.w, r8.w
      mad r23.xyz, r16.xyzx, r6.wwww, r2.xyzx
      add r24.xyz, -r23.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
      mul r25.xyz, r3.xxxx, r24.xyzx
      mad r23.xyz, r24.xyzx, r3.xxxx, r23.xyzx
      add r23.xyz, -r23.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
      mul r24.xyz, r3.yyyy, r25.xyzx
      mov r17.w, l(-1.000000)
      movc r17.xyz, r5.yyyy, r23.xyzx, r17.wyzw
      movc r18.xyz, r5.yyyy, r24.xyzx, r18.xyzx
      movc r22.xyz, r5.yyyy, r22.xyzx, cb0[7].xyzx
      mov r20.yzw, cb0[3].xxyz
      movc r20.xyzw, r5.yyyy, r21.xyzw, r20.xyzw
      mad r7.xyz, r7.xyzx, r0.wwww, -r20.yzwy
      dp3 r0.w, r7.xyzx, r7.xyzx
      rsq r0.w, r0.w
      mul r7.xyz, r0.wwww, r7.xyzx
      dp3 r0.w, r8.xyzx, r7.xyzx
      ge r3.y, r17.x, l(0.000000)
      mov_sat r5.y, r0.w
      add r5.y, -r5.y, l(1.000000)
      mul r6.w, r5.y, r5.y
      mul r6.w, r6.w, r6.w
      mul r5.y, r5.y, r6.w
      mad r20.yzw, r16.xxyz, r5.yyyy, r2.xxyz
      movc r17.xyz, r3.yyyy, r17.xyzx, r20.yzwy
      dp3 r5.y, r9.xyzx, r7.xyzx
      mul r5.y, r5.y, r5.y
      mad r5.y, r5.y, r10.w, l(1.000000)
      max r5.y, r5.y, l(0.000100)
      mul r5.y, r5.y, r5.y
      mul r5.y, r5.y, l(4.000000)
      div r5.y, r9.w, r5.y
      mad r0.w, r0.w, r7.w, r11.w
      mul r0.w, r0.w, r0.w
      div r0.w, l(1.000000, 1.000000, 1.000000, 1.000000), r0.w
      mul r0.w, r0.w, r5.y
      mul r7.xyz, r0.wwww, r17.xyzx
      mul r7.xyz, r22.xyzx, r7.xyzx
      mov_sat r20.x, r20.x
      mul r12.zw, cb0[8].wwww, cb0[12].yyyx
      mad r13.zw, -cb0[12].yyyx, cb0[8].wwww, l(0.000000, 0.000000, 1.000000, 1.000000)
      mad r0.w, r4.w, r12.z, r13.z
      mul r0.w, r0.w, r20.x
      mad r14.xyz, r7.xyzx, r0.wwww, r14.xyzx
      mul r7.xyz, r20.xxxx, r22.xyzx
      movc r17.xyz, r3.yyyy, r18.xyzx, r19.xyzx
      mul r7.xyz, r7.xyzx, r17.xyzx
      mad r0.w, r1.w, r12.w, r13.w
      mad r15.xyz, r7.xyzx, r0.wwww, r15.xyzx
    endif
  endif
endif
ne r0.w, cb0[27].x, l(0.000000)
dp3 r3.y, -r8.xyzx, r9.xyzx
add r3.y, r3.y, r3.y
mad r7.xyz, r9.xyzx, -r3.yyyy, -r8.xyzx
mov r8.x, -r9.y
mov r8.y, -r7.y
mov_sat r8.xy, r8.xyxx
dp3_sat r13.y, r7.xyzx, -cb0[0].xyzx
mov_sat r13.x, r13.x
add r8.xy, r8.xyxx, r13.xyxx
mul_sat r8.xy, r8.xyxx, cb0[27].xxxx
add r3.y, r6.z, l(-1.000000)
mad r6.zw, r8.xxxy, r3.yyyy, l(0.000000, 0.000000, 1.000000, 1.000000)
movc r6.zw, r0.wwww, r6.zzzw, l(0,0,1.000000,1.000000)
sample_l_indexable(texturecube)(float,float,float,float) r8.xyz, r9.xyzx, t2.xyzw, s2, l(6.000000)
mul r8.xyz, r6.zzzz, r8.xyzx
mad r8.xyz, r8.xyzx, cb0[28].xyzx, cb0[9].xyzx
add r0.w, -cb0[28].w, l(1.000000)
mad r0.w, r1.w, cb0[28].w, r0.w
add r0.w, r0.w, l(-1.000000)
add r0.w, r0.w, l(1.000000)
add r6.xy, -r6.yxyy, l(1.000000, 1.000000, 0.000000, 0.000000)
mul r3.y, r0.w, r6.x
mul r8.xyz, r3.yyyy, r8.xyzx
mad r8.xyz, r8.xyzx, r19.xyzx, r15.xyzx
mul r3.y, r3.w, l(6.000000)
max r7.w, |r7.y|, l(0.008749)
sample_l_indexable(texturecube)(float,float,float,float) r7.xyz, r7.xwzx, t2.xyzw, s2, r3.y
mul r6.xzw, r6.wwww, r7.xxyz
mul r6.xzw, r6.xxzw, cb0[29].xxyz
mov r12.y, r2.w
sample_indexable(texture2d)(float,float,float,float) r3.yw, r12.xyxx, t1.zxwy, s1
mad r7.xyz, r2.xyzx, r3.yyyy, r3.wwww
mul r6.xzw, r6.xxzw, r7.xxyz
add r2.w, -cb0[29].w, l(1.000000)
mad r1.w, r1.w, cb0[29].w, r2.w
add r2.w, -r1.w, l(1.000000)
mad r2.w, r4.w, r2.w, r1.w
mad r1.w, r1.w, r2.w, l(-1.000000)
add r1.w, r1.w, l(1.000000)
mul r2.w, r6.y, r1.w
mad r6.xyz, r6.xzwx, r2.wwww, r14.xyzx
div r2.w, l(1.000000, 1.000000, 1.000000, 1.000000), r5.x
dp3 r3.y, r10.xyzx, r10.xyzx
rsq r3.y, r3.y
mul r7.xyz, r3.yyyy, r10.xyzx
dp3_sat r3.y, r9.xyzx, r7.xyzx
mad r3.y, -r3.y, r3.y, l(1.000000)
sqrt r3.y, r3.y
mad r3.y, r3.y, r2.w, -r3.y
add r9.xyz, r9.xyzx, l(-0.000000, -1.000000, -0.000000, 0.000000)
mul r7.xyz, r2.wwww, r7.xyzx
mad r7.xyz, r3.yyyy, r9.xyzx, -r7.xyzx
dp3 r2.w, r7.xyzx, r7.xyzx
rsq r2.w, r2.w
mul r7.xyz, r2.wwww, r7.xyzx
mad r7.xyz, r7.xyzx, r5.zzzz, r0.xyzx
mov r7.w, l(1.000000)
dp4 r0.x, r7.xyzw, cb0[16].xyzw
dp4 r0.y, r7.xyzw, cb0[17].xyzw
dp4 r0.z, r7.xyzw, cb0[18].xyzw

//Haloing fix. Related to water PS.
add r26.w, r0.z, -r26.y
mul r26.w, r26.w, l(0.5)
mad r0.x, r26.x, r26.w, r0.x

div r0.xy, r0.xyxx, r0.zzzz
sample_indexable(texture2d)(float,float,float,float) r0.z, r0.xyxx, t0.yzxw, s0
if_nz r5.w
  div r3.yw, v1.xxxy, v1.wwww
  mad r3.yw, r3.yyyw, l(0.000000, 0.500000, 0.000000, -0.500000), l(0.000000, 0.500000, 0.000000, 0.500000)
  dp3 r2.w, -r10.xyzx, cb0[14].xyzx
  add r3.z, -r3.z, l(1.000000)
  mul r4.w, r3.z, r3.z
  mul r4.w, r4.w, r4.w
  mul r3.z, r3.z, r4.w
  mad r2.xyz, r16.xyzx, r3.zzzz, r2.xyzx
  add r5.xyz, -r2.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
  mad r2.xyz, r5.xyzx, r3.xxxx, r2.xyzx
  add r2.xyz, -r2.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
  mul r5.xyz, r3.xxxx, r2.xyzx
  mad_sat r0.z, cb0[15].y, r0.z, cb0[15].x
  div r0.z, l(1.000000, 1.000000, 1.000000, 1.000000), r0.z
  lt r0.z, r0.z, r2.w
  movc r0.xy, r0.zzzz, r3.ywyy, r0.xyxx
  mad r0.xy, r0.xyxx, cb0[30].zwzz, cb0[30].xyxx
  sample_l_indexable(texture2d)(float,float,float,float) r3.xyz, r0.xyxx, t3.xyzw, s3, l(16.000000)
  mul r3.xyz, r3.xyzx, cb0[28].xyzx
  mul r3.xyz, r0.wwww, r3.xyzx
  mul r3.xyz, r5.xyzx, r3.xyzx
  mad r8.xyz, r3.xyzx, r11.xyzx, r8.xyzx
  sample_l_indexable(texture2d)(float,float,float,float) r0.xyz, r0.xyxx, t3.xyzw, s3, l(0.000000)
  mul r0.xyz, r0.xyzx, cb0[29].xyzx
  mul r0.xyz, r1.wwww, r0.xyzx
  mul r0.xyz, r2.xyzx, r0.xyzx
  mad r6.xyz, r0.xyzx, r11.xyzx, r6.xyzx
endif
mad r0.xyz, r8.xyzx, r1.xyzx, r4.xyzx
add o0.xyz, r6.xyzx, r0.xyzx
mov o0.w, l(1.000000)
ret
// Approximately 431 instruction slots used
