// ---- Created with 3Dmigoto v1.2.65 on Wed Sep 20 22:54:54 2017
Texture2D<uint4> t3 : register(t3);

Texture2D<float4> t2 : register(t2);

Texture2D<float4> t1 : register(t1);

Texture2D<float4> t0 : register(t0);

SamplerState s2_s : register(s2);

SamplerState s1_s : register(s1);

SamplerState s0_s : register(s0);

cbuffer cb4 : register(b4)
{
  float4 cb4[8];
}

cbuffer cb3 : register(b3)
{
  float4 cb3[3];
}

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

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

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




// 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 : TEXCOORD0,
  float4 v3 : TEXCOORD6,
  float4 v4 : SV_Position0,
  uint v5 : SV_IsFrontFace0,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1,r2,r3,r4,r5;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.x = -cb4[6].z + v1.z;
  r0.y = saturate(r0.x);
  r0.y = -0.150000006 + r0.y;
  r0.y = saturate(10 * r0.y);
  r0.x = r0.x + -r0.y;
  r0.y = -cb4[6].z + -v1.z;
  r0.z = saturate(r0.y);
  r0.z = -0.150000006 + r0.z;
  r0.xz = saturate(float2(10,10) * r0.xz);
  r0.y = r0.y + -r0.z;
  r0.y = saturate(10 * r0.y);
  r0.x = r0.x + r0.y;
  r0.y = 1 + -abs(v1.z);
  r0.y = max(9.99999997e-007, abs(r0.y));
  r0.y = r0.y * r0.y;
  r0.y = r0.y * r0.y;
  r0.x = r0.x * r0.y;
  r0.x = cb4[6].z * r0.x;
  r1.xyzw = cb1[37].xyzw * v4.yyyy;
  r1.xyzw = v4.xxxx * cb1[36].xyzw + r1.xyzw;
  r1.xyzw = v4.zzzz * cb1[38].xyzw + r1.xyzw;
  r1.xyzw = cb1[39].xyzw + r1.xyzw;
  r1.xyz = r1.xyz / r1.www;
  
  // Common SVPositionToTranslatedWorld fix:
