// Model 3 Batch DHR
// ---- Created with 3Dmigoto v1.2.65 on Thu Sep 21 20:33:52 2017
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 cb3 : register(b3)
{
  float4 cb3[6];
}

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

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

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




// 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 : SV_Position0,
  uint v4 : 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,r5,r6,r7,r8;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xyz = v1.zxy * v0.yzx;
  r0.xyz = v1.yzx * v0.zxy + -r0.xyz;
  r0.xyz = v1.www * r0.xyz;
  r1.xyzw = cb0[37].xyzw * v3.yyyy;
  r1.xyzw = v3.xxxx * cb0[36].xyzw + r1.xyzw;
  r1.xyzw = v3.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);
  
  r0.w = dot(-r1.xyz, -r1.xyz);
  r0.w = rsqrt(r0.w);
  r2.xyz = -r1.xyz * r0.www;
  r3.xy = float2(-0.5,-0.5) * cb3[5].zy;
  r0.w = t0.Sample(s0_s, v2.xy).y;
  r0.w = cb3[5].z * r0.w + r3.x;
  r4.x = dot(v0.xyz, r2.xyz);
  r4.y = dot(r0.xyz, r2.xyz);
  r2.xy = r4.xy * r0.ww + v2.xy;
  r0.w = t0.Sample(s0_s, r2.xy).y;
  r0.w = cb3[5].y * r0.w + r3.y;
  r2.xy = r4.xy * r0.ww + r2.xy;
  r2.zw = t1.Sample(s1_s, r2.xy).xy;
  r3.xy = r2.zw * float2(2,2) + float2(-1,-1);
  r0.w = dot(r3.xy, r3.xy);
  r0.w = 1 + -r0.w;
  r0.w = max(0, r0.w);
  r3.z = sqrt(r0.w);
  r3.xyz = r3.xyz * cb0[122].www + cb0[122].xyz;
  r0.w = dot(r3.xyz, r3.xyz);
  r0.w = rsqrt(r0.w);
  r3.xyz = r3.xyz * r0.www;
  r0.xyz = r3.yyy * r0.xyz;
  r0.xyz = r3.xxx * v0.xyz + r0.xyz;
  r0.xyz = r3.zzz * v1.xyz + r0.xyz;
  r0.w = dot(r0.xyz, r0.xyz);
  r0.w = rsqrt(r0.w);
  r0.xyz = r0.xyz * r0.www;
  r3.xyz = t2.Sample(s2_s, r2.xy).xyz;
  r3.xyz = saturate(cb3[3].xyz * r3.xyz);
  r2.xyz = t0.Sample(s0_s, r2.xy).zwx;
  r0.w = 1 + -r2.z;
  r0.w = saturate(r0.w * r2.y);
  r1.w = saturate(r2.z * 0.800000012 + 0.200000003);
  r2.xy = saturate(r2.xy);
  o2.z = r1.w * cb0[123].y + cb0[123].x;
  r1.w = cmp(0 < cb1[11].y);
  o5.x = r1.w ? cb2[5].x : 1;
  r1.w = 0.0799999982 * r0.w;
  r4.xyz = -r0.www * float3(0.0799999982,0.0799999982,0.0799999982) + r3.xyz;
  r4.xyz = r2.xxx * r4.xyz + r1.www;
  r5.xyz = -r3.xyz * r2.xxx + r3.xyz;
  r5.xyz = r5.xyz * cb0[120].www + cb0[120].xyz;
  r4.xyz = r4.xyz * cb0[121].www + cb0[121].xyz;
  r6.xyz = r0.yzy * r0.yzx;
  r7.yw = r0.zz * r0.yx;
  r1.w = r0.x * r0.x + -r6.x;
  r8.yzw = float3(-1.02332771,1.02332771,-1.02332771) * r0.yzx;
  r7.xz = r6.zy * float2(1,3) + float2(0,-1);
  r6.xyzw = float4(0.858085215,-0.858085215,0.247708291,-0.858085215) * r7.xyzw;
  r1.w = 0.429042608 * r1.w;
  r8.x = 0.886227548;
  r2.z = dot(cb2[8].xyzw, r8.xyzw);
  r2.w = dot(cb2[11].xyzw, r6.xyzw);
  r2.z = r2.z + r2.w;
  r7.x = cb2[14].x * r1.w + r2.z;
  r2.z = dot(cb2[9].xyzw, r8.xyzw);
  r2.w = dot(cb2[12].xyzw, r6.xyzw);
  r2.z = r2.z + r2.w;
  r7.y = cb2[14].y * r1.w + r2.z;
  r2.z = dot(cb2[10].xyzw, r8.xyzw);
  r2.w = dot(cb2[13].xyzw, r6.xyzw);
  r2.z = r2.z + r2.w;
  r7.z = cb2[14].z * r1.w + r2.z;
  r6.xyz = max(float3(0,0,0), r7.xyz);
  r6.xyz = cb0[140].xyz * r6.xyz;
  r1.w = dot(r6.xyz, float3(0.300000012,0.589999974,0.109999999));
  r6.xyz = r6.xyz * r5.xyz;
  r6.xyz = r6.xyz * r2.yyy;
  r4.xyz = r4.xyz * float3(0.449999988,0.449999988,0.449999988) + r5.xyz;
  r5.xyz = max(float3(0,0,0), cb3[2].xyz);
  r2.z = cmp(0 < cb0[124].x);
  if (r2.z != 0) {
    r1.xyz = -cb0[58].xyz + r1.xyz;
    r7.xyz = -cb1[8].xyz + r1.xyz;
    r8.xyz = float3(1,1,1) + cb1[9].xyz;
    r7.xyz = cmp(r8.xyz < abs(r7.xyz));
    r2.z = (int)r7.y | (int)r7.x;
    r2.z = (int)r7.z | (int)r2.z;
    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.xyz = r1.xxx ? float3(0,1,1) : float3(1,1,0);
    r5.xyz = r2.zzz ? r1.xyz : r5.xyz;
  }
  r1.xyz = cb0[128].xxx * r4.xyz + r6.xyz;
  o0.xyz = r1.xyz + r5.xyz;
  r1.xyz = float3(0.0078125,0.0078125,0.0078125) * v3.xyx;
  r1.xyz = frac(r1.xyz);
  r1.xyz = r1.xyz * float3(128,128,128) + float3(-64.3406219,-72.4656219,-64.3406219);
  r1.xyz = r1.xyz * r1.xyy;
  r1.x = dot(r1.xyz, float3(20.390625,60.703125,2.42812085));
  r1.x = frac(r1.x);
  r1.x = -0.5 + r1.x;
  o1.xyz = r0.xyz * float3(0.5,0.5,0.5) + float3(0.5,0.5,0.5);
  r0.x = r1.w * r2.y + 0.00390625;
  r0.x = log2(r0.x);
  r0.x = r0.x * 0.0625 + 0.5;
  o3.w = r1.x * 0.00392156886 + r0.x;
  o0.w = 0;
  o1.w = cb1[11].x;
  o2.x = r2.x;
  o2.w = 0.75686276;
  o2.y = r0.w;
  o3.xyz = r3.xyz;
  o4.xyzw = float4(0,0,0,0);
  o5.yzw = float3(1,1,1);
  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  
