// ---- Created with 3Dmigoto v1.2.65 on Wed Sep 20 21:05:01 2017

cbuffer cb3 : register(b3)
{
  float4 cb3[13] : packoffset(c0);
}

cbuffer cb2 : register(b2)
{
  float4 cb2[6] : packoffset(c0);
}

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

cbuffer cb0 : register(b0)
{
  float4 cb0[170] : packoffset(c0);
}

SamplerState s0_s_s : register(s0);
Texture2D<float4> t0 : register(t0);


// 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,
  float2 v3 : TEXCOORD0,
  float4 v4 : SV_Position0,
  uint v5 : 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;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xyzw = cb0[37].xyzw * v4.yyyy;
  r0.xyzw = v4.xxxx * cb0[36].xyzw + r0.xyzw;
  r0.xyzw = v4.zzzz * cb0[38].xyzw + r0.xyzw;
  r0.xyzw = cb0[39].xyzw + r0.xyzw;
  r0.xyz = r0.xyz / r0.www;
  
  // Common SVPositionToTranslatedWorld fix:
float4 s = StereoParams.Load(0);
matrix TranslatedWorldToClip = MATRIX(cb0, 0);
matrix ClipToTranslatedWorld = MATRIX(cb0, 32);
float4 t = mul(r0.xyz, TranslatedWorldToClip);
t.x -= s.x * (t.w - s.y);
r0.xyz = mul(t, ClipToTranslatedWorld);
  
  r0.xyz = -cb0[58].xyz + r0.xyz;
  r1.xyz = -cb1[8].xyz + r0.xyz;
  r0.x = dot(r0.xyz, float3(0.577000022,0.577000022,0.577000022));
  r0.x = 0.00200000009 * r0.x;
  r0.x = frac(r0.x);
  r0.x = cmp(0.5 < r0.x);
  r0.xyz = r0.xxx ? float3(0,1,1) : float3(1,1,0);
  r2.xyz = float3(1,1,1) + cb1[9].xyz;
  r1.xyz = cmp(r2.xyz < abs(r1.xyz));
  r0.w = (int)r1.x | (int)r1.y;
  r0.w = (int)r0.w | (int)r1.z;
  r0.w = (int)r0.w;
  r0.w = cmp(0 != r0.w);
  r1.xyz = max(float3(0,0,0), cb3[2].xyz);
  r0.xyz = r0.www ? r0.xyz : r1.xyz;
  r0.w = cmp(0 < cb0[124].x);
  r0.xyz = r0.www ? r0.xyz : r1.xyz;
  r1.xy = (uint2)v4.yx;
  r1.xy = (uint2)r1.xy;
  r1.xy = (int2)r1.xy;
  r0.w = (int)r1.y + (int)r1.x;
  r1.x = (uint)cb0[135].x;
  r1.x = (uint)r1.x;
  r1.x = (int)r1.x;
  r0.w = (int)r0.w + (int)r1.x;
  r0.w = (int)r0.w & 1;
  r0.w = (int)r0.w;
  r0.w = cmp(0 != r0.w);
  r1.xy = r0.ww ? float2(1,0) : float2(0,1);
  r2.xyz = -cb3[9].xyz + cb3[8].xyz;
  r3.xyz = t0.Sample(s0_s_s, v3.xy).xyz;
  r2.xyz = r3.xxx * r2.xyz + cb3[9].xyz;
  r2.xyz = -cb3[10].xyz + r2.xyz;
  r2.xyz = r3.yyy * r2.xyz + cb3[10].xyz;
  r0.w = cb3[11].x + r3.z;
  r1.z = cb3[11].z + -r3.y;
  r1.z = saturate(1 + r1.z);
  o2.z = r1.z * cb0[123].y + cb0[123].x;
  r2.xyz = r2.xyz * r0.www;
  r2.xyz = saturate(cb3[3].xyz * r2.xyz);
  r0.w = cmp(cb0[139].x != 0.000000);
  r3.xyz = r0.www ? float3(1,1,1) : r2.xyz;
  r0.w = cmp(0 < cb0[139].x);
  r0.w = r0.w ? -1.000000 : 0;
  r1.z = cmp(0 < cb0[169].w);
  r1.w = r0.w ? r1.z : 0;
  r1.w = cmp(0 != r1.w);
  r3.xyz = r1.www ? r1.xxx : r3.xyz;
  r4.xy = saturate(cb3[11].yw);
  r1.x = cmp(0 < r4.y);
  r3.xyz = r1.xxx ? r3.xyz : r2.xyz;
  o3.xyz = r2.xyz;
  r2.xyz = r3.xyz * cb0[120].www + cb0[120].xyz;
  r2.w = 0.0799999982 * r4.x;
  r3.x = r2.w * r1.y;
  r1.w = r1.w ? r3.x : r2.w;
  r1.w = r1.x ? r1.w : r2.w;
  r3.xyz = r1.www * cb0[121].www + cb0[121].xyz;
  r2.xyz = r3.xyz * float3(0.449999988,0.449999988,0.449999988) + r2.xyz;
  r0.xyz = cb0[128].xxx * r2.xyz + r0.xyz;
  r2.xyz = r0.xyz * r1.yyy;
  r0.w = r0.w ? r1.x : 0;
  r0.w = r0.w ? r1.z : 0;
  r0.w = cmp(0 != r0.w);
  o0.xyz = r0.www ? r2.xyz : r0.xyz;
  o0.w = 0;
  r0.xyz = v1.zxy * v0.yzx;
  r0.xyz = v1.yzx * v0.zxy + -r0.xyz;
  r0.xyz = v1.www * r0.xyz;
  r1.yzw = cb0[122].www * float3(0,0,1) + cb0[122].xyz;
  r0.w = dot(r1.yzw, r1.yzw);
  r0.w = rsqrt(r0.w);
  r1.yzw = r1.yzw * r0.www;
  r0.xyz = r1.zzz * r0.xyz;
  r0.xyz = r1.yyy * v0.xyz + r0.xyz;
  r0.xyz = r1.www * v1.xyz + r0.xyz;
  r0.w = dot(r0.xyz, r0.xyz);
  r0.w = rsqrt(r0.w);
  r0.xyz = r0.xyz * r0.www;
  o1.xyz = r0.xyz * float3(0.5,0.5,0.5) + float3(0.5,0.5,0.5);
  o1.w = cb1[11].x;
  o2.y = r4.x;
  o4.w = r1.x ? r4.y : 0;
  o2.x = 0;
  o2.w = r1.x ? 0.772549093 : 0.756862819;
  o4.x = r1.x ? cb3[12].x : 0;
  r0.xyz = float3(0.0078125,0.0078125,0.0078125) * v4.xyx;
  r0.xyz = frac(r0.xyz);
  r0.xyz = r0.xyz * float3(128,128,128) + float3(-64.3406219,-72.4656219,-64.3406219);
  r0.xyz = r0.xyz * r0.xyy;
  r0.x = dot(r0.xyz, float3(20.390625,60.703125,2.42812085));
  r0.x = frac(r0.x);
  r0.x = -0.5 + r0.x;
  o3.w = 0.00392156886 * r0.x;
  o4.yz = float2(0,0);
  r0.x = cmp(0 < cb1[11].y);
  o5.x = r0.x ? cb2[5].x : 1;
  o5.yzw = float3(1,1,1);
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20789
//
//   using 3Dmigoto v1.2.65 on Wed Sep 20 21:05:01 2017
//
//
// Buffer Definitions: 
//
// cbuffer cb3
// {
//
//   float4 cb3[13];                    // Offset:    0 Size:   208
//
// }
//
// cbuffer cb2
// {
//
//   float4 cb2[6];                     // Offset:    0 Size:    96
//
// }
//
// cbuffer cb1
// {
//
//   float4 cb1[12];                    // Offset:    0 Size:   192
//
// }
//
// cbuffer cb0
// {
//
//   float4 cb0[170];                   // Offset:    0 Size:  2720
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// s0_s                              sampler      NA          NA    0        1
// t0                                texture  float4          2d    0        1
// cb0                               cbuffer      NA          NA    0        1
// cb1                               cbuffer      NA          NA    1        1
// cb2                               cbuffer      NA          NA    2        1
// cb3                               cbuffer      NA          NA    3        1
//
//
//
// 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       
// TEXCOORD                 0   xy          3     NONE   float   xy  
// SV_Position              0   xyzw        4      POS   float   xyz 
// SV_IsFrontFace           0   x           5    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 cb3[13], immediateIndexed
dcl_constantbuffer cb2[6], immediateIndexed
dcl_constantbuffer cb1[12], immediateIndexed
dcl_constantbuffer cb0[170], immediateIndexed
dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_input_ps linear centroid v0.xyz
dcl_input_ps linear centroid v1.xyzw
dcl_input_ps linear v3.xy
dcl_input_ps_siv linear noperspective v4.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 5
mul r0.xyzw, v4.yyyy, cb0[37].xyzw
mad r0.xyzw, v4.xxxx, cb0[36].xyzw, r0.xyzw
mad r0.xyzw, v4.zzzz, cb0[38].xyzw, r0.xyzw
add r0.xyzw, r0.xyzw, cb0[39].xyzw
div r0.xyz, r0.xyzx, r0.wwww
add r0.xyz, r0.xyzx, -cb0[58].xyzx
add r1.xyz, r0.xyzx, -cb1[8].xyzx
dp3 r0.x, r0.xyzx, l(0.577000, 0.577000, 0.577000, 0.000000)
mul r0.x, r0.x, l(0.002000)
frc r0.x, r0.x
lt r0.x, l(0.500000), r0.x
movc r0.xyz, r0.xxxx, l(0,1.000000,1.000000,0), l(1.000000,1.000000,0,0)
add r2.xyz, cb1[9].xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
lt r1.xyz, r2.xyzx, |r1.xyzx|
or r0.w, r1.x, r1.y
or r0.w, r0.w, r1.z
itof r0.w, r0.w
ne r0.w, l(0.000000, 0.000000, 0.000000, 0.000000), r0.w
max r1.xyz, cb3[2].xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
movc r0.xyz, r0.wwww, r0.xyzx, r1.xyzx
lt r0.w, l(0.000000), cb0[124].x
movc r0.xyz, r0.wwww, r0.xyzx, r1.xyzx
ftou r1.xy, v4.yxyy
utof r1.xy, r1.xyxx
ftoi r1.xy, r1.xyxx
iadd r0.w, r1.y, r1.x
ftou r1.x, cb0[135].x
utof r1.x, r1.x
ftoi r1.x, r1.x
iadd r0.w, r0.w, r1.x
and r0.w, r0.w, l(1)
itof r0.w, r0.w
ne r0.w, l(0.000000, 0.000000, 0.000000, 0.000000), r0.w
movc r1.xy, r0.wwww, l(1.000000,0,0,0), l(0,1.000000,0,0)
add r2.xyz, cb3[8].xyzx, -cb3[9].xyzx
sample_indexable(texture2d)(float,float,float,float) r3.xyz, v3.xyxx, t0.xyzw, s0
mad r2.xyz, r3.xxxx, r2.xyzx, cb3[9].xyzx
add r2.xyz, r2.xyzx, -cb3[10].xyzx
mad r2.xyz, r3.yyyy, r2.xyzx, cb3[10].xyzx
add r0.w, r3.z, cb3[11].x
add r1.z, -r3.y, cb3[11].z
add_sat r1.z, r1.z, l(1.000000)
mad o2.z, r1.z, cb0[123].y, cb0[123].x
mul r2.xyz, r0.wwww, r2.xyzx
mul_sat r2.xyz, r2.xyzx, cb3[3].xyzx
ne r0.w, cb0[139].x, l(0.000000)
movc r3.xyz, r0.wwww, l(1.000000,1.000000,1.000000,0), r2.xyzx
lt r0.w, l(0.000000), cb0[139].x
and r0.w, r0.w, l(0xbf800000)
lt r1.z, l(0.000000), cb0[169].w
and r1.w, r0.w, r1.z
ne r1.w, l(0.000000, 0.000000, 0.000000, 0.000000), r1.w
movc r3.xyz, r1.wwww, r1.xxxx, r3.xyzx
mov_sat r4.xy, cb3[11].ywyy
lt r1.x, l(0.000000), r4.y
movc r3.xyz, r1.xxxx, r3.xyzx, r2.xyzx
mov o3.xyz, r2.xyzx
mad r2.xyz, r3.xyzx, cb0[120].wwww, cb0[120].xyzx
mul r2.w, r4.x, l(0.080000)
mul r3.x, r1.y, r2.w
movc r1.w, r1.w, r3.x, r2.w
movc r1.w, r1.x, r1.w, r2.w
mad r3.xyz, r1.wwww, cb0[121].wwww, cb0[121].xyzx
mad r2.xyz, r3.xyzx, l(0.450000, 0.450000, 0.450000, 0.000000), r2.xyzx
mad r0.xyz, cb0[128].xxxx, r2.xyzx, r0.xyzx
mul r2.xyz, r1.yyyy, r0.xyzx
and r0.w, r0.w, r1.x
and r0.w, r0.w, r1.z
ne r0.w, l(0.000000, 0.000000, 0.000000, 0.000000), r0.w
movc o0.xyz, r0.wwww, r2.xyzx, r0.xyzx
mov o0.w, l(0)
mul r0.xyz, v0.yzxy, v1.zxyz
mad r0.xyz, v1.yzxy, v0.zxyz, -r0.xyzx
mul r0.xyz, r0.xyzx, v1.wwww
mad r1.yzw, cb0[122].wwww, l(0.000000, 0.000000, 0.000000, 1.000000), cb0[122].xxyz
dp3 r0.w, r1.yzwy, r1.yzwy
rsq r0.w, r0.w
mul r1.yzw, r0.wwww, r1.yyzw
mul r0.xyz, r0.xyzx, r1.zzzz
mad r0.xyz, r1.yyyy, v0.xyzx, r0.xyzx
mad r0.xyz, r1.wwww, v1.xyzx, r0.xyzx
dp3 r0.w, r0.xyzx, r0.xyzx
rsq r0.w, r0.w
mul r0.xyz, r0.wwww, r0.xyzx
mad o1.xyz, r0.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000), l(0.500000, 0.500000, 0.500000, 0.000000)
mov o1.w, cb1[11].x
mov o2.y, r4.x
and o4.w, r4.y, r1.x
mov o2.x, l(0)
movc o2.w, r1.x, l(0.772549093), l(0.756862819)
and o4.x, r1.x, cb3[12].x
mul r0.xyz, v4.xyxx, l(0.00781250000, 0.00781250000, 0.00781250000, 0.000000)
frc r0.xyz, r0.xyzx
mad r0.xyz, r0.xyzx, l(128.000000, 128.000000, 128.000000, 0.000000), l(-64.340622, -72.465622, -64.340622, 0.000000)
mul r0.xyz, r0.xyyx, r0.xyzx
dp3 r0.x, r0.xyzx, l(20.390625, 60.703125, 2.42812085, 0.000000)
frc r0.x, r0.x
add r0.x, r0.x, l(-0.500000)
mul o3.w, r0.x, l(0.00392156886)
mov o4.yz, l(0,0,0,0)
lt r0.x, l(0.000000), cb1[11].y
movc o5.x, r0.x, cb2[5].x, l(1.000000)
mov o5.yzw, l(0,1.000000,1.000000,1.000000)
ret 
// Approximately 104 instruction slots used

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