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

cbuffer DSCommonBuffer : register(b0)
{
  float4x4 g_ds_viewProjectionMatrix : packoffset(c0);
  float4x4 g_ds_viewMatrix : packoffset(c4);
  float4x4 g_ds_projectionMatrix : packoffset(c8);
  float4x4 g_ds_worldViewProjectionMatrix : packoffset(c12);
  float g_ds_fogStartZ : packoffset(c16);
  float g_ds_recFogEndZ : packoffset(c16.y);
  float g_ds_fogStartY : packoffset(c16.z);
  float g_ds_recFogEndY : packoffset(c16.w);
  float3 g_ds_lightDir : packoffset(c17);
  float4 g_ds_directionalLightColor : packoffset(c18);
  float4 g_ds_hemiLightColor0 : packoffset(c19);
  float4 g_ds_hemiLightColor1 : packoffset(c20);
  float g_ds_nearFar : packoffset(c21);
  float g_ds_nearFarDistance : packoffset(c21.y);
  float g_ds_far : packoffset(c21.z);
  float g_ds_near : packoffset(c21.w);
  float3 g_ds_eye : packoffset(c22);
  float g_ds_fadeNearStart : packoffset(c23);
  float g_ds_fadeNearDist : packoffset(c23.y);
  float g_ds_fadeFarStart : packoffset(c23.z);
  float g_ds_fadeFarDist : packoffset(c23.w);
  float3 g_ds_cameraPos : packoffset(c24);
  float3 g_ds_cameraUp : packoffset(c25);
  float4 g_ds_softSpriteParam : packoffset(c26);
  float2 g_ds_softSpriteScaleOffset : packoffset(c27);
  float2 g_ds_softSpriteScaleOffsetDummy : packoffset(c27.z);
}



