//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//   using 3Dmigoto v1.3.15 on Mon Mar 11 09:54:31 2019
//
//
// Buffer Definitions:
//
// cbuffer $Globals
// {
//
//   float4 litDir[4];                  // Offset:    0 Size:    64
//   float4 litCol[4];                  // Offset:   64 Size:    64
//   float4 litOcc;                     // Offset:  128 Size:    16
//   float4 ambLit;                     // Offset:  144 Size:    16
//   int nDirLit;                       // Offset:  160 Size:     4
//   float4 vEye;                       // Offset:  176 Size:    16
//   float2 vOccRate;                   // Offset:  192 Size:     8
//      = 0x3f800000 0x3f800000
//   float3 vCameraPos;                 // Offset:  208 Size:    12
//   float3 vCameraDir;                 // Offset:  224 Size:    12
//   float2 vD2Z;                       // Offset:  240 Size:     8
//   float4 mRrW2T[3];                  // Offset:  256 Size:    48
//   row_major float4x4 mV2W;           // Offset:  304 Size:    64
//   row_major float4x4 mP2W;           // Offset:  368 Size:    64
//   float fAmbMapsDORate;              // Offset:  432 Size:     4
//      = 0x00000000
//   float4 vAmbDifScl;                 // Offset:  448 Size:    16
//      = 0x3f800000 0x3f800000 0x3f800000 0x3f800000
//   float4 vAmbSpcScl;                 // Offset:  464 Size:    16
//      = 0x3f800000 0x3f800000 0x3f800000 0x3f800000
//   float4 vTsbViewPort;               // Offset:  480 Size:    16
//
// }
//
//
// 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 28

// mP2W inversed with inverse-cs, i.e. mW2P
dcl_constantbuffer cb13[4], immediateIndexed

dcl_resource_texture2d (float,float,float,float) t121
ld_indexable(texture2d)(float,float,float,float) r25.xyzw, l(0, 0, 0, 0), t121.xyzw

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.xyz, r0.xyww, t6.xyzw
ld_indexable(texture2d)(float,float,float,float) r3.xyzw, 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
// mP2W
mul r7.xyzw, v1.yyyy, cb0[24].xyzw
mad r7.xyzw, v1.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

if_nz cb13[0].x
	// mW2P
	mul r26.xyzw, r0.xxxx, cb13[0].xyzw
	mad r26.xyzw, r0.yyyy, cb13[1].xyzw, r26.xyzw
	mad r26.xyzw, r0.zzzz, cb13[2].xyzw, r26.xyzw
	add r26.xyzw, r26.xyzw, cb13[3].xyzw
	// Stereo correct
	add r25.w, r26.w, -r25.y
	mad r26.x, -r25.w, r25.x, r26.x
	// mP2W
	mul r27.xyzw, r26.xxxx, cb0[23].xyzw
	mad r27.xyzw, r26.yyyy, cb0[24].xyzw, r27.xyzw
	mad r27.xyzw, r26.zzzz, cb0[25].xyzw, r27.xyzw
	mad r27.xyzw, r26.wwww, cb0[26].xyzw, r27.xyzw
	// Do not adjust o0 - breaks refraction
	div r27.xyz, r27.xyzw, r27.wwww

	// r7 affects reflections, r0 affects refraction. Use the corrected value for r7 only:
	add r7.xyz, -r27.xyzx, cb0[11].xyzx
else
	add r7.xyz, -r0.xyzx, cb0[11].xyzx
endif

// Correct reflections by stereoising eye position (must be at surface depth from above adjustment)
mul r27.x, r25.x, -r25.y
mul r27.xyzw, r27.xxxx, cb0[23].xyzw
add r7.xyz, r7.xyzw, -r27.xyzw

dp3 r0.w, r7.xyzx, r7.xyzx
rsq r0.w, r0.w
mul r8.xyz, r0.wwww, r7.xyzx
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 r2.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, r2.wwww, r3.xyxx, r9.xyxx
dp3 r2.w, r10.xyzx, r10.xyzx
rsq r2.w, r2.w
mul r9.xyz, r2.wwww, r10.xyzx

