// Batch Decals Swizzle oDepthLE 2
// ---- Created with 3Dmigoto v1.2.65 on Sat Sep 23 18:51:46 2017
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 cb3 : register(b3)
{
  float4 cb3[10];
}

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)
  //out float oDepthLE : SV_DepthLessEqual)
{
  float4 r0,r1,r2,r3,r4,r5,r6,r7,r8,r9;
  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;
  r0.w = v3.z;
  r1.x = 1;
  r0.w = v3.w * r0.w;
  r2.xyzw = cb0[37].xyzw * v3.yyyy;
  r2.xyzw = v3.xxxx * cb0[36].xyzw + r2.xyzw;
  r2.xyzw = v3.zzzz * cb0[38].xyzw + r2.xyzw;
  r2.xyzw = cb0[39].xyzw + r2.xyzw;
  r1.yzw = r2.xyz / r2.www;
  
  // Common SVPositionToTranslatedWorld fix:
float4 s = StereoParams.Load(0);
matrix TranslatedWorldToClip = MATRIX(cb0, 0);
matrix ClipToTranslatedWorld = MATRIX(cb0, 32);
float4 t = mul(r1.yzw, TranslatedWorldToClip);
t.x -= s.x * (t.w - s.y);
r1.yzw = mul(t, ClipToTranslatedWorld);
  
  r2.xyz = -cb0[58].xyz + r1.yzw;
  r3.xyz = -cb0[55].xyz + r2.xyz;
  r2.w = dot(r3.xyz, r3.xyz);
  r2.w = sqrt(r2.w);
  r3.w = 0.000122070313 * r2.w;
  r3.w = min(1, r3.w);
  r3.xyz = r3.xyz / r2.www;
  r3.x = dot(cb0[14].xyz, r3.xyz);
  r3.x = saturate(0.300000012 + r3.x);
  r3.y = r3.w * 7 + -13;
  r3.y = r3.x * r3.y + 12;
  r3.zw = cb3[2].xy + v2.xy;
  r3.zw = cb3[1].xy * r3.zw;
  r4.xy = t0.SampleBias(s0_s, r3.zw, r3.y).xy;
  r4.xy = r4.xy * float2(2,2) + float2(-1,-1);
  r4.w = dot(r4.xy, r4.xy);
  r4.w = 1 + -r4.w;
  r4.w = max(0, r4.w);
  r4.z = sqrt(r4.w);
  r5.xy = t1.Sample(s1_s, v2.xy).xy;
  r5.xy = r5.xy * float2(2,2) + float2(-1,-1);
  r4.w = dot(r5.xy, r5.xy);
  r4.w = 1 + -r4.w;
  r4.w = max(0, r4.w);
  r5.z = sqrt(r4.w);
  r2.w = saturate(r2.w * 0.000244140625 + -0.200000003);
  r6.xyz = r5.xyz + -r4.xyz;
  r4.xyz = r2.www * r6.xyz + r4.xyz;
  r5.xyz = r5.xyz + -r4.xyz;
  r4.xyz = cb3[9].zzz * r5.xyz + r4.xyz;
  r4.xyz = r4.xyz * cb0[122].www + cb0[122].xyz;
  r2.w = dot(r4.xyz, r4.xyz);
  r2.w = rsqrt(r2.w);
  r4.xyz = r4.xyz * r2.www;
  r0.xyz = r4.yyy * r0.xyz;
  r0.xyz = r4.xxx * v0.xyz + r0.xyz;
  r0.xyz = r4.zzz * v1.xyz + r0.xyz;
  r2.w = dot(r0.xyz, r0.xyz);
  r2.w = rsqrt(r2.w);
  r0.xyz = r2.www * r0.xyz;
  r2.w = r3.x * -12 + 12;
  r4.xyz = t2.SampleBias(s2_s, r3.zw, r2.w).xyz;
  r4.xyz = cb3[8].xyz * r4.xyz;
  r4.xyz = saturate(cb3[5].xyz * r4.xyz);
  r3.xyz = t3.SampleBias(s3_s, r3.zw, r3.y).xyz;
  r2.w = 1 + -r3.x;
  r2.w = max(9.99999997e-007, abs(r2.w));
  r3.w = r2.w * r2.w;
  r2.w = -r2.w * r2.w + 0.800000012;
  r5.y = saturate(r3.z * r2.w + r3.w);
  r2.w = saturate(r3.x * 0.849999964 + 0.0500000007);
  r1.x = r1.x * v3.w + 0.5;
  //oDepthLE = r0.w / r1.x;
  r5.x = saturate(r3.y);
  r0.w = min(1, r3.w);
  o2.z = r2.w * cb0[123].y + cb0[123].x;
  r1.x = cmp(0 < cb1[11].y);
  o5.x = r1.x ? cb2[5].x : 1;
  r1.x = 0.0799999982 * r5.y;
  r3.xyz = -r5.yyy * float3(0.0799999982,0.0799999982,0.0799999982) + r4.xyz;
  r3.xyz = r5.xxx * r3.xyz + r1.xxx;
  r6.xyz = -r4.xyz * r5.xxx + r4.xyz;
  r6.xyz = r6.xyz * cb0[120].www + cb0[120].xyz;
  r3.xyz = r3.xyz * cb0[121].www + cb0[121].xyz;
  r7.xyz = r0.yzy * r0.yzx;
  r8.yw = r0.zz * r0.yx;
  r1.x = r0.x * r0.x + -r7.x;
  r9.yzw = float3(-1.02332771,1.02332771,-1.02332771) * r0.yzx;
  r8.xz = r7.zy * float2(1,3) + float2(0,-1);
  r7.xyzw = float4(0.858085215,-0.858085215,0.247708291,-0.858085215) * r8.xyzw;
  r1.x = 0.429042608 * r1.x;
  r9.x = 0.886227548;
  r2.w = dot(cb2[8].xyzw, r9.xyzw);
  r3.w = dot(cb2[11].xyzw, r7.xyzw);
  r2.w = r3.w + r2.w;
  r8.x = cb2[14].x * r1.x + r2.w;
  r2.w = dot(cb2[9].xyzw, r9.xyzw);
  r3.w = dot(cb2[12].xyzw, r7.xyzw);
  r2.w = r3.w + r2.w;
  r8.y = cb2[14].y * r1.x + r2.w;
  r2.w = dot(cb2[10].xyzw, r9.xyzw);
  r3.w = dot(cb2[13].xyzw, r7.xyzw);
  r2.w = r3.w + r2.w;
  r8.z = cb2[14].z * r1.x + r2.w;
  r7.xyz = max(float3(0,0,0), r8.xyz);
  r7.xyz = cb0[140].xyz * r7.xyz;
  r1.x = dot(r7.xyz, float3(0.300000012,0.589999974,0.109999999));
  r7.xyz = r7.xyz * r6.xyz;
  r7.xyz = r7.xyz * r0.www;
  r3.xyz = r3.xyz * float3(0.449999988,0.449999988,0.449999988) + r6.xyz;
  r6.xyz = max(float3(0,0,0), cb3[4].xyz);
  r2.w = cmp(0 < cb0[124].x);
  if (r2.w != 0) {
    r2.w = dot(-r1.yzw, -r1.yzw);
    r2.w = rsqrt(r2.w);
    r1.yzw = r2.www * -r1.yzw;
    r1.yzw = r1.yzw * float3(0.5,0.5,0.5) + r2.xyz;
    r2.xyz = -cb1[8].xyz + r1.yzw;
    r8.xyz = float3(1,1,1) + cb1[9].xyz;
    r2.xyz = cmp(r8.xyz < abs(r2.xyz));
    r2.x = (int)r2.y | (int)r2.x;
    r2.x = (int)r2.z | (int)r2.x;
    r1.y = dot(r1.yzw, float3(0.577000022,0.577000022,0.577000022));
    r1.y = 0.00200000009 * r1.y;
    r1.y = frac(r1.y);
    r1.y = cmp(0.5 < r1.y);
    r1.yzw = r1.yyy ? float3(0,1,1) : float3(1,1,0);
    r6.xyz = r2.xxx ? r1.yzw : r6.xyz;
  }
  r1.yzw = cb0[128].xxx * r3.xyz + r7.xyz;
  o0.xyz = r1.yzw + r6.xyz;
  r1.yzw = float3(0.0078125,0.0078125,0.0078125) * v3.xyx;
  r1.yzw = frac(r1.yzw);
  r1.yzw = r1.yzw * float3(128,128,128) + float3(-64.3406219,-72.4656219,-64.3406219);
  r1.yzw = r1.yzw * r1.yzz;
  r1.y = dot(r1.yzw, float3(20.390625,60.703125,2.42812085));
  r1.y = frac(r1.y);
  r1.y = -0.5 + r1.y;
  o1.xyz = r0.xyz * float3(0.5,0.5,0.5) + float3(0.5,0.5,0.5);
  r0.x = r1.x * r0.w + 0.00390625;
  r0.x = log2(r0.x);
  r0.x = r0.x * 0.0625 + 0.5;
  o3.w = r1.y * 0.00392156886 + r0.x;
  o0.w = 0;
  o1.w = cb1[11].x;
  o2.w = 0.75686276;
  o2.xy = r5.xy;
  o3.xyz = r4.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   xyzw
// 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
// SV_DepthLessEqual        0    N/A oDepthLE  DEPTHLE   float    YES
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[141], immediateIndexed
dcl_constantbuffer cb1[12], immediateIndexed
dcl_constantbuffer cb2[15], immediateIndexed
dcl_constantbuffer cb3[10], 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 centroid v0.xyz
dcl_input_ps linear centroid v1.xyzw
dcl_input_ps linear v2.xy
dcl_input_ps_siv linear noperspective centroid v3.xyzw, 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_output oDepthLE
dcl_temps 10
mul r0.xyz, v0.yzxy, v1.zxyz
mad r0.xyz, v1.yzxy, v0.zxyz, -r0.xyzx
mul r0.xyz, r0.xyzx, v1.wwww
mov r0.w, v3.z
mov r1.x, l(1.000000)
mul r0.w, r0.w, v3.w
mul r2.xyzw, v3.yyyy, cb0[37].xyzw
mad r2.xyzw, v3.xxxx, cb0[36].xyzw, r2.xyzw
mad r2.xyzw, v3.zzzz, cb0[38].xyzw, r2.xyzw
add r2.xyzw, r2.xyzw, cb0[39].xyzw
div r1.yzw, r2.xxyz, r2.wwww
add r2.xyz, r1.yzwy, -cb0[58].xyzx
add r3.xyz, r2.xyzx, -cb0[55].xyzx
dp3 r2.w, r3.xyzx, r3.xyzx
sqrt r2.w, r2.w
mul r3.w, r2.w, l(0.000122)
min r3.w, r3.w, l(1.000000)
div r3.xyz, r3.xyzx, r2.wwww
dp3 r3.x, cb0[14].xyzx, r3.xyzx
add_sat r3.x, r3.x, l(0.300000)
mad r3.y, r3.w, l(7.000000), l(-13.000000)
mad r3.y, r3.x, r3.y, l(12.000000)
add r3.zw, v2.xxxy, cb3[2].xxxy
mul r3.zw, r3.zzzw, cb3[1].xxxy
sample_b_indexable(texture2d)(float,float,float,float) r4.xy, r3.zwzz, t0.xyzw, s0, r3.y
mad r4.xy, r4.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
dp2 r4.w, r4.xyxx, r4.xyxx
add r4.w, -r4.w, l(1.000000)
max r4.w, r4.w, l(0.000000)
sqrt r4.z, r4.w
sample_indexable(texture2d)(float,float,float,float) r5.xy, v2.xyxx, t1.xyzw, s1
mad r5.xy, r5.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
dp2 r4.w, r5.xyxx, r5.xyxx
add r4.w, -r4.w, l(1.000000)
max r4.w, r4.w, l(0.000000)
sqrt r5.z, r4.w
mad_sat r2.w, r2.w, l(0.000244), l(-0.200000)
add r6.xyz, -r4.xyzx, r5.xyzx
mad r4.xyz, r2.wwww, r6.xyzx, r4.xyzx
add r5.xyz, -r4.xyzx, r5.xyzx
mad r4.xyz, cb3[9].zzzz, r5.xyzx, r4.xyzx
mad r4.xyz, r4.xyzx, cb0[122].wwww, cb0[122].xyzx
dp3 r2.w, r4.xyzx, r4.xyzx
rsq r2.w, r2.w
mul r4.xyz, r2.wwww, r4.xyzx
mul r0.xyz, r0.xyzx, r4.yyyy
mad r0.xyz, r4.xxxx, v0.xyzx, r0.xyzx
mad r0.xyz, r4.zzzz, v1.xyzx, r0.xyzx
dp3 r2.w, r0.xyzx, r0.xyzx
rsq r2.w, r2.w
mul r0.xyz, r0.xyzx, r2.wwww
mad r2.w, r3.x, l(-12.000000), l(12.000000)
sample_b_indexable(texture2d)(float,float,float,float) r4.xyz, r3.zwzz, t2.xyzw, s2, r2.w
mul r4.xyz, r4.xyzx, cb3[8].xyzx
mul_sat r4.xyz, r4.xyzx, cb3[5].xyzx
sample_b_indexable(texture2d)(float,float,float,float) r3.xyz, r3.zwzz, t3.xyzw, s3, r3.y
add r2.w, -r3.x, l(1.000000)
max r2.w, |r2.w|, l(0.000001)
mul r3.w, r2.w, r2.w
mad r2.w, -r2.w, r2.w, l(0.800000)
mad_sat r5.y, r3.z, r2.w, r3.w
mad_sat r2.w, r3.x, l(0.850000), l(0.050000)
mad r1.x, r1.x, v3.w, l(0.500000)
div oDepthLE, r0.w, r1.x
mov_sat r5.x, r3.y
min r0.w, r3.w, l(1.000000)
mad o2.z, r2.w, cb0[123].y, cb0[123].x
lt r1.x, l(0.000000), cb1[11].y
movc o5.x, r1.x, cb2[5].x, l(1.000000)
mul r1.x, r5.y, l(0.080000)
mad r3.xyz, -r5.yyyy, l(0.080000, 0.080000, 0.080000, 0.000000), r4.xyzx
mad r3.xyz, r5.xxxx, r3.xyzx, r1.xxxx
mad r6.xyz, -r4.xyzx, r5.xxxx, r4.xyzx
mad r6.xyz, r6.xyzx, cb0[120].wwww, cb0[120].xyzx
mad r3.xyz, r3.xyzx, cb0[121].wwww, cb0[121].xyzx
mul r7.xyz, r0.yzxy, r0.yzyy
mul r8.yw, r0.yyyx, r0.zzzz
mad r1.x, r0.x, r0.x, -r7.x
mul r9.yzw, r0.yyzx, l(0.000000, -1.023328, 1.023328, -1.023328)
mad r8.xz, r7.zzyz, l(1.000000, 0.000000, 3.000000, 0.000000), l(0.000000, 0.000000, -1.000000, 0.000000)
mul r7.xyzw, r8.xyzw, l(0.858085, -0.858085, 0.247708, -0.858085)
mul r1.x, r1.x, l(0.429043)
mov r9.x, l(0.886228)
dp4 r2.w, cb2[8].xyzw, r9.xyzw
dp4 r3.w, cb2[11].xyzw, r7.xyzw
add r2.w, r2.w, r3.w
mad r8.x, cb2[14].x, r1.x, r2.w
dp4 r2.w, cb2[9].xyzw, r9.xyzw
dp4 r3.w, cb2[12].xyzw, r7.xyzw
add r2.w, r2.w, r3.w
mad r8.y, cb2[14].y, r1.x, r2.w
dp4 r2.w, cb2[10].xyzw, r9.xyzw
dp4 r3.w, cb2[13].xyzw, r7.xyzw
add r2.w, r2.w, r3.w
mad r8.z, cb2[14].z, r1.x, r2.w
max r7.xyz, r8.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
mul r7.xyz, r7.xyzx, cb0[140].xyzx
dp3 r1.x, r7.xyzx, l(0.300000, 0.590000, 0.110000, 0.000000)
mul r7.xyz, r6.xyzx, r7.xyzx
mul r7.xyz, r0.wwww, r7.xyzx
mad r3.xyz, r3.xyzx, l(0.450000, 0.450000, 0.450000, 0.000000), r6.xyzx
max r6.xyz, cb3[4].xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
lt r2.w, l(0.000000), cb0[124].x
if_nz r2.w
  dp3 r2.w, -r1.yzwy, -r1.yzwy
  rsq r2.w, r2.w
  mul r1.yzw, -r1.yyzw, r2.wwww
  mad r1.yzw, r1.yyzw, l(0.000000, 0.500000, 0.500000, 0.500000), r2.xxyz
  add r2.xyz, r1.yzwy, -cb1[8].xyzx
  add r8.xyz, cb1[9].xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
  lt r2.xyz, r8.xyzx, |r2.xyzx|
  or r2.x, r2.y, r2.x
  or r2.x, r2.z, r2.x
  dp3 r1.y, r1.yzwy, l(0.577000, 0.577000, 0.577000, 0.000000)
  mul r1.y, r1.y, l(0.002000)
  frc r1.y, r1.y
  lt r1.y, l(0.500000), r1.y
  movc r1.yzw, r1.yyyy, l(0,0,1.000000,1.000000), l(0,1.000000,1.000000,0)
  movc r6.xyz, r2.xxxx, r1.yzwy, r6.xyzx
endif 
mad r1.yzw, cb0[128].xxxx, r3.xxyz, r7.xxyz
add o0.xyz, r6.xyzx, r1.yzwy
mul r1.yzw, v3.xxyx, l(0.000000, 0.007813, 0.007813, 0.007813)
frc r1.yzw, r1.yyzw
mad r1.yzw, r1.yyzw, l(0.000000, 128.000000, 128.000000, 128.000000), l(0.000000, -64.340622, -72.465622, -64.340622)
mul r1.yzw, r1.yyzz, r1.yyzw
dp3 r1.y, r1.yzwy, l(20.390625, 60.703125, 2.428121, 0.000000)
frc r1.y, r1.y
add r1.y, r1.y, 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.x, r0.w, l(0.003906)
log r0.x, r0.x
mad r0.x, r0.x, l(0.062500), l(0.500000)
mad o3.w, r1.y, l(0.003922), r0.x
mov o0.w, l(0)
mov o1.w, cb1[11].x
mov o2.w, l(0.756863)
mov o2.xy, r5.xyxx
mov o3.xyz, r4.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

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


/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~ HLSL errors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error X8000: D3D11 Internal Compiler Error: Invalid Bytecode: Interpolation mode for PS input position must be linear_noperspective_centroid or linear_noperspective_sample when outputting oDepthGE or oDepthLE and not running at sample frequency (which is forced by inputting SV_SampleIndex or declaring an input linear_sample or linear_noperspective_sample). 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