// 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 : TEXCOORD0,
  float4 v4 : TEXCOORD1,
  float4 v5 : TEXCOORD2,
  float4 v6 : TEXCOORD3,
  float4 v7 : TEXCOORD4,
  float4 v8 : TEXCOORD5,
  out float4 o0 : COLOR0,
  out float4 o1 : TEXCOORD0,
  out float4 o2 : TEXCOORD1,
  out float4 o3 : TEXCOORD2,
  out float2 o4 : TEXCOORD3,
  out float4 o5 : SV_POSITION0)
{
// Needs manual fix for instruction: 
// unknown dcl_: dcl_input_control_point_count 1
// Needs manual fix for instruction: 
// unknown dcl_: dcl_tessellator_domain domain_quad
  float4 r0,r1,r2,r3;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xy = float2(-0.5,-0.5) + vDomain.xy;
  r0.z = cmp(0 < r0.y);
  r0.w = cmp(r0.y < 0);
  r0.z = (int)-r0.z + (int)r0.w;
  r0.z = (int)r0.z;
  r0.w = 0.0606599897 * r0.z;
  r1.y = r0.y * 0.878679991 + r0.w;
  r0.y = -r0.z * 0.207106665 + r1.y;
  r0.y = dot(r0.yy, r0.zz);
  r0.y = 1 + -r0.y;
  r1.x = r0.x * r0.y;
  r1.zw = float2(0,0);
  r0.xyzw = vicp[0][0].xyzw + r1.xyzw;
  r2.x = dot(r0.xyzw, vicp[0][6].xyzw);
  r2.y = dot(r0.xyzw, vicp[0][7].xyzw);
  r2.z = dot(r0.xyzw, vicp[0][8].xyzw);
  r0.xyz = g_ds_cameraPos.xyz + -r2.xyz;
  r0.x = dot(r0.xyz, r0.xyz);
  r0.x = sqrt(r0.x);
  r0.yz = -g_ds_fadeFarStart + r0.xx;
  r0.xw = -g_ds_fadeNearStart + r0.xx;
  r0.y = saturate(r0.y / g_ds_fadeFarDist);
  r0.z = saturate(r0.z / -g_ds_fadeNearDist);
  r0.yz = float2(1,1) + -r0.yz;
  r1.zw = cmp(float2(9.99999975e-005,9.99999975e-005) >= g_ds_fadeNearDist);
  r0.y = r1.z ? r0.y : r0.z;
  r0.z = r1.w ? r1.z : 0;
  r1.z = (int)r1.w | (int)r1.z;
  r0.y = r0.z ? 1 : r0.y;
  r3.x = -1 / g_ds_fadeNearDist;
  r3.y = 1 / g_ds_fadeFarDist;
  r0.xz = saturate(r3.xy * r0.xw);
  r0.xz = float2(1,1) + -r0.xz;
  r0.x = r0.x * r0.z;
  r0.x = r1.z ? r0.y : r0.x;
  r3.xyzw = vicp[0][2].xyzw * vicp[0][1].xyzw;
  o0.w = saturate(r3.w * r0.x);
  o0.xyz = r3.xyz;
  r0.xw = float2(1,-1);
  r0.yz = vicp[0][4].yx;
  r0.xy = r1.xy * r0.xy;
  o1.xy = r0.xy * r0.zw + vicp[0][3].xy;
  o2.xy = r0.xy * r0.zw + vicp[0][3].zw;
  r2.w = 1;
  r0.x = dot(r2.xyzw, g_ds_viewMatrix._m00_m10_m20_m30);
  r0.y = dot(r2.xyzw, g_ds_viewMatrix._m01_m11_m21_m31);
  r0.z = dot(r2.xyzw, g_ds_viewMatrix._m02_m12_m22_m32);
  r0.w = dot(r2.xyzw, g_ds_viewMatrix._m03_m13_m23_m33);
  o3.xyz = g_ds_eye.xyz + -r2.xyz;
  r1.x = dot(r0.xyzw, g_ds_projectionMatrix._m03_m13_m23_m33);
  r1.y = -g_ds_fogStartZ + r1.x;
  o5.w = r1.x;
  o1.z = saturate(g_ds_recFogEndZ * r1.y);
  o2.z = vicp[0][4].z;
  o3.w = 0;
  o4.xy = vicp[0][5].xy;
  o5.x = dot(r0.xyzw, g_ds_projectionMatrix._m00_m10_m20_m30);
  o5.y = dot(r0.xyzw, g_ds_projectionMatrix._m01_m11_m21_m31);
  o5.z = dot(r0.xyzw, g_ds_projectionMatrix._m02_m12_m22_m32);
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Original ASM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20546
//
//
// Buffer Definitions: 
//
// cbuffer DSCommonBuffer
// {
//
//   float4x4 g_ds_viewProjectionMatrix;// Offset:    0 Size:    64 [unused]
//   float4x4 g_ds_viewMatrix;          // Offset:   64 Size:    64
//   float4x4 g_ds_projectionMatrix;    // Offset:  128 Size:    64
//   float4x4 g_ds_worldViewProjectionMatrix;// Offset:  192 Size:    64 [unused]
//   float g_ds_fogStartZ;              // Offset:  256 Size:     4
//   float g_ds_recFogEndZ;             // Offset:  260 Size:     4
//   float g_ds_fogStartY;              // Offset:  264 Size:     4 [unused]
//   float g_ds_recFogEndY;             // Offset:  268 Size:     4 [unused]
//   float3 g_ds_lightDir;              // Offset:  272 Size:    12 [unused]
//   float4 g_ds_directionalLightColor; // Offset:  288 Size:    16 [unused]
//   float4 g_ds_hemiLightColor0;       // Offset:  304 Size:    16 [unused]
//   float4 g_ds_hemiLightColor1;       // Offset:  320 Size:    16 [unused]
//   float g_ds_nearFar;                // Offset:  336 Size:     4 [unused]
//   float g_ds_nearFarDistance;        // Offset:  340 Size:     4 [unused]
//   float g_ds_far;                    // Offset:  344 Size:     4 [unused]
//   float g_ds_near;                   // Offset:  348 Size:     4 [unused]
//   float3 g_ds_eye;                   // Offset:  352 Size:    12
//   float g_ds_fadeNearStart;          // Offset:  368 Size:     4
//   float g_ds_fadeNearDist;           // Offset:  372 Size:     4
//   float g_ds_fadeFarStart;           // Offset:  376 Size:     4
//   float g_ds_fadeFarDist;            // Offset:  380 Size:     4
//   float3 g_ds_cameraPos;             // Offset:  384 Size:    12
//   float3 g_ds_cameraUp;              // Offset:  400 Size:    12 [unused]
//   float4 g_ds_softSpriteParam;       // Offset:  416 Size:    16 [unused]
//   float2 g_ds_softSpriteScaleOffset; // Offset:  432 Size:     8 [unused]
//   float2 g_ds_softSpriteScaleOffsetDummy;// Offset:  440 Size:     8 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// DSCommonBuffer                    cbuffer      NA          NA    0        1
//
//
//
// Patch Constant signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_TESSFACTOR            0   x           0 QUADEDGE   float       
// SV_TESSFACTOR            1   x           1 QUADEDGE   float       
// SV_TESSFACTOR            2   x           2 QUADEDGE   float       
// SV_TESSFACTOR            3   x           3 QUADEDGE   float       
// SV_INSIDETESSFACTOR      0   x           4  QUADINT   float       
// SV_INSIDETESSFACTOR      1   x           5  QUADINT   float       
//
//
// 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
// TEXCOORD                 0   xyzw        3     NONE   float   xyzw
// TEXCOORD                 1   xyzw        4     NONE   float   xyz 
// TEXCOORD                 2   xy          5     NONE   float   xy  
// TEXCOORD                 3   xyzw        6     NONE   float   xyzw
// TEXCOORD                 4   xyzw        7     NONE   float   xyzw
// TEXCOORD                 5   xyzw        8     NONE   float   xyzw
//
//
// 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   xyz         2     NONE   float   xyz 
// TEXCOORD                 2   xyzw        3     NONE   float   xyzw
// TEXCOORD                 3   xy          4     NONE   float   xy  
// SV_POSITION              0   xyzw        5      POS   float   xyzw
//
// Tessellation Domain   # of control points
// -------------------- --------------------
// Quadrilateral                           1
//
ds_5_0
dcl_input_control_point_count 1
dcl_tessellator_domain domain_quad
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[25], immediateIndexed
dcl_input vDomain.xy
dcl_input vicp[1][0].xyzw
dcl_input vicp[1][1].xyzw
dcl_input vicp[1][2].xyzw
dcl_input vicp[1][3].xyzw
dcl_input vicp[1][4].xyz
dcl_input vicp[1][5].xy
dcl_input vicp[1][6].xyzw
dcl_input vicp[1][7].xyzw
dcl_input vicp[1][8].xyzw
dcl_output o0.xyzw
dcl_output o1.xyz
dcl_output o2.xyz
dcl_output o3.xyzw
dcl_output o4.xy
dcl_output_siv o5.xyzw, position
dcl_temps 4
add r0.xy, vDomain.xyxx, l(-0.500000, -0.500000, 0.000000, 0.000000)
lt r0.z, l(0.000000), r0.y
lt r0.w, r0.y, l(0.000000)
iadd r0.z, -r0.z, r0.w
itof r0.z, r0.z
mul r0.w, r0.z, l(0.060660)
mad r1.y, r0.y, l(0.878680), r0.w
mad r0.y, -r0.z, l(0.207107), r1.y
dp2 r0.y, r0.yyyy, r0.zzzz
add r0.y, -r0.y, l(1.000000)
mul r1.x, r0.y, r0.x
mov r1.zw, l(0,0,0,0)
add r0.xyzw, r1.xyzw, vicp[0][0].xyzw
dp4 r2.x, r0.xyzw, vicp[0][6].xyzw
dp4 r2.y, r0.xyzw, vicp[0][7].xyzw
dp4 r2.z, r0.xyzw, vicp[0][8].xyzw
add r0.xyz, -r2.xyzx, cb0[24].xyzx
dp3 r0.x, r0.xyzx, r0.xyzx
sqrt r0.x, r0.x
add r0.yz, r0.xxxx, -cb0[23].zzxz
add r0.xw, r0.xxxx, -cb0[23].xxxz
div_sat r0.y, r0.y, cb0[23].w
div_sat r0.z, r0.z, -cb0[23].y
add r0.yz, -r0.yyzy, l(0.000000, 1.000000, 1.000000, 0.000000)
ge r1.zw, l(0.000000, 0.000000, 0.000100, 0.000100), cb0[23].yyyw
movc r0.y, r1.z, r0.y, r0.z
and r0.z, r1.w, r1.z
or r1.z, r1.w, r1.z
movc r0.y, r0.z, l(1.000000), r0.y
div r3.x, l(-1.000000), cb0[23].y
div r3.y, l(1.000000, 1.000000, 1.000000, 1.000000), cb0[23].w
mul_sat r0.xz, r0.xxwx, r3.xxyx
add r0.xz, -r0.xxzx, l(1.000000, 0.000000, 1.000000, 0.000000)
mul r0.x, r0.z, r0.x
movc r0.x, r1.z, r0.y, r0.x
mul r3.xyzw, vicp[0][1].xyzw, vicp[0][2].xyzw
mul_sat o0.w, r0.x, r3.w
mov o0.xyz, r3.xyzx
mov r0.xw, l(1.000000,0,0,-1.000000)
mov r0.yz, vicp[0][4].yyxy
mul r0.xy, r0.xyxx, r1.xyxx
mad o1.xy, r0.xyxx, r0.zwzz, vicp[0][3].xyxx
mad o2.xy, r0.xyxx, r0.zwzz, vicp[0][3].zwzz
mov r2.w, l(1.000000)
dp4 r0.x, r2.xyzw, cb0[4].xyzw
dp4 r0.y, r2.xyzw, cb0[5].xyzw
dp4 r0.z, r2.xyzw, cb0[6].xyzw
dp4 r0.w, r2.xyzw, cb0[7].xyzw
add o3.xyz, -r2.xyzx, cb0[22].xyzx
dp4 r1.x, r0.xyzw, cb0[11].xyzw
add r1.y, r1.x, -cb0[16].x
mov o5.w, r1.x
mul_sat o1.z, r1.y, cb0[16].y
mov o2.z, vicp[0][4].z
mov o3.w, l(0)
mov o4.xy, vicp[0][5].xyxx
dp4 o5.x, r0.xyzw, cb0[8].xyzw
dp4 o5.y, r0.xyzw, cb0[9].xyzw
dp4 o5.z, r0.xyzw, cb0[10].xyzw
ret 
// Approximately 60 instruction slots used

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