// DEcals
Texture2D<float4> t3 : register(t3);

Texture2D<float4> t2 : register(t2);

Texture2D<float4> t1 : register(t1);

Texture2D<float4> t0 : register(t0);

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[4];
}

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

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




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

#include "matrix.hlsl"

void main( 
  float4 v0 : SV_Position0,
  uint v1 : SV_IsFrontFace0,
  out float4 o0 : SV_Target0,
  out float4 o1 : SV_Target1,
  out float4 o2 : SV_Target2,
  out float4 o3 : SV_Target3)
{
  float4 r0,r1;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xy = cb1[116].zw * v0.xy;
  r0.x = t3.SampleLevel(s3_s, r0.xy, 0).x;
  r1.xyzw = cb0[1].xyzw * v0.yyyy;
  r1.xyzw = v0.xxxx * cb0[0].xyzw + r1.xyzw;
  r0.xyzw = r0.xxxx * cb0[2].xyzw + r1.xyzw;
  r0.xyzw = cb0[3].xyzw + r0.xyzw;
  r0.xyz = r0.zyx / r0.www;
  
  float4 s = StereoParams.Load(0);
matrix m = MATRIX(cb0, 0);
matrix im = inverse(m);
float4 t = mul(float4(r0.zyx, 1), im);
t.x -= s.x * (t.w - s.y) * cb1[116].x / 2;
r0.xyz = mul(t, m).zyx;
  
  r1.xyz = float3(1,1,1) + r0.zyx;
  r1.xyz = cmp(r1.xyz < float3(0,0,0));
  r0.w = (int)r1.y | (int)r1.x;
  r0.w = (int)r1.z | (int)r0.w;
  if (r0.w != 0) discard;
  r1.xyz = float3(1,1,1) + -r0.zyx;
  r0.xyz = r0.xyz * float3(0.5,0.5,0.5) + float3(0.5,0.5,0.5);
  r1.xyz = cmp(r1.xyz < float3(0,0,0));
  r0.w = (int)r1.y | (int)r1.x;
  r0.w = (int)r1.z | (int)r0.w;
  if (r0.w != 0) discard;
  r0.w = t2.Sample(s2_s, r0.xy).w;
  r0.w = saturate(r0.w);
  r0.z = r0.z * 2 + -1;
  r0.xy = r0.xy + r0.xy;
  r0.z = saturate(-abs(r0.z) * 4 + 4);
  r0.z = r0.w * r0.z;
  r0.z = cb0[12].x * r0.z;
  o0.w = r0.z;
  o0.xyz = max(float3(0,0,0), cb2[2].xyz);
  r1.xy = t0.Sample(s0_s, r0.xy).xy;
  r0.xyw = t1.Sample(s1_s, r0.xy).xyz;
  r0.xyw = cb2[3].xyz * r0.xyw;
  o3.xyz = saturate(float3(0.300000012,0.300000012,0.300000012) * r0.xyw);
  r1.xy = r1.xy * float2(2,2) + float2(-1,-1);
  r0.x = dot(r1.xy, r1.xy);
  r0.x = 1 + -r0.x;
  r0.x = max(0, r0.x);
  r1.z = sqrt(r0.x);
  r0.xyw = float3(0,0,4) + -r1.xyz;
  r0.xyw = r0.xyw * float3(0.5,0.5,0.5) + r1.xyz;
  r0.xyw = r0.xyw * cb1[120].www + cb1[120].xyz;
  r1.x = dot(cb0[4].xyz, cb0[4].xyz);
  r1.x = rsqrt(r1.x);
  r0.w = r1.x * -r0.w;
  r1.x = dot(cb0[5].xyz, cb0[5].xyz);
  r1.y = rsqrt(r1.x);
  r1.x = dot(cb0[6].xyz, cb0[6].xyz);
  r1.z = rsqrt(r1.x);
  r0.xy = r1.yz * r0.yx;
  r1.xyz = cb0[5].xyz * r0.xxx;
  r1.xyz = r0.www * cb0[4].xyz + r1.xyz;
  r0.xyw = r0.yyy * cb0[6].xyz + r1.xyz;
  r1.x = dot(r0.xyw, r0.xyw);
  r1.x = rsqrt(r1.x);
  r0.xyw = r1.xxx * r0.xyw;
  o1.xyz = r0.xyw * float3(0.5,0.5,0.5) + float3(0.5,0.5,0.5);
  o1.w = r0.z;
  o2.w = r0.z;
  o3.w = r0.z;
  o2.z = cb1[121].y * 0.200000003 + cb1[121].x;
  o2.xy = float2(0,0.100000001);
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v1.2.57 on Fri Apr 28 14:46:12 2017
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xy  
// SV_IsFrontFace           0   x           1    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
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[13], immediateIndexed
dcl_constantbuffer cb1[122], immediateIndexed
dcl_constantbuffer cb2[4], 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_texture2d (float,float,float,float) t2
dcl_resource_texture2d (float,float,float,float) t3
dcl_input_ps_siv linear noperspective v0.xy, position
dcl_output o0.xyzw
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_temps 2
mul r0.xy, v0.xyxx, cb1[116].zwzz
sample_l_indexable(texture2d)(float,float,float,float) r0.x, r0.xyxx, t3.xyzw, s3, l(0.000000)
mul r1.xyzw, v0.yyyy, cb0[1].xyzw
mad r1.xyzw, v0.xxxx, cb0[0].xyzw, r1.xyzw
mad r0.xyzw, r0.xxxx, cb0[2].xyzw, r1.xyzw
add r0.xyzw, r0.xyzw, cb0[3].xyzw
div r0.xyz, r0.zyxz, r0.wwww
add r1.xyz, r0.zyxz, l(1.000000, 1.000000, 1.000000, 0.000000)
lt r1.xyz, r1.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
or r0.w, r1.y, r1.x
or r0.w, r1.z, r0.w
discard_nz r0.w
add r1.xyz, -r0.zyxz, l(1.000000, 1.000000, 1.000000, 0.000000)
mad r0.xyz, r0.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000), l(0.500000, 0.500000, 0.500000, 0.000000)
lt r1.xyz, r1.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
or r0.w, r1.y, r1.x
or r0.w, r1.z, r0.w
discard_nz r0.w
sample_indexable(texture2d)(float,float,float,float) r0.w, r0.xyxx, t2.xyzw, s2
mov_sat r0.w, r0.w
mad r0.z, r0.z, l(2.000000), l(-1.000000)
add r0.xy, r0.xyxx, r0.xyxx
mad_sat r0.z, -|r0.z|, l(4.000000), l(4.000000)
mul r0.z, r0.z, r0.w
mul r0.z, r0.z, cb0[12].x
mov o0.w, r0.z
max o0.xyz, cb2[2].xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
sample_indexable(texture2d)(float,float,float,float) r1.xy, r0.xyxx, t0.xyzw, s0
sample_indexable(texture2d)(float,float,float,float) r0.xyw, r0.xyxx, t1.xywz, s1
mul r0.xyw, r0.xyxw, cb2[3].xyxz
mul_sat o3.xyz, r0.xywx, l(0.300000, 0.300000, 0.300000, 0.000000)
mad r1.xy, r1.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
dp2 r0.x, r1.xyxx, r1.xyxx
add r0.x, -r0.x, l(1.000000)
max r0.x, r0.x, l(0.000000)
sqrt r1.z, r0.x
add r0.xyw, -r1.xyxz, l(0.000000, 0.000000, 0.000000, 4.000000)
mad r0.xyw, r0.xyxw, l(0.500000, 0.500000, 0.000000, 0.500000), r1.xyxz
mad r0.xyw, r0.xyxw, cb1[120].wwww, cb1[120].xyxz
dp3 r1.x, cb0[4].xyzx, cb0[4].xyzx
rsq r1.x, r1.x
mul r0.w, -r0.w, r1.x
dp3 r1.x, cb0[5].xyzx, cb0[5].xyzx
rsq r1.y, r1.x
dp3 r1.x, cb0[6].xyzx, cb0[6].xyzx
rsq r1.z, r1.x
mul r0.xy, r0.yxyy, r1.yzyy
mul r1.xyz, r0.xxxx, cb0[5].xyzx
mad r1.xyz, r0.wwww, cb0[4].xyzx, r1.xyzx
mad r0.xyw, r0.yyyy, cb0[6].xyxz, r1.xyxz
dp3 r1.x, r0.xywx, r0.xywx
rsq r1.x, r1.x
mul r0.xyw, r0.xyxw, r1.xxxx
mad o1.xyz, r0.xywx, l(0.500000, 0.500000, 0.500000, 0.000000), l(0.500000, 0.500000, 0.500000, 0.000000)
mov o1.w, r0.z
mov o2.w, r0.z
mov o3.w, r0.z
mad o2.z, cb1[121].y, l(0.200000), cb1[121].x
mov o2.xy, l(0,0.100000,0,0)
ret 
// Approximately 0 instruction slots used

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