// Water
Texture2D<float4> t6 : register(t6);

Texture2D<float4> t5 : register(t5);

Texture2D<float4> t4 : register(t4);

Texture2D<float4> t3 : register(t3);

Texture2D<float4> t2 : register(t2);

Texture2D<float4> t1 : register(t1);

Texture2D<float4> t0 : register(t0);

SamplerState s6_s : register(s6);

SamplerState s5_s : register(s5);

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 cb3 : register(b3)
{
  float4 cb3[9];
}

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

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

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




// 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 : TEXCOORD0,
  float4 v4 : TEXCOORD4,
  float4 v5 : SV_Position0,
  uint v6 : SV_IsFrontFace0,
  out float4 o0 : SV_Target0,
  out float4 o1 : SV_Target1,
  out float4 o2 : SV_Target2,
  out float4 o3 : SV_Target3,
  out float4 o4 : SV_Target4,
  out float4 o5 : SV_Target5)
{
  float4 r0,r1,r2,r3,r4,r5,r6;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xyz = v1.xyz * v0.zxy;
  r0.xyz = v1.zxy * v0.xyz + -r0.xyz;
  r0.xyz = v1.www * r0.xyz;
  r1.xyzw = cb0[37].xyzw * v5.yyyy;
  r1.xyzw = v5.xxxx * cb0[36].xyzw + r1.xyzw;
  r1.xyzw = v5.zzzz * cb0[38].xyzw + r1.xyzw;
  r1.xyzw = cb0[39].xyzw + r1.xyzw;
  r1.xyz = r1.xyz / r1.www;
  
  // Common SVPositionToTranslatedWorld fix:
float4 s = StereoParams.Load(0);
matrix TranslatedWorldToClip = MATRIX(cb0, 0);
matrix ClipToTranslatedWorld = MATRIX(cb0, 32);
float4 t = mul(r1.xyz, TranslatedWorldToClip);
t.x -= s.x * (t.w - s.y);
r1.xyz = mul(t, ClipToTranslatedWorld);
  
  
  r1.xyz = -cb0[56].xyz + r1.xyz;
  r2.xy = t2.Sample(s2_s, v3.xy).xy;
  r2.xy = r2.xy * float2(2,2) + float2(-1,-1);
  r0.w = dot(r2.xy, r2.xy);
  r0.w = 1 + -r0.w;
  r0.w = max(0, r0.w);
  r2.z = sqrt(r0.w);
  r0.w = cb3[7].x * cb0[124].z;
  r3.xy = r1.yx * float2(0.00100000005,0.00100000005) + r0.ww;
  r3.xy = t3.Sample(s3_s, r3.xy).xy;
  r3.xy = r3.xy * float2(2,2) + float2(-1,-1);
  r1.w = dot(r3.xy, r3.xy);
  r1.w = 1 + -r1.w;
  r1.w = max(0, r1.w);
  r3.z = sqrt(r1.w);
  r4.xy = r1.yx * float2(0.00100000005,0.00100000005) + -r0.ww;
  r4.xy = t3.Sample(s3_s, r4.xy).xy;
  r4.xy = r4.xy * float2(2,2) + float2(-1,-1);
  r0.w = dot(r4.xy, r4.xy);
  r0.w = 1 + -r0.w;
  r0.w = max(0, r0.w);
  r4.z = sqrt(r0.w);
  r3.xyz = r4.xyz + r3.xyz;
  r3.xyz = r3.xyz + -r2.xyz;
  r3.xyz = cb3[7].yyy * r3.xyz;
  r4.xy = cb3[7].zz * r1.yx;
  r0.w = t4.Sample(s4_s, r4.xy).x;
  r0.w = 1 + -r0.w;
  r0.w = 1 / r0.w;
  r0.w = saturate(v2.x * r0.w);
  r1.w = r0.w * -2 + 3;
  r0.w = r0.w * r0.w;
  r0.w = r1.w * r0.w;
  r2.xyz = r0.www * r3.xyz + r2.xyz;
  r2.xyz = r2.xyz * cb0[120].www + cb0[120].xyz;
  r1.w = dot(r2.xyz, r2.xyz);
  r1.w = rsqrt(r1.w);
  r2.xyz = r2.xyz * r1.www;
  r0.xyz = r2.yyy * r0.xyz;
  r0.xyz = r2.xxx * v0.yzx + r0.xyz;
  r0.xyz = r2.zzz * v1.yzx + r0.xyz;
  r1.w = dot(r0.xyz, r0.xyz);
  r1.w = rsqrt(r1.w);
  r2.xyz = r1.www * r0.xyz;
  r0.xyz = t5.Sample(s5_s, v3.xy).xyz;
  r3.xyz = r0.xyz * cb3[6].xyz + -r0.xyz;
  r0.xyz = r0.www * r3.xyz + r0.xyz;
  r0.xyz = saturate(cb3[3].xyz * r0.xyz);
  r1.w = t6.Sample(s6_s, v3.xy).x;
  r3.x = cb3[8].x + -r1.w;
  r0.w = saturate(r0.w * r3.x + r1.w);
  r1.w = saturate(cb3[7].w);
  o2.z = r0.w * cb0[121].y + cb0[121].x;
  r3.xyzw = t1.Sample(s1_s, v4.zw).xyzw;
  r4.xyzw = cb2[7].xyzw * float4(-0.5,-0.5,-0.5,-0.5) + float4(0.5,0.5,0.5,0.5);
  r3.xyzw = saturate(r3.xyzw * cb2[7].xyzw + r4.xyzw);
  r3.xyzw = r3.xyzw * r3.xyzw;
  o5.xyzw = cb2[6].xyzw * r3.xyzw;
  r3.xyz = -r0.xyz * r1.www + r0.xyz;
  r4.xyz = float3(-0.0399999991,-0.0399999991,-0.0399999991) + r0.xyz;
  r4.xyz = r1.www * r4.xyz + float3(0.0399999991,0.0399999991,0.0399999991);
  r3.xyz = r3.xyz * cb0[118].www + cb0[118].xyz;
  r4.xyz = r4.xyz * cb0[119].www + cb0[119].xyz;
  r5.xy = float2(1,0.5) * v4.xy;
  r5.zw = v4.xy * float2(1,0.5) + float2(0,0.5);
  r6.xyzw = t0.Sample(s0_s, r5.xy).xyzw;
  r5.xyzw = t0.Sample(s0_s, r5.zw).xyzw;
  r0.w = r5.w * 0.00392156886 + r6.w;
  r0.w = -0.00196078443 + r0.w;
  r0.w = r0.w * cb2[18].w + cb2[20].w;
  r6.xyz = r6.xyz * r6.xyz;
  r6.xyz = r6.xyz * cb2[18].xyz + cb2[20].xyz;
  r0.w = exp2(r0.w);
  r0.w = -0.0185813606 + r0.w;
  r5.xyzw = r5.xyzw * cb2[19].xyzw + cb2[21].xyzw;
  r2.w = 1;
  r2.w = dot(r5.xyzw, r2.xyzw);
  r2.w = max(0, r2.w);
  r0.w = r2.w * r0.w;
  r5.xyz = r0.www * r6.xyz;
  r5.xyz = cb0[138].xyz * r5.xyz;
  r0.w = dot(r5.xyz, float3(0.300000012,0.589999974,0.109999999));
  r6.xyz = r5.xyz * r3.xyz;
  r4.xyz = r4.xyz * float3(0.449999988,0.449999988,0.449999988) + r3.xyz;
  r3.xyz = -r5.xyz * r3.xyz + r4.xyz;
  r3.xyz = cb0[126].yyy * r3.xyz + r6.xyz;
  r4.xyz = max(float3(0,0,0), cb3[2].xyz);
  r2.w = cmp(0 < cb0[122].x);
  if (r2.w != 0) {
    r5.xyz = -cb1[8].xyz + r1.xyz;
    r6.xyz = float3(1,1,1) + cb1[9].xyz;
    r5.xyz = cmp(r6.xyz < abs(r5.xyz));
    r2.w = (int)r5.y | (int)r5.x;
    r2.w = (int)r5.z | (int)r2.w;
    r1.x = dot(r1.xyz, float3(0.577000022,0.577000022,0.577000022));
    r1.x = 0.00200000009 * r1.x;
    r1.x = frac(r1.x);
    r1.x = cmp(0.5 < r1.x);
    r1.xyz = r1.xxx ? float3(0,1,1) : float3(1,1,0);
    r4.xyz = r2.www ? r1.xyz : r4.xyz;
  }
  o0.xyz = r4.xyz + r3.xyz;
  r1.xyz = float3(0.0078125,0.0078125,0.0078125) * v5.xyx;
  r1.xyz = frac(r1.xyz);
  r1.xyz = r1.xyz * float3(128,128,128) + float3(-64.3406219,-72.4656219,-64.3406219);
  r1.xyz = r1.xyz * r1.xyy;
  r1.x = dot(r1.xyz, float3(20.390625,60.703125,2.42812085));
  r1.x = frac(r1.x);
  r1.x = -0.5 + r1.x;
  o1.xyz = r2.zxy * float3(0.5,0.5,0.5) + float3(0.5,0.5,0.5);
  r0.w = 0.00390625 + r0.w;
  r0.w = log2(r0.w);
  r0.w = r0.w * 0.0625 + 0.5;
  o3.w = r1.x * 0.00392156886 + r0.w;
  o0.w = 0;
  o1.w = cb1[11].x;
  o2.yw = float2(0.5,0.75686276);
  o2.x = r1.w;
  o3.xyz = r0.xyz;
  o4.xyzw = float4(0,0,0,0);
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v1.2.57 on Fri Apr 28 16:44:54 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   x   
// TEXCOORD                 0   xyzw        3     NONE   float   xy  
// TEXCOORD                 4   xyzw        4     NONE   float   xyzw
// SV_Position              0   xyzw        5      POS   float   xyz 
// SV_IsFrontFace           0   x           6    FFACE    uint       
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target                0   xyzw        0   TARGET   float   xyzw
// SV_Target                1   xyzw        1   TARGET   float   xyzw
// SV_Target                2   xyzw        2   TARGET   float   xyzw
// SV_Target                3   xyzw        3   TARGET   float   xyzw
// SV_Target                4   xyzw        4   TARGET   float   xyzw
// SV_Target                5   xyzw        5   TARGET   float   xyzw
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[139], immediateIndexed
dcl_constantbuffer cb1[12], immediateIndexed
dcl_constantbuffer cb2[22], immediateIndexed
dcl_constantbuffer cb3[9], 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_sampler s5, mode_default
dcl_sampler s6, mode_default
dcl_resource_texture2d (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 centroid v0.xyz
dcl_input_ps linear centroid v1.xyzw
dcl_input_ps linear v2.x
dcl_input_ps linear v3.xy
dcl_input_ps linear v4.xyzw
dcl_input_ps_siv linear noperspective v5.xyz, position
dcl_output o0.xyzw
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_output o4.xyzw
dcl_output o5.xyzw
dcl_temps 7
mul r0.xyz, v0.zxyz, v1.xyzx
mad r0.xyz, v1.zxyz, v0.xyzx, -r0.xyzx
mul r0.xyz, r0.xyzx, v1.wwww
mul r1.xyzw, v5.yyyy, cb0[37].xyzw
mad r1.xyzw, v5.xxxx, cb0[36].xyzw, r1.xyzw
mad r1.xyzw, v5.zzzz, cb0[38].xyzw, r1.xyzw
add r1.xyzw, r1.xyzw, cb0[39].xyzw
div r1.xyz, r1.xyzx, r1.wwww
add r1.xyz, r1.xyzx, -cb0[56].xyzx
sample_indexable(texture2d)(float,float,float,float) r2.xy, v3.xyxx, t2.xyzw, s2
mad r2.xy, r2.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
dp2 r0.w, r2.xyxx, r2.xyxx
add r0.w, -r0.w, l(1.000000)
max r0.w, r0.w, l(0.000000)
sqrt r2.z, r0.w
mul r0.w, cb0[124].z, cb3[7].x
mad r3.xy, r1.yxyy, l(0.001000, 0.001000, 0.000000, 0.000000), r0.wwww
sample_indexable(texture2d)(float,float,float,float) r3.xy, r3.xyxx, t3.xyzw, s3
mad r3.xy, r3.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
dp2 r1.w, r3.xyxx, r3.xyxx
add r1.w, -r1.w, l(1.000000)
max r1.w, r1.w, l(0.000000)
sqrt r3.z, r1.w
mad r4.xy, r1.yxyy, l(0.001000, 0.001000, 0.000000, 0.000000), -r0.wwww
sample_indexable(texture2d)(float,float,float,float) r4.xy, r4.xyxx, t3.xyzw, s3
mad r4.xy, r4.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
dp2 r0.w, r4.xyxx, r4.xyxx
add r0.w, -r0.w, l(1.000000)
max r0.w, r0.w, l(0.000000)
sqrt r4.z, r0.w
add r3.xyz, r3.xyzx, r4.xyzx
add r3.xyz, -r2.xyzx, r3.xyzx
mul r3.xyz, r3.xyzx, cb3[7].yyyy
mul r4.xy, r1.yxyy, cb3[7].zzzz
sample_indexable(texture2d)(float,float,float,float) r0.w, r4.xyxx, t4.yzwx, s4
add r0.w, -r0.w, l(1.000000)
div r0.w, l(1.000000, 1.000000, 1.000000, 1.000000), r0.w
mul_sat r0.w, r0.w, v2.x
mad r1.w, r0.w, l(-2.000000), l(3.000000)
mul r0.w, r0.w, r0.w
mul r0.w, r0.w, r1.w
mad r2.xyz, r0.wwww, r3.xyzx, r2.xyzx
mad r2.xyz, r2.xyzx, cb0[120].wwww, cb0[120].xyzx
dp3 r1.w, r2.xyzx, r2.xyzx
rsq r1.w, r1.w
mul r2.xyz, r1.wwww, r2.xyzx
mul r0.xyz, r0.xyzx, r2.yyyy
mad r0.xyz, r2.xxxx, v0.yzxy, r0.xyzx
mad r0.xyz, r2.zzzz, v1.yzxy, r0.xyzx
dp3 r1.w, r0.xyzx, r0.xyzx
rsq r1.w, r1.w
mul r2.xyz, r0.xyzx, r1.wwww
sample_indexable(texture2d)(float,float,float,float) r0.xyz, v3.xyxx, t5.xyzw, s5
mad r3.xyz, r0.xyzx, cb3[6].xyzx, -r0.xyzx
mad r0.xyz, r0.wwww, r3.xyzx, r0.xyzx
mul_sat r0.xyz, r0.xyzx, cb3[3].xyzx
sample_indexable(texture2d)(float,float,float,float) r1.w, v3.xyxx, t6.yzwx, s6
add r3.x, -r1.w, cb3[8].x
mad_sat r0.w, r0.w, r3.x, r1.w
mov_sat r1.w, cb3[7].w
mad o2.z, r0.w, cb0[121].y, cb0[121].x
sample_indexable(texture2d)(float,float,float,float) r3.xyzw, v4.zwzz, t1.xyzw, s1
mad r4.xyzw, cb2[7].xyzw, l(-0.500000, -0.500000, -0.500000, -0.500000), l(0.500000, 0.500000, 0.500000, 0.500000)
mad_sat r3.xyzw, r3.xyzw, cb2[7].xyzw, r4.xyzw
mul r3.xyzw, r3.xyzw, r3.xyzw
mul o5.xyzw, r3.xyzw, cb2[6].xyzw
mad r3.xyz, -r0.xyzx, r1.wwww, r0.xyzx
add r4.xyz, r0.xyzx, l(-0.040000, -0.040000, -0.040000, 0.000000)
mad r4.xyz, r1.wwww, r4.xyzx, l(0.040000, 0.040000, 0.040000, 0.000000)
mad r3.xyz, r3.xyzx, cb0[118].wwww, cb0[118].xyzx
mad r4.xyz, r4.xyzx, cb0[119].wwww, cb0[119].xyzx
mul r5.xy, v4.xyxx, l(1.000000, 0.500000, 0.000000, 0.000000)
mad r5.zw, v4.xxxy, l(0.000000, 0.000000, 1.000000, 0.500000), l(0.000000, 0.000000, 0.000000, 0.500000)
sample_indexable(texture2d)(float,float,float,float) r6.xyzw, r5.xyxx, t0.xyzw, s0
sample_indexable(texture2d)(float,float,float,float) r5.xyzw, r5.zwzz, t0.xyzw, s0
mad r0.w, r5.w, l(0.00392156886), r6.w
add r0.w, r0.w, l(-0.00196078443)
mad r0.w, r0.w, cb2[18].w, cb2[20].w
mul r6.xyz, r6.xyzx, r6.xyzx
mad r6.xyz, r6.xyzx, cb2[18].xyzx, cb2[20].xyzx
exp r0.w, r0.w
add r0.w, r0.w, l(-0.0185813606)
mad r5.xyzw, r5.xyzw, cb2[19].xyzw, cb2[21].xyzw
mov r2.w, l(1.000000)
dp4 r2.w, r5.xyzw, r2.xyzw
max r2.w, r2.w, l(0.000000)
mul r0.w, r0.w, r2.w
mul r5.xyz, r6.xyzx, r0.wwww
mul r5.xyz, r5.xyzx, cb0[138].xyzx
dp3 r0.w, r5.xyzx, l(0.300000, 0.590000, 0.110000, 0.000000)
mul r6.xyz, r3.xyzx, r5.xyzx
mad r4.xyz, r4.xyzx, l(0.450000, 0.450000, 0.450000, 0.000000), r3.xyzx
mad r3.xyz, -r5.xyzx, r3.xyzx, r4.xyzx
mad r3.xyz, cb0[126].yyyy, r3.xyzx, r6.xyzx
max r4.xyz, cb3[2].xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
lt r2.w, l(0.000000), cb0[122].x
if_nz r2.w
  add r5.xyz, r1.xyzx, -cb1[8].xyzx
  add r6.xyz, cb1[9].xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
  lt r5.xyz, r6.xyzx, |r5.xyzx|
  or r2.w, r5.y, r5.x
  or r2.w, r5.z, r2.w
  dp3 r1.x, r1.xyzx, l(0.577000, 0.577000, 0.577000, 0.000000)
  mul r1.x, r1.x, l(0.002000)
  frc r1.x, r1.x
  lt r1.x, l(0.500000), r1.x
  movc r1.xyz, r1.xxxx, l(0,1.000000,1.000000,0), l(1.000000,1.000000,0,0)
  movc r4.xyz, r2.wwww, r1.xyzx, r4.xyzx
endif 
add o0.xyz, r3.xyzx, r4.xyzx
mul r1.xyz, v5.xyxx, l(0.00781250000, 0.00781250000, 0.00781250000, 0.000000)
frc r1.xyz, r1.xyzx
mad r1.xyz, r1.xyzx, l(128.000000, 128.000000, 128.000000, 0.000000), l(-64.340622, -72.465622, -64.340622, 0.000000)
mul r1.xyz, r1.xyyx, r1.xyzx
dp3 r1.x, r1.xyzx, l(20.390625, 60.703125, 2.42812085, 0.000000)
frc r1.x, r1.x
add r1.x, r1.x, l(-0.500000)
mad o1.xyz, r2.zxyz, l(0.500000, 0.500000, 0.500000, 0.000000), l(0.500000, 0.500000, 0.500000, 0.000000)
add r0.w, r0.w, l(0.00390625000)
log r0.w, r0.w
mad r0.w, r0.w, l(0.062500), l(0.500000)
mad o3.w, r1.x, l(0.00392156886), r0.w
mov o0.w, l(0)
mov o1.w, cb1[11].x
mov o2.yw, l(0,0.500000,0,0.756862760)
mov o2.x, r1.w
mov o3.xyz, r0.xyzx
mov o4.xyzw, l(0,0,0,0)
ret 
// Approximately 0 instruction slots used

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