//Blood decals PS 1.
// ---- Created with 3Dmigoto v1.3.16 on Sun May 12 13:01:41 2019
Texture2D<float4> t3 : register(t3);

Texture2D<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 cb9 : register(b9)
{
  float4 cb9[18];
}

cbuffer cb12 : register(b12)
{
  float4 cb12[10];
}


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


void main(
  float4 v0 : TEXCOORD0,
  float3 v1 : TEXCOORD1,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1,r2,r3,r4,r5,r6;
  uint4 bitmask, uiDest;
  float4 fDest;

  float4 stereo = StereoParams.Load(0);
  
  v1.x-=stereo.x*stereo.y/cb12[0].x;
  
  r0.xy = v0.xy / v0.zz;
  r0.z = t3.Sample(s3_s, r0.xy).z;
  r0.z = f32tof16(r0.z);
  r0.z = (uint)r0.z >> 7;
  r0.z = (int)r0.z ^ 383;
  r0.z = (int)r0.z & 2;
  if (r0.z != 0) discard;
  r0.z = t0.Sample(s0_s, r0.xy).x;
  r0.xy = t1.Sample(s1_s, r0.xy).xy;
  r0.xy = float2(4,4) * r0.xy;
  r0.z = cb9[6].x + r0.z;
  r0.z = -cb9[6].y / r0.z;
  r1.xyz = v1.xyz * r0.zzz;
  
  r1.x+=stereo.x*(0+stereo.y*v1.z)/cb12[0].x;
  
  r1.xyz = r1.xyz / v1.zzz;
  r1.w = 1;
  r2.x = dot(cb9[0].xyzw, r1.xyzw);
  r2.y = dot(cb9[1].xyzw, r1.xyzw);
  r2.z = dot(cb9[2].xyzw, r1.xyzw);
  r0.zw = r2.xy / r2.zz;
  r0.z = dot(r0.zw, r0.zw);
  r0.z = sqrt(r0.z);
  r0.z = -r0.z * cb9[7].z + 1;
  r0.w = cb9[6].w + -cb9[6].z;
  r1.w = -cb9[6].z + r2.z;
  r0.w = saturate(r1.w / r0.w);
  r1.w = cb9[7].x + -cb9[7].y;
  r2.w = cb9[7].x + -r2.z;
  r1.w = saturate(r2.w / r1.w);
  r0.w = min(r1.w, r0.w);
  r0.z = min(r0.z, r0.w);
  r0.w = cmp(r0.z < 0);
  if (r0.w != 0) discard;
  r0.w = r2.z * r2.z;
  r2.xyw = cb9[8].xyz * r0.www + r2.xyz;
  r2.xy = cb9[7].ww * r2.xy;
  r2.xy = r2.xy / r2.ww;
  r2.xyw = t2.Sample(s2_s, r2.xy).xyw;
  r0.w = r2.w * r0.z + -cb9[14].w;
  r1.w = cb9[15].w + -cb9[14].w;
  r1.w = 1 / r1.w;
  r0.w = saturate(r1.w * r0.w);
  r1.w = r0.w * -2 + 3;
  r0.w = r0.w * r0.w;
  r0.w = r1.w * r0.w;
  r3.x = -cb9[3].w;
  r3.y = -cb9[4].w;
  r3.z = -cb9[5].w;
  r3.xyz = r3.xyz + r1.xyz;
  r1.w = dot(r3.xyz, r3.xyz);
  r1.w = rsqrt(r1.w);
  r3.xyz = r3.xyz * r1.www;
  r4.xyz = -cb9[16].xyz * r2.zzz + r3.xyz;
  r1.w = cb9[16].w + -r2.z;
  r1.w = max(0, r1.w);
  r1.w = cb9[17].x * r1.w;
  r2.z = dot(r4.xyz, r4.xyz);
  r2.z = rsqrt(r2.z);
  r4.xyz = r4.xyz * r2.zzz;
  r5.xy = log2(cb9[17].yz);
  r5.xy = r5.xy * r1.ww;
  r5.xy = exp2(r5.xy);
  r1.w = cb9[14].z * r5.y;
  r5.xyz = cb9[15].xyz * r5.xxx;
  r4.xyz = r4.xyz * r1.www;
  r1.w = dot(r0.xy, r0.xy);
  r6.zw = -r1.ww * float2(0.25,0.5) + float2(1,1);
  r1.w = max(0, r6.z);
  r1.w = sqrt(r1.w);
  r6.xy = r1.ww * r0.xy;
  r0.x = dot(r3.xyz, r6.xyw);
  r3.xyz = r5.xyz * abs(r0.xxx) + r4.xyz;
  r0.y = dot(r3.xyz, r6.xyw);
  r3.xyz = -r6.xyw * r0.yyy + r3.xyz;
  r3.xyz = r0.www * r3.xyz + r1.xyz;
  r0.y = cb9[9].w * r1.z;
  r3.w = 1;
  r1.x = dot(cb9[0].xyzw, r3.xyzw);
  r1.y = dot(cb9[1].xyzw, r3.xyzw);
  r1.z = dot(cb9[2].xyzw, r3.xyzw);
  r0.w = r1.z * r1.z;
  r1.xyz = cb9[8].xyz * r0.www + r1.xyz;
  r1.xy = cb9[7].ww * r1.xy;
  r1.xy = r1.xy / r1.zz;
  r1.xyz = t2.Sample(s2_s, r1.xy).xyw;
  r1.xyz = r1.xyz + -r2.xyw;
  r1.xyz = r1.xyz * float3(0.5,0.5,0.5) + r2.xyw;
  r0.w = 1 + -r0.x;
  r1.w = 0.25 * r0.w;
  r0.w = -r0.w * 0.25 + 1;
  r0.w = r1.z * r0.w + r1.w;
  r1.xy = r1.xy * float2(2,2) + float2(-1,-1);
  r1.z = r0.w * r0.z + -cb9[8].w;
  r1.w = max(-cb9[8].w, r0.y);
  r0.y = -2 * r0.y;
  r0.y = 1 / r0.y;
  r1.w = r1.z * cb9[12].x + -r1.w;
  r1.z = cb9[12].x * r1.z;
  r2.x = r0.w * r0.z + -cb9[13].w;
  r0.z = r0.w * r0.z;
  r0.w = max(r2.x, r1.w);
  r0.y = saturate(r1.w * r0.y);
  r0.w = cmp(r0.w < 0);
  if (r0.w != 0) discard;
  r3.x = dot(cb9[3].xy, r1.xy);
  r3.y = dot(cb9[4].xy, r1.xy);
  r3.z = dot(cb9[5].xy, r1.xy);
  r0.w = dot(r3.xyz, r6.xyw);
  r0.x = r1.z / r0.x;
  r0.x = -1 + abs(r0.x);
  r0.x = r0.x * r0.w;
  r1.xyw = r6.xyw * r0.xxx + r3.xyz;
  r0.x = dot(r1.xyw, r1.xyw);
  r0.x = rsqrt(r0.x);
  r1.xyw = r1.xyw * r0.xxx;
  r0.x = dot(v1.xyz, v1.xyz);
  r0.x = rsqrt(r0.x);
  r2.yzw = v1.xyz * r0.xxx;
  r0.x = dot(r2.yzw, r1.xyw);
  r0.w = r0.x + r0.x;
  r0.x = 1 + -abs(r0.x);
  r0.x = log2(r0.x);
  r0.x = cb9[10].w * r0.x;
  r0.x = exp2(r0.x);
  r2.yzw = r1.xyw * -r0.www + r2.yzw;
  r0.w = dot(r2.yzw, r6.xyw);
  r0.w = r0.w * 0.5 + 0.5;
  r0.x = r0.x * r0.w;
  r0.w = cb9[11].w + -cb9[11].z;
  r0.w = r1.y * r0.w + cb9[11].z;
  r0.w = cb9[11].x + r0.w;
  r0.w = cb9[11].y * abs(r1.z) + r0.w;
  r1.xyz = log2(cb9[9].xyz);
  r1.xyz = r1.xyz * r0.www;
  r1.xyz = exp2(r1.xyz);
  r1.xyz = cb9[10].xyz * r0.xxx + r1.xyz;
  r0.x = cb9[14].x + -cb9[13].w;
  r0.x = 1 / r0.x;
  r0.x = saturate(r2.x * r0.x);
  r0.w = r0.x * -2 + 3;
  r0.x = r0.x * r0.x;
  r0.x = r0.w * r0.x;
  r2.xyz = cb9[13].xyz + -cb9[12].yzw;
  r2.xyz = r0.zzz * r2.xyz + cb9[12].yzw;
  r2.xyz = float3(-1,-1,-1) + r2.xyz;
  r0.xzw = r0.xxx * r2.xyz + float3(1,1,1);
  r1.xyz = r1.xyz + -r0.xzw;
  r1.w = r0.y * -2 + 3;
  r0.y = r0.y * r0.y;
  r0.y = r1.w * r0.y;
  r0.xyz = r0.yyy * r1.xyz + r0.xzw;
  o0.xyz = max(float3(0,0,0), r0.xyz);
  o0.w = 1;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v1.3.16 on Sun May 12 13:01:41 2019
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                 0   xyz         0     NONE   float   xyz
// TEXCOORD                 1   xyz         1     NONE   float   xyz
//
//
// 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 cb9[18], 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_texture2d (float,float,float,float) t2
dcl_resource_texture2d (float,float,float,float) t3
dcl_input_ps linear v0.xyz
dcl_input_ps linear v1.xyz
dcl_output o0.xyzw
dcl_temps 7
div r0.xy, v0.xyxx, v0.zzzz
sample_indexable(texture2d)(float,float,float,float) r0.z, r0.xyxx, t3.xyzw, s3
f32tof16 r0.z, r0.z
ushr r0.z, r0.z, l(7)
xor r0.z, r0.z, l(383)
and r0.z, r0.z, l(2)
discard_nz r0.z
sample_indexable(texture2d)(float,float,float,float) r0.z, r0.xyxx, t0.yzxw, s0
sample_indexable(texture2d)(float,float,float,float) r0.xy, r0.xyxx, t1.xyzw, s1
mul r0.xy, r0.xyxx, l(4.000000, 4.000000, 0.000000, 0.000000)
add r0.z, r0.z, cb9[6].x
div r0.z, -cb9[6].y, r0.z
mul r1.xyz, r0.zzzz, v1.xyzx
div r1.xyz, r1.xyzx, v1.zzzz
mov r1.w, l(1.000000)
dp4 r2.x, cb9[0].xyzw, r1.xyzw
dp4 r2.y, cb9[1].xyzw, r1.xyzw
dp4 r2.z, cb9[2].xyzw, r1.xyzw
div r0.zw, r2.xxxy, r2.zzzz
dp2 r0.z, r0.zwzz, r0.zwzz
sqrt r0.z, r0.z
mad r0.z, -r0.z, cb9[7].z, l(1.000000)
add r0.w, -cb9[6].z, cb9[6].w
add r1.w, r2.z, -cb9[6].z
div_sat r0.w, r1.w, r0.w
add r1.w, -cb9[7].y, cb9[7].x
add r2.w, -r2.z, cb9[7].x
div_sat r1.w, r2.w, r1.w
min r0.w, r0.w, r1.w
min r0.z, r0.w, r0.z
lt r0.w, r0.z, l(0.000000)
discard_nz r0.w
mul r0.w, r2.z, r2.z
mad r2.xyw, cb9[8].xyxz, r0.wwww, r2.xyxz
mul r2.xy, r2.xyxx, cb9[7].wwww
div r2.xy, r2.xyxx, r2.wwww
sample_indexable(texture2d)(float,float,float,float) r2.xyw, r2.xyxx, t2.xyzw, s2
mad r0.w, r2.w, r0.z, -cb9[14].w
add r1.w, -cb9[14].w, cb9[15].w
div r1.w, l(1.000000, 1.000000, 1.000000, 1.000000), r1.w
mul_sat r0.w, r0.w, r1.w
mad r1.w, r0.w, l(-2.000000), l(3.000000)
mul r0.w, r0.w, r0.w
mul r0.w, r0.w, r1.w
mov r3.x, -cb9[3].w
mov r3.y, -cb9[4].w
mov r3.z, -cb9[5].w
add r3.xyz, r1.xyzx, r3.xyzx
dp3 r1.w, r3.xyzx, r3.xyzx
rsq r1.w, r1.w
mul r3.xyz, r1.wwww, r3.xyzx
mad r4.xyz, -cb9[16].xyzx, r2.zzzz, r3.xyzx
add r1.w, -r2.z, cb9[16].w
max r1.w, r1.w, l(0.000000)
mul r1.w, r1.w, cb9[17].x
dp3 r2.z, r4.xyzx, r4.xyzx
rsq r2.z, r2.z
mul r4.xyz, r2.zzzz, r4.xyzx
log r5.xy, cb9[17].yzyy
mul r5.xy, r1.wwww, r5.xyxx
exp r5.xy, r5.xyxx
mul r1.w, r5.y, cb9[14].z
mul r5.xyz, r5.xxxx, cb9[15].xyzx
mul r4.xyz, r1.wwww, r4.xyzx
dp2 r1.w, r0.xyxx, r0.xyxx
mad r6.zw, -r1.wwww, l(0.000000, 0.000000, 0.250000, 0.500000), l(0.000000, 0.000000, 1.000000, 1.000000)
max r1.w, r6.z, l(0.000000)
sqrt r1.w, r1.w
mul r6.xy, r0.xyxx, r1.wwww
dp3 r0.x, r3.xyzx, r6.xywx
mad r3.xyz, r5.xyzx, |r0.xxxx|, r4.xyzx
dp3 r0.y, r3.xyzx, r6.xywx
mad r3.xyz, -r6.xywx, r0.yyyy, r3.xyzx
mad r3.xyz, r0.wwww, r3.xyzx, r1.xyzx
mul r0.y, r1.z, cb9[9].w
mov r3.w, l(1.000000)
dp4 r1.x, cb9[0].xyzw, r3.xyzw
dp4 r1.y, cb9[1].xyzw, r3.xyzw
dp4 r1.z, cb9[2].xyzw, r3.xyzw
mul r0.w, r1.z, r1.z
mad r1.xyz, cb9[8].xyzx, r0.wwww, r1.xyzx
mul r1.xy, r1.xyxx, cb9[7].wwww
div r1.xy, r1.xyxx, r1.zzzz
sample_indexable(texture2d)(float,float,float,float) r1.xyz, r1.xyxx, t2.xywz, s2
add r1.xyz, -r2.xywx, r1.xyzx
mad r1.xyz, r1.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000), r2.xywx
add r0.w, -r0.x, l(1.000000)
mul r1.w, r0.w, l(0.250000)
mad r0.w, -r0.w, l(0.250000), l(1.000000)
mad r0.w, r1.z, r0.w, r1.w
mad r1.xy, r1.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
mad r1.z, r0.w, r0.z, -cb9[8].w
max r1.w, r0.y, -cb9[8].w
mul r0.y, r0.y, l(-2.000000)
div r0.y, l(1.000000, 1.000000, 1.000000, 1.000000), r0.y
mad r1.w, r1.z, cb9[12].x, -r1.w
mul r1.z, r1.z, cb9[12].x
mad r2.x, r0.w, r0.z, -cb9[13].w
mul r0.z, r0.z, r0.w
max r0.w, r1.w, r2.x
mul_sat r0.y, r0.y, r1.w
lt r0.w, r0.w, l(0.000000)
discard_nz r0.w
dp2 r3.x, cb9[3].xyxx, r1.xyxx
dp2 r3.y, cb9[4].xyxx, r1.xyxx
dp2 r3.z, cb9[5].xyxx, r1.xyxx
dp3 r0.w, r3.xyzx, r6.xywx
div r0.x, r1.z, r0.x
add r0.x, |r0.x|, l(-1.000000)
mul r0.x, r0.w, r0.x
mad r1.xyw, r6.xyxw, r0.xxxx, r3.xyxz
dp3 r0.x, r1.xywx, r1.xywx
rsq r0.x, r0.x
mul r1.xyw, r0.xxxx, r1.xyxw
dp3 r0.x, v1.xyzx, v1.xyzx
rsq r0.x, r0.x
mul r2.yzw, r0.xxxx, v1.xxyz
dp3 r0.x, r2.yzwy, r1.xywx
add r0.w, r0.x, r0.x
add r0.x, -|r0.x|, l(1.000000)
log r0.x, r0.x
mul r0.x, r0.x, cb9[10].w
exp r0.x, r0.x
mad r2.yzw, r1.xxyw, -r0.wwww, r2.yyzw
dp3 r0.w, r2.yzwy, r6.xywx
mad r0.w, r0.w, l(0.500000), l(0.500000)
mul r0.x, r0.w, r0.x
add r0.w, -cb9[11].z, cb9[11].w
mad r0.w, r1.y, r0.w, cb9[11].z
add r0.w, r0.w, cb9[11].x
mad r0.w, cb9[11].y, |r1.z|, r0.w
log r1.xyz, cb9[9].xyzx
mul r1.xyz, r0.wwww, r1.xyzx
exp r1.xyz, r1.xyzx
mad r1.xyz, cb9[10].xyzx, r0.xxxx, r1.xyzx
add r0.x, -cb9[13].w, cb9[14].x
div r0.x, l(1.000000, 1.000000, 1.000000, 1.000000), r0.x
mul_sat r0.x, r0.x, r2.x
mad r0.w, r0.x, l(-2.000000), l(3.000000)
mul r0.x, r0.x, r0.x
mul r0.x, r0.x, r0.w
add r2.xyz, -cb9[12].yzwy, cb9[13].xyzx
mad r2.xyz, r0.zzzz, r2.xyzx, cb9[12].yzwy
add r2.xyz, r2.xyzx, l(-1.000000, -1.000000, -1.000000, 0.000000)
mad r0.xzw, r0.xxxx, r2.xxyz, l(1.000000, 0.000000, 1.000000, 1.000000)
add r1.xyz, -r0.xzwx, r1.xyzx
mad r1.w, r0.y, l(-2.000000), l(3.000000)
mul r0.y, r0.y, r0.y
mul r0.y, r0.y, r1.w
mad r0.xyz, r0.yyyy, r1.xyzx, r0.xzwx
max o0.xyz, r0.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
mov o0.w, l(1.000000)
ret
// Approximately 0 instruction slots used

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