//\FortressOfVarnolis
// MANUALLY DUMPED [ShaderRegex\ShaderFixes\ShaderRegEx_UE4_UNIVERSAL2_C44.ini\_97_LightReflectSpecial]
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v1.3.16 on Thu Feb 17 17:26:55 2022
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                 0   xyzw        0     NONE   float   xyzw
// SV_POSITION              0   xyzw        1      POS   float
//
//
// 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[29], immediateIndexed
dcl_constantbuffer cb1[208], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_sampler s2, mode_default
dcl_sampler s3, mode_default
dcl_resource_texturecube (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_input_ps linear noperspective v0.xyzw
dcl_output o0.xyzw
dcl_temps 54
dcl_resource_texture2d (float,float,float,float) t125
sample_l_indexable(texture2d)(float,float,float,float) r0.xyz, v0.xyxx, t2.xyzw, s0, l(0.000000)
sample_l_indexable(texture2d)(float,float,float,float) r1.xyzw, v0.xyxx, t3.xyzw, s0, l(0.000000)
sample_l_indexable(texture2d)(float,float,float,float) r2.xyz, v0.xyxx, t4.xyzw, s0, l(0.000000)
sample_l_indexable(texture2d)(float,float,float,float) r3.xyz, v0.xyxx, t5.xyzw, s0, l(0.000000)
mul r4.xy, v0.xyxx, cb1[132].xyxx
ftou r4.xy, r4.xyxx
ftou r0.w, cb1[152].x
iadd r2.w, r4.y, r4.x
iadd r0.w, r0.w, r2.w
and r0.w, r0.w, l(1)
mad r0.xyz, r0.xyzx, l(2.000000, 2.000000, 2.000000, 0.000000), l(-1.000000, -1.000000, -1.000000, 0.000000)
dp3 r2.w, r0.xyzx, r0.xyzx
rsq r2.w, r2.w
mul r4.xyz, r0.xyzx, r2.wwww
mul r5.xy, r1.wyww, l(255.000000, 0.080000, 0.000000, 0.000000)
round_ne r1.w, r5.x
ftou r1.w, r1.w
and r1.w, r1.w, l(15)
ieq r6.xyzw, r1.wwww, l(2, 3, 4, 5)
or r3.w, r6.y, r6.x
or r4.w, r6.z, r3.w
or r4.w, r6.w, r4.w
ieq r7.xyzw, r1.wwww, l(6, 7, 8, 9)
or r1.w, r4.w, r7.x
or r1.w, r7.y, r1.w
or r1.w, r7.z, r1.w
or r1.w, r7.w, r1.w
and r3.xyz, r3.xyzx, r1.wwww
movc r1.w, r7.w, l(0), r1.x
mad r5.xzw, -r1.yyyy, l(0.080000, 0.000000, 0.080000, 0.080000), r2.xxyz
mad r5.xyz, r1.wwww, r5.xzwx, r5.yyyy
or r4.w, r6.w, r7.w
lt r6.x, l(0.000000), cb1[156].y
lt r6.y, l(0.000000), cb1[207].z
and r6.x, r6.y, r6.x
ne r6.y, l(0.000000, 0.000000, 0.000000, 0.000000), cb1[156].y
movc r7.xzw, r6.yyyy, l(1.000000,0,1.000000,1.000000), r2.xxyz
movc r6.yw, r0.wwww, l(0,1.000000,0,0), l(0,0,0,1.000000)
mul r8.xyz, r5.xyzx, r6.wwww
mul r8.w, r1.y, r6.w
movc r9.xyz, r6.xxxx, r6.yyyy, r7.xzwx
mov r5.w, r1.y
movc r8.xyzw, r6.xxxx, r8.xyzw, r5.xyzw
movc r6.xyw, r4.wwww, r8.xyxz, r5.xyxz
mov r9.w, r8.w
mov r5.xyz, r2.xyzx
movc r5.xyzw, r4.wwww, r9.xyzw, r5.xyzw
mad r2.xyz, -r5.xyzx, r1.wwww, r5.xyzx
mad r2.xyz, r2.xyzx, cb1[136].wwww, cb1[136].xyzx
mad r6.xyw, r6.xyxw, cb1[137].wwww, cb1[137].xyxz

mul r7.xzw, v0.wwww, cb1[49].xxyz

ld_indexable(texture2d)(float,float,float,float) r12.xyzw, l(0, 0, 0, 0), t125.xyzw
mov r13.z, v0.zzzz
add r13.z, r13.z, -r12.x
mad r7.xzw, r13.zzzz, cb1[48].xxyz, r7.xxzw
add r7.xzw, r7.xxzw, cb1[50].xxyz
dp3 r0.w, r7.xzwx, r7.xzwx

rsq r0.w, r0.w
mul r7.xzw, r0.wwww, r7.xxzw
dp3 r0.w, -r7.xzwx, r4.xyzx
add r8.x, r0.w, r0.w
mad r8.xyz, r8.xxxx, r4.xyzx, r7.xzwx
mov_sat r1.x, r0.w
mad r8.w, -r1.z, r1.z, l(1.000000)
sqrt r9.x, r8.w
mad r9.x, r1.z, r1.z, r9.x
mul r8.w, r8.w, r9.x
mad r0.xyz, -r0.xyzx, r2.wwww, r8.xyzx
mad r0.xyz, r8.wwww, r0.xyzx, r4.xyzx
sample_l_indexable(texturecube)(float,float,float,float) r9.xyz, r4.xyzx, t0.xyzw, s1, cb0[28].z
mul r2.xyz, r2.xyzx, r9.xyzx
if_nz r6.z
  log r2.w, r1.z
  mad r2.w, -r2.w, l(1.150000), l(3.000000)
  add r6.z, cb0[28].w, l(-1.000000)
  add r2.w, -r2.w, r6.z
  sample_l_indexable(texturecube)(float,float,float,float) r10.xyz, r0.xyzx, t0.xyzw, s1, r2.w
  mov r1.y, r1.z
  sample_l_indexable(texture2d)(float,float,float,float) r11.xy, r1.xyxx, t1.xyzw, s2, l(0.000000)
  add r1.y, -r3.x, l(1.000000)
  mul r1.y, r1.y, r11.y
  mad r11.xyz, r6.xywx, r11.xxxx, r1.yyyy
  mul r10.xyz, r10.xyzx, r11.xyzx
  log r1.y, r3.y
  mad r1.y, -r1.y, l(1.150000), l(3.000000)
  add r1.y, -r1.y, r6.z
  sample_l_indexable(texturecube)(float,float,float,float) r8.xyz, r8.xyzx, t0.xyzw, s1, r1.y
  add r1.y, -r1.x, l(1.000000)
  mul r2.w, r1.y, r1.y
  mul r2.w, r2.w, r2.w
  mul r6.z, r1.y, r2.w
  mad r1.y, -r1.y, r2.w, l(1.000000)
  mad r1.y, r1.y, l(0.040000), r6.z
  mul r2.w, r3.x, r1.y
  mad r1.y, -r1.y, r3.x, l(1.000000)
  mul r2.xyz, r1.yyyy, r2.xyzx
  mul r8.xyz, r2.wwww, r8.xyzx
  mad r8.xyz, r10.xyzx, r1.yyyy, r8.xyzx
else
  log r1.y, r1.z
  mad r1.y, -r1.y, l(1.150000), l(3.000000)
  add r2.w, cb0[28].w, l(-1.000000)
  add r1.y, -r1.y, r2.w
  sample_l_indexable(texturecube)(float,float,float,float) r0.xyz, r0.xyzx, t0.xyzw, s1, r1.y
  sample_l_indexable(texture2d)(float,float,float,float) r1.xy, r1.xzxx, t1.xyzw, s2, l(0.000000)
  mul_sat r2.w, r6.y, l(50.000000)
  mul r1.y, r1.y, r2.w
  mad r6.xyz, r6.xywx, r1.xxxx, r1.yyyy
  mul r8.xyz, r0.xyzx, r6.xyzx
endif
if_nz r7.y
  mad r0.xyz, -r4.xyzx, r0.wwww, -r7.xzwx




  dp3 r1.x, r0.xyzx, r0.xyzx
  rsq r1.x, r1.x
  mul r0.xyz, r0.xyzx, r1.xxxx
  sample_l_indexable(texturecube)(float,float,float,float) r6.xyz, r0.xyzx, t0.xyzw, s1, cb0[28].z
  max r1.x, r1.z, l(0.00392156886)
  min r1.x, r1.x, l(1.000000)
  dp3 r1.y, -r7.xzwx, r0.xyzx
  dp3 r1.z, r4.xyzx, r0.xyzx
  max r2.w, r1.z, l(-1.000000)
  min r2.w, r2.w, l(1.000000)
  max r0.w, r0.w, l(-1.000000)
  min r0.w, r0.w, l(1.000000)
  mad r6.w, |r0.w|, l(-0.156583), l(1.57079637)
  add r7.y, -|r0.w|, l(1.000000)
  sqrt r7.y, r7.y
  mul r8.w, r6.w, r7.y
  ge r9.w, r0.w, l(0.000000)
  mad r6.w, -r6.w, r7.y, l(3.14159274)
  movc r6.w, r9.w, r8.w, r6.w
  add r6.w, -r6.w, l(1.57079637)
  mad r7.y, |r2.w|, l(-0.156583), l(1.57079637)
  add r8.w, -|r2.w|, l(1.000000)
  sqrt r8.w, r8.w
  mul r9.w, r7.y, r8.w
  ge r10.x, r2.w, l(0.000000)
  mad r7.y, -r7.y, r8.w, l(3.14159274)
  movc r7.y, r10.x, r9.w, r7.y
  add r7.y, -r7.y, l(1.57079637)
  add r6.w, r6.w, -r7.y
  mul r6.w, |r6.w|, l(0.500000)
  sincos null, r6.w, r6.w
  mad r10.xyz, -r2.wwww, r4.xyzx, r0.xyzx
  mad r4.xyz, -r0.wwww, r4.xyzx, -r7.xzwx
  dp3 r7.y, r10.xyzx, r4.xyzx
  dp3 r8.w, r10.xyzx, r10.xyzx
  dp3 r4.x, r4.xyzx, r4.xyzx
  mad r4.x, r8.w, r4.x, l(0.000100)
  rsq r4.x, r4.x
  mul r4.x, r4.x, r7.y
  mad r4.xy, r4.xxxx, l(0.500000, 17.000000, 0.000000, 0.000000), l(0.500000, -16.780001, 0.000000, 0.000000)
  mov_sat r4.x, r4.x
  sqrt r4.x, r4.x
  mul r4.z, r1.x, r1.x
  mad r1.x, r1.x, r1.x, l(0.200000)
  mad r4.z, r4.z, l(2.000000), l(0.200000)
  mul r7.y, r4.x, l(0.997551)
  mad r8.w, -r0.w, r0.w, l(1.000000)
  sqrt r8.w, r8.w
  mul r9.w, r0.w, l(-0.0699428469)
  mad r7.y, r7.y, r8.w, r9.w
  mul r1.x, r4.x, r1.x
  mul r10.xy, r1.xxxx, l(1.41421354, 3.54490757, 0.000000, 0.000000)
  add r0.w, r0.w, r2.w
  mad r1.x, -r7.y, l(-0.139885694), r0.w
  mul r1.x, r1.x, r1.x
  mul r1.x, r1.x, l(-0.500000)
  mul r2.w, r10.x, r10.x
  div r1.x, r1.x, r2.w
  mul r1.x, r1.x, l(1.442695)
  exp r1.x, r1.x
  div r1.x, r1.x, r10.y
  mul r1.x, r4.x, r1.x
  mad_sat r2.w, r1.y, l(0.500000), l(0.500000)
  sqrt r2.w, r2.w
  add r2.w, -r2.w, l(1.000000)
  mul r4.x, r2.w, r2.w
  mul r4.x, r4.x, r4.x
  mul r2.w, r2.w, r4.x
  mad r2.w, r2.w, l(0.953479409), l(0.0465205684)
  mul r1.x, r1.x, r2.w
  mul r1.x, r5.w, r1.x
  mul r1.x, r1.x, l(0.500000)
  mov_sat r1.y, -r1.y
  add r1.y, -r1.y, l(1.000000)
  add r0.w, r0.w, l(-0.140000)
  mul r0.w, r0.w, r0.w
  mul r0.w, r0.w, l(-0.500000)
  mul r2.w, r4.z, r4.z
  div r0.w, r0.w, r2.w
  mul r0.w, r0.w, l(1.442695)
  exp r0.w, r0.w
  mul r2.w, r4.z, l(2.50662827)
  div r0.w, r0.w, r2.w
  mad r2.w, -r6.w, l(0.500000), l(1.000000)
  mul r4.x, r2.w, r2.w
  mul r4.x, r4.x, r4.x
  mul r2.w, r2.w, r4.x
  mad r2.w, r2.w, l(0.953479409), l(0.0465205684)
  add r4.x, -r2.w, l(1.000000)
  mul r4.x, r4.x, r4.x
  mul r2.w, r2.w, r4.x
  div r4.x, l(0.800000), r6.w
  log r10.xyz, r5.xyzx
  mul r10.xyz, r4.xxxx, r10.xyzx
  exp r10.xyz, r10.xyzx
  mul r4.x, r4.y, l(1.442695)
  exp r4.x, r4.x
  mul r0.w, r0.w, r4.x
  mul r0.w, r2.w, r0.w
  mul r4.xyz, r10.xyzx, r0.wwww
  mad r4.xyz, r1.xxxx, r1.yyyy, r4.xyzx
  add r0.w, -|r1.z|, l(1.000000)
  dp3 r0.x, r0.xyzx, r0.xyzx
  add r0.x, r0.x, l(1.000000)
  mul r0.x, r0.x, l(0.250000)
  min r0.x, r0.x, l(1.000000)
  add r0.y, -r0.x, r0.w
  mad r0.x, r0.y, l(0.330000), r0.x
  mul r0.x, r0.x, r1.w
  mul r0.x, r0.x, l(0.318309873)
  sqrt r0.yzw, r5.xxyz
  mad r0.xyz, r0.yzwy, r0.xxxx, r4.xyzx
  min r0.xyz, -r0.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
  mul r0.xyz, -r0.xyzx, r6.xyzx
  mul r8.xyz, r0.xyzx, l(3.14159274, 3.14159274, 3.14159274, 0.000000)
  mov r2.xyz, l(0,0,0,0)
endif
sample_l_indexable(texture2d)(float,float,float,float) r0.x, v0.xyxx, t6.xyzw, s3, l(0.000000)
if_nz r3.w
  mul r0.yzw, r3.xxyz, r3.xxyz
  mul r1.xyz, r0.yzwy, r9.xyzx
  mad r2.xyz, r1.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000), r2.xyzx
  add r1.x, cb0[28].z, l(-2.500000)

add r12.w, r0.z, -r12.y
mul r12.x, r12.x, l(-1.0)
mad r7.xzw, l(0.5), -r12.xxxx, r7.xzwx



  sample_l_indexable(texturecube)(float,float,float,float) r1.xyz, r7.xzwx, t0.xyzw, s1, r1.x
  mul r0.yzw, r0.yyzw, r1.xxyz
  mul r1.x, r0.x, l(0.500000)
  mad r8.xyz, r0.yzwy, r1.xxxx, r8.xyzx
endif
add r0.yzw, r2.xxyz, r8.xxyz
mul r1.xyz, r0.yzwy, cb0[27].xyzx
eq r0.y, cb1[207].z, l(0.000000)
mul r2.xyz, r2.xyzx, cb0[27].xyzx
dp3 r0.z, r2.xyzx, l(0.300000, 0.590000, 0.110000, 0.000000)
and r0.z, r0.z, r0.y
and r0.z, r0.z, r4.w
and r1.w, r0.z, r0.y
mul o0.xyzw, r0.xxxx, r1.xyzw
ret
// Approximately 0 instruction slots used