// mV2W
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.xyz, r3.zwwz, l(65535.000000, 65535.000000, 65535.000000, 0.000000)
ftou r3.xyz, r3.xyzx
ushr r3.xyz, r3.xyzx, l(8, 8, 8, 0)
utof r3.xyz, r3.xyzx
mul r10.yzw, r3.xxyz, l(0.000000, 0.00392156886, 0.00784313772, 0.00392156886)
mad r2.w, r3.x, l(0.00392156886), l(1.000000)
// vCameraPos:
add r3.xyz, -r0.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 r10.x, r9.xyzx, r8.xyzx
mov_sat r3.w, r10.x
add r4.w, r1.w, r3.w
mad r4.w, r4.w, r4.w, r1.w
add_sat r4.w, r4.w, l(-1.000000)
dp3 r12.x, r9.xyzx, -cb0[0].xyzx
lt r5.y, r12.x, l(0.000000)
lt r5.w, l(1.000000), r2.w
and r5.y, r5.w, r5.y
add r6.w, r12.x, r12.x
mad r13.yzw, r9.xxyz, r6.wwww, cb0[0].xxyz
mov r13.x, -r12.x
mul r14.xyz, r11.xyzx, cb0[4].xyzx
mad r15.xyz, r7.xyzx, r0.wwww, -r13.yzwy
dp3 r6.w, r15.xyzx, r15.xyzx
rsq r6.w, r6.w
mul r15.xyz, r6.wwww, r15.xyzx
dp3_sat r6.w, r8.xyzx, r15.xyzx
add r15.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 r16.xyz, r15.xyzx, r6.wwww, r2.xyzx
add r17.xyz, -r16.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
add r2.w, -r2.w, l(2.000000)
mul r18.xyz, r2.wwww, r17.xyzx
mad r16.xyz, r17.xyzx, r2.wwww, r16.xyzx
add r16.xyz, -r16.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
mul r17.xyz, r10.yyyy, r18.xyzx
movc r16.xyz, r5.yyyy, r16.xyzx, l(-1.000000,-1.000000,-1.000000,0)
movc r17.xyz, r5.yyyy, r17.xyzx, l(-1.000000,-1.000000,-1.000000,0)
movc r14.xyz, r5.yyyy, r14.xyzx, cb0[4].xyzx
mov r12.yzw, cb0[0].xxyz
movc r13.xyzw, r5.yyyy, r13.xyzw, r12.xyzw
mad r13.yzw, r7.xxyz, r0.wwww, -r13.yyzw
dp3 r5.y, r13.yzwy, r13.yzwy
rsq r5.y, r5.y
mul r13.yzw, r5.yyyy, r13.yyzw
dp3 r5.y, r8.xyzx, r13.yzwy
ge r6.w, r16.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 r18.xyz, r15.xyzx, r7.wwww, r2.xyzx
movc r18.xyz, r6.wwww, r16.xyzx, r18.xyzx
mul r7.w, r10.z, r10.z
mul r8.w, r7.w, r7.w
dp3 r9.w, r9.xyzx, r13.yzwy
mul r10.z, r8.w, r8.w
mul r9.w, r9.w, r9.w
mad r11.w, r8.w, r8.w, l(-1.000000)
mad r9.w, r9.w, r11.w, l(1.000000)
max r9.w, r9.w, l(0.000100)
mul r9.w, r9.w, r9.w
mul r9.w, r9.w, l(4.000000)
div r9.w, r10.z, r9.w
mul r12.z, r8.w, l(0.500000)
mad r8.w, -r8.w, l(0.500000), l(1.000000)
mad r5.y, r5.y, r8.w, r12.z
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, r9.w
mul r13.yzw, r5.yyyy, r18.xxyz
mul r13.yzw, r14.xxyz, r13.yyzw
mov_sat r13.x, r13.x
mul r18.xy, cb0[8].xxxx, cb0[12].yxyy
mad r18.zw, -cb0[12].yyyx, cb0[8].xxxx, l(0.000000, 0.000000, 1.000000, 1.000000)
mad r5.y, r4.w, r18.x, r18.z
mul r5.y, r5.y, r13.x
mul r13.yzw, r5.yyyy, r13.yyzw
mul r14.xyz, r13.xxxx, r14.xyzx
mul r19.xyz, r2.wwww, r15.xyzx
movc r20.xyz, r6.wwww, r17.xyzx, r19.xyzx
mul r14.xyz, r14.xyzx, r20.xyzx
mad r5.y, r1.w, r18.y, r18.w
mul r14.xyz, r5.yyyy, r14.xyzx
mul r14.xyz, r6.zzzz, r14.xyzx
mul r13.xyz, r6.zzzz, r13.yzwy
ilt r5.y, l(0), cb0[10].x
if_nz r5.y
  dp3 r18.x, r9.xyzx, -cb0[1].xyzx
  lt r5.y, r18.x, l(0.000000)
  and r5.y, r5.w, r5.y
  add r6.w, r18.x, r18.x
  mad r20.yzw, r9.xxyz, r6.wwww, cb0[1].xxyz
  mov r20.x, -r18.x
  mul r21.xyz, r11.xyzx, cb0[5].xyzx
  mad r22.xyz, r7.xyzx, r0.wwww, -r20.yzwy
  dp3 r6.w, r22.xyzx, r22.xyzx
  rsq r6.w, r6.w
  mul r22.xyz, r6.wwww, r22.xyzx
  dp3_sat r6.w, r8.xyzx, r22.xyzx
  add r6.w, -r6.w, l(1.000000)
  mul r9.w, r6.w, r6.w
  mul r9.w, r9.w, r9.w
  mul r6.w, r6.w, r9.w
  mad r22.xyz, r15.xyzx, r6.wwww, r2.xyzx
  add r23.xyz, -r22.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
  mul r24.xyz, r2.wwww, r23.xyzx
  mad r22.xyz, r23.xyzx, r2.wwww, r22.xyzx
  add r22.xyz, -r22.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
  mul r23.xyz, r10.yyyy, r24.xyzx
  mov r16.w, l(-1.000000)
  movc r16.xyz, r5.yyyy, r22.xyzx, r16.wyzw
  movc r17.xyz, r5.yyyy, r23.xyzx, r17.xyzx
  movc r21.xyz, r5.yyyy, r21.xyzx, cb0[5].xyzx
  mov r18.yzw, cb0[1].xxyz
  movc r18.xyzw, r5.yyyy, r20.xyzw, r18.xyzw
  mad r18.yzw, r7.xxyz, r0.wwww, -r18.yyzw
  dp3 r5.y, r18.yzwy, r18.yzwy
  rsq r5.y, r5.y
  mul r18.yzw, r5.yyyy, r18.yyzw
  dp3 r5.y, r8.xyzx, r18.yzwy
  ge r6.w, r16.x, l(0.000000)
  mov_sat r9.w, r5.y
  add r9.w, -r9.w, l(1.000000)
  mul r12.w, r9.w, r9.w
  mul r12.w, r12.w, r12.w
  mul r9.w, r9.w, r12.w
  mad r20.xyz, r15.xyzx, r9.wwww, r2.xyzx
  movc r20.xyz, r6.wwww, r16.xyzx, r20.xyzx
  dp3 r9.w, r9.xyzx, r18.yzwy
  mul r9.w, r9.w, r9.w
  mad r9.w, r9.w, r11.w, l(1.000000)
  max r9.w, r9.w, l(0.000100)
  mul r9.w, r9.w, r9.w
  mul r9.w, r9.w, l(4.000000)
  div r9.w, r10.z, r9.w
  mad r5.y, r5.y, r8.w, r12.z
  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, r9.w
  mul r18.yzw, r5.yyyy, r20.xxyz
  mul r18.yzw, r21.xxyz, r18.yyzw
  mov_sat r18.x, r18.x
  mul r20.xy, cb0[8].yyyy, cb0[12].yxyy
  mad r20.zw, -cb0[12].yyyx, cb0[8].yyyy, l(0.000000, 0.000000, 1.000000, 1.000000)
  mad r5.y, r4.w, r20.x, r20.z
  mul r5.y, r5.y, r18.x
  mad r13.xyz, r18.yzwy, r5.yyyy, r13.xyzx
  mul r18.xyz, r18.xxxx, r21.xyzx
  movc r21.xyz, r6.wwww, r17.xyzx, r19.xyzx
  mul r18.xyz, r18.xyzx, r21.xyzx
  mad r5.y, r1.w, r20.y, r20.w
  mad r14.xyz, r18.xyzx, r5.yyyy, r14.xyzx
  ilt r5.y, l(1), cb0[10].x
  if_nz r5.y
    dp3 r18.x, r9.xyzx, -cb0[2].xyzx
    lt r5.y, r18.x, l(0.000000)
    and r5.y, r5.w, r5.y
    add r6.w, r18.x, r18.x
    mad r20.yzw, r9.xxyz, r6.wwww, cb0[2].xxyz
    mov r20.x, -r18.x
    mul r21.xyz, r11.xyzx, cb0[6].xyzx
    mad r22.xyz, r7.xyzx, r0.wwww, -r20.yzwy
    dp3 r6.w, r22.xyzx, r22.xyzx
    rsq r6.w, r6.w
    mul r22.xyz, r6.wwww, r22.xyzx
    dp3_sat r6.w, r8.xyzx, r22.xyzx
    add r6.w, -r6.w, l(1.000000)
    mul r9.w, r6.w, r6.w
    mul r9.w, r9.w, r9.w
    mul r6.w, r6.w, r9.w
    mad r22.xyz, r15.xyzx, r6.wwww, r2.xyzx
    add r23.xyz, -r22.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
    mul r24.xyz, r2.wwww, r23.xyzx
    mad r22.xyz, r23.xyzx, r2.wwww, r22.xyzx
    add r22.xyz, -r22.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
    mul r23.xyz, r10.yyyy, r24.xyzx
    mov r16.w, l(-1.000000)
    movc r16.xyz, r5.yyyy, r22.xyzx, r16.wyzw
    movc r17.xyz, r5.yyyy, r23.xyzx, r17.xyzx
    movc r21.xyz, r5.yyyy, r21.xyzx, cb0[6].xyzx
    mov r18.yzw, cb0[2].xxyz
    movc r18.xyzw, r5.yyyy, r20.xyzw, r18.xyzw
    mad r18.yzw, r7.xxyz, r0.wwww, -r18.yyzw
    dp3 r5.y, r18.yzwy, r18.yzwy
    rsq r5.y, r5.y
    mul r18.yzw, r5.yyyy, r18.yyzw
    dp3 r5.y, r8.xyzx, r18.yzwy
    ge r6.w, r16.x, l(0.000000)
    mov_sat r9.w, r5.y
    add r9.w, -r9.w, l(1.000000)
    mul r12.w, r9.w, r9.w
    mul r12.w, r12.w, r12.w
    mul r9.w, r9.w, r12.w
    mad r20.xyz, r15.xyzx, r9.wwww, r2.xyzx
    movc r20.xyz, r6.wwww, r16.xyzx, r20.xyzx
    dp3 r9.w, r9.xyzx, r18.yzwy
    mul r9.w, r9.w, r9.w
    mad r9.w, r9.w, r11.w, l(1.000000)
    max r9.w, r9.w, l(0.000100)
    mul r9.w, r9.w, r9.w
    mul r9.w, r9.w, l(4.000000)
    div r9.w, r10.z, r9.w
    mad r5.y, r5.y, r8.w, r12.z
    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, r9.w
    mul r18.yzw, r5.yyyy, r20.xxyz
    mul r18.yzw, r21.xxyz, r18.yyzw
    mov_sat r18.x, r18.x
    mul r20.xy, cb0[8].zzzz, cb0[12].yxyy
    mad r20.zw, -cb0[12].yyyx, cb0[8].zzzz, l(0.000000, 0.000000, 1.000000, 1.000000)
    mad r5.y, r4.w, r20.x, r20.z
    mul r5.y, r5.y, r18.x
    mad r13.xyz, r18.yzwy, r5.yyyy, r13.xyzx
    mul r18.xyz, r18.xxxx, r21.xyzx
    movc r21.xyz, r6.wwww, r17.xyzx, r19.xyzx
    mul r18.xyz, r18.xyzx, r21.xyzx
    mad r5.y, r1.w, r20.y, r20.w
    mad r14.xyz, r18.xyzx, r5.yyyy, r14.xyzx
    ilt r5.y, l(2), cb0[10].x
    if_nz r5.y
      dp3 r18.x, r9.xyzx, -cb0[3].xyzx
      lt r5.y, r18.x, l(0.000000)
      and r5.y, r5.w, r5.y
      add r6.w, r18.x, r18.x
      mad r20.yzw, r9.xxyz, r6.wwww, cb0[3].xxyz
      mov r20.x, -r18.x
      mul r21.xyz, r11.xyzx, cb0[7].xyzx
      mad r22.xyz, r7.xyzx, r0.wwww, -r20.yzwy
      dp3 r6.w, r22.xyzx, r22.xyzx
      rsq r6.w, r6.w
      mul r22.xyz, r6.wwww, r22.xyzx
      dp3_sat r6.w, r8.xyzx, r22.xyzx
      add r6.w, -r6.w, l(1.000000)
      mul r9.w, r6.w, r6.w
      mul r9.w, r9.w, r9.w
      mul r6.w, r6.w, r9.w
      mad r22.xyz, r15.xyzx, r6.wwww, r2.xyzx
      add r23.xyz, -r22.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
      mul r24.xyz, r2.wwww, r23.xyzx
      mad r22.xyz, r23.xyzx, r2.wwww, r22.xyzx
      add r22.xyz, -r22.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
      mul r23.xyz, r10.yyyy, r24.xyzx
      mov r16.w, l(-1.000000)
      movc r16.xyz, r5.yyyy, r22.xyzx, r16.wyzw
      movc r17.xyz, r5.yyyy, r23.xyzx, r17.xyzx
      movc r21.xyz, r5.yyyy, r21.xyzx, cb0[7].xyzx
      mov r18.yzw, cb0[3].xxyz
      movc r18.xyzw, r5.yyyy, r20.xyzw, r18.xyzw
      mad r7.xyz, r7.xyzx, r0.wwww, -r18.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 r5.y, r16.x, l(0.000000)
      mov_sat r6.w, r0.w
      add r6.w, -r6.w, l(1.000000)
      mul r9.w, r6.w, r6.w
      mul r9.w, r9.w, r9.w
      mul r6.w, r6.w, r9.w
      mad r18.yzw, r15.xxyz, r6.wwww, r2.xxyz
      movc r16.xyz, r5.yyyy, r16.xyzx, r18.yzwy
      dp3 r6.w, r9.xyzx, r7.xyzx
      mul r6.w, r6.w, r6.w
      mad r6.w, r6.w, r11.w, l(1.000000)
      max r6.w, r6.w, l(0.000100)
      mul r6.w, r6.w, r6.w
      mul r6.w, r6.w, l(4.000000)
      div r6.w, r10.z, r6.w
      mad r0.w, r0.w, r8.w, r12.z
      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, r6.w
      mul r7.xyz, r0.wwww, r16.xyzx
      mul r7.xyz, r21.xyzx, r7.xyzx
      mov_sat r18.x, r18.x
      mul r10.yz, cb0[8].wwww, cb0[12].yyxy
      mad r12.zw, -cb0[12].yyyx, cb0[8].wwww, l(0.000000, 0.000000, 1.000000, 1.000000)
      mad r0.w, r4.w, r10.y, r12.z
      mul r0.w, r0.w, r18.x
      mad r13.xyz, r7.xyzx, r0.wwww, r13.xyzx
      mul r7.xyz, r18.xxxx, r21.xyzx
      movc r16.xyz, r5.yyyy, r17.xyzx, r19.xyzx
      mul r7.xyz, r7.xyzx, r16.xyzx
      mad r0.w, r1.w, r10.z, r12.w
      mad r14.xyz, r7.xyzx, r0.wwww, r14.xyzx
    endif
  endif