float4 s = StereoParams.Load(0);
matrix TranslatedWorldToClip = MATRIX(cb1, 0);
matrix ClipToTranslatedWorld = MATRIX(cb1, 32);
float4 t = mul(r1.xyz, TranslatedWorldToClip);
t.x -= s.x * (t.w - s.y);
r1.xyz = mul(t, ClipToTranslatedWorld);
  
  r0.z = dot(-r1.xyz, -r1.xyz);
  r0.z = rsqrt(r0.z);
  r1.xyz = -r1.xyz * r0.zzz;
  r2.xyz = v1.zxy * v0.yzx;
  r2.xyz = v1.yzx * v0.zxy + -r2.xyz;
  r2.xyz = v1.www * r2.xyz;
  r0.z = cb2[9].w * cb1[125].w;
  r0.w = v5.x ? 1 : -1;
  r0.z = r0.z * r0.w;
  r3.xyz = cb1[122].www * float3(0,0,1) + cb1[122].xyz;
  r4.xyz = r3.xyz * r0.zzz;
  r0.z = dot(r4.xyz, r4.xyz);
  r0.z = rsqrt(r0.z);
  r4.xyz = r4.xyz * r0.zzz;
  r5.xyz = r4.yyy * r2.xyz;
  r2.xyz = r3.yyy * r2.xyz;
  r2.xyz = r3.xxx * v0.xyz + r2.xyz;
  r2.xyz = r3.zzz * v1.xyz + r2.xyz;
  r3.xyz = r4.xxx * v0.xyz + r5.xyz;
  r3.xyz = r4.zzz * v1.xyz + r3.xyz;
  r0.z = dot(r3.xyz, r3.xyz);
  r0.z = rsqrt(r0.z);
  r3.xyz = r3.xyz * r0.zzz;
  r0.z = dot(r3.xyz, r1.xyz);
  r0.z = max(0, r0.z);
  r0.z = 1 + -r0.z;
  r0.z = max(9.99999997e-007, abs(r0.z));
  r0.w = r0.z * r0.z;
  r0.z = log2(r0.z);
  r0.xz = float2(0.200000003,30) * r0.xz;
  r0.z = exp2(r0.z);
  r0.z = r0.z * 0.959999979 + r0.x;
  r0.z = 0.0399999991 + r0.z;
  r0.w = r0.w * 0.959999979 + 0.0399999991;
  r1.x = r0.w * r0.w;
  r0.w = r1.x * r0.w;
  r0.y = r0.w * r0.y;
  r0.x = r0.y * 0.600000024 + r0.x;
  r0.y = cb4[6].y * -0.899999976 + 1;
  r0.x = r0.y * r0.x;
  r0.yw = t0.SampleLevel(s0_s, v2.xy, -1).xy;
  r0.y = r0.y * 2 + -r0.x;
  r0.x = r0.w * r0.y + r0.x;
  r0.yw = -cb1[116].xy + v4.xy;
  r0.yw = r0.yw * cb1[117].zw + float2(-0.5,-0.5);
  r1.xy = v4.ww * r0.yw;
  r1.z = v4.w;
  r1.xyw = float3(2,-2,1) * r1.xyz;
  r0.yw = r1.xy / r1.ww;
  r0.yw = r0.yw * cb1[54].xy + cb1[54].wz;
  r1.x = t2.SampleLevel(s2_s, r0.yw, 0).x;
  r1.y = r1.x * cb1[53].z + -cb1[53].w;
  r1.x = r1.x * cb1[53].x + cb1[53].y;
  r1.y = 1 / r1.y;
  r1.x = r1.x + r1.y;
  r1.x = saturate(r1.z * 1 + -r1.x);
  r1.x = 1 + -r1.x;
  r1.yw = cb1[118].xy * r0.yw;
  r1.yw = trunc(r1.yw);
  r3.xy = (int2)r1.yw;
  r3.zw = float2(0,0);
  r1.y = t3.Load(r3.xyz).y;
  r1.y = (uint)r1.y;
  r1.y = r1.y * 0.00392156886 + -1;
  r1.y = cmp(9.99999975e-006 < abs(r1.y));
  r1.x = r1.y ? 1 : r1.x;
  r0.x = r1.x * r0.x;
  r0.x = cb4[7].x * r0.x;
  r1.x = cb4[7].y * r0.x;
  r0.x = -cb4[7].y * r0.x + 1;
  r0.x = cb4[6].x * r0.x + r1.x;
  r1.x = r0.x * r0.z;
  r0.x = r0.x * r0.z + 1;
  r0.z = cb4[6].y * r1.x;
  r1.x = 1.20000005 + -r0.x;
  r0.x = r0.z * r1.x + r0.x;
  r0.x = -1 + r0.x;
  r0.x = cb3[2].x * r0.x;
  r1.xyw = cb1[9].xyz * r2.yyy;
  r1.xyw = r2.xxx * cb1[8].xyz + r1.xyw;
  r1.xyw = r2.zzz * cb1[10].xyz + r1.xyw;
  r0.z = dot(r1.xyw, r1.xyw);
  r0.z = rsqrt(r0.z);
  r1.xy = r1.xy * r0.zz;
  r0.xz = r1.xy * r0.xx;
  r1.x = dot(r0.xz, r0.xz);
  r1.x = -9.99999975e-006 + r1.x;
  r1.x = cmp(r1.x < 0);
  if (r1.x != 0) discard;
  r2.w = cb0[6].y * cb0[6].x;
  r2.z = cb0[6].x;
  r1.xy = cb0[6].zw * r2.zw;
  r0.xz = r1.xy * r0.xz;
  r0.yw = r0.xz * float2(0.000230000005,-0.000230000005) + r0.yw;
  r0.xz = float2(0.000230000005,-0.000230000005) * r0.xz;
  r0.y = t1.SampleLevel(s1_s, r0.yw, 0).x;
  r0.w = r0.y * cb1[53].z + -cb1[53].w;
  r0.y = r0.y * cb1[53].x + cb1[53].y;
  r0.w = 1 / r0.w;
  r0.y = r0.y + r0.w;
  r0.y = -r1.z * 1 + r0.y;
  r0.w = -0.5 * cb4[7].z;
  r0.w = min(50, abs(r0.w));
  r0.w = max(1, r0.w);
  r0.w = 1 / r0.w;
  r0.y = saturate(r0.y * r0.w + -cb4[7].z);
  r0.xy = r0.xz * r0.yy;
  r0.xy = float2(4,4) * r0.xy;
  o0.xy = max(float2(0,0), r0.xy);
  r0.xy = min(float2(0,0), r0.xy);
  o0.zw = -r0.xy;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Original ASM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                10   xyzw        0     NONE   float   xyz 
