// ---- Created with 3Dmigoto v1.2.35 on Tue Apr 26 22:30:56 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( 
  float3 v0 : POSITION0,
  float4 v1 : COLOR0,
  float4 v2 : COLOR1,
  float4 v3 : TEXCOORD0,
  float4 v4 : TEXCOORD3,
  float2 v5 : TEXCOORD4,
  out float4 o0 : COLOR0,
  out float4 o1 : TEXCOORD0,
  out float4 o2 : TEXCOORD1,
  out float2 o3 : TEXCOORD3,
  out float2 p3 : TEXCOORD4,
  out float4 o4 : TEXCOORD5,
  out float4 o5 : SV_POSITION0)
{
  float4 r0,r1,r2,r3,r4;
  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.xw = float2(0,1);
  r2.xyz = v0.xyz;
  r2.w = 1;
  r3.x = dot(r2.xyzw, g_viewMatrix._m00_m10_m20_m30);
  r3.y = dot(r2.xyzw, g_viewMatrix._m01_m11_m21_m31);
  r3.z = dot(r2.xyzw, g_viewMatrix._m02_m12_m22_m32);
  r3.w = dot(r2.xyzw, g_viewMatrix._m03_m13_m23_m33);
  r2.w = dot(r3.xyzw, g_projectionMatrix._m03_m13_m23_m33);
  r0.y = -g_vs_softSpriteParam.x * 0.5 + r2.w;
  r0.z = r2.w + -r0.y;
  r0.z = 1 / r0.z;
  r0.w = g_near + -r0.y;
  r0.z = saturate(r0.w * r0.z);
  r0.w = r0.z * -2 + 3;
  r0.z = r0.z * r0.z;
  r1.y = -r0.w * r0.z + 1;
  r0.z = r2.w / r0.y;
  r4.xy = g_far / g_nearFarDistance;
  r0.w = r4.x * r0.y + -r4.y;
  r1.z = r0.z * r0.w;
  r0.z = cmp(g_near < r2.w);
  r0.w = cmp(r0.y < g_near);
  o4.z = r0.y;
  r0.y = r0.z ? r0.w : 0;
  r0.yz = r0.yy ? r1.xy : r1.zw;
  r1.xyzw = v2.xyzw * v1.xyzw;
  r0.z = r1.w * r0.z;
  o5.z = r0.y;
  o0.xyz = r1.xyz;
  o0.w = saturate(r0.z * r0.x);
  o1.xy = v3.xy;
  r0.x = -g_fogStartZ + r2.w;
  o1.z = saturate(g_recFogEndZ * r0.x);
  o2.xyz = g_eye.xyz + -v0.xyz;
  o2.w = 0;
  o3.xy = v4.xy;
  p3.xy = v5.xy;
  r2.x = dot(r3.xyzw, g_projectionMatrix._m00_m10_m20_m30);
  r2.y = dot(r3.xyzw, g_projectionMatrix._m01_m11_m21_m31);
  r0.xy = r2.xy / r2.ww;
  o5.xyw = r2.xyw;
  o4.xy = r0.xy * float2(0.5,-0.5) + float2(0.5,0.5);
  o4.w = g_vs_softSpriteParam.x;
  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
//   float2 g_vs_softSpriteScaleOffset; // Offset:  416 Size:     8 [unused]
//   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   xyz         0     NONE   float   xyz 
// COLOR                    0   xyzw        1     NONE   float   xyzw
// COLOR                    1   xyzw        2     NONE   float   xyzw
// TEXCOORD                 0   xy          3     NONE   float   xy  
// TEXCOORD                 3   xy          4     NONE   float   xy  
// TEXCOORD                 4   xy          5     NONE   float   xy  
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// COLOR                    0   xyzw        0     NONE   float   xyzw
// TEXCOORD                 0   xyz         1     NONE   float   xyz 
// TEXCOORD                 1   xyzw        2     NONE   float   xyzw
// TEXCOORD                 3   xy          3     NONE   float   xy  
// TEXCOORD                 4     zw        3     NONE   float     zw
// TEXCOORD                 5   xyzw        4     NONE   float   xyzw
// SV_POSITION              0   xyzw        5      POS   float   xyzw
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[28], immediateIndexed
dcl_input v0.xyz
dcl_input v1.xyzw
dcl_input v2.xyzw
dcl_input v3.xy
dcl_input v4.xy
dcl_input v5.xy
dcl_output o0.xyzw
dcl_output o1.xyz
dcl_output o2.xyzw
dcl_output o3.xy
dcl_output o3.zw
dcl_output o4.xyzw
dcl_output_siv o5.xyzw, position
dcl_temps 5
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
mov r1.xw, l(0,0,0,1.000000)
mov r2.xyz, v0.xyzx
mov r2.w, l(1.000000)
dp4 r3.x, r2.xyzw, cb0[4].xyzw
dp4 r3.y, r2.xyzw, cb0[5].xyzw
dp4 r3.z, r2.xyzw, cb0[6].xyzw
dp4 r3.w, r2.xyzw, cb0[7].xyzw
dp4 r2.w, r3.xyzw, cb0[11].xyzw
mad r0.y, -cb0[25].x, l(0.500000), r2.w
add r0.z, -r0.y, r2.w
div r0.z, l(1.000000, 1.000000, 1.000000, 1.000000), r0.z
add r0.w, -r0.y, cb0[20].w
mul_sat r0.z, r0.z, r0.w
mad r0.w, r0.z, l(-2.000000), l(3.000000)
mul r0.z, r0.z, r0.z
mad r1.y, -r0.w, r0.z, l(1.000000)
div r0.z, r2.w, r0.y
div r4.xy, cb0[20].zxzz, cb0[20].yyyy
mad r0.w, r4.x, r0.y, -r4.y
mul r1.z, r0.w, r0.z
lt r0.z, cb0[20].w, r2.w
lt r0.w, r0.y, cb0[20].w
mov o4.z, r0.y
and r0.y, r0.z, r0.w
movc r0.yz, r0.yyyy, r1.xxyx, r1.zzwz
mul r1.xyzw, v1.xyzw, v2.xyzw
mul r0.z, r0.z, r1.w
mov o5.z, r0.y
mov o0.xyz, r1.xyzx
mul_sat o0.w, r0.x, r0.z
mov o1.xy, v3.xyxx
add r0.x, r2.w, -cb0[18].x
mul_sat o1.z, r0.x, cb0[18].y
add o2.xyz, -v0.xyzx, cb0[21].xyzx
mov o2.w, l(0)
mov o3.xy, v4.xyxx
mov o3.zw, v5.xxxy
dp4 r2.x, r3.xyzw, cb0[8].xyzw
dp4 r2.y, r3.xyzw, cb0[9].xyzw
div r0.xy, r2.xyxx, r2.wwww
mov o5.xyw, r2.xyxw
mad o4.xy, r0.xyxx, l(0.500000, -0.500000, 0.000000, 0.000000), l(0.500000, 0.500000, 0.000000, 0.000000)
mov o4.w, cb0[25].x
ret 
// Approximately 63 instruction slots used

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