endif
ne r0.w, cb0[27].x, l(0.000000)
dp3 r5.y, -r8.xyzx, r9.xyzx
add r5.y, r5.y, r5.y
mad r8.xyz, r9.xyzx, -r5.yyyy, -r8.xyzx
mov r7.x, -r9.y
mov r7.y, -r8.y
mov_sat r7.xy, r7.xyxx
dp3_sat r12.y, r8.xyzx, -cb0[0].xyzx
mov_sat r12.x, r12.x
add r7.xy, r7.xyxx, r12.xyxx
mul_sat r7.xy, r7.xyxx, cb0[27].xxxx
add r5.y, r6.z, l(-1.000000)
mad r6.zw, r7.xxxy, r5.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) r7.xyz, r9.xyzx, t2.xyzw, s2, l(6.000000)
mul r7.xyz, r6.zzzz, r7.xyzx
mad r7.xyz, r7.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 r5.y, r0.w, r6.x
mul r7.xyz, r5.yyyy, r7.xyzx
mad r7.xyz, r7.xyzx, r19.xyzx, r14.xyzx
mul r5.y, r7.w, l(6.000000)
max r8.w, |r8.y|, l(0.008749)

// environment cube map:
sample_l_indexable(texturecube)(float,float,float,float) r8.xyz, r8.xwzx, t2.xyzw, s2, r5.y

