// ---- Created with 3Dmigoto v1.2.35 on Tue Apr 26 22:30:55 2016

cbuffer VSCommonBuffer : register(b0)
{
  float4x4 g_viewProjectionMatrix : packoffset(c0);
  float4x4 g_viewMatrix : packoffset(c4);
  float4x4 g_projectionMatrix : packoffset(c8);
  float4x4 g_worldViewProjectionMatrix : packoffset(c12);
  float4 g_nearFarParam : packoffset(c16);
  float3 g_lightDir : packoffset(c17);
  float g_fogStartZ : packoffset(c18);
  float g_recFogEndZ : packoffset(c18.y);
  float g_fogStartY : packoffset(c18.z);
  float g_recFogEndY : packoffset(c18.w);
  float2 g_screenSize : packoffset(c19);
  float2 g_recScreenSize : packoffset(c19.z);
  float g_nearFar : packoffset(c20);
  float g_nearFarDistance : packoffset(c20.y);
  float g_far : packoffset(c20.z);
  float g_near : packoffset(c20.w);
  float3 g_eye : packoffset(c21);
  float2 g_fbTexCoef : packoffset(c22);
  float3 g_lightDir2 : packoffset(c23);
  float g_vs_fadeNearStart : packoffset(c24);
  float g_vs_fadeNearDist : packoffset(c24.y);
  float g_vs_fadeFarStart : packoffset(c24.z);
  float g_vs_fadeFarDist : packoffset(c24.w);
  float4 g_vs_softSpriteParam : packoffset(c25);
  float2 g_vs_softSpriteScaleOffset : packoffset(c26);
  float2 g_vs_softSpriteScaleOffsetDummy : packoffset(c26.z);
  float3 g_camerapos : packoffset(c27);
}



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