// SV_Position              0   xyzw        3      POS   float   xyz 
// SV_IsFrontFace           0   x           4    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 cb0[141], immediateIndexed
dcl_constantbuffer cb1[12], immediateIndexed
dcl_constantbuffer cb2[15], immediateIndexed
dcl_constantbuffer cb3[6], 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 centroid v0.xyz
dcl_input_ps linear centroid v1.xyzw
dcl_input_ps linear v2.xy
dcl_input_ps_siv linear noperspective v3.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 9
mul r0.xyz, v0.yzxy, v1.zxyz
mad r0.xyz, v1.yzxy, v0.zxyz, -r0.xyzx
mul r0.xyz, r0.xyzx, v1.wwww
mul r1.xyzw, v3.yyyy, cb0[37].xyzw
mad r1.xyzw, v3.xxxx, cb0[36].xyzw, r1.xyzw
mad r1.xyzw, v3.zzzz, cb0[38].xyzw, r1.xyzw
add r1.xyzw, r1.xyzw, cb0[39].xyzw
div r1.xyz, r1.xyzx, r1.wwww
dp3 r0.w, -r1.xyzx, -r1.xyzx
rsq r0.w, r0.w
mul r2.xyz, r0.wwww, -r1.xyzx
mul r3.xy, cb3[5].zyzz, l(-0.500000, -0.500000, 0.000000, 0.000000)
sample_indexable(texture2d)(float,float,float,float) r0.w, v2.xyxx, t0.xzwy, s0
mad r0.w, cb3[5].z, r0.w, r3.x
dp3 r4.x, v0.xyzx, r2.xyzx
dp3 r4.y, r0.xyzx, r2.xyzx
mad r2.xy, r4.xyxx, r0.wwww, v2.xyxx
sample_indexable(texture2d)(float,float,float,float) r0.w, r2.xyxx, t0.xzwy, s0
mad r0.w, cb3[5].y, r0.w, r3.y
mad r2.xy, r4.xyxx, r0.wwww, r2.xyxx
sample_indexable(texture2d)(float,float,float,float) r2.zw, r2.xyxx, t1.zwxy, s1
mad r3.xy, r2.zwzz, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
dp2 r0.w, r3.xyxx, r3.xyxx
add r0.w, -r0.w, l(1.000000)
max r0.w, r0.w, l(0.000000)
sqrt r3.z, r0.w
mad r3.xyz, r3.xyzx, cb0[122].wwww, cb0[122].xyzx
dp3 r0.w, r3.xyzx, r3.xyzx
rsq r0.w, r0.w
mul r3.xyz, r0.wwww, r3.xyzx
mul r0.xyz, r0.xyzx, r3.yyyy
mad r0.xyz, r3.xxxx, v0.xyzx, r0.xyzx
mad r0.xyz, r3.zzzz, v1.xyzx, 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) r3.xyz, r2.xyxx, t2.xyzw, s2
mul_sat r3.xyz, r3.xyzx, cb3[3].xyzx
sample_indexable(texture2d)(float,float,float,float) r2.xyz, r2.xyxx, t0.zwxy, s0
add r0.w, -r2.z, l(1.000000)
mul_sat r0.w, r2.y, r0.w
mad_sat r1.w, r2.z, l(0.800000), l(0.200000)
mov_sat r2.xy, r2.xyxx
mad o2.z, r1.w, cb0[123].y, cb0[123].x
lt r1.w, l(0.000000), cb1[11].y
movc o5.x, r1.w, cb2[5].x, l(1.000000)
mul r1.w, r0.w, l(0.080000)
mad r4.xyz, -r0.wwww, l(0.080000, 0.080000, 0.080000, 0.000000), r3.xyzx
mad r4.xyz, r2.xxxx, r4.xyzx, r1.wwww
mad r5.xyz, -r3.xyzx, r2.xxxx, r3.xyzx
mad r5.xyz, r5.xyzx, cb0[120].wwww, cb0[120].xyzx
mad r4.xyz, r4.xyzx, cb0[121].wwww, cb0[121].xyzx
mul r6.xyz, r0.yzxy, r0.yzyy
mul r7.yw, r0.yyyx, r0.zzzz
mad r1.w, r0.x, r0.x, -r6.x
mul r8.yzw, r0.yyzx, l(0.000000, -1.023328, 1.023328, -1.023328)
mad r7.xz, r6.zzyz, l(1.000000, 0.000000, 3.000000, 0.000000), l(0.000000, 0.000000, -1.000000, 0.000000)
mul r6.xyzw, r7.xyzw, l(0.858085, -0.858085, 0.247708, -0.858085)
mul r1.w, r1.w, l(0.429043)
mov r8.x, l(0.886228)
dp4 r2.z, cb2[8].xyzw, r8.xyzw
dp4 r2.w, cb2[11].xyzw, r6.xyzw
add r2.z, r2.w, r2.z
mad r7.x, cb2[14].x, r1.w, r2.z
dp4 r2.z, cb2[9].xyzw, r8.xyzw
dp4 r2.w, cb2[12].xyzw, r6.xyzw
add r2.z, r2.w, r2.z
mad r7.y, cb2[14].y, r1.w, r2.z
dp4 r2.z, cb2[10].xyzw, r8.xyzw
dp4 r2.w, cb2[13].xyzw, r6.xyzw
add r2.z, r2.w, r2.z
mad r7.z, cb2[14].z, r1.w, r2.z
max r6.xyz, r7.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
mul r6.xyz, r6.xyzx, cb0[140].xyzx
dp3 r1.w, r6.xyzx, l(0.300000, 0.590000, 0.110000, 0.000000)
mul r6.xyz, r5.xyzx, r6.xyzx
mul r6.xyz, r2.yyyy, r6.xyzx
mad r4.xyz, r4.xyzx, l(0.450000, 0.450000, 0.450000, 0.000000), r5.xyzx
max r5.xyz, cb3[2].xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
lt r2.z, l(0.000000), cb0[124].x
if_nz r2.z
  add r1.xyz, r1.xyzx, -cb0[58].xyzx
  add r7.xyz, r1.xyzx, -cb1[8].xyzx
  add r8.xyz, cb1[9].xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
  lt r7.xyz, r8.xyzx, |r7.xyzx|
  or r2.z, r7.y, r7.x
  or r2.z, r7.z, r2.z
  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.xyz, r1.xxxx, l(0,1.000000,1.000000,0), l(1.000000,1.000000,0,0)
  movc r5.xyz, r2.zzzz, r1.xyzx, r5.xyzx
