// ---- Created with 3Dmigoto v1.2.57 on Fri Apr 28 13:23:25 2017
Texture3D<float4> t3 : register(t3);

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

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

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

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 : TEXCOORD0,
  float4 v3 : TEXCOORD4,
  float4 v4 : TEXCOORD7,
  float4 v5 : SV_Position0,
  uint v6 : SV_IsFrontFace0,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1,r2,r3,r4,r5,r6,r7;
  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.xyz = cb0[120].www * float3(0,0,1) + cb0[120].xyz;
  r0.w = dot(r2.xyz, r2.xyz);
  r0.w = rsqrt(r0.w);
  r2.xyz = r2.xyz * r0.www;
  r0.xyz = r2.yyy * r0.xyz;
  r0.xyz = r2.xxx * v0.yzx + r0.xyz;
  r0.xyz = r2.zzz * v1.yzx + r0.xyz;
  r0.w = dot(r0.xyz, r0.xyz);
  r0.w = rsqrt(r0.w);
  r0.xyz = r0.xyz * r0.www;
  r2.w = t1.Sample(s1_s, v2.xy).x;
  r3.xyz = saturate(cb3[4].xyz);
  r2.w = saturate(r2.w);
  r3.xyz = r3.xyz * cb0[118].www + cb0[118].xyz;
  r4.xyz = cb0[119].www * float3(0.0399999991,0.0399999991,0.0399999991) + cb0[119].xyz;
  r5.xy = float2(1,0.5) * v3.xy;
  r5.zw = v3.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;
  r1.w = r5.w * 0.00392156886 + r6.w;
  r1.w = -0.00196078443 + r1.w;
  r1.w = r1.w * cb2[18].w + cb2[20].w;
  r6.xyz = r6.xyz * r6.xyz;
  r6.xyz = r6.xyz * cb2[18].xyz + cb2[20].xyz;
  r1.w = exp2(r1.w);
  r1.w = -0.0185813606 + r1.w;
  r5.xyzw = r5.xyzw * cb2[19].xyzw + cb2[21].xyzw;
  r0.w = 1;
  r0.x = dot(r5.xyzw, r0.xyzw);
  r0.x = max(0, r0.x);
  r0.x = r1.w * r0.x;
  r0.xyz = r0.xxx * r6.xyz;
  r0.xyz = cb0[138].xyz * r0.xyz;
  r5.xyz = -cb0[129].xyz + r1.xyz;
  r6.xyz = cb0[131].xyz * r5.xyz;
  r7.xyz = -cb0[130].xyz + r1.xyz;
  r7.xyz = cb0[132].xyz * r7.xyz;
  r5.xyz = r5.xyz * cb0[131].xyz + float3(-0.5,-0.5,-0.5);
  r5.xyz = float3(0.5,0.5,0.5) + -abs(r5.xyz);
  r5.xyz = saturate(float3(6,6,6) * r5.xyz);
  r0.w = r5.x * r5.y;
  r0.w = r0.w * r5.z;
  r5.xyz = t2.SampleLevel(s2_s, r6.xyz, 0).xyz;
  r6.xyz = t3.SampleLevel(s3_s, r7.xyz, 0).xyz;
  r5.xyz = -r6.xyz + r5.xyz;
  r5.xyz = r0.www * r5.xyz + r6.xyz;
  r5.xyz = r5.xyz * r3.xyz;
  r5.xyz = float3(0.886227548,0.886227548,0.886227548) * r5.xyz;
  r0.xyz = r0.xyz * r3.xyz + r5.xyz;
  r3.xyz = r4.xyz * float3(0.449999988,0.449999988,0.449999988) + r3.xyz;
  r3.xyz = r3.xyz + -r0.xyz;
  r0.xyz = cb0[126].yyy * r3.xyz + r0.xyz;
  r2.xyz = max(float3(0,0,0), cb3[2].xyz);
  r0.w = cmp(0 < cb0[122].x);
  if (r0.w != 0) {
    r3.xyz = -cb1[8].xyz + r1.xyz;
    r4.xyz = float3(1,1,1) + cb1[9].xyz;
    r3.xyz = cmp(r4.xyz < abs(r3.xyz));
    r0.w = (int)r3.y | (int)r3.x;
    r0.w = (int)r3.z | (int)r0.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.yzw = r1.xxx ? float3(0,1,1) : float3(1,1,0);
    r1.x = 1;
    r2.xyzw = r0.wwww ? r1.yzwx : r2.xyzw;
    o0.w = r2.w;
  } else {
    o0.w = r2.w;
  }
  r0.xyz = r2.xyz + r0.xyz;
  o0.xyz = r0.xyz * v4.www + v4.xyz;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v1.2.57 on Fri Apr 28 13:23:25 2017
