//Power Armour
cbuffer cb2 : register(b2)
{
  float4 cb2[7];
}

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

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


Texture2D<float4> StereoParams : register(t125);
Texture1D<float4> IniParams : register(t120);

void main( 
  float4 v0 : POSITION0,
  float2 v1 : TEXCOORD0,
  float4 v2 : NORMAL0,
  float4 v3 : BINORMAL0,
  float4 v4 : COLOR0,
  out float4 o0 : SV_POSITION0,
  out float4 o1 : TEXCOORD0,
  out float4 o2 : TEXCOORD4,
  out float4 o3 : TEXCOORD7,
  out float4 o4 : TEXCOORD8,
  out float3 o5 : TEXCOORD9,
  out float4 o6 : COLOR0,
  out float4 o7 : COLOR1)
{
  float4 r0,r1,r2,r3;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xyz = v0.xyz;
  r0.w = 1;
  r1.x = dot(cb2[0].xyzw, r0.xyzw);
  r1.y = dot(cb2[1].xyzw, r0.xyzw);
  r1.z = dot(cb2[2].xyzw, r0.xyzw);
  r1.w = dot(cb2[3].xyzw, r0.xyzw);
  o0.xyzw = r1.xyzw;
  
float4 s = StereoParams.Load(0);
float4 p = IniParams.Load(0);
if (p.x == 1)
{
	o0.x -= s.x*(o0.w-s.y)*p.z; //1.5;  
}
  
  r2.x = dot(cb2[4].xyzw, r0.xyzw);
  r2.y = dot(cb2[5].xyzw, r0.xyzw);
  r2.z = dot(cb2[6].xyzw, r0.xyzw);
  r0.x = dot(-r2.xyz, -r2.xyz);
  r0.x = rsqrt(r0.x);
  r0.xyz = -r2.xyz * r0.xxx;
  r2.xyz = v2.xyz * float3(2,2,2) + float3(-1,-1,-1);
  r3.x = dot(cb2[4].xyz, r2.xyz);
  r3.y = dot(cb2[5].xyz, r2.xyz);
  r3.z = dot(cb2[6].xyz, r2.xyz);
  r0.w = dot(r3.xyz, r3.xyz);
  r0.w = rsqrt(r0.w);
  r2.xyz = r3.xyz * r0.www;
  r0.w = dot(r2.xyz, r0.xyz);
  o2.xyz = r0.xyz;
  r0.x = -cb1[2].x + abs(r0.w);
  r0.yz = cb1[2].yw + -cb1[2].xz;
  r0.x = saturate(r0.x / r0.y);
  r0.y = r0.x * r0.x;
  r0.x = -r0.x * 2 + 3;
  r0.x = r0.y * r0.x;
  o1.z = r0.x * r0.z + cb1[2].z;
  o1.xy = v1.xy * cb1[0].zw + cb1[0].xy;
  o1.w = v1.y;
  o2.w = 0;
  r0.x = v0.w;
  r0.y = v2.w * 2 + -1;
  r0.z = v3.w * 2 + -1;
  o3.x = dot(r0.xyz, cb2[4].xyz);
  o3.y = dot(r0.xyz, cb2[5].xyz);
  o3.z = dot(r0.xyz, cb2[6].xyz);
  r0.xyz = v3.xyz * float3(2,2,2) + float3(-1,-1,-1);
  o4.x = dot(r0.xyz, cb2[4].xyz);
  o4.y = dot(r0.xyz, cb2[5].xyz);
  o4.z = dot(r0.xyz, cb2[6].xyz);
  o5.x = dot(r2.xyz, cb2[4].xyz);
  o5.y = dot(r2.xyz, cb2[5].xyz);
  o5.z = dot(r2.xyz, cb2[6].xyz);
  o6.xyzw = v4.xyzw;
  r0.x = dot(cb12[20].xyzw, r1.xyzw);
  r0.y = dot(cb12[21].xyzw, r1.xyzw);
  r0.z = dot(cb12[22].xyzw, r1.xyzw);
  r1.x = dot(r0.xyz, r0.xyz);
  r1.x = sqrt(r1.x);
  r1.x = r1.x * cb12[41].x + -cb12[41].z;
  r1.y = r1.x < 0.0149999997;
  r1.z = saturate(r1.x);
  r1.x = 0.75 < r1.x;
  r1.w = 66.6666718 * r1.z;
  r1.y = r1.y ? r1.w : 1;
  r0.w = 1;
  r0.x = dot(cb12[14].xyzw, r0.xyzw);
  r0.x = cb12[35].z + r0.x;
  r0.xy = saturate(r0.xx * cb12[46].xy + -cb12[46].zw);
  r0.y = r0.y + -r0.x;
  r0.x = r1.z * r0.y + r0.x;
  r0.y = 1 + -r0.x;
  r0.y = r0.x * cb12[44].w + r0.y;
  r0.z = -0.75 + r1.z;
  r0.w = log2(r1.z);
  r0.w = cb12[42].w * r0.w;
  r0.w = exp2(r0.w);
  r0.z = 4 * r0.z;
  r1.z = 1 + -cb12[43].w;
  r0.z = r0.z * r1.z + cb12[43].w;
  r0.z = min(1, r0.z);
  r0.z = r1.x ? r0.z : cb12[43].w;
  r0.z = min(r0.w, r0.z);
  r0.y = r0.z * r0.y;
  o7.w = r0.y * r1.y;
  r1.xyz = cb12[45].xyz + -cb12[43].xyz;
  r1.xyz = r0.zzz * r1.xyz + cb12[43].xyz;
  r2.xyz = cb12[44].xyz + -cb12[42].xyz;
  r0.yzw = r0.zzz * r2.xyz + cb12[42].xyz;
  r1.xyz = r1.xyz + -r0.yzw;
  o7.xyz = r0.xxx * r1.xyz + r0.yzw;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v1.2.9 on Thu Nov 19 23:37:49 2015
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyzw
// TEXCOORD                 0   xy          1     NONE   float   xy  
// NORMAL                   0   xyzw        2     NONE   float   xyzw
// BINORMAL                 0   xyzw        3     NONE   float   xyzw
// COLOR                    0   xyzw        4     NONE   float   xyzw
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float   xyzw
// TEXCOORD                 0   xyzw        1     NONE   float   xyzw
// TEXCOORD                 4   xyzw        2     NONE   float   xyzw
// TEXCOORD                 7   xyz         3     NONE   float   xyz 
// TEXCOORD                 8   xyz         4     NONE   float   xyz 
// TEXCOORD                 9   xyz         5     NONE   float   xyz 
// COLOR                    0   xyzw        6     NONE   float   xyzw
// COLOR                    1   xyzw        7     NONE   float   xyzw
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb12[47], immediateIndexed
dcl_constantbuffer cb1[3], immediateIndexed
dcl_constantbuffer cb2[7], immediateIndexed
dcl_input v0.xyzw
dcl_input v1.xy
dcl_input v2.xyzw
dcl_input v3.xyzw
dcl_input v4.xyzw
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyz
dcl_output o4.xyz
dcl_output o5.xyz
dcl_output o6.xyzw
dcl_output o7.xyzw
dcl_temps 4
mov r0.xyz, v0.xyzx
mov r0.w, l(1.000000)
dp4 r1.x, cb2[0].xyzw, r0.xyzw
dp4 r1.y, cb2[1].xyzw, r0.xyzw
dp4 r1.z, cb2[2].xyzw, r0.xyzw
dp4 r1.w, cb2[3].xyzw, r0.xyzw
mov o0.xyzw, r1.xyzw
dp4 r2.x, cb2[4].xyzw, r0.xyzw
dp4 r2.y, cb2[5].xyzw, r0.xyzw
dp4 r2.z, cb2[6].xyzw, r0.xyzw
dp3 r0.x, -r2.xyzx, -r2.xyzx
rsq r0.x, r0.x
mul r0.xyz, r0.xxxx, -r2.xyzx
mad r2.xyz, v2.xyzx, l(2.000000, 2.000000, 2.000000, 0.000000), l(-1.000000, -1.000000, -1.000000, 0.000000)
dp3 r3.x, cb2[4].xyzx, r2.xyzx
dp3 r3.y, cb2[5].xyzx, r2.xyzx
dp3 r3.z, cb2[6].xyzx, r2.xyzx
dp3 r0.w, r3.xyzx, r3.xyzx
rsq r0.w, r0.w
mul r2.xyz, r0.wwww, r3.xyzx
dp3 r0.w, r2.xyzx, r0.xyzx
mov o2.xyz, r0.xyzx
add r0.x, |r0.w|, -cb1[2].x
add r0.yz, -cb1[2].xxzx, cb1[2].yywy
div_sat r0.x, r0.x, r0.y
mul r0.y, r0.x, r0.x
mad r0.x, -r0.x, l(2.000000), l(3.000000)
mul r0.x, r0.x, r0.y
mad o1.z, r0.x, r0.z, cb1[2].z
mad o1.xy, v1.xyxx, cb1[0].zwzz, cb1[0].xyxx
mov o1.w, v1.y
mov o2.w, l(0)
mov r0.x, v0.w
mad r0.y, v2.w, l(2.000000), l(-1.000000)
mad r0.z, v3.w, l(2.000000), l(-1.000000)
dp3 o3.x, r0.xyzx, cb2[4].xyzx
dp3 o3.y, r0.xyzx, cb2[5].xyzx
dp3 o3.z, r0.xyzx, cb2[6].xyzx
mad r0.xyz, v3.xyzx, l(2.000000, 2.000000, 2.000000, 0.000000), l(-1.000000, -1.000000, -1.000000, 0.000000)
dp3 o4.x, r0.xyzx, cb2[4].xyzx
dp3 o4.y, r0.xyzx, cb2[5].xyzx
dp3 o4.z, r0.xyzx, cb2[6].xyzx
dp3 o5.x, r2.xyzx, cb2[4].xyzx
dp3 o5.y, r2.xyzx, cb2[5].xyzx
dp3 o5.z, r2.xyzx, cb2[6].xyzx
mov o6.xyzw, v4.xyzw
dp4 r0.x, cb12[20].xyzw, r1.xyzw
dp4 r0.y, cb12[21].xyzw, r1.xyzw
dp4 r0.z, cb12[22].xyzw, r1.xyzw
dp3 r1.x, r0.xyzx, r0.xyzx
sqrt r1.x, r1.x
mad r1.x, r1.x, cb12[41].x, -cb12[41].z
lt r1.y, r1.x, l(0.015000)
mov_sat r1.z, r1.x
lt r1.x, l(0.750000), r1.x
mul r1.w, r1.z, l(66.666672)
movc r1.y, r1.y, r1.w, l(1.000000)
mov r0.w, l(1.000000)
dp4 r0.x, cb12[14].xyzw, r0.xyzw
add r0.x, r0.x, cb12[35].z
mad_sat r0.xy, r0.xxxx, cb12[46].xyxx, -cb12[46].zwzz
add r0.y, -r0.x, r0.y
mad r0.x, r1.z, r0.y, r0.x
add r0.y, -r0.x, l(1.000000)
mad r0.y, r0.x, cb12[44].w, r0.y
add r0.z, r1.z, l(-0.750000)
log r0.w, r1.z
mul r0.w, r0.w, cb12[42].w
exp r0.w, r0.w
mul r0.z, r0.z, l(4.000000)
add r1.z, -cb12[43].w, l(1.000000)
mad r0.z, r0.z, r1.z, cb12[43].w
min r0.z, r0.z, l(1.000000)
movc r0.z, r1.x, r0.z, cb12[43].w
min r0.z, r0.z, r0.w
mul r0.y, r0.y, r0.z
mul o7.w, r1.y, r0.y
add r1.xyz, -cb12[43].xyzx, cb12[45].xyzx
mad r1.xyz, r0.zzzz, r1.xyzx, cb12[43].xyzx
add r2.xyz, -cb12[42].xyzx, cb12[44].xyzx
mad r0.yzw, r0.zzzz, r2.xxyz, cb12[42].xxyz
add r1.xyz, -r0.yzwy, r1.xyzx
mad o7.xyz, r0.xxxx, r1.xyzx, r0.yzwy
ret 
// Approximately 0 instruction slots used

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