// MANUALLY DUMPED [ShaderRegexDecals2][ShaderRegexHaloingPS2] Manual haloing fix.
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v1.3.16 on Sat May 29 18:23:47 2021
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                10   xyzw        0     NONE   float
// TEXCOORD                11   xyzw        1     NONE   float
// TEXCOORD                 7   xyzw        2     NONE   float   xyzw
// TEXCOORD                 8   x           3     NONE   float   x
// SV_POSITION              0   xyzw        4      POS   float   xyzw
// SV_IsFrontFace           0   x           5    FFACE    uint
//
//
// 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[1], immediateIndexed
dcl_constantbuffer cb1[57], immediateIndexed
dcl_constantbuffer cb2[44], immediateIndexed
dcl_constantbuffer cb3[34], immediateIndexed
dcl_constantbuffer cb4[8], immediateIndexed
dcl_constantbuffer cb5[8], immediateIndexed
dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_resource_texture3d (float,float,float,float) t2
dcl_resource_texture3d (float,float,float,float) t3
dcl_resource_texture2d (float,float,float,float) t4
dcl_input_ps linear v2.xyzw
dcl_input_ps linear v3.x
dcl_input_ps_siv linear noperspective v4.xyzw, position
dcl_output o0.xyzw
dcl_temps 14
dcl_resource_texture2d (float,float,float,float) t125
dcl_resource_texture1d (float,float,float,float) t120
mul r0.xy, v4.xyxx, cb0[0].xyxx
mad r0.zw, v4.xxxy, cb0[0].xxxy, -cb3[1].xxxy
mad r0.zw, r0.zzzw, cb3[2].zzzw, l(0.000000, 0.000000, -0.500000, -0.500000)
mul r1.xy, r0.zwzz, l(2.000000, -2.000000, 0.000000, 0.000000)
mov r1.w, l(1.000000)
mul r2.xyz, r1.xywx, v4.wwww
ld_indexable(texture2d)(float,float,float,float) r10.xyzw, l(0, 0, 0, 0), t125.xyzw
ld_indexable(texture2d)(float,float,float,float) r9.xyzw, l(2, 0, 0, 0), t125.xyzw
ld_indexable(texture1d)(float,float,float,float) r8.xyzw, l(10, 0, 0, 0), t120.xyzw
mov r11.x, r0.x
mul r12.xyzw, r0.yyyy, cb1[37].xyzw
mad r12.xyzw, r11.xxxx, cb1[36].xyzw, r12.xyzw
mad r12.xyzw, v4.zzzz, cb1[38].xyzw, r12.xyzw
add r12.xyzw, r12.xyzw, cb1[39].xyzw
mul r10.w, r9.x, l(0.5)
mul r10.w, r10.w, r8.x
mad r11.x, -r10.x, r10.w, r11.x
mul r10.w, r9.x, l(0.5)
mul r10.w, r10.w, r8.x
mul r10.w, r10.w, r10.y
mul r10.w, r10.w, r12.w
mad r11.x, r10.x, r10.w, r11.x
mul r3.xyzw, r0.yyyy, cb1[37].xyzw
mad r0.xyzw, r11.xxxx, cb1[36].xyzw, r3.xyzw
mad r0.xyzw, v4.zzzz, cb1[38].xyzw, r0.xyzw
add r0.xyzw, r0.xyzw, cb1[39].xyzw
div r0.xyz, r0.xyzx, r0.wwww
mov r3.x, cb3[31].w
mov r3.y, cb3[32].w
mov r3.z, cb3[33].w
dp3 r0.w, r3.xyzx, l(0.300000, 0.590000, 0.110000, 0.000000)
add r4.xyz, -r3.xyzx, r0.wwww
mad r3.xyz, cb5[7].xxxx, r4.xyzx, r3.xyzx
mad r3.xyz, r3.xyzx, cb5[3].xyzx, cb5[4].xyzx
add r4.xyz, r0.xyzx, -cb1[56].xyzx
mul r5.xyz, r4.yyyy, cb4[5].xyzx
mad r4.xyw, r4.xxxx, cb4[4].xyxz, r5.xyxz
mad r4.xyz, r4.zzzz, cb4[6].xyzx, r4.xywx
add r4.xyz, r4.xyzx, cb4[7].xyzx
mul r5.xyz, r0.yyyy, cb4[5].xyzx
mad r5.xyz, r0.xxxx, cb4[4].xyzx, r5.xyzx
mad r5.xyz, r0.zzzz, cb4[6].xyzx, r5.xyzx
max r0.w, |r4.y|, |r4.x|
max r0.w, |r4.z|, r0.w
div r6.xyz, l(1.000000, 1.000000, 1.000000, 1.000000), r5.xyzx
mul r7.xyz, r0.wwww, r6.xyzx
mad r6.xyz, r4.xyzx, r6.xyzx, |r7.xyzx|
min r0.w, r6.y, r6.x
min r0.w, r6.z, r0.w
mad r4.xyw, -r0.wwww, r5.xyxz, r4.xyxz
mul r5.xyz, r4.yyyy, cb4[1].xyzx
mad r5.xyz, r4.xxxx, cb4[0].xyzx, r5.xyzx
mad r5.xyz, r4.wwww, cb4[2].xyzx, r5.xyzx
add r5.xyz, r5.xyzx, cb4[3].xyzx
add r5.xyz, r5.xyzx, cb1[56].xyzx