//
//
// 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                 4   xyzw        3     NONE   float   xy  
// TEXCOORD                 7   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
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[139], immediateIndexed
dcl_constantbuffer cb1[10], immediateIndexed
dcl_constantbuffer cb2[22], immediateIndexed
dcl_constantbuffer cb3[5], 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_texture3d (float,float,float,float) t2
dcl_resource_texture3d (float,float,float,float) t3
dcl_input_ps linear centroid v0.xyz
dcl_input_ps linear centroid v1.xyzw
dcl_input_ps linear v2.xy
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_temps 8
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
mad r2.xyz, cb0[120].wwww, l(0.000000, 0.000000, 1.000000, 0.000000), cb0[120].xyzx
dp3 r0.w, r2.xyzx, r2.xyzx
rsq r0.w, r0.w
mul r2.xyz, r0.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 r0.w, r0.xyzx, r0.xyzx
rsq r0.w, r0.w
mul r0.xyz, r0.wwww, r0.xyzx
sample_indexable(texture2d)(float,float,float,float) r2.w, v2.xyxx, t1.yzwx, s1
mov_sat r3.xyz, cb3[4].xyzx
mov_sat r2.w, r2.w
mad r3.xyz, r3.xyzx, cb0[118].wwww, cb0[118].xyzx
mad r4.xyz, cb0[119].wwww, l(0.040000, 0.040000, 0.040000, 0.000000), cb0[119].xyzx
mul r5.xy, v3.xyxx, l(1.000000, 0.500000, 0.000000, 0.000000)
mad r5.zw, v3.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 r1.w, r5.w, l(0.00392156886), r6.w
add r1.w, r1.w, l(-0.00196078443)
mad r1.w, r1.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 r1.w, r1.w
add r1.w, r1.w, l(-0.0185813606)
mad r5.xyzw, r5.xyzw, cb2[19].xyzw, cb2[21].xyzw
mov r0.w, l(1.000000)
dp4 r0.x, r5.xyzw, r0.xyzw
max r0.x, r0.x, l(0.000000)
mul r0.x, r0.x, r1.w
mul r0.xyz, r6.xyzx, r0.xxxx
mul r0.xyz, r0.xyzx, cb0[138].xyzx
add r5.xyz, r1.xyzx, -cb0[129].xyzx
mul r6.xyz, r5.xyzx, cb0[131].xyzx
add r7.xyz, r1.xyzx, -cb0[130].xyzx
mul r7.xyz, r7.xyzx, cb0[132].xyzx
mad r5.xyz, r5.xyzx, cb0[131].xyzx, l(-0.500000, -0.500000, -0.500000, 0.000000)
add r5.xyz, -|r5.xyzx|, l(0.500000, 0.500000, 0.500000, 0.000000)
mul_sat r5.xyz, r5.xyzx, l(6.000000, 6.000000, 6.000000, 0.000000)
mul r0.w, r5.y, r5.x
mul r0.w, r5.z, r0.w
sample_l_indexable(texture3d)(float,float,float,float) r5.xyz, r6.xyzx, t2.xyzw, s2, l(0.000000)
sample_l_indexable(texture3d)(float,float,float,float) r6.xyz, r7.xyzx, t3.xyzw, s3, l(0.000000)
add r5.xyz, r5.xyzx, -r6.xyzx
mad r5.xyz, r0.wwww, r5.xyzx, r6.xyzx
mul r5.xyz, r3.xyzx, r5.xyzx
mul r5.xyz, r5.xyzx, l(0.886227548, 0.886227548, 0.886227548, 0.000000)
mad r0.xyz, r0.xyzx, r3.xyzx, r5.xyzx
mad r3.xyz, r4.xyzx, l(0.450000, 0.450000, 0.450000, 0.000000), r3.xyzx
add r3.xyz, -r0.xyzx, r3.xyzx
mad r0.xyz, cb0[126].yyyy, r3.xyzx, r0.xyzx
max r2.xyz, cb3[2].xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
lt r0.w, l(0.000000), cb0[122].x
if_nz r0.w
  add r3.xyz, r1.xyzx, -cb1[8].xyzx
  add r4.xyz, cb1[9].xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
  lt r3.xyz, r4.xyzx, |r3.xyzx|
  or r0.w, r3.y, r3.x
  or r0.w, r3.z, r0.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.yzw, r1.xxxx, l(0,0,1.000000,1.000000), l(0,1.000000,1.000000,0)
  mov r1.x, l(1.000000)
  movc r2.xyzw, r0.wwww, r1.yzwx, r2.xyzw
  mov o0.w, r2.w
else 
  mov o0.w, r2.w
endif 
add r0.xyz, r0.xyzx, r2.xyzx
mad o0.xyz, r0.xyzx, v4.wwww, v4.xyzx
ret 
// Approximately 0 instruction slots used

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