endif 
mad r1.xyz, cb0[128].xxxx, r4.xyzx, r6.xyzx
add o0.xyz, r5.xyzx, r1.xyzx
mul r1.xyz, v3.xyxx, l(0.007813, 0.007813, 0.007813, 0.000000)
frc r1.xyz, r1.xyzx
mad r1.xyz, r1.xyzx, l(128.000000, 128.000000, 128.000000, 0.000000), l(-64.340622, -72.465622, -64.340622, 0.000000)
mul r1.xyz, r1.xyyx, r1.xyzx
dp3 r1.x, r1.xyzx, l(20.390625, 60.703125, 2.428121, 0.000000)
frc r1.x, r1.x
add r1.x, r1.x, l(-0.500000)
mad o1.xyz, r0.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000), l(0.500000, 0.500000, 0.500000, 0.000000)
mad r0.x, r1.w, r2.y, l(0.003906)
log r0.x, r0.x
mad r0.x, r0.x, l(0.062500), l(0.500000)
mad o3.w, r1.x, l(0.003922), r0.x
mov o0.w, l(0)
mov o1.w, cb1[11].x
mov o2.x, r2.x
mov o2.w, l(0.756863)
mov o2.y, r0.w
mov o3.xyz, r3.xyzx
mov o4.xyzw, l(0,0,0,0)
mov o5.yzw, l(0,1.000000,1.000000,1.000000)
ret 
// Approximately 0 instruction slots used

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