// Model 3 Batch DHR
// ---- Created with 3Dmigoto v1.2.65 on Wed Sep 20 22:55:11 2017
Texture3D<float4> t1 : register(t1);

Texture3D<float4> t0 : register(t0);

SamplerState s1_s : register(s1);

SamplerState s0_s : register(s0);

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

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

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




// 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 : TEXCOORD7,
  float4 v3 : SV_Position0,
  uint v4 : SV_IsFrontFace0,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1,r2,r3,r4,r5,r6;
  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);
  
  r1.xyz = -cb0[58].xyz + r1.xyz;
  r2.xyz = cb0[122].www * float3(0,0,1) + cb0[122].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.xyz + r0.xyz;
  r0.xyz = r2.zzz * v1.xyz + r0.xyz;
  r0.w = dot(r0.xyz, r0.xyz);
  r0.w = rsqrt(r0.w);
  r0.xyz = r0.xyz * r0.www;
  r2.xyz = saturate(cb2[5].xyz);
  r2.xyz = r2.xyz * cb0[120].www + cb0[120].xyz;
  r3.xyz = cb0[121].www * float3(0.0399999991,0.0399999991,0.0399999991) + cb0[121].xyz;
  r0.w = 1;
  r4.x = dot(cb0[151].xyzw, r0.xyzw);
  r4.y = dot(cb0[152].xyzw, r0.xyzw);
  r4.z = dot(cb0[153].xyzw, r0.xyzw);
  r5.xyzw = r0.xyzz * r0.yzzx;
  r6.x = dot(cb0[154].xyzw, r5.xyzw);
  r6.y = dot(cb0[155].xyzw, r5.xyzw);
  r6.z = dot(cb0[156].xyzw, r5.xyzw);
  r0.y = r0.y * r0.y;
  r0.x = r0.x * r0.x + -r0.y;
  r0.yzw = r6.xyz + r4.xyz;
  r0.xyz = cb0[157].xyz * r0.xxx + r0.yzw;
  r0.xyz = max(float3(0,0,0), r0.xyz);
  r0.xyz = cb0[150].xyz * r0.xyz;
  r4.xyz = -cb0[131].xyz + r1.xyz;
  r5.xyz = cb0[133].xyz * r4.xyz;
  r6.xyz = -cb0[132].xyz + r1.xyz;
  r6.xyz = cb0[134].xyz * r6.xyz;
  r4.xyz = r4.xyz * cb0[133].xyz + float3(-0.5,-0.5,-0.5);
  r4.xyz = float3(0.5,0.5,0.5) + -abs(r4.xyz);
  r4.xyz = saturate(float3(6,6,6) * r4.xyz);
  r0.w = r4.x * r4.y;
  r0.w = r0.w * r4.z;
  r4.xyz = t0.SampleLevel(s0_s, r5.xyz, 0).xyz;
  r5.xyz = t1.SampleLevel(s1_s, r6.xyz, 0).xyz;
  r4.xyz = -r5.xyz + r4.xyz;
  r4.xyz = r0.www * r4.xyz + r5.xyz;
  r4.xyz = r4.xyz * r2.xyz;
  r5.xyz = float3(0.886227548,0.886227548,0.886227548) * r4.xyz;
  r3.xyz = r3.xyz * float3(0.449999988,0.449999988,0.449999988) + r2.xyz;
  r3.xyz = -r4.xyz * float3(0.886227548,0.886227548,0.886227548) + r3.xyz;
  r3.xyz = cb0[128].xxx * r3.xyz + r5.xyz;
  r4.xyz = max(float3(0,0,0), cb2[2].xyz);
  r0.w = cmp(0 < cb0[124].x);
  if (r0.w != 0) {
    r5.xyz = -cb1[8].xyz + r1.xyz;
    r6.xyz = float3(1,1,1) + cb1[9].xyz;
    r5.xyz = cmp(r6.xyz < abs(r5.xyz));
    r0.w = (int)r5.y | (int)r5.x;
    r0.w = (int)r5.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;
    r4.w = 0.100000001;
    r4.xyzw = r0.wwww ? r1.yzwx : r4.xyzw;
    o0.w = r4.w;
  } else {
    o0.w = 0.100000001;
  }
  r0.xyz = r0.xyz * r2.xyz + r3.xyz;
  r0.xyz = r0.xyz + r4.xyz;
  o0.xyz = r0.xyz * v2.www + v2.xyz;
  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                 7   xyzw        2     NONE   float   xyzw
