// DLC 2 Sparks
Texture2D<float4> t4 : register(t4);

Texture2D<float4> t3 : register(t3);

Texture2D<float4> t2 : register(t2);

Texture2D<float4> t1 : register(t1);

Buffer<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 cb4 : register(b4)
{
  float4 cb4[11];
}

cbuffer cb3 : register(b3)
{
  float4 cb3[4];
}

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

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

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




// 3Dmigoto declarations
#define cmp -
Texture1D<float4> IniParams : register(t120);
Texture2D<float4> StereoParams : register(t125);


void main(
  uint v0 : SV_VertexID0,
  uint v1 : SV_InstanceID0,
  float2 v2 : ATTRIBUTE0,
  out float4 o0 : TEXCOORD0,
  out float4 o1 : TEXCOORD4,
  out float4 o2 : TEXCOORD5,
  out float4 o3 : TANGENTX0,
  out float4 o4 : TANGENTZ0,
  out float4 o5 : TEXCOORD7,
  out float4 o6 : SV_POSITION0)
{
// Needs manual fix for instruction:
// unknown dcl_: dcl_input_sgv v0.x, vertex_id
// Needs manual fix for instruction:
// unknown dcl_: dcl_input_sgv v1.x, instance_id
  float4 r0,r1,r2,r3,r4,r5,r6,r7,r8,r9;
  uint4 bitmask, uiDest;
  float4 fDest;

  o0.zw = float2(0,0);
  r0.xy = float2(1,1) + -v2.xy;
  r0.z = (uint)v1.x << 4;
  r0.w = (uint)v0.x >> 2;
  r0.z = (int)r0.w + (int)r0.z;
  r0.z = (int)r0.z + asint(cb0[2].x);
  r0.zw = t0.Load(r0.z).xy;
  r1.xyzw = t3.SampleLevel(s2_s, r0.zw, 0).xyzw;
  r2.xy = cmp(r1.xy < float2(0.5,0.5));
  r0.xy = r2.xy ? r0.xy : v2.xy;
  r2.xy = r2.xy ? float2(0,0) : float2(-0.5,-0.5);
  r1.xy = r2.xy + r1.xy;
  r1.xy = r1.xy + r1.xy;
  r2.xyzw = t1.SampleLevel(s0_s, r0.zw, 0).xyzw;
  r3.xyz = t2.SampleLevel(s1_s, r0.zw, 0).xyz;
  r0.zw = cb4[3].zw * r2.ww + cb4[3].xy;
  r4.xyz = t4.SampleLevel(s3_s, r0.zw, 0).xyz;
  r4.xyz = r4.xyz * cb4[4].xyz + cb4[5].xyz;
  r0.z = frac(r4.z);
  r0.w = r4.z + -r0.z;
  r4.xy = cb3[0].xy * r4.xy;
  r1.xy = r4.xy * r1.xy;
  o1.x = r0.z;
  r0.z = r0.w / cb4[7].x;
  r0.w = cb4[7].z * r0.w;
  r4.y = floor(r0.w);
  r0.w = cmp(r0.z >= -r0.z);
  r0.z = frac(abs(r0.z));
  r0.z = r0.w ? r0.z : -r0.z;
  r4.x = cb4[7].x * r0.z;
  r0.xy = r4.xy + r0.xy;
  o0.xy = cb4[7].zw * r0.xy;
  o1.z = 0;
  o1.y = r2.w;
  r0.xy = cb4[0].zw * r2.ww + cb4[0].xy;
  r0.xyzw = t4.SampleLevel(s3_s, r0.xy, 0).xyzw;
  r0.xyzw = r0.xyzw * cb4[1].xyzw + cb4[2].xyzw;
  o2.xyzw = cb3[3].xyzw * r0.xyzw;
  r0.xyz = cb2[1].xyz * r3.yyy;
  r0.xyz = r3.xxx * cb2[0].xyz + r0.xyz;
  r0.xyz = r3.zzz * cb2[2].xyz + r0.xyz;
  r3.xyz = float3(9.99999975e-005,0,0) + r0.zxy;
  r0.x = dot(r0.xyz, r0.xyz);
  r0.x = sqrt(r0.x);
  r0.xy = cb4[6].xy * r0.xx;
  r0.xy = max(float2(1,1), r0.xy);
  r0.xy = min(cb4[6].zw, r0.xy);
  r0.xy = r1.xy * r0.xy;
  r0.z = dot(r3.xyz, r3.xyz);
  r0.z = rsqrt(r0.z);
  r3.xyz = r3.xyz * r0.zzz;
  r4.xyz = cb2[1].xyz * r2.yyy;
  r4.xyz = cb2[0].xyz * r2.xxx + r4.xyz;
  r2.xyz = cb2[2].xyz * r2.zzz + r4.xyz;
  r4.xyz = cb2[3].xyz + cb1[56].xyz;
  r2.xyz = r4.xyz + r2.xyz;
  r4.xyz = cb1[54].yzx + -r2.yzx;
  r0.z = dot(r4.xyz, r4.xyz);
  r0.z = max(0.00999999978, r0.z);
  r0.z = sqrt(r0.z);
  r4.xyz = r4.xyz / r0.zzz;
  r5.xyz = cb3[1].yzx * r4.zxy;
  r5.xyz = cb3[1].xyz * r4.xyz + -r5.xyz;
  r0.z = dot(r5.xyz, r5.xyz);
  r0.z = max(0.00999999978, r0.z);
  r0.z = sqrt(r0.z);
  r5.xyz = r5.xyz / r0.zzz;
  r6.xyz = float3(0,0,1) * r4.xyz;
  r6.xyz = r4.zxy * float3(0,1,0) + -r6.xyz;
  r0.z = dot(r6.yz, r6.yz);
  r0.z = max(0.00999999978, r0.z);
  r0.z = sqrt(r0.z);
  r6.xyz = r6.xyz / r0.zzz;
  r7.xyz = r6.yzx * r4.xyz;
  r7.xyz = r4.zxy * r6.zxy + -r7.xyz;
  r8.xyz = cb3[2].zxy + cb1[49].zxy;
  r8.xyz = cb3[2].www * r8.xyz + -cb1[49].zxy;
  r9.xyz = cmp(float3(0,0,0) < cb4[8].yzw);
  r7.xyz = r9.zzz ? r7.xyz : r8.xyz;
  r5.xyz = r9.yyy ? -r5.xyz : r7.xyz;
  r5.xyz = r9.xxx ? -r3.xyz : r5.xyz;
  r7.xyz = r4.xyz * r3.yzx;
  r3.xyz = r4.zxy * r3.zxy + -r7.xyz;
  r0.z = dot(r3.xyz, r3.xyz);
  r0.z = max(0.00999999978, r0.z);
  r0.z = sqrt(r0.z);
  r3.xyz = r3.xyz / r0.zzz;
  r4.xyz = cb3[1].zxy + -cb1[50].zxy;
  r4.xyz = cb3[1].www * r4.xyz + cb1[50].zxy;
  r4.xyz = r9.zzz ? r6.xyz : r4.xyz;
  r4.xyz = r9.yyy ? cb3[1].zxy : r4.xyz;
  r3.xyz = r9.xxx ? r3.xyz : r4.xyz;
  r0.z = cb4[9].x * r1.w;
  r0.z = r0.z * r2.w + r1.z;
  r0.w = cmp(1 >= r2.w);
  r0.w = r0.w ? 1.000000 : 0;
  r0.xy = r0.xy * r0.ww;
  r0.z = r0.z * 6.28318548 + cb4[9].y;
  sincos(r0.z, r1.x, r4.x);
  r1.yzw = r4.xxx * r3.yzx;
  r3.xyz = r1.xxx * r3.xyz;
  r3.xyz = r4.xxx * r5.xyz + -r3.xyz;
  r1.xyz = r1.xxx * r5.yzx + r1.yzw;
  o3.xyz = r1.xyz;
  o3.w = 0;
  r4.xyz = r1.zxy * r3.zxy;
  r4.xyz = r1.yzx * r3.xyz + -r4.xyz;
  r0.z = dot(r4.xyz, r4.xyz);
  r0.z = rsqrt(r0.z);
  r4.xyz = r4.xyz * r0.zzz;
  r5.xyz = r4.yzx * r3.xyz;
  r5.xyz = r3.zxy * r4.zxy + -r5.xyz;
  o4.xyz = r4.xyz;
  r0.z = dot(r5.xyz, r1.xyz);
  r0.w = cmp(0 < r0.z);
  r0.z = cmp(r0.z < 0);
  r0.z = (int)-r0.w + (int)r0.z;
  o4.w = (int)r0.z;
  r0.zw = cb4[10].xy + v2.xy;
  r0.xy = r0.xy * r0.zw;
  r0.yzw = r0.yyy * r3.yzx;
  r0.xyz = r0.xxx * r1.xyz + r0.yzw;
  r0.xyz = r2.xyz + r0.xyz;
  r1.xyz = -cb1[54].xyz + r0.xyz;
  r0.w = cmp(0.00999999978 < abs(r1.z));
  r0.w = r0.w ? r1.z : 0.00999999978;
  r0.w = cb0[3].y * r0.w;
  r0.w = max(-127, r0.w);
  r1.w = exp2(-r0.w);
  r1.w = 1 + -r1.w;
  r1.w = cb0[3].x * r1.w;
  r0.w = r1.w / r0.w;
  r1.w = dot(r1.xyz, r1.xyz);
  r2.x = rsqrt(r1.w);
  r2.y = r1.w * r2.x + -cb0[8].x;
  r1.w = r1.w * r2.x + -cb0[3].w;
  r1.xyz = r2.xxx * r1.xyz;
  r1.x = saturate(dot(r1.xyz, cb0[6].xyz));
  r1.x = log2(r1.x);
  r1.x = cb0[7].w * r1.x;
  r1.x = exp2(r1.x);
  r1.xyz = cb0[7].xyz * r1.xxx;
  r1.w = max(0, r1.w);
  r1.w = r1.w * r0.w;
  r1.w = exp2(-r1.w);
  r1.w = min(1, r1.w);
  r1.w = max(cb0[4].w, r1.w);
  r2.x = max(0, r2.y);
  r0.w = r2.x * r0.w;
  r0.w = exp2(-r0.w);
  r0.w = min(1, r0.w);
  r0.w = 1 + -r0.w;
  r1.xyz = r1.xyz * r0.www;
  r0.w = cmp(0 < cb0[6].w);
  r1.xyz = r0.www ? r1.xyz : 0;
  r0.w = 1 + -r1.w;
  o5.w = r1.w;
  o5.xyz = cb0[4].xyz * r0.www + r1.xyz;
  r1.xyzw = cb1[1].xyzw * r0.yyyy;
  r1.xyzw = r0.xxxx * cb1[0].xyzw + r1.xyzw;
  r0.xyzw = r0.zzzz * cb1[2].xyzw + r1.xyzw;
  o6.xyzw = cb1[3].xyzw + r0.xyzw;
  
  float4 stereo = StereoParams.Load(0);
  //o6.x += stereo.x * (o6.w - stereo.y) / 2;
  
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v1.2.67 on Sat Nov 18 07:33:00 2017
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_VertexID              0   x           0   VERTID    uint   x   
// SV_InstanceID            0   x           1   INSTID    uint   x   
// ATTRIBUTE                0   xy          2     NONE   float   xy  
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                 0   xyzw        0     NONE   float   xyzw
// TEXCOORD                 4   xyz         1     NONE   float   xyz 
// TEXCOORD                 5   xyzw        2     NONE   float   xyzw
// TANGENTX                 0   xyzw        3     NONE   float   xyzw
// TANGENTZ                 0   xyzw        4     NONE   float   xyzw
// TEXCOORD                 7   xyzw        5     NONE   float   xyzw
// SV_POSITION              0   xyzw        6      POS   float   xyzw
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[9], immediateIndexed
dcl_constantbuffer cb1[57], immediateIndexed
dcl_constantbuffer cb2[4], immediateIndexed
dcl_constantbuffer cb3[4], immediateIndexed
dcl_constantbuffer cb4[11], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_sampler s2, mode_default
dcl_sampler s3, mode_default
dcl_resource_buffer (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_resource_texture2d (float,float,float,float) t2
dcl_resource_texture2d (float,float,float,float) t3
dcl_resource_texture2d (float,float,float,float) t4
dcl_input_sgv v0.x, vertex_id
dcl_input_sgv v1.x, instance_id
dcl_input v2.xy
dcl_output o0.xyzw
dcl_output o1.xyz
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_output o4.xyzw
dcl_output o5.xyzw
dcl_output_siv o6.xyzw, position
dcl_temps 10
mov o0.zw, l(0,0,0,0)
add r0.xy, -v2.xyxx, l(1.000000, 1.000000, 0.000000, 0.000000)
ishl r0.z, v1.x, l(4)
ushr r0.w, v0.x, l(2)
iadd r0.z, r0.w, r0.z
iadd r0.z, r0.z, cb0[2].x
ld_indexable(buffer)(float,float,float,float) r0.zw, r0.zzzz, t0.zwxy
sample_l_indexable(texture2d)(float,float,float,float) r1.xyzw, r0.zwzz, t3.xyzw, s2, l(0.000000)
lt r2.xy, r1.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000)
movc r0.xy, r2.xyxx, r0.xyxx, v2.xyxx
movc r2.xy, r2.xyxx, l(0,0,0,0), l(-0.500000,-0.500000,0,0)
add r1.xy, r1.xyxx, r2.xyxx
add r1.xy, r1.xyxx, r1.xyxx
sample_l_indexable(texture2d)(float,float,float,float) r2.xyzw, r0.zwzz, t1.xyzw, s0, l(0.000000)
sample_l_indexable(texture2d)(float,float,float,float) r3.xyz, r0.zwzz, t2.xyzw, s1, l(0.000000)
mad r0.zw, cb4[3].zzzw, r2.wwww, cb4[3].xxxy
sample_l_indexable(texture2d)(float,float,float,float) r4.xyz, r0.zwzz, t4.xyzw, s3, l(0.000000)
mad r4.xyz, r4.xyzx, cb4[4].xyzx, cb4[5].xyzx
frc r0.z, r4.z
add r0.w, -r0.z, r4.z
mul r4.xy, r4.xyxx, cb3[0].xyxx
mul r1.xy, r1.xyxx, r4.xyxx
mov o1.x, r0.z
div r0.z, r0.w, cb4[7].x
mul r0.w, r0.w, cb4[7].z
round_ni r4.y, r0.w
ge r0.w, r0.z, -r0.z
frc r0.z, |r0.z|
movc r0.z, r0.w, r0.z, -r0.z
mul r4.x, r0.z, cb4[7].x
add r0.xy, r0.xyxx, r4.xyxx
mul o0.xy, r0.xyxx, cb4[7].zwzz
mov o1.z, l(0)
mov o1.y, r2.w
mad r0.xy, cb4[0].zwzz, r2.wwww, cb4[0].xyxx
sample_l_indexable(texture2d)(float,float,float,float) r0.xyzw, r0.xyxx, t4.xyzw, s3, l(0.000000)
mad r0.xyzw, r0.xyzw, cb4[1].xyzw, cb4[2].xyzw
mul o2.xyzw, r0.xyzw, cb3[3].xyzw
mul r0.xyz, r3.yyyy, cb2[1].xyzx
mad r0.xyz, r3.xxxx, cb2[0].xyzx, r0.xyzx
mad r0.xyz, r3.zzzz, cb2[2].xyzx, r0.xyzx
add r3.xyz, r0.zxyz, l(0.000100, 0.000000, 0.000000, 0.000000)
dp3 r0.x, r0.xyzx, r0.xyzx
sqrt r0.x, r0.x
mul r0.xy, r0.xxxx, cb4[6].xyxx
max r0.xy, r0.xyxx, l(1.000000, 1.000000, 0.000000, 0.000000)
min r0.xy, r0.xyxx, cb4[6].zwzz
mul r0.xy, r0.xyxx, r1.xyxx
dp3 r0.z, r3.xyzx, r3.xyzx
rsq r0.z, r0.z
mul r3.xyz, r0.zzzz, r3.xyzx
mul r4.xyz, r2.yyyy, cb2[1].xyzx
mad r4.xyz, cb2[0].xyzx, r2.xxxx, r4.xyzx
mad r2.xyz, cb2[2].xyzx, r2.zzzz, r4.xyzx
add r4.xyz, cb1[56].xyzx, cb2[3].xyzx
add r2.xyz, r2.xyzx, r4.xyzx
add r4.xyz, -r2.yzxy, cb1[54].yzxy
dp3 r0.z, r4.xyzx, r4.xyzx
max r0.z, r0.z, l(0.010000)
sqrt r0.z, r0.z
div r4.xyz, r4.xyzx, r0.zzzz
mul r5.xyz, r4.zxyz, cb3[1].yzxy
mad r5.xyz, cb3[1].xyzx, r4.xyzx, -r5.xyzx
dp3 r0.z, r5.xyzx, r5.xyzx
max r0.z, r0.z, l(0.010000)
sqrt r0.z, r0.z
div r5.xyz, r5.xyzx, r0.zzzz
mul r6.xyz, r4.xyzx, l(0.000000, 0.000000, 1.000000, 0.000000)
mad r6.xyz, r4.zxyz, l(0.000000, 1.000000, 0.000000, 0.000000), -r6.xyzx
dp2 r0.z, r6.yzyy, r6.yzyy
max r0.z, r0.z, l(0.010000)
sqrt r0.z, r0.z
div r6.xyz, r6.xyzx, r0.zzzz
mul r7.xyz, r4.xyzx, r6.yzxy
mad r7.xyz, r4.zxyz, r6.zxyz, -r7.xyzx
add r8.xyz, cb1[49].zxyz, cb3[2].zxyz
mad r8.xyz, cb3[2].wwww, r8.xyzx, -cb1[49].zxyz
lt r9.xyz, l(0.000000, 0.000000, 0.000000, 0.000000), cb4[8].yzwy
movc r7.xyz, r9.zzzz, r7.xyzx, r8.xyzx
movc r5.xyz, r9.yyyy, -r5.xyzx, r7.xyzx
movc r5.xyz, r9.xxxx, -r3.xyzx, r5.xyzx
mul r7.xyz, r3.yzxy, r4.xyzx
mad r3.xyz, r4.zxyz, r3.zxyz, -r7.xyzx
dp3 r0.z, r3.xyzx, r3.xyzx
max r0.z, r0.z, l(0.010000)
sqrt r0.z, r0.z
div r3.xyz, r3.xyzx, r0.zzzz
add r4.xyz, -cb1[50].zxyz, cb3[1].zxyz
mad r4.xyz, cb3[1].wwww, r4.xyzx, cb1[50].zxyz
movc r4.xyz, r9.zzzz, r6.xyzx, r4.xyzx
movc r4.xyz, r9.yyyy, cb3[1].zxyz, r4.xyzx
movc r3.xyz, r9.xxxx, r3.xyzx, r4.xyzx
mul r0.z, r1.w, cb4[9].x
mad r0.z, r0.z, r2.w, r1.z
ge r0.w, l(1.000000), r2.w
and r0.w, r0.w, l(0x3f800000)
mul r0.xy, r0.wwww, r0.xyxx
mad r0.z, r0.z, l(6.28318548), cb4[9].y
sincos r1.x, r4.x, r0.z
mul r1.yzw, r3.yyzx, r4.xxxx
mul r3.xyz, r3.xyzx, r1.xxxx
mad r3.xyz, r4.xxxx, r5.xyzx, -r3.xyzx
mad r1.xyz, r1.xxxx, r5.yzxy, r1.yzwy
mov o3.xyz, r1.xyzx
mov o3.w, l(0)
mul r4.xyz, r3.zxyz, r1.zxyz
mad r4.xyz, r1.yzxy, r3.xyzx, -r4.xyzx
dp3 r0.z, r4.xyzx, r4.xyzx
rsq r0.z, r0.z
mul r4.xyz, r0.zzzz, r4.xyzx
mul r5.xyz, r3.xyzx, r4.yzxy
mad r5.xyz, r3.zxyz, r4.zxyz, -r5.xyzx
mov o4.xyz, r4.xyzx
dp3 r0.z, r5.xyzx, r1.xyzx
lt r0.w, l(0.000000), r0.z
lt r0.z, r0.z, l(0.000000)
iadd r0.z, -r0.w, r0.z
itof o4.w, r0.z
add r0.zw, v2.xxxy, cb4[10].xxxy
mul r0.xy, r0.zwzz, r0.xyxx
mul r0.yzw, r3.yyzx, r0.yyyy
mad r0.xyz, r0.xxxx, r1.xyzx, r0.yzwy
add r0.xyz, r0.xyzx, r2.xyzx
add r1.xyz, r0.xyzx, -cb1[54].xyzx
lt r0.w, l(0.010000), |r1.z|
movc r0.w, r0.w, r1.z, l(0.010000)
mul r0.w, r0.w, cb0[3].y
max r0.w, r0.w, l(-127.000000)
exp r1.w, -r0.w
add r1.w, -r1.w, l(1.000000)
mul r1.w, r1.w, cb0[3].x
div r0.w, r1.w, r0.w
dp3 r1.w, r1.xyzx, r1.xyzx
rsq r2.x, r1.w
mad r2.y, r1.w, r2.x, -cb0[8].x
mad r1.w, r1.w, r2.x, -cb0[3].w
mul r1.xyz, r1.xyzx, r2.xxxx
dp3_sat r1.x, r1.xyzx, cb0[6].xyzx
log r1.x, r1.x
mul r1.x, r1.x, cb0[7].w
exp r1.x, r1.x
mul r1.xyz, r1.xxxx, cb0[7].xyzx
max r1.w, r1.w, l(0.000000)
mul r1.w, r0.w, r1.w
exp r1.w, -r1.w
min r1.w, r1.w, l(1.000000)
max r1.w, r1.w, cb0[4].w
max r2.x, r2.y, l(0.000000)
mul r0.w, r0.w, r2.x
exp r0.w, -r0.w
min r0.w, r0.w, l(1.000000)
add r0.w, -r0.w, l(1.000000)
mul r1.xyz, r0.wwww, r1.xyzx
lt r0.w, l(0.000000), cb0[6].w
and r1.xyz, r1.xyzx, r0.wwww
add r0.w, -r1.w, l(1.000000)
mov o5.w, r1.w
mad o5.xyz, cb0[4].xyzx, r0.wwww, r1.xyzx
mul r1.xyzw, r0.yyyy, cb1[1].xyzw
mad r1.xyzw, r0.xxxx, cb1[0].xyzw, r1.xyzw
mad r0.xyzw, r0.zzzz, cb1[2].xyzw, r1.xyzw
add o6.xyzw, r0.xyzw, cb1[3].xyzw
ret 
// Approximately 0 instruction slots used

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