// Reflections
Texture3D<float4> t4 : register(t4);

Texture3D<float4> t3 : register(t3);

Texture2D<float4> t2 : register(t2);

TextureCube<float4> t1 : register(t1);

Texture2D<float4> t0 : register(t0);

SamplerState s4_s : register(s4);

SamplerState s3_s : register(s3);

SamplerState s2_s : register(s2);

SamplerState s1_s : register(s1);

SamplerState s0_s : register(s0);

cbuffer cb2 : register(b2)
{
  float4 cb2[15];
}

cbuffer cb1 : register(b1)
{
  float4 cb1[10];
}

cbuffer cb0 : register(b0)
{
  float4 cb0[135];
}




// 3Dmigoto declarations
#define cmp -
Texture1D<float4> IniParams : register(t120);
Texture2D<float4> StereoParams : register(t125);
#include "matrix.hlsl"

void main( 
  linear centroid float4 v0 : TEXCOORD10,
  linear centroid float4 v1 : TEXCOORD11,
  float4 v2 : COLOR0,
  float4 v3 : SV_Position0,
  uint v4 : SV_IsFrontFace0,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1,r2,r3,r4,r5,r6,r7;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xyz = v1.zxy * v0.yzx;
  r0.xyz = v1.yzx * v0.zxy + -r0.xyz;
  r0.xyz = v1.www * r0.xyz;
  r1.xy = -cb0[116].xy + v3.xy;
  r1.xy = r1.xy * cb0[117].zw + float2(-0.5,-0.5);
  r1.xy = v3.ww * r1.xy;
  r1.z = v3.w;
  r1.xyw = float3(2,-2,1) * r1.xyz;
  r2.xyzw = cb0[37].xyzw * v3.yyyy;
  r2.xyzw = v3.xxxx * cb0[36].xyzw + r2.xyzw;
  r2.xyzw = v3.zzzz * cb0[38].xyzw + r2.xyzw;
  r2.xyzw = cb0[39].xyzw + r2.xyzw;
  r2.xyz = r2.xyz / r2.www;
  
  // Common SVPositionToTranslatedWorld fix:
float4 s = StereoParams.Load(0);
matrix TranslatedWorldToClip = MATRIX(cb0, 0);
matrix ClipToTranslatedWorld = MATRIX(cb0, 32);
float4 t = mul(r2.xyz, TranslatedWorldToClip);
t.x -= s.x * (t.w - s.y);
r2.xyz = mul(t, ClipToTranslatedWorld);
  
  r3.xyz = -cb0[58].xyz + r2.xyz;
  r0.w = dot(-r2.xyz, -r2.xyz);
  r0.w = rsqrt(r0.w);
  r2.xyz = -r2.xyz * r0.www;
  r4.xyz = cb0[122].www * float3(0,0,1) + cb0[122].xyz;
  r0.w = dot(r4.xyz, r4.xyz);
  r0.w = rsqrt(r0.w);
  r4.xyz = r4.xyz * r0.www;
  r0.xyz = r4.yyy * r0.xyz;
  r0.xyz = r4.xxx * v0.xyz + r0.xyz;
  r0.xyz = r4.zzz * v1.xyz + r0.xyz;
  r0.w = dot(r0.xyz, r0.xyz);
  r0.w = rsqrt(r0.w);
  r0.xyz = r0.xyz * r0.www;
  r0.w = dot(r0.xyz, r2.xyz);
  r4.xyz = r0.xyz * r0.www;
  r2.xyz = r4.xyz * float3(2,2,2) + -r2.xyz;
  r0.w = dot(cb2[2].xyz, r2.xyz);
  r2.xyz = -cb2[2].xyz * r0.www + r2.xyz;
  r4.xyz = cb2[2].zxy * r2.yzx;
  r4.xyz = cb2[2].yzx * r2.zxy + -r4.xyz;
  sincos(cb2[12].z, r5.x, r6.x);
  r4.xyz = r5.xxx * r4.xyz;
  r2.xyz = r2.xyz * r6.xxx + r4.xyz;
  r2.xyz = cb2[2].xyz * r0.www + r2.xyz;
  r0.w = dot(r2.xyz, r2.xyz);
  r0.w = sqrt(r0.w);
  r2.xyz = r2.xyz / r0.www;
  r2.xyz = t1.SampleBias(s1_s, r2.xyz, cb2[12].w).xyz;
  r0.w = r2.y + -r2.x;
  r0.w = r0.w * 0.5 + r2.x;
  r2.x = r2.z + -r0.w;
  r0.w = r2.x * 0.5 + r0.w;
  r0.w = cb2[13].x * r0.w;
  r0.w = max(9.99999997e-007, abs(r0.w));
  r0.w = log2(r0.w);
  r0.w = cb2[13].y * r0.w;
  r0.w = exp2(r0.w);
  r2.x = dot(r0.xyz, r0.xyz);
  r2.x = sqrt(r2.x);
  r0.xyz = r0.xyz / r2.xxx;
  r2.x = dot(r0.xyz, cb2[6].xyz);
  r0.xyz = r2.xxx * r0.xyz;
  r0.xyz = r0.xyz * float3(2,2,2) + -cb2[6].xyz;
  r2.xy = cb0[9].xy * r0.yy;
  r0.xy = r0.xx * cb0[8].xy + r2.xy;
  r0.xy = r0.zz * cb0[10].xy + r0.xy;
  r0.xy = r0.xy * float2(0.5,-0.5) + float2(0.5,0.5);
  r0.xyz = t0.SampleBias(s0_s, r0.xy, 2).xyz;
  r0.xyz = r0.www * cb2[4].xyz + r0.xyz;
  r0.xyz = cb2[7].xyz + r0.xyz;
  r2.xyz = saturate(cb2[11].xyz * cb2[8].xyz);
  r1.xy = r1.xy / r1.ww;
  r1.xy = r1.xy * cb0[54].xy + cb0[54].wz;
  r0.w = t2.SampleLevel(s2_s, r1.xy, 0).x;
  r1.x = r0.w * cb0[53].x + cb0[53].y;
  r0.w = r0.w * cb0[53].z + -cb0[53].w;
  r0.w = 1 / r0.w;
  r0.w = r1.x + r0.w;
  r0.w = -r1.z * 1 + r0.w;
  r0.w = saturate(r0.w / cb2[13].w);
  r0.w = cb2[14].x * r0.w;
  r0.w = max(9.99999997e-007, abs(r0.w));
  r0.w = r0.w * r0.w;
  r1.w = min(1, r0.w);
  r2.xyz = r2.xyz * cb0[120].www + cb0[120].xyz;
  r4.xyz = cb0[121].www * float3(0.0399999991,0.0399999991,0.0399999991) + cb0[121].xyz;
  r5.xyz = -cb0[131].xyz + r3.xyz;
  r6.xyz = cb0[133].xyz * r5.xyz;
  r7.xyz = -cb0[132].xyz + r3.xyz;
  r7.xyz = cb0[134].xyz * r7.xyz;
  r5.xyz = r5.xyz * cb0[133].xyz + float3(-0.5,-0.5,-0.5);
  r5.xyz = float3(0.5,0.5,0.5) + -abs(r5.xyz);
  r5.xyz = saturate(float3(6,6,6) * r5.xyz);
  r0.w = r5.x * r5.y;
  r0.w = r0.w * r5.z;
  r5.xyz = t3.SampleLevel(s3_s, r6.xyz, 0).xyz;
  r6.xyz = t4.SampleLevel(s4_s, r7.xyz, 0).xyz;
  r5.xyz = -r6.xyz + r5.xyz;
  r5.xyz = r0.www * r5.xyz + r6.xyz;
  r5.xyz = r5.xyz * r2.xyz;
  r6.xyz = float3(0.886227548,0.886227548,0.886227548) * r5.xyz;
  r2.xyz = r4.xyz * float3(0.449999988,0.449999988,0.449999988) + r2.xyz;
  r2.xyz = -r5.xyz * float3(0.886227548,0.886227548,0.886227548) + r2.xyz;
  r2.xyz = cb0[128].xxx * r2.xyz + r6.xyz;
  r1.xyz = max(float3(0,0,0), r0.xyz);
  r0.x = cmp(0 < cb0[124].x);
  if (r0.x != 0) {
    r0.xyz = -cb1[8].xyz + r3.xyz;
    r4.xyz = float3(1,1,1) + cb1[9].xyz;
    r0.xyz = cmp(r4.xyz < abs(r0.xyz));
    r0.x = (int)r0.y | (int)r0.x;
    r0.x = (int)r0.z | (int)r0.x;
    r0.y = dot(r3.xyz, float3(0.577000022,0.577000022,0.577000022));
    r0.y = 0.00200000009 * r0.y;
    r0.y = frac(r0.y);
    r0.y = cmp(0.5 < r0.y);
    r3.yzw = r0.yyy ? float3(0,1,1) : float3(1,1,0);
    r3.x = 1;
    r1.xyzw = r0.xxxx ? r3.yzwx : r1.xyzw;
    o0.w = r1.w;
  } else {
    o0.w = r1.w;
  }
  o0.xyz = r2.xyz + r1.xyz;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v1.2.65 on Wed Sep 20 21:02:03 2017
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                10   xyzw        0     NONE   float   xyz 
// TEXCOORD                11   xyzw        1     NONE   float   xyzw
// COLOR                    0   xyzw        2     NONE   float       
// SV_Position              0   xyzw        3      POS   float   xyzw
// SV_IsFrontFace           0   x           4    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[135], immediateIndexed
dcl_constantbuffer cb1[10], immediateIndexed
dcl_constantbuffer cb2[15], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
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_texturecube (float,float,float,float) t1
dcl_resource_texture2d (float,float,float,float) t2
dcl_resource_texture3d (float,float,float,float) t3
dcl_resource_texture3d (float,float,float,float) t4
dcl_input_ps linear centroid v0.xyz
dcl_input_ps linear centroid v1.xyzw
dcl_input_ps_siv linear noperspective v3.xyzw, position
dcl_output o0.xyzw
dcl_temps 8
mul r0.xyz, v0.yzxy, v1.zxyz
mad r0.xyz, v1.yzxy, v0.zxyz, -r0.xyzx
mul r0.xyz, r0.xyzx, v1.wwww
add r1.xy, v3.xyxx, -cb0[116].xyxx
mad r1.xy, r1.xyxx, cb0[117].zwzz, l(-0.500000, -0.500000, 0.000000, 0.000000)
mul r1.xy, r1.xyxx, v3.wwww
mov r1.z, v3.w
mul r1.xyw, r1.xyxz, l(2.000000, -2.000000, 0.000000, 1.000000)
mul r2.xyzw, v3.yyyy, cb0[37].xyzw
mad r2.xyzw, v3.xxxx, cb0[36].xyzw, r2.xyzw
mad r2.xyzw, v3.zzzz, cb0[38].xyzw, r2.xyzw
add r2.xyzw, r2.xyzw, cb0[39].xyzw
div r2.xyz, r2.xyzx, r2.wwww
add r3.xyz, r2.xyzx, -cb0[58].xyzx
dp3 r0.w, -r2.xyzx, -r2.xyzx
rsq r0.w, r0.w
mul r2.xyz, r0.wwww, -r2.xyzx
mad r4.xyz, cb0[122].wwww, l(0.000000, 0.000000, 1.000000, 0.000000), cb0[122].xyzx
dp3 r0.w, r4.xyzx, r4.xyzx
rsq r0.w, r0.w
mul r4.xyz, r0.wwww, r4.xyzx
mul r0.xyz, r0.xyzx, r4.yyyy
mad r0.xyz, r4.xxxx, v0.xyzx, r0.xyzx
mad r0.xyz, r4.zzzz, v1.xyzx, r0.xyzx
dp3 r0.w, r0.xyzx, r0.xyzx
rsq r0.w, r0.w
mul r0.xyz, r0.wwww, r0.xyzx
dp3 r0.w, r0.xyzx, r2.xyzx
mul r4.xyz, r0.wwww, r0.xyzx
mad r2.xyz, r4.xyzx, l(2.000000, 2.000000, 2.000000, 0.000000), -r2.xyzx
dp3 r0.w, cb2[2].xyzx, r2.xyzx
mad r2.xyz, -cb2[2].xyzx, r0.wwww, r2.xyzx
mul r4.xyz, r2.yzxy, cb2[2].zxyz
mad r4.xyz, cb2[2].yzxy, r2.zxyz, -r4.xyzx
sincos r5.x, r6.x, cb2[12].z
mul r4.xyz, r4.xyzx, r5.xxxx
mad r2.xyz, r2.xyzx, r6.xxxx, r4.xyzx
mad r2.xyz, cb2[2].xyzx, r0.wwww, r2.xyzx
dp3 r0.w, r2.xyzx, r2.xyzx
sqrt r0.w, r0.w
div r2.xyz, r2.xyzx, r0.wwww
sample_b_indexable(texturecube)(float,float,float,float) r2.xyz, r2.xyzx, t1.xyzw, s1, cb2[12].w
add r0.w, -r2.x, r2.y
mad r0.w, r0.w, l(0.500000), r2.x
add r2.x, -r0.w, r2.z
mad r0.w, r2.x, l(0.500000), r0.w
mul r0.w, r0.w, cb2[13].x
max r0.w, |r0.w|, l(0.000001)
log r0.w, r0.w
mul r0.w, r0.w, cb2[13].y
exp r0.w, r0.w
dp3 r2.x, r0.xyzx, r0.xyzx
sqrt r2.x, r2.x
div r0.xyz, r0.xyzx, r2.xxxx
dp3 r2.x, r0.xyzx, cb2[6].xyzx
mul r0.xyz, r0.xyzx, r2.xxxx
mad r0.xyz, r0.xyzx, l(2.000000, 2.000000, 2.000000, 0.000000), -cb2[6].xyzx
mul r2.xy, r0.yyyy, cb0[9].xyxx
mad r0.xy, r0.xxxx, cb0[8].xyxx, r2.xyxx
mad r0.xy, r0.zzzz, cb0[10].xyxx, r0.xyxx
mad r0.xy, r0.xyxx, l(0.500000, -0.500000, 0.000000, 0.000000), l(0.500000, 0.500000, 0.000000, 0.000000)
sample_b_indexable(texture2d)(float,float,float,float) r0.xyz, r0.xyxx, t0.xyzw, s0, l(2.000000)
mad r0.xyz, r0.wwww, cb2[4].xyzx, r0.xyzx
add r0.xyz, r0.xyzx, cb2[7].xyzx
mul_sat r2.xyz, cb2[8].xyzx, cb2[11].xyzx
div r1.xy, r1.xyxx, r1.wwww
mad r1.xy, r1.xyxx, cb0[54].xyxx, cb0[54].wzww
sample_l_indexable(texture2d)(float,float,float,float) r0.w, r1.xyxx, t2.yzwx, s2, l(0.000000)
mad r1.x, r0.w, cb0[53].x, cb0[53].y
mad r0.w, r0.w, cb0[53].z, -cb0[53].w
div r0.w, l(1.000000, 1.000000, 1.000000, 1.000000), r0.w
add r0.w, r0.w, r1.x
mad r0.w, -r1.z, l(1.000000), r0.w
div_sat r0.w, r0.w, cb2[13].w
mul r0.w, r0.w, cb2[14].x
max r0.w, |r0.w|, l(0.000001)
mul r0.w, r0.w, r0.w
min r1.w, r0.w, l(1.000000)
mad r2.xyz, r2.xyzx, cb0[120].wwww, cb0[120].xyzx
mad r4.xyz, cb0[121].wwww, l(0.040000, 0.040000, 0.040000, 0.000000), cb0[121].xyzx
add r5.xyz, r3.xyzx, -cb0[131].xyzx
mul r6.xyz, r5.xyzx, cb0[133].xyzx
add r7.xyz, r3.xyzx, -cb0[132].xyzx
mul r7.xyz, r7.xyzx, cb0[134].xyzx
mad r5.xyz, r5.xyzx, cb0[133].xyzx, l(-0.500000, -0.500000, -0.500000, 0.000000)
add r5.xyz, -|r5.xyzx|, l(0.500000, 0.500000, 0.500000, 0.000000)
mul_sat r5.xyz, r5.xyzx, l(6.000000, 6.000000, 6.000000, 0.000000)
mul r0.w, r5.y, r5.x
mul r0.w, r5.z, r0.w
sample_l_indexable(texture3d)(float,float,float,float) r5.xyz, r6.xyzx, t3.xyzw, s3, l(0.000000)
sample_l_indexable(texture3d)(float,float,float,float) r6.xyz, r7.xyzx, t4.xyzw, s4, l(0.000000)
add r5.xyz, r5.xyzx, -r6.xyzx
mad r5.xyz, r0.wwww, r5.xyzx, r6.xyzx
mul r5.xyz, r2.xyzx, r5.xyzx
mul r6.xyz, r5.xyzx, l(0.886227548, 0.886227548, 0.886227548, 0.000000)
mad r2.xyz, r4.xyzx, l(0.450000, 0.450000, 0.450000, 0.000000), r2.xyzx
mad r2.xyz, -r5.xyzx, l(0.886227548, 0.886227548, 0.886227548, 0.000000), r2.xyzx
mad r2.xyz, cb0[128].xxxx, r2.xyzx, r6.xyzx
max r1.xyz, r0.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
lt r0.x, l(0.000000), cb0[124].x
if_nz r0.x
  add r0.xyz, r3.xyzx, -cb1[8].xyzx
  add r4.xyz, cb1[9].xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
  lt r0.xyz, r4.xyzx, |r0.xyzx|
  or r0.x, r0.y, r0.x
  or r0.x, r0.z, r0.x
  dp3 r0.y, r3.xyzx, l(0.577000, 0.577000, 0.577000, 0.000000)
  mul r0.y, r0.y, l(0.002000)
  frc r0.y, r0.y
  lt r0.y, l(0.500000), r0.y
  movc r3.yzw, r0.yyyy, l(0,0,1.000000,1.000000), l(0,1.000000,1.000000,0)
  mov r3.x, l(1.000000)
  movc r1.xyzw, r0.xxxx, r3.yzwx, r1.xyzw
  mov o0.w, r1.w
else 
  mov o0.w, r1.w
endif 
add o0.xyz, r1.xyzx, r2.xyzx
ret 
// Approximately 0 instruction slots used

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