void main( 
  float4 v0 : POSITION0,
  float4 v1 : COLOR0,
  float4 v2 : COLOR1,
  float4 v3 : COLOR2,
  float4 v4 : COLOR3,
  float4 v5 : COLOR4,
  float4 v6 : TEXCOORD0,
  float4 v7 : TEXCOORD1,
  float2 v8 : TEXCOORD2,
  out float4 o0 : COLOR0,
  out float4 o1 : TEXCOORD0,
  out float4 o2 : TEXCOORD1,
  out float4 o3 : TEXCOORD2,
  out float4 o4 : TEXCOORD3,
  out float4 o5 : TEXCOORD4,
  out float4 o6 : TEXCOORD5,
  out float4 o7 : TEXCOORD6,
  out float4 o8 : TEXCOORD7,
  out float4 o9 : TEXCOORD8,
  out float4 o10 : SV_POSITION0)
{
  float4 r0,r1,r2;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xyz = g_camerapos.xyz + -v0.xyz;
  r0.x = dot(r0.xyz, r0.xyz);
  r0.x = sqrt(r0.x);
  r0.yz = -g_vs_fadeNearStart + r0.xx;
  r0.xw = -g_vs_fadeFarStart + r0.xx;
  r1.x = -1 / g_vs_fadeNearDist;
  r1.y = 1 / g_vs_fadeFarDist;
  r0.yz = saturate(r1.xy * r0.yz);
  r0.yz = float2(1,1) + -r0.yz;
  r0.y = r0.y * r0.z;
  r0.x = saturate(r0.x / g_vs_fadeFarDist);
  r0.z = saturate(r0.w / -g_vs_fadeNearDist);
  r0.xz = float2(1,1) + -r0.xz;
  r1.xy = cmp(float2(9.99999975e-005,9.99999975e-005) >= g_vs_fadeNearDist);
  r0.x = r1.x ? r0.x : r0.z;
  r0.z = r1.y ? r1.x : 0;
  r0.w = (int)r1.y | (int)r1.x;
  r0.x = r0.z ? 1 : r0.x;
  r0.x = r0.w ? r0.x : r0.y;
  r1.xyzw = v5.xyzw * v1.xyzw;
  o0.w = saturate(r1.w * r0.x);
  o0.xyz = r1.xyz;
  o1.xyzw = v6.xyzw;
  o2.xyzw = v7.xyzw;
  o3.x = v0.w;
  o3.z = v8.x;
  r0.xyz = v0.xyz;
  r0.w = 1;
  r1.x = dot(r0.xyzw, g_viewMatrix._m00_m10_m20_m30);
  r1.y = dot(r0.xyzw, g_viewMatrix._m01_m11_m21_m31);
  r1.z = dot(r0.xyzw, g_viewMatrix._m02_m12_m22_m32);
  r1.w = dot(r0.xyzw, g_viewMatrix._m03_m13_m23_m33);
  r0.w = dot(r1.xyzw, g_projectionMatrix._m03_m13_m23_m33);
  r2.x = -g_fogStartZ + r0.w;
  o3.y = saturate(g_recFogEndZ * r2.x);
  r0.x = dot(r1.xyzw, g_projectionMatrix._m00_m10_m20_m30);
  r0.y = dot(r1.xyzw, g_projectionMatrix._m01_m11_m21_m31);
  r1.xy = r0.xy / r0.ww;
  o4.xy = r1.xy * float2(0.5,-0.5) + float2(0.5,0.5);
  r1.x = g_vs_softSpriteScaleOffset.x * v8.y;
  r1.y = 0.5 * r1.x;
  r1.x = r1.x * 0.5 + g_vs_softSpriteScaleOffset.y;
  r1.x = -r1.x + r0.w;
  o4.w = g_vs_softSpriteScaleOffset.y * 2 + r1.y;
  r1.y = -r1.x + r0.w;
  r1.z = g_near + 1;
  r1.w = r1.z + -r1.x;
  r1.z = cmp(r1.x < r1.z);
  r1.w = min(1, r1.w);
  r1.y = r1.w * r1.y + r1.x;
  r1.x = r1.z ? r1.y : r1.x;
  o4.z = r1.x;
  r1.y = r0.w / r1.x;
  r1.zw = g_far / g_nearFarDistance;
  r1.x = r1.z * r1.x + -r1.w;
  r0.z = r1.y * r1.x;
  o5.xyzw = r0.xyzw;
  o10.xyzw = r0.xyzw;
  o6.xyz = g_eye.xyz + -v0.xyz;
  o6.w = 0;
  o7.xyzw = v2.xyzw;
  o8.xyzw = v3.xyzw;
  o9.xyzw = v4.xyzw;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Original ASM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20546
//
//
// Buffer Definitions: 
//
// cbuffer VSCommonBuffer
// {
//
//   float4x4 g_viewProjectionMatrix;   // Offset:    0 Size:    64 [unused]
//   float4x4 g_viewMatrix;             // Offset:   64 Size:    64
//   float4x4 g_projectionMatrix;       // Offset:  128 Size:    64
//   float4x4 g_worldViewProjectionMatrix;// Offset:  192 Size:    64 [unused]
//   float4 g_nearFarParam;             // Offset:  256 Size:    16 [unused]
//   float3 g_lightDir;                 // Offset:  272 Size:    12 [unused]
//   float g_fogStartZ;                 // Offset:  288 Size:     4
//   float g_recFogEndZ;                // Offset:  292 Size:     4
//   float g_fogStartY;                 // Offset:  296 Size:     4 [unused]
//   float g_recFogEndY;                // Offset:  300 Size:     4 [unused]
//   float2 g_screenSize;               // Offset:  304 Size:     8 [unused]
//   float2 g_recScreenSize;            // Offset:  312 Size:     8 [unused]
//   float g_nearFar;                   // Offset:  320 Size:     4
//   float g_nearFarDistance;           // Offset:  324 Size:     4
//   float g_far;                       // Offset:  328 Size:     4
//   float g_near;                      // Offset:  332 Size:     4
//   float3 g_eye;                      // Offset:  336 Size:    12
//   float2 g_fbTexCoef;                // Offset:  352 Size:     8 [unused]
//   float3 g_lightDir2;                // Offset:  368 Size:    12 [unused]
//   float g_vs_fadeNearStart;          // Offset:  384 Size:     4
//   float g_vs_fadeNearDist;           // Offset:  388 Size:     4
//   float g_vs_fadeFarStart;           // Offset:  392 Size:     4
//   float g_vs_fadeFarDist;            // Offset:  396 Size:     4
//   float4 g_vs_softSpriteParam;       // Offset:  400 Size:    16 [unused]
//   float2 g_vs_softSpriteScaleOffset; // Offset:  416 Size:     8
//   float2 g_vs_softSpriteScaleOffsetDummy;// Offset:  424 Size:     8 [unused]
//   float3 g_camerapos;                // Offset:  432 Size:    12
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// VSCommonBuffer                    cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyzw
// COLOR                    0   xyzw        1     NONE   float   xyzw
// COLOR                    1   xyzw        2     NONE   float   xyzw
// COLOR                    2   xyzw        3     NONE   float   xyzw
// COLOR                    3   xyzw        4     NONE   float   xyzw
// COLOR                    4   xyzw        5     NONE   float   xyzw
// TEXCOORD                 0   xyzw        6     NONE   float   xyzw
// TEXCOORD                 1   xyzw        7     NONE   float   xyzw
// TEXCOORD                 2   xy          8     NONE   float   xy  
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// COLOR                    0   xyzw        0     NONE   float   xyzw
// TEXCOORD                 0   xyzw        1     NONE   float   xyzw
// TEXCOORD                 1   xyzw        2     NONE   float   xyzw
// TEXCOORD                 2   xyz         3     NONE   float   xyz 
// TEXCOORD                 3   xyzw        4     NONE   float   xyzw
// TEXCOORD                 4   xyzw        5     NONE   float   xyzw
// TEXCOORD                 5   xyzw        6     NONE   float   xyzw
// TEXCOORD                 6   xyzw        7     NONE   float   xyzw
// TEXCOORD                 7   xyzw        8     NONE   float   xyzw
// TEXCOORD                 8   xyzw        9     NONE   float   xyzw
// SV_POSITION              0   xyzw       10      POS   float   xyzw
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[28], immediateIndexed
dcl_input v0.xyzw
dcl_input v1.xyzw
dcl_input v2.xyzw
dcl_input v3.xyzw
dcl_input v4.xyzw
dcl_input v5.xyzw
dcl_input v6.xyzw
dcl_input v7.xyzw
dcl_input v8.xy
dcl_output o0.xyzw
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyz
dcl_output o4.xyzw
dcl_output o5.xyzw
dcl_output o6.xyzw
dcl_output o7.xyzw
dcl_output o8.xyzw
dcl_output o9.xyzw
dcl_output_siv o10.xyzw, position
dcl_temps 3
add r0.xyz, -v0.xyzx, cb0[27].xyzx
dp3 r0.x, r0.xyzx, r0.xyzx
sqrt r0.x, r0.x
add r0.yz, r0.xxxx, -cb0[24].xxzx
add r0.xw, r0.xxxx, -cb0[24].zzzx
div r1.x, l(-1.000000), cb0[24].y
div r1.y, l(1.000000, 1.000000, 1.000000, 1.000000), cb0[24].w
mul_sat r0.yz, r0.yyzy, r1.xxyx
add r0.yz, -r0.yyzy, l(0.000000, 1.000000, 1.000000, 0.000000)
mul r0.y, r0.z, r0.y
div_sat r0.x, r0.x, cb0[24].w
div_sat r0.z, r0.w, -cb0[24].y
add r0.xz, -r0.xxzx, l(1.000000, 0.000000, 1.000000, 0.000000)
ge r1.xy, l(0.000100, 0.000100, 0.000000, 0.000000), cb0[24].ywyy
movc r0.x, r1.x, r0.x, r0.z
and r0.z, r1.y, r1.x
or r0.w, r1.y, r1.x
movc r0.x, r0.z, l(1.000000), r0.x
movc r0.x, r0.w, r0.x, r0.y
mul r1.xyzw, v1.xyzw, v5.xyzw
mul_sat o0.w, r0.x, r1.w
mov o0.xyz, r1.xyzx
mov o1.xyzw, v6.xyzw
mov o2.xyzw, v7.xyzw
mov o3.x, v0.w
mov o3.z, v8.x
mov r0.xyz, v0.xyzx
mov r0.w, l(1.000000)
dp4 r1.x, r0.xyzw, cb0[4].xyzw
dp4 r1.y, r0.xyzw, cb0[5].xyzw
dp4 r1.z, r0.xyzw, cb0[6].xyzw
dp4 r1.w, r0.xyzw, cb0[7].xyzw
dp4 r0.w, r1.xyzw, cb0[11].xyzw
add r2.x, r0.w, -cb0[18].x
mul_sat o3.y, r2.x, cb0[18].y
dp4 r0.x, r1.xyzw, cb0[8].xyzw
dp4 r0.y, r1.xyzw, cb0[9].xyzw
div r1.xy, r0.xyxx, r0.wwww
mad o4.xy, r1.xyxx, l(0.500000, -0.500000, 0.000000, 0.000000), l(0.500000, 0.500000, 0.000000, 0.000000)
mul r1.x, v8.y, cb0[26].x
mul r1.y, r1.x, l(0.500000)
mad r1.x, r1.x, l(0.500000), cb0[26].y
add r1.x, r0.w, -r1.x
mad o4.w, cb0[26].y, l(2.000000), r1.y
add r1.y, r0.w, -r1.x
add r1.z, l(1.000000), cb0[20].w
add r1.w, -r1.x, r1.z
lt r1.z, r1.x, r1.z
min r1.w, r1.w, l(1.000000)
mad r1.y, r1.w, r1.y, r1.x
movc r1.x, r1.z, r1.y, r1.x
mov o4.z, r1.x
div r1.y, r0.w, r1.x
div r1.zw, cb0[20].zzzx, cb0[20].yyyy
mad r1.x, r1.z, r1.x, -r1.w
mul r0.z, r1.x, r1.y
mov o5.xyzw, r0.xyzw
mov o10.xyzw, r0.xyzw
add o6.xyz, -v0.xyzx, cb0[21].xyzx
mov o6.w, l(0)
mov o7.xyzw, v2.xyzw
mov o8.xyzw, v3.xyzw
mov o9.xyzw, v4.xyzw
ret 
// Approximately 64 instruction slots used

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