// 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
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[158], immediateIndexed
dcl_constantbuffer cb1[10], immediateIndexed
dcl_constantbuffer cb2[6], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_resource_texture3d (float,float,float,float) t0
dcl_resource_texture3d (float,float,float,float) t1
dcl_input_ps linear centroid v0.xyz
dcl_input_ps linear centroid v1.xyzw
dcl_input_ps linear v2.xyzw
dcl_input_ps_siv linear noperspective v3.xyz, position
dcl_output o0.xyzw
dcl_temps 7
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
add r1.xyz, r1.xyzx, -cb0[58].xyzx
mad r2.xyz, cb0[122].wwww, l(0.000000, 0.000000, 1.000000, 0.000000), cb0[122].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.xyzx, r0.xyzx
mad r0.xyz, r2.zzzz, v1.xyzx, r0.xyzx
dp3 r0.w, r0.xyzx, r0.xyzx
rsq r0.w, r0.w
mul r0.xyz, r0.wwww, r0.xyzx
mov_sat r2.xyz, cb2[5].xyzx
mad r2.xyz, r2.xyzx, cb0[120].wwww, cb0[120].xyzx
mad r3.xyz, cb0[121].wwww, l(0.040000, 0.040000, 0.040000, 0.000000), cb0[121].xyzx
mov r0.w, l(1.000000)
dp4 r4.x, cb0[151].xyzw, r0.xyzw
dp4 r4.y, cb0[152].xyzw, r0.xyzw
dp4 r4.z, cb0[153].xyzw, r0.xyzw
mul r5.xyzw, r0.yzzx, r0.xyzz
dp4 r6.x, cb0[154].xyzw, r5.xyzw
dp4 r6.y, cb0[155].xyzw, r5.xyzw
dp4 r6.z, cb0[156].xyzw, r5.xyzw
mul r0.y, r0.y, r0.y
mad r0.x, r0.x, r0.x, -r0.y
add r0.yzw, r4.xxyz, r6.xxyz
mad r0.xyz, cb0[157].xyzx, r0.xxxx, r0.yzwy
max r0.xyz, r0.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
mul r0.xyz, r0.xyzx, cb0[150].xyzx
add r4.xyz, r1.xyzx, -cb0[131].xyzx
mul r5.xyz, r4.xyzx, cb0[133].xyzx
add r6.xyz, r1.xyzx, -cb0[132].xyzx
mul r6.xyz, r6.xyzx, cb0[134].xyzx
mad r4.xyz, r4.xyzx, cb0[133].xyzx, l(-0.500000, -0.500000, -0.500000, 0.000000)
add r4.xyz, -|r4.xyzx|, l(0.500000, 0.500000, 0.500000, 0.000000)
mul_sat r4.xyz, r4.xyzx, l(6.000000, 6.000000, 6.000000, 0.000000)
mul r0.w, r4.y, r4.x
mul r0.w, r4.z, r0.w
sample_l_indexable(texture3d)(float,float,float,float) r4.xyz, r5.xyzx, t0.xyzw, s0, l(0.000000)
sample_l_indexable(texture3d)(float,float,float,float) r5.xyz, r6.xyzx, t1.xyzw, s1, l(0.000000)
add r4.xyz, r4.xyzx, -r5.xyzx
mad r4.xyz, r0.wwww, r4.xyzx, r5.xyzx
mul r4.xyz, r2.xyzx, r4.xyzx
mul r5.xyz, r4.xyzx, l(0.886228, 0.886228, 0.886228, 0.000000)
mad r3.xyz, r3.xyzx, l(0.450000, 0.450000, 0.450000, 0.000000), r2.xyzx
mad r3.xyz, -r4.xyzx, l(0.886228, 0.886228, 0.886228, 0.000000), r3.xyzx
mad r3.xyz, cb0[128].xxxx, r3.xyzx, r5.xyzx
max r4.xyz, cb2[2].xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
lt r0.w, l(0.000000), cb0[124].x
if_nz r0.w
  add r5.xyz, r1.xyzx, -cb1[8].xyzx
  add r6.xyz, cb1[9].xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
  lt r5.xyz, r6.xyzx, |r5.xyzx|
  or r0.w, r5.y, r5.x
  or r0.w, r5.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)
  mov r4.w, l(0.100000)
  movc r4.xyzw, r0.wwww, r1.yzwx, r4.xyzw
  mov o0.w, r4.w
else 
  mov o0.w, l(0.100000)
endif 
mad r0.xyz, r0.xyzx, r2.xyzx, r3.xyzx
add r0.xyz, r4.xyzx, r0.xyzx
mad o0.xyz, r0.xyzx, v2.wwww, v2.xyzx
ret 
// Approximately 0 instruction slots used

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