// Decals
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 cb2 : register(b2)
{
  float4 cb2[11];
}

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

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




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


void main( 
  float4 v0 : TEXCOORD0,
  out float4 o0 : SV_Target0,
  out float4 o1 : SV_Target1,
  out float4 o2 : SV_Target2)
{
  float4 r0,r1,r2,r3;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xy = v0.xy / v0.ww;
  r0.zw = r0.xy * cb1[41].xy + cb1[41].wz;
  r0.z = t2.SampleLevel(s2_s, r0.zw, 0).x;
  r0.z = r0.z * cb1[40].z + -cb1[40].w;
  r0.z = 1 / r0.z;
  r0.xy = r0.xy * r0.zz;
  
  float4 stereo = StereoParams.Load(0);
  r0.x -= stereo.x * (r0.z - stereo.y);
  
  r1.xyzw = cb0[1].xyzw * r0.yyyy;
  r1.xyzw = r0.xxxx * cb0[0].xyzw + r1.xyzw;
  r0.xyzw = r0.zzzz * cb0[2].xyzw + r1.xyzw;
  r0.xyzw = cb0[3].xyzw + r0.xyzw;
  r0.xyz = r0.xyz / r0.www;
  r1.xyz = float3(1,1,1) + r0.xyz;
  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.xyz;
  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;
  r1.xw = float2(1,0);
  r1.yz = cb2[7].ww;
  r1.xy = r1.xy * r0.zy;
  r1.xy = r1.zw * r1.xy + cb2[1].xy;
  r2.xw = cb2[9].yy;
  r2.yz = float2(1,0);
  r0.yz = r2.xy * r0.zy;
  r0.x = r0.x * 2 + -1;
  r0.x = saturate(-abs(r0.x) * 4 + 4);
  r0.yz = r2.zw * r0.yz + cb2[2].xy;
  r0.yz = r1.xy + r0.yz;
  r1.xyzw = t1.Sample(s1_s, r0.yz).xyzw;
  r0.yz = t0.Sample(s0_s, r0.yz).xy;
  r2.xy = r0.yz * float2(2,2) + float2(-1,-1);
  r3.xyzw = cb2[10].zxxx * r1.wxyz;
  r0.y = saturate(cb2[10].y * r1.x);
  r0.y = r0.y * cb1[50].y + cb1[50].x;
  o2.x = max(0.0399999991, r0.y);
  r3.x = saturate(r3.x);
  o0.xyz = saturate(cb2[5].xyz * r3.yzw);
  r0.x = r3.x * r0.x;
  o0.w = r0.x;
  r0.y = dot(r2.xy, r2.xy);
  r0.y = 1 + -r0.y;
  r0.y = max(0, r0.y);
  r2.z = sqrt(r0.y);
  r0.yzw = r2.xyz * cb1[49].www + cb1[49].xyz;
  r1.xyz = cb0[5].xyz * r0.zzz;
  r1.xyz = -r0.www * cb0[4].xyz + r1.xyz;
  r0.yzw = r0.yyy * cb0[6].xyz + r1.xyz;
  r1.x = dot(r0.yzw, r0.yzw);
  r1.x = rsqrt(r1.x);
  r0.yzw = r1.xxx * r0.yzw;
  o1.xyz = r0.yzw * float3(0.5,0.5,0.5) + float3(0.501960814,0.501960814,0.501960814);
  o1.w = r0.x;
  o2.w = r0.x;
  o2.yz = float2(0,0);
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v1.2.34 on Mon Mar 21 20:24:50 2016
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                 0   xyzw        0     NONE   float   xy w
//
//
// 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
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[7], immediateIndexed
dcl_constantbuffer cb1[51], immediateIndexed
dcl_constantbuffer cb2[11], 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_input_ps linear v0.xyw
dcl_output o0.xyzw
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_temps 4
div r0.xy, v0.xyxx, v0.wwww
mad r0.zw, r0.xxxy, cb1[41].xxxy, cb1[41].wwwz
sample_l_indexable(texture2d)(float,float,float,float) r0.z, r0.zwzz, t2.yzxw, s2, l(0.000000)
mad r0.z, r0.z, cb1[40].z, -cb1[40].w
div r0.z, l(1.000000, 1.000000, 1.000000, 1.000000), r0.z
mul r0.xy, r0.zzzz, r0.xyxx
mul r1.xyzw, r0.yyyy, cb0[1].xyzw
mad r1.xyzw, r0.xxxx, cb0[0].xyzw, r1.xyzw
mad r0.xyzw, r0.zzzz, cb0[2].xyzw, r1.xyzw
add r0.xyzw, r0.xyzw, cb0[3].xyzw
div r0.xyz, r0.xyzx, r0.wwww
add r1.xyz, r0.xyzx, 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.xyzx, 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
mov r1.xw, l(1.000000,0,0,0)
mov r1.yz, cb2[7].wwww
mul r1.xy, r0.zyzz, r1.xyxx
mad r1.xy, r1.zwzz, r1.xyxx, cb2[1].xyxx
mov r2.xw, cb2[9].yyyy
mov r2.yz, l(0,1.000000,0,0)
mul r0.yz, r0.zzyz, r2.xxyx
mad r0.x, r0.x, l(2.000000), l(-1.000000)
mad_sat r0.x, -|r0.x|, l(4.000000), l(4.000000)
mad r0.yz, r2.zzwz, r0.yyzy, cb2[2].xxyx
add r0.yz, r0.yyzy, r1.xxyx
sample_indexable(texture2d)(float,float,float,float) r1.xyzw, r0.yzyy, t1.xyzw, s1
sample_indexable(texture2d)(float,float,float,float) r0.yz, r0.yzyy, t0.zxyw, s0
mad r2.xy, r0.yzyy, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
mul r3.xyzw, r1.wxyz, cb2[10].zxxx
mul_sat r0.y, r1.x, cb2[10].y
mad r0.y, r0.y, cb1[50].y, cb1[50].x
max o2.x, r0.y, l(0.040000)
mov_sat r3.x, r3.x
mul_sat o0.xyz, r3.yzwy, cb2[5].xyzx
mul r0.x, r0.x, r3.x
mov o0.w, r0.x
dp2 r0.y, r2.xyxx, r2.xyxx
add r0.y, -r0.y, l(1.000000)
max r0.y, r0.y, l(0.000000)
sqrt r2.z, r0.y
mad r0.yzw, r2.xxyz, cb1[49].wwww, cb1[49].xxyz
mul r1.xyz, r0.zzzz, cb0[5].xyzx
mad r1.xyz, -r0.wwww, cb0[4].xyzx, r1.xyzx
mad r0.yzw, r0.yyyy, cb0[6].xxyz, r1.xxyz
dp3 r1.x, r0.yzwy, r0.yzwy
rsq r1.x, r1.x
mul r0.yzw, r0.yyzw, r1.xxxx
mad o1.xyz, r0.yzwy, l(0.500000, 0.500000, 0.500000, 0.000000), l(0.501960814, 0.501960814, 0.501960814, 0.000000)
mov o1.w, r0.x
mov o2.w, r0.x
mov o2.yz, l(0,0,0,0)
ret 
// Approximately 0 instruction slots used

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