ld_indexable(texture2d)(float,float,float,float) r13.xyzw, l(0, 0, 0, 0), t125.xyzw
//add r13.w, r2.z, -r13.y
//mad r2.x, r13.x, r13.w, r2.x
div r2.xy, r2.xyxx, r2.zzzz
mad r2.xy, r2.xyxx, cb1[52].xyxx, cb1[52].wzww
sample_l_indexable(texture2d)(float,float,float,float) r0.w, r2.xyxx, t4.yzwx, s0, l(0.000000)
mul r0.w, r0.w, r0.w
mad r0.w, r0.w, cb1[51].z, -cb1[51].w
div r0.w, l(1.000000, 1.000000, 1.000000, 1.000000), r0.w
dp3 r2.x, r5.xyzx, cb1[14].xyzx
dp3 r0.x, r0.xyzx, cb1[14].xyzx
max r0.y, r2.x, l(0.000000)
max r0.z, r0.x, l(0.000000)
min r0.yz, r0.wwww, r0.yyzy
add r0.xw, -r2.xxxx, r0.xxxy
div r0.x, l(1.000000, 1.000000, 1.000000, 1.000000), r0.x
mul r0.w, r0.x, r0.w
add r2.x, -r2.x, r0.z
mul r0.x, r0.x, r2.x
add r0.y, -r0.z, r0.y
mul r0.z, r4.w, l(0.020000)
add r2.x, -r4.w, r4.z
mul r0.xw, r0.xxxw, r2.xxxx
mad r0.w, r0.w, l(0.020000), r0.z
mad r0.x, r0.x, l(0.020000), r0.z
mul r0.xz, r0.xxwx, -cb5[7].zzzz
exp r0.z, r0.z
exp r2.x, r0.x
mad r0.x, r0.w, -cb5[7].z, -r0.x
eq r0.w, r0.x, l(0.000000)
add r0.z, r0.z, -r2.x
div r0.x, r0.z, r0.x
movc r0.x, r0.w, l(1.000000), r0.x
mul r0.x, r0.x, cb5[7].w
mul r0.x, r0.x, r0.y
mul r0.x, r0.x, l(0.00195312500)
exp r0.x, r0.x
add r0.x, -r0.x, l(1.000000)
max o0.w, r0.x, l(0.000000)
ne r0.x, cb2[13].w, l(0.000000)
if_nz r0.x
  mov r1.z, v4.z
  mul r0.xyzw, r1.xyzw, v4.wwww
  
  
  
  div r0.xyz, r0.xyzx, r0.wwww
  mad r0.xy, r0.xyxx, l(0.500000, -0.500000, 0.000000, 0.000000), l(0.500000, 0.500000, 0.000000, 0.000000)
  lt r1.x, cb2[13].z, r0.z
  movc r2.xyzw, r1.xxxx, cb2[11].xyzw, cb2[12].xyzw
  mad r1.yz, -r2.zzwz, l(0.000000, 0.500000, 0.500000, 0.000000), l(0.000000, 1.000000, 1.000000, 0.000000)
  max r0.xy, r0.xyxx, l(0.000000, 0.000000, 0.000000, 0.000000)
  min r0.xy, r1.yzyy, r0.xyxx
  mul r0.xy, r2.xyxx, r0.xyxx
  round_ni r0.xy, r0.xyxx
  ftoi r2.xy, r0.xyxx
  mov r2.w, l(0)
  ld_indexable(texture2d)(float,float,float,float) r0.x, r2.xyww, t0.xyzw
  ld_indexable(texture2d)(float,float,float,float) r0.y, r2.xyww, t1.yxzw
  movc r0.y, r1.x, r0.x, r0.y
  lt r0.z, r0.z, r0.y
  movc r0.y, r0.z, l(0), r0.y
  movc r0.x, r1.x, r0.x, r0.y
  max r0.x, r0.x, cb2[13].w
  max r0.y, r0.x, cb2[13].z
  movc r0.x, r1.x, r0.y, r0.x
  mad r0.x, r0.x, cb1[51].z, -cb1[51].w
  mul r0.y, r0.x, r0.w
  mul r4.y, r0.y, l(32.000000)
  mad r0.y, r0.y, l(32.000000), l(-1.000000)
  max r0.y, r0.y, l(0.000000)
  min r4.x, r0.y, l(30.999001)
  mov_sat r4.y, r4.y
  mul r0.y, r0.x, cb2[13].x
  mad r0.y, r0.w, r0.x, -r0.y
  mad r0.x, -cb2[13].x, r0.x, l(1.000000)
  div r0.x, r0.y, r0.x
  mul r0.x, r0.x, l(15.000000)
  max r0.x, r0.x, l(0.000000)
  min r0.x, r0.x, l(14.999000)
  mov r0.y, l(1.000000)
  movc r0.xy, r1.xxxx, r4.xyxx, r0.xyxx
  round_ni r0.z, r0.x
  ftoi r2.z, r0.z
  frc r0.x, r0.x
  if_nz r1.x
    ld_aoffimmi_indexable(0,0,0)(texture3d)(float,float,float,float) r1.xyzw, r2.xyzw, t2.xyzw
    ld_aoffimmi_indexable(0,0,1)(texture3d)(float,float,float,float) r4.xyzw, r2.xyzw, t2.xyzw
    add r4.xyzw, -r1.xyzw, r4.xyzw
    mad r1.xyzw, r0.xxxx, r4.xyzw, r1.xyzw
    mul r1.xyzw, r0.yyyy, r1.xyzw
  else
    ld_aoffimmi_indexable(0,0,0)(texture3d)(float,float,float,float) r4.xyzw, r2.xyzw, t3.xyzw
    ld_aoffimmi_indexable(0,0,1)(texture3d)(float,float,float,float) r2.xyzw, r2.xyzw, t3.xyzw
    add r2.xyzw, -r4.xyzw, r2.xyzw
    mad r1.xyzw, r0.xxxx, r2.xyzw, r4.xyzw
  endif
else
  mov r1.xyzw, l(0,0,0,0)
endif
add r0.x, -r1.w, l(1.000000)
mul r0.y, r0.x, v2.w
mad r0.xzw, v2.xxyz, r0.xxxx, r1.xxyz
dp3 r1.x, l(0.627403915, 0.329283029, 0.0433130674, 0.000000), r3.xyzx
dp3 r1.y, l(0.0690972880, 0.919540405, 0.0113623161, 0.000000), r3.xyzx
dp3 r1.z, l(0.0163914394, 0.0880133063, 0.895595253, 0.000000), r3.xyzx
mul r1.xyz, r1.xyzx, cb2[43].yyyy
mad r0.xyz, r1.xyzx, r0.yyyy, r0.xzwx
mad r1.xyzw, cb2[17].xyzw, v3.xxxx, cb2[16].xyzw
dp3 r0.w, r0.xyzx, l(0.300000, 0.590000, 0.110000, 0.000000)
add r0.xyz, -r0.wwww, r0.xyzx
mad r0.xyz, r1.wwww, r0.xyzx, r0.wwww
mul o0.xyz, r1.xyzx, r0.xyzx
ret
// Approximately 0 instruction slots used
