// Smoke
Texture3D<float4> t5 : register(t5);

Texture3D<float4> t4 : register(t4);

Texture3D<float4> t3 : register(t3);

Texture3D<float4> t2 : register(t2);

Texture2D<float4> t1 : register(t1);

Texture2D<float4> t0 : register(t0);

SamplerState s5_s : register(s5);

SamplerState s4_s : register(s4);

SamplerState s3_s : register(s3);

SamplerState s2_s : register(s2);

SamplerState s1_s : register(s1);

SamplerState s0_s : register(s0);

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

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( 
  float4 v0 : TEXCOORD10,
  float4 v1 : TEXCOORD11,
  float4 v2 : TEXCOORD2,
  float4 v3 : TEXCOORD3,
  float4 v4 : PARTICLE_POSITION0,
  float3 v5 : PARTICLE_LIGHTING_OFFSET0,
  float4 v6 : TEXCOORD7,
  float4 v7 : SV_Position0,
  uint v8 : SV_IsFrontFace0,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xyzw = cb0[37].xyzw * v7.yyyy;
  r0.xyzw = v7.xxxx * cb0[36].xyzw + r0.xyzw;
  r0.xyzw = v7.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);
  
  r1.xyz = -v4.xyz + r0.xyz;
  r0.w = dot(r1.xyz, r1.xyz);
  r0.w = v4.w * v4.w + -r0.w;
  r1.x = cmp(0 < r0.w);
  r0.w = sqrt(r0.w);
  r1.yzw = -cb0[48].xyz * r0.www + r0.xyz;
  r1.yzw = -v4.xyz + r1.yzw;
  r0.w = dot(r1.yzw, r1.yzw);
  r0.w = rsqrt(r0.w);
  r1.yzw = r1.yzw * r0.www;
  r1.xyz = r1.xxx ? r1.yzw : float3(0,0,1);
  r2.xyz = cb0[49].zxy * r1.yzx;
  r2.xyz = cb0[49].yzx * r1.zxy + -r2.xyz;
  r0.w = dot(r2.xyz, r2.xyz);
  r0.w = rsqrt(r0.w);
  r2.xyz = r2.xyz * r0.www;
  r3.xyz = r2.yzx * r1.zxy;
  r3.xyz = r1.yzx * r2.zxy + -r3.xyz;
  r4.xy = -cb0[116].xy + v7.xy;
  r4.xy = r4.xy * cb0[117].zw + float2(-0.5,-0.5);
  r4.xy = v7.ww * r4.xy;
  r4.z = v7.w;
  r4.xyw = float3(2,-2,1) * r4.xyz;
  r0.xyz = -cb0[58].xyz + r0.xyz;
  r5.xyz = cb0[122].www * float3(0,0,1) + cb0[122].xyz;
  r0.w = dot(r5.xyz, r5.xyz);
  r0.w = rsqrt(r0.w);
  r5.xyz = r5.xyz * r0.www;
  r3.xyz = r5.yyy * r3.xyz;
  r2.xyz = r5.xxx * r2.xyz + r3.xyz;
  r1.xyz = r5.zzz * r1.xyz + r2.xyz;
  r0.w = dot(r1.xyz, r1.xyz);
  r0.w = rsqrt(r0.w);
  r1.xyz = r1.xyz * r0.www;
  r2.xyz = cb2[1].xyz + v2.xxx;
  r0.w = t0.Sample(s0_s, v3.xy).x;
  r2.w = v2.w * r0.w;
  r2.w = 0.600000024 * r2.w;
  r3.xyz = cb0[55].xyz + -r0.xyz;
  r3.x = dot(r3.xyz, r3.xyz);
  r3.x = sqrt(r3.x);
  r3.x = 0.00200000009 * r3.x;
  r3.x = min(1, r3.x);
  r0.w = r0.w * -150 + 200;
  r0.w = max(9.99999975e-006, r0.w);
  r3.yz = r4.xy / r4.ww;
  r3.yz = r3.yz * cb0[54].xy + cb0[54].wz;
  r3.y = t1.SampleLevel(s1_s, r3.yz, 0).x;
  r3.z = r3.y * cb0[53].x + cb0[53].y;
  r3.y = r3.y * cb0[53].z + -cb0[53].w;
  r3.y = 1 / r3.y;
  r3.y = r3.z + r3.y;
  r3.y = -r4.z * 1 + r3.y;
  r0.w = saturate(r3.y / r0.w);
  r0.w = r3.x * r0.w;
  r3.w = saturate(r2.w * r0.w);
  r4.xyz = saturate(cb2[4].xyz);
  r4.xyz = r4.xyz * cb0[120].www + cb0[120].xyz;
  r5.xyz = cb0[121].www * float3(0.0399999991,0.0399999991,0.0399999991) + cb0[121].xyz;
  r1.w = 1;
  r6.x = dot(cb0[151].xyzw, r1.xyzw);
  r6.y = dot(cb0[152].xyzw, r1.xyzw);
  r6.z = dot(cb0[153].xyzw, r1.xyzw);
  r7.xyzw = r1.xyzz * r1.yzzx;
  r8.x = dot(cb0[154].xyzw, r7.xyzw);
  r8.y = dot(cb0[155].xyzw, r7.xyzw);
  r8.z = dot(cb0[156].xyzw, r7.xyzw);
  r0.w = r1.y * r1.y;
  r0.w = r1.x * r1.x + -r0.w;
  r6.xyz = r8.xyz + r6.xyz;
  r6.xyz = cb0[157].xyz * r0.www + r6.xyz;
  r6.xyz = max(float3(0,0,0), r6.xyz);
  r6.xyz = cb0[150].xyz * r6.xyz;
  r7.xyz = v5.xyz + r0.xyz;
  r8.xyz = -cb0[131].xyz + r7.xyz;
  r9.xyz = cb0[133].xyz * r8.xyz;
  r7.xyz = -cb0[132].xyz + r7.xyz;
  r7.xyz = cb0[134].xyz * r7.xyz;
  r8.xyz = r8.xyz * cb0[133].xyz + float3(-0.5,-0.5,-0.5);
  r8.xyz = float3(0.5,0.5,0.5) + -abs(r8.xyz);
  r8.xyz = saturate(float3(6,6,6) * r8.xyz);
  r0.w = r8.x * r8.y;
  r0.w = r0.w * r8.z;
  r8.xyz = t2.SampleLevel(s2_s, r9.xyz, 0).xyz;
  r10.xyz = t3.SampleLevel(s3_s, r7.xyz, 0).xyz;
  r8.xyz = -r10.xyz + r8.xyz;
  r8.xyz = r0.www * r8.xyz + r10.xyz;
  r9.xyz = t4.SampleLevel(s4_s, r9.xyz, 0).xyz;
  r7.xyz = t5.SampleLevel(s5_s, r7.xyz, 0).xyz;
  r9.xyz = r9.xyz + -r7.xyz;
  r7.xyz = r0.www * r9.xyz + r7.xyz;
  r0.w = dot(r8.xyz, float3(0.300000012,0.589999974,0.109999999));
  r9.xyz = r8.xyz / r0.www;
  r10.yzw = r9.xxx * r7.xyz;
  r11.yzw = r9.yyy * r7.xyz;
  r7.yzw = r9.zzz * r7.xyz;
  r1.yzw = float3(-1.02332771,1.02332771,-1.02332771) * r1.yzx;
  r10.x = r8.x;
  r1.x = 0.886227548;
  r9.x = dot(r10.xyzw, r1.xyzw);
  r11.x = r8.y;
  r9.y = dot(r11.xyzw, r1.xyzw);
  r7.x = r8.z;
  r9.z = dot(r7.xyzw, r1.xyzw);
  r1.xyz = max(float3(0,0,0), r9.xyz);
  r7.xyz = r4.xyz * r1.xyz;
  r5.xyz = r5.xyz * float3(0.449999988,0.449999988,0.449999988) + r4.xyz;
  r1.xyz = -r4.xyz * r1.xyz + r5.xyz;
  r1.xyz = cb0[128].xxx * r1.xyz + r7.xyz;
  r3.xyz = max(float3(0,0,0), r2.xyz);
  r0.w = cmp(0 < cb0[124].x);
  if (r0.w != 0) {
    r2.xyz = -cb1[8].xyz + r0.xyz;
    r5.xyz = float3(1,1,1) + cb1[9].xyz;
    r2.xyz = cmp(r5.xyz < abs(r2.xyz));
    r0.w = (int)r2.y | (int)r2.x;
    r0.w = (int)r2.z | (int)r0.w;
    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);
    r2.yzw = r0.xxx ? float3(0,1,1) : float3(1,1,0);
    r2.x = 1;
    r3.xyzw = r0.wwww ? r2.yzwx : r3.xyzw;
    o0.w = r3.w;
  } else {
    o0.w = r3.w;
  }
  r0.xyz = r6.xyz * r4.xyz + r1.xyz;
  r0.xyz = r0.xyz + r3.xyz;
  o0.xyz = r0.xyz * v6.www + v6.xyz;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v1.2.65 on Wed Sep 20 23:23:12 2017
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                10   xyzw        0     NONE   float       
// TEXCOORD                11   xyzw        1     NONE   float       
// TEXCOORD                 2   xyzw        2     NONE   float   x  w
// TEXCOORD                 3   xyzw        3     NONE   float   xy  
// PARTICLE_POSITION        0   xyzw        4     NONE   float   xyzw
// PARTICLE_LIGHTING_OFFSET     0   xyz         5     NONE   float   xyz 
// TEXCOORD                 7   xyzw        6     NONE   float   xyzw
// SV_Position              0   xyzw        7      POS   float   xyzw
// SV_IsFrontFace           0   x           8    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[5], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_sampler s2, mode_default
dcl_sampler s3, mode_default
dcl_sampler s4, mode_default
dcl_sampler s5, 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_resource_texture3d (float,float,float,float) t4
dcl_resource_texture3d (float,float,float,float) t5
dcl_input_ps linear v2.xw
dcl_input_ps linear v3.xy
dcl_input_ps linear v4.xyzw
dcl_input_ps linear v5.xyz
dcl_input_ps linear v6.xyzw
dcl_input_ps_siv linear noperspective v7.xyzw, position
dcl_output o0.xyzw
dcl_temps 12
mul r0.xyzw, v7.yyyy, cb0[37].xyzw
mad r0.xyzw, v7.xxxx, cb0[36].xyzw, r0.xyzw
mad r0.xyzw, v7.zzzz, cb0[38].xyzw, r0.xyzw
add r0.xyzw, r0.xyzw, cb0[39].xyzw
div r0.xyz, r0.xyzx, r0.wwww
add r1.xyz, r0.xyzx, -v4.xyzx
dp3 r0.w, r1.xyzx, r1.xyzx
mad r0.w, v4.w, v4.w, -r0.w
lt r1.x, l(0.000000), r0.w
sqrt r0.w, r0.w
mad r1.yzw, -cb0[48].xxyz, r0.wwww, r0.xxyz
add r1.yzw, r1.yyzw, -v4.xxyz
dp3 r0.w, r1.yzwy, r1.yzwy
rsq r0.w, r0.w
mul r1.yzw, r0.wwww, r1.yyzw
movc r1.xyz, r1.xxxx, r1.yzwy, l(0,0,1.000000,0)
mul r2.xyz, r1.yzxy, cb0[49].zxyz
mad r2.xyz, cb0[49].yzxy, r1.zxyz, -r2.xyzx
dp3 r0.w, r2.xyzx, r2.xyzx
rsq r0.w, r0.w
mul r2.xyz, r0.wwww, r2.xyzx
mul r3.xyz, r1.zxyz, r2.yzxy
mad r3.xyz, r1.yzxy, r2.zxyz, -r3.xyzx
add r4.xy, v7.xyxx, -cb0[116].xyxx
mad r4.xy, r4.xyxx, cb0[117].zwzz, l(-0.500000, -0.500000, 0.000000, 0.000000)
mul r4.xy, r4.xyxx, v7.wwww
mov r4.z, v7.w
mul r4.xyw, r4.xyxz, l(2.000000, -2.000000, 0.000000, 1.000000)
add r0.xyz, r0.xyzx, -cb0[58].xyzx
mad r5.xyz, cb0[122].wwww, l(0.000000, 0.000000, 1.000000, 0.000000), cb0[122].xyzx
dp3 r0.w, r5.xyzx, r5.xyzx
rsq r0.w, r0.w
mul r5.xyz, r0.wwww, r5.xyzx
mul r3.xyz, r3.xyzx, r5.yyyy
mad r2.xyz, r5.xxxx, r2.xyzx, r3.xyzx
mad r1.xyz, r5.zzzz, r1.xyzx, r2.xyzx
dp3 r0.w, r1.xyzx, r1.xyzx
rsq r0.w, r0.w
mul r1.xyz, r0.wwww, r1.xyzx
add r2.xyz, v2.xxxx, cb2[1].xyzx
sample_indexable(texture2d)(float,float,float,float) r0.w, v3.xyxx, t0.yzwx, s0
mul r2.w, r0.w, v2.w
mul r2.w, r2.w, l(0.600000)
add r3.xyz, -r0.xyzx, cb0[55].xyzx
dp3 r3.x, r3.xyzx, r3.xyzx
sqrt r3.x, r3.x
mul r3.x, r3.x, l(0.002000)
min r3.x, r3.x, l(1.000000)
mad r0.w, r0.w, l(-150.000000), l(200.000000)
max r0.w, r0.w, l(0.000010)
div r3.yz, r4.xxyx, r4.wwww
mad r3.yz, r3.yyzy, cb0[54].xxyx, cb0[54].wwzw
sample_l_indexable(texture2d)(float,float,float,float) r3.y, r3.yzyy, t1.yxzw, s1, l(0.000000)
mad r3.z, r3.y, cb0[53].x, cb0[53].y
mad r3.y, r3.y, cb0[53].z, -cb0[53].w
div r3.y, l(1.000000, 1.000000, 1.000000, 1.000000), r3.y
add r3.y, r3.y, r3.z
mad r3.y, -r4.z, l(1.000000), r3.y
div_sat r0.w, r3.y, r0.w
mul r0.w, r0.w, r3.x
mul_sat r3.w, r0.w, r2.w
mov_sat r4.xyz, cb2[4].xyzx
mad r4.xyz, r4.xyzx, cb0[120].wwww, cb0[120].xyzx
mad r5.xyz, cb0[121].wwww, l(0.040000, 0.040000, 0.040000, 0.000000), cb0[121].xyzx
mov r1.w, l(1.000000)
dp4 r6.x, cb0[151].xyzw, r1.xyzw
dp4 r6.y, cb0[152].xyzw, r1.xyzw
dp4 r6.z, cb0[153].xyzw, r1.xyzw
mul r7.xyzw, r1.yzzx, r1.xyzz
dp4 r8.x, cb0[154].xyzw, r7.xyzw
dp4 r8.y, cb0[155].xyzw, r7.xyzw
dp4 r8.z, cb0[156].xyzw, r7.xyzw
mul r0.w, r1.y, r1.y
mad r0.w, r1.x, r1.x, -r0.w
add r6.xyz, r6.xyzx, r8.xyzx
mad r6.xyz, cb0[157].xyzx, r0.wwww, r6.xyzx
max r6.xyz, r6.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
mul r6.xyz, r6.xyzx, cb0[150].xyzx
add r7.xyz, r0.xyzx, v5.xyzx
add r8.xyz, r7.xyzx, -cb0[131].xyzx
mul r9.xyz, r8.xyzx, cb0[133].xyzx
add r7.xyz, r7.xyzx, -cb0[132].xyzx
mul r7.xyz, r7.xyzx, cb0[134].xyzx
mad r8.xyz, r8.xyzx, cb0[133].xyzx, l(-0.500000, -0.500000, -0.500000, 0.000000)
add r8.xyz, -|r8.xyzx|, l(0.500000, 0.500000, 0.500000, 0.000000)
mul_sat r8.xyz, r8.xyzx, l(6.000000, 6.000000, 6.000000, 0.000000)
mul r0.w, r8.y, r8.x
mul r0.w, r8.z, r0.w
sample_l_indexable(texture3d)(float,float,float,float) r8.xyz, r9.xyzx, t2.xyzw, s2, l(0.000000)
sample_l_indexable(texture3d)(float,float,float,float) r10.xyz, r7.xyzx, t3.xyzw, s3, l(0.000000)
add r8.xyz, r8.xyzx, -r10.xyzx
mad r8.xyz, r0.wwww, r8.xyzx, r10.xyzx
sample_l_indexable(texture3d)(float,float,float,float) r9.xyz, r9.xyzx, t4.xyzw, s4, l(0.000000)
sample_l_indexable(texture3d)(float,float,float,float) r7.xyz, r7.xyzx, t5.xyzw, s5, l(0.000000)
add r9.xyz, -r7.xyzx, r9.xyzx
mad r7.xyz, r0.wwww, r9.xyzx, r7.xyzx
dp3 r0.w, r8.xyzx, l(0.300000, 0.590000, 0.110000, 0.000000)
div r9.xyz, r8.xyzx, r0.wwww
mul r10.yzw, r7.xxyz, r9.xxxx
mul r11.yzw, r7.xxyz, r9.yyyy
mul r7.yzw, r7.xxyz, r9.zzzz
mul r1.yzw, r1.yyzx, l(0.000000, -1.02332771, 1.02332771, -1.02332771)
mov r10.x, r8.x
mov r1.x, l(0.886227548)
dp4 r9.x, r10.xyzw, r1.xyzw
mov r11.x, r8.y
dp4 r9.y, r11.xyzw, r1.xyzw
mov r7.x, r8.z
dp4 r9.z, r7.xyzw, r1.xyzw
max r1.xyz, r9.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
mul r7.xyz, r1.xyzx, r4.xyzx
mad r5.xyz, r5.xyzx, l(0.450000, 0.450000, 0.450000, 0.000000), r4.xyzx
mad r1.xyz, -r4.xyzx, r1.xyzx, r5.xyzx
mad r1.xyz, cb0[128].xxxx, r1.xyzx, r7.xyzx
max r3.xyz, r2.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
lt r0.w, l(0.000000), cb0[124].x
if_nz r0.w
  add r2.xyz, r0.xyzx, -cb1[8].xyzx
  add r5.xyz, cb1[9].xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
  lt r2.xyz, r5.xyzx, |r2.xyzx|
  or r0.w, r2.y, r2.x
  or r0.w, r2.z, r0.w
  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 r2.yzw, r0.xxxx, l(0,0,1.000000,1.000000), l(0,1.000000,1.000000,0)
  mov r2.x, l(1.000000)
  movc r3.xyzw, r0.wwww, r2.yzwx, r3.xyzw
  mov o0.w, r3.w
else 
  mov o0.w, r3.w
endif 
mad r0.xyz, r6.xyzx, r4.xyzx, r1.xyzx
add r0.xyz, r3.xyzx, r0.xyzx
mad o0.xyz, r0.xyzx, v6.wwww, v6.xyzx
ret 
// Approximately 0 instruction slots used

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