mul r6.xzw, r6.wwww, r8.xxyz
mul r6.xzw, r6.xxzw, cb0[29].xxyz
sample_indexable(texture2d)(float,float,float,float) r8.xy, r10.xwxx, t1.xyzw, s1
mad r8.xyz, r2.xyzx, r8.xxxx, r8.yyyy
mul r6.xzw, r6.xxzw, r8.xxyz
add r5.y, -cb0[29].w, l(1.000000)
mad r1.w, r1.w, cb0[29].w, r5.y
add r5.y, -r1.w, l(1.000000)
mad r4.w, r4.w, r5.y, r1.w
mad r1.w, r1.w, r4.w, l(-1.000000)
add r1.w, r1.w, l(1.000000)
mul r4.w, r6.y, r1.w
mad r6.xyz, r6.xzwx, r4.wwww, r13.xyzx
div r4.w, l(1.000000, 1.000000, 1.000000, 1.000000), r5.x
dp3 r5.x, r3.xyzx, r3.xyzx
rsq r5.x, r5.x
mul r8.xyz, r3.xyzx, r5.xxxx
dp3_sat r5.x, r9.xyzx, r8.xyzx
mad r5.x, -r5.x, r5.x, l(1.000000)
sqrt r5.x, r5.x
mad r5.x, r5.x, r4.w, -r5.x
add r9.xyz, r9.xyzx, l(-0.000000, -1.000000, -0.000000, 0.000000)
mul r8.xyz, r4.wwww, r8.xyzx
mad r8.xyz, r5.xxxx, r9.xyzx, -r8.xyzx
dp3 r4.w, r8.xyzx, r8.xyzx
rsq r4.w, r4.w
mul r8.xyz, r4.wwww, r8.xyzx
mad r8.xyz, r8.xyzx, r5.zzzz, r0.xyzx
mov r8.w, l(1.000000)
// mRrW2T
dp4 r0.x, r8.xyzw, cb0[16].xyzw
dp4 r0.y, r8.xyzw, cb0[17].xyzw
dp4 r0.z, r8.xyzw, cb0[18].xyzw
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 r5.xy, v1.xyxx, v1.wwww
  mad r5.xy, r5.xyxx, l(0.500000, -0.500000, 0.000000, 0.000000), l(0.500000, 0.500000, 0.000000, 0.000000)
  dp3 r3.x, -r3.xyzx, cb0[14].xyzx
  add r3.y, -r3.w, l(1.000000)
  mul r3.z, r3.y, r3.y
  mul r3.z, r3.z, r3.z
  mul r3.y, r3.z, r3.y
  mad r2.xyz, r15.xyzx, r3.yyyy, r2.xyzx
  add r3.yzw, -r2.xxyz, l(0.000000, 1.000000, 1.000000, 1.000000)
  mad r2.xyz, r3.yzwy, r2.wwww, r2.xyzx
  add r2.xyz, -r2.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
  mul r3.yzw, r2.wwww, r2.xxyz
  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, r3.x
  movc r0.xy, r0.zzzz, r5.xyxx, r0.xyxx
  mad r0.xy, r0.xyxx, cb0[30].zwzz, cb0[30].xyxx
  sample_l_indexable(texture2d)(float,float,float,float) r5.xyz, r0.xyxx, t3.xyzw, s3, l(16.000000)
  mul r5.xyz, r5.xyzx, cb0[28].xyzx
  mul r5.xyz, r0.wwww, r5.xyzx
  mul r3.xyz, r3.yzwy, r5.xyzx
  mad r7.xyz, r3.xyzx, r11.xyzx, r7.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, r7.xyzx, r1.xyzx, r4.xyzx
add o0.xyz, r6.xyzx, r0.xyzx
mov o0.w, l(1.000000)
ret
// Approximately 429 instruction slots used