// TEXCOORD                11   xyzw        1     NONE   float   xyzw
// TEXCOORD                 0   xyzw        2     NONE   float   xy  
// TEXCOORD                 6   xyzw        3     NONE   float       
// SV_Position              0   xyzw        4      POS   float   xyzw
// SV_IsFrontFace           0   x           5    FFACE    uint   x   
//
//
// 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[7], immediateIndexed
dcl_constantbuffer cb1[126], immediateIndexed
dcl_constantbuffer cb2[10], immediateIndexed
dcl_constantbuffer cb3[3], immediateIndexed
dcl_constantbuffer cb4[8], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_sampler s2, 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 (uint,uint,uint,uint) t3
dcl_input_ps linear centroid v0.xyz
dcl_input_ps linear centroid v1.xyzw
dcl_input_ps linear v2.xy
dcl_input_ps_siv linear noperspective v4.xyzw, position
dcl_input_ps_sgv v5.x, is_front_face
dcl_output o0.xyzw
dcl_temps 6
add r0.x, v1.z, -cb4[6].z
mov_sat r0.y, r0.x
add r0.y, r0.y, l(-0.150000)
mul_sat r0.y, r0.y, l(10.000000)
add r0.x, -r0.y, r0.x
add r0.y, -v1.z, -cb4[6].z
mov_sat r0.z, r0.y
add r0.z, r0.z, l(-0.150000)
mul_sat r0.xz, r0.xxzx, l(10.000000, 0.000000, 10.000000, 0.000000)
add r0.y, -r0.z, r0.y
mul_sat r0.y, r0.y, l(10.000000)
add r0.x, r0.y, r0.x
add r0.y, -|v1.z|, l(1.000000)
max r0.y, |r0.y|, l(0.000001)
mul r0.y, r0.y, r0.y
mul r0.y, r0.y, r0.y
mul r0.x, r0.y, r0.x
mul r0.x, r0.x, cb4[6].z
mul r1.xyzw, v4.yyyy, cb1[37].xyzw
mad r1.xyzw, v4.xxxx, cb1[36].xyzw, r1.xyzw
mad r1.xyzw, v4.zzzz, cb1[38].xyzw, r1.xyzw
add r1.xyzw, r1.xyzw, cb1[39].xyzw
div r1.xyz, r1.xyzx, r1.wwww
dp3 r0.z, -r1.xyzx, -r1.xyzx
rsq r0.z, r0.z
mul r1.xyz, r0.zzzz, -r1.xyzx
mul r2.xyz, v0.yzxy, v1.zxyz
mad r2.xyz, v1.yzxy, v0.zxyz, -r2.xyzx
mul r2.xyz, r2.xyzx, v1.wwww
mul r0.z, cb1[125].w, cb2[9].w
movc r0.w, v5.x, l(1.000000), l(-1.000000)
mul r0.z, r0.w, r0.z
mad r3.xyz, cb1[122].wwww, l(0.000000, 0.000000, 1.000000, 0.000000), cb1[122].xyzx
mul r4.xyz, r0.zzzz, r3.xyzx
dp3 r0.z, r4.xyzx, r4.xyzx
rsq r0.z, r0.z
mul r4.xyz, r0.zzzz, r4.xyzx
mul r5.xyz, r2.xyzx, r4.yyyy
mul r2.xyz, r2.xyzx, r3.yyyy
mad r2.xyz, r3.xxxx, v0.xyzx, r2.xyzx
mad r2.xyz, r3.zzzz, v1.xyzx, r2.xyzx
mad r3.xyz, r4.xxxx, v0.xyzx, r5.xyzx
mad r3.xyz, r4.zzzz, v1.xyzx, r3.xyzx
dp3 r0.z, r3.xyzx, r3.xyzx
rsq r0.z, r0.z
mul r3.xyz, r0.zzzz, r3.xyzx
dp3 r0.z, r3.xyzx, r1.xyzx
max r0.z, r0.z, l(0.000000)
add r0.z, -r0.z, l(1.000000)
max r0.z, |r0.z|, l(0.000001)
mul r0.w, r0.z, r0.z
log r0.z, r0.z
mul r0.xz, r0.xxzx, l(0.200000, 0.000000, 30.000000, 0.000000)
exp r0.z, r0.z
mad r0.z, r0.z, l(0.960000), r0.x
add r0.z, r0.z, l(0.040000)
mad r0.w, r0.w, l(0.960000), l(0.040000)
mul r1.x, r0.w, r0.w
mul r0.w, r0.w, r1.x
mul r0.y, r0.y, r0.w
mad r0.x, r0.y, l(0.600000), r0.x
mad r0.y, cb4[6].y, l(-0.900000), l(1.000000)
mul r0.x, r0.x, r0.y
sample_l_indexable(texture2d)(float,float,float,float) r0.yw, v2.xyxx, t0.zxwy, s0, l(-1.000000)
mad r0.y, r0.y, l(2.000000), -r0.x
mad r0.x, r0.w, r0.y, r0.x
add r0.yw, v4.xxxy, -cb1[116].xxxy
mad r0.yw, r0.yyyw, cb1[117].zzzw, l(0.000000, -0.500000, 0.000000, -0.500000)
mul r1.xy, r0.ywyy, v4.wwww
mov r1.z, v4.w
mul r1.xyw, r1.xyxz, l(2.000000, -2.000000, 0.000000, 1.000000)
div r0.yw, r1.xxxy, r1.wwww
mad r0.yw, r0.yyyw, cb1[54].xxxy, cb1[54].wwwz
sample_l_indexable(texture2d)(float,float,float,float) r1.x, r0.ywyy, t2.xyzw, s2, l(0.000000)
mad r1.y, r1.x, cb1[53].z, -cb1[53].w
mad r1.x, r1.x, cb1[53].x, cb1[53].y
div r1.y, l(1.000000, 1.000000, 1.000000, 1.000000), r1.y
add r1.x, r1.y, r1.x
mad_sat r1.x, r1.z, l(1.000000), -r1.x
add r1.x, -r1.x, l(1.000000)
mul r1.yw, r0.yyyw, cb1[118].xxxy
round_z r1.yw, r1.yyyw
ftoi r3.xy, r1.ywyy
mov r3.zw, l(0,0,0,0)
ld_indexable(texture2d)(uint,uint,uint,uint) r1.y, r3.xyzw, t3.xyzw
utof r1.y, r1.y
mad r1.y, r1.y, l(0.003922), l(-1.000000)
lt r1.y, l(0.000010), |r1.y|
movc r1.x, r1.y, l(1.000000), r1.x
mul r0.x, r0.x, r1.x
mul r0.x, r0.x, cb4[7].x
mul r1.x, r0.x, cb4[7].y
mad r0.x, -cb4[7].y, r0.x, l(1.000000)
mad r0.x, cb4[6].x, r0.x, r1.x
mul r1.x, r0.z, r0.x
mad r0.x, r0.x, r0.z, l(1.000000)
mul r0.z, r1.x, cb4[6].y
add r1.x, -r0.x, l(1.200000)
mad r0.x, r0.z, r1.x, r0.x
add r0.x, r0.x, l(-1.000000)
mul r0.x, r0.x, cb3[2].x
mul r1.xyw, r2.yyyy, cb1[9].xyxz
mad r1.xyw, r2.xxxx, cb1[8].xyxz, r1.xyxw
mad r1.xyw, r2.zzzz, cb1[10].xyxz, r1.xyxw
dp3 r0.z, r1.xywx, r1.xywx
rsq r0.z, r0.z
mul r1.xy, r0.zzzz, r1.xyxx
mul r0.xz, r0.xxxx, r1.xxyx
dp2 r1.x, r0.xzxx, r0.xzxx
add r1.x, r1.x, l(-0.000010)
lt r1.x, r1.x, l(0.000000)
discard_nz r1.x
mul r2.w, cb0[6].x, cb0[6].y
mov r2.z, cb0[6].x
mul r1.xy, r2.zwzz, cb0[6].zwzz
mul r0.xz, r0.xxzx, r1.xxyx
mad r0.yw, r0.xxxz, l(0.000000, 0.000230, 0.000000, -0.000230), r0.yyyw
mul r0.xz, r0.xxzx, l(0.000230, 0.000000, -0.000230, 0.000000)
sample_l_indexable(texture2d)(float,float,float,float) r0.y, r0.ywyy, t1.yxzw, s1, l(0.000000)
mad r0.w, r0.y, cb1[53].z, -cb1[53].w
mad r0.y, r0.y, cb1[53].x, cb1[53].y
div r0.w, l(1.000000, 1.000000, 1.000000, 1.000000), r0.w
add r0.y, r0.w, r0.y
mad r0.y, -r1.z, l(1.000000), r0.y
mul r0.w, cb4[7].z, l(-0.500000)
min r0.w, |r0.w|, l(50.000000)
max r0.w, r0.w, l(1.000000)
div r0.w, l(1.000000, 1.000000, 1.000000, 1.000000), r0.w
mad_sat r0.y, r0.y, r0.w, -cb4[7].z
mul r0.xy, r0.yyyy, r0.xzxx
mul r0.xy, r0.xyxx, l(4.000000, 4.000000, 0.000000, 0.000000)
max o0.xy, r0.xyxx, l(0.000000, 0.000000, 0.000000, 0.000000)
min r0.xy, r0.xyxx, l(0.000000, 0.000000, 0.000000, 0.000000)
mov o0.zw, -r0.xxxy
ret 
// Approximately 0 instruction slots used

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