// ---- 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 float4 o4 : TEXCOORD3,
  out float4 o5 : TEXCOORD4,
  out float4 o6 : TEXCOORD5,
  out float4 o7 : TEXCOORD6,
  out float4 o8 : TEXCOORD7,
  out float4 o9 : TEXCOORD8,
  out float3 o10 : TEXCOORD9,
  out float4 o11 : 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.x = -vicp[0][4].w + 1;
  r1.z = vicp[0][0].z;
  r2.xy = float2(-0.5,-0.5) + vDomain.xy;
  r2.zw = float2(0,0);
  r2.xyzw = vicp[0][0].xyzw + r2.xyzw;
  r1.xy = r2.xy;
  r0.yzw = float3(0,0,-0.5) + r1.xyz;
  r1.x = dot(r0.yzw, r0.yzw);
  r1.x = rsqrt(r1.x);
  r0.yzw = r1.xxx * r0.yzw;
  r1.x = dot(r0.yzw, vicp[0][6].xyz);
  r1.z = dot(r0.yzw, vicp[0][8].xyz);
  r1.y = dot(r0.yzw, vicp[0][7].xyz);
  r0.y = dot(r1.xyz, g_ds_lightDir.xyz);
  o8.xyz = r1.xyz;
  r0.x = saturate(r0.y * r0.x + vicp[0][4].w);
  r0.y = 1 + r1.y;
  o4.z = r1.y;
  r0.yzw = r0.yyy * g_ds_hemiLightColor0.xyz + g_ds_hemiLightColor1.xyz;
  r0.xyz = r0.xxx * g_ds_directionalLightColor.xyz + r0.yzw;
  r1.xyzw = vicp[0][2].xyzw * vicp[0][1].xyzw;
  o0.xyz = r1.xyz * r0.xyz;
  r0.xy = cmp(float2(9.99999975e-005,9.99999975e-005) >= g_ds_fadeNearDist);
  r0.z = r0.y ? r0.x : 0;
  r3.x = dot(r2.xyzw, vicp[0][6].xyzw);
  r3.y = dot(r2.xyzw, vicp[0][7].xyzw);
  r3.z = dot(r2.xyzw, vicp[0][8].xyzw);
  r1.xyz = g_ds_cameraPos.xyz + -r3.xyz;
  r0.w = dot(r1.xyz, r1.xyz);
  r0.w = sqrt(r0.w);
  r1.xy = -g_ds_fadeFarStart + r0.ww;
  r2.xy = -g_ds_fadeNearStart + r0.ww;
  r0.w = saturate(r1.x / g_ds_fadeFarDist);
  r1.x = saturate(r1.y / -g_ds_fadeNearDist);
  r1.x = 1 + -r1.x;
  r0.w = 1 + -r0.w;
  r0.w = r0.x ? r0.w : r1.x;
  r0.x = (int)r0.y | (int)r0.x;
  r0.y = r0.z ? 1 : r0.w;
  r1.x = -1 / g_ds_fadeNearDist;
  r1.y = 1 / g_ds_fadeFarDist;
  r0.zw = saturate(r2.xy * r1.xy);
  r0.zw = float2(1,1) + -r0.zw;
  r0.z = r0.z * r0.w;
  r0.x = r0.x ? r0.y : r0.z;
  o0.w = saturate(r1.w * r0.x);
  r0.xyzw = float4(-0.5,-0.5,-0.5,-0.5) + vDomain.xyxy;
  r1.xz = float2(1,1);
  r1.yw = vicp[0][4].yy;
  r0.xyzw = r1.xyzw * r0.xyzw;
  r1.xz = vicp[0][4].xx;
  r1.yw = float2(-1,-1);
  r0.xyzw = r0.xyzw * r1.xyzw + vicp[0][3].xyzw;
  o1.xy = r0.xy;
  o2.xy = r0.zw;
  o1.w = vicp[0][5].x;
  r3.w = 1;
  r0.x = dot(r3.xyzw, g_ds_viewMatrix._m00_m10_m20_m30);
  r0.y = dot(r3.xyzw, g_ds_viewMatrix._m01_m11_m21_m31);
  r0.z = dot(r3.xyzw, g_ds_viewMatrix._m02_m12_m22_m32);
  r0.w = dot(r3.xyzw, g_ds_viewMatrix._m03_m13_m23_m33);
  r1.x = dot(r0.xyzw, g_ds_projectionMatrix._m03_m13_m23_m33);
  r1.y = -g_ds_fogStartZ + r1.x;
  o11.w = r1.x;
  o1.z = saturate(g_ds_recFogEndZ * r1.y);
  o2.z = vicp[0][4].z;
  o3.xyz = g_ds_lightDir.xyz;
  o4.xy = vicp[0][7].xy * float2(-1,1);
  o5.xy = vicp[0][4].ww * float2(1,-1) + float2(0,1);
  o6.xyz = g_ds_eye.xyz + -r3.xyz;
  o7.xyz = r3.xyz;
  o6.w = 0;
  o9.x = vicp[0][6].y;
  o9.y = vicp[0][7].y;
  o9.z = vicp[0][8].y;
  o10.x = -vicp[0][6].x;
  o10.y = -vicp[0][7].x;
  o10.z = -vicp[0][8].x;
  o11.x = dot(r0.xyzw, g_ds_projectionMatrix._m00_m10_m20_m30);
  o11.y = dot(r0.xyzw, g_ds_projectionMatrix._m01_m11_m21_m31);
  o11.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
//   float4 g_ds_directionalLightColor; // Offset:  288 Size:    16
//   float4 g_ds_hemiLightColor0;       // Offset:  304 Size:    16
//   float4 g_ds_hemiLightColor1;       // Offset:  320 Size:    16
//   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   xyzw
// TEXCOORD                 2   xy          5     NONE   float   x   
// 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   xyzw        1     NONE   float   xyzw
// TEXCOORD                 1   xyz         2     NONE   float   xyz 
// TEXCOORD                 2   xyz         3     NONE   float   xyz 
// TEXCOORD                 3   xyz         4     NONE   float   xyz 
// TEXCOORD                 4   xy          5     NONE   float   xy  
// TEXCOORD                 5   xyzw        6     NONE   float   xyzw
// TEXCOORD                 6   xyz         7     NONE   float   xyz 
// TEXCOORD                 7   xyz         8     NONE   float   xyz 
// TEXCOORD                 8   xyz         9     NONE   float   xyz 
// TEXCOORD                 9   xyz        10     NONE   float   xyz 
// SV_POSITION              0   xyzw       11      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].xyzw
dcl_input vicp[1][5].x
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.xyzw
dcl_output o2.xyz
dcl_output o3.xyz
dcl_output o4.xyz
dcl_output o5.xy
dcl_output o6.xyzw
dcl_output o7.xyz
dcl_output o8.xyz
dcl_output o9.xyz
dcl_output o10.xyz
dcl_output_siv o11.xyzw, position
dcl_temps 4
add r0.x, l(1.000000), -vicp[0][4].w
mov r1.z, vicp[0][0].z
add r2.xy, vDomain.xyxx, l(-0.500000, -0.500000, 0.000000, 0.000000)
mov r2.zw, l(0,0,0,0)
add r2.xyzw, r2.xyzw, vicp[0][0].xyzw
mov r1.xy, r2.xyxx
add r0.yzw, r1.xxyz, l(0.000000, 0.000000, 0.000000, -0.500000)
dp3 r1.x, r0.yzwy, r0.yzwy
rsq r1.x, r1.x
mul r0.yzw, r0.yyzw, r1.xxxx
dp3 r1.x, r0.yzwy, vicp[0][6].xyzx
dp3 r1.z, r0.yzwy, vicp[0][8].xyzx
dp3 r1.y, r0.yzwy, vicp[0][7].xyzx
dp3 r0.y, r1.xyzx, cb0[17].xyzx
mov o8.xyz, r1.xyzx
mad_sat r0.x, r0.y, r0.x, vicp[0][4].w
add r0.y, r1.y, l(1.000000)
mov o4.z, r1.y
mad r0.yzw, r0.yyyy, cb0[19].xxyz, cb0[20].xxyz
mad r0.xyz, r0.xxxx, cb0[18].xyzx, r0.yzwy
mul r1.xyzw, vicp[0][1].xyzw, vicp[0][2].xyzw
mul o0.xyz, r0.xyzx, r1.xyzx
ge r0.xy, l(0.000100, 0.000100, 0.000000, 0.000000), cb0[23].ywyy
and r0.z, r0.y, r0.x
dp4 r3.x, r2.xyzw, vicp[0][6].xyzw
dp4 r3.y, r2.xyzw, vicp[0][7].xyzw
dp4 r3.z, r2.xyzw, vicp[0][8].xyzw
add r1.xyz, -r3.xyzx, cb0[24].xyzx
dp3 r0.w, r1.xyzx, r1.xyzx
sqrt r0.w, r0.w
add r1.xy, r0.wwww, -cb0[23].zxzz
add r2.xy, r0.wwww, -cb0[23].xzxx
div_sat r0.w, r1.x, cb0[23].w
div_sat r1.x, r1.y, -cb0[23].y
add r1.x, -r1.x, l(1.000000)
add r0.w, -r0.w, l(1.000000)
movc r0.w, r0.x, r0.w, r1.x
or r0.x, r0.y, r0.x
movc r0.y, r0.z, l(1.000000), r0.w
div r1.x, l(-1.000000), cb0[23].y
div r1.y, l(1.000000, 1.000000, 1.000000, 1.000000), cb0[23].w
mul_sat r0.zw, r1.xxxy, r2.xxxy
add r0.zw, -r0.zzzw, l(0.000000, 0.000000, 1.000000, 1.000000)
mul r0.z, r0.w, r0.z
movc r0.x, r0.x, r0.y, r0.z
mul_sat o0.w, r0.x, r1.w
add r0.xyzw, vDomain.xyxy, l(-0.500000, -0.500000, -0.500000, -0.500000)
mov r1.xz, l(1.000000,0,1.000000,0)
mov r1.yw, vicp[0][4].yyyy
mul r0.xyzw, r0.xyzw, r1.xyzw
mov r1.xz, vicp[0][4].xxxx
mov r1.yw, l(0,-1.000000,0,-1.000000)
mad r0.xyzw, r0.xyzw, r1.xyzw, vicp[0][3].xyzw
mov o1.xy, r0.xyxx
mov o2.xy, r0.zwzz
mov o1.w, vicp[0][5].x
mov r3.w, l(1.000000)
dp4 r0.x, r3.xyzw, cb0[4].xyzw
dp4 r0.y, r3.xyzw, cb0[5].xyzw
dp4 r0.z, r3.xyzw, cb0[6].xyzw
dp4 r0.w, r3.xyzw, cb0[7].xyzw
dp4 r1.x, r0.xyzw, cb0[11].xyzw
add r1.y, r1.x, -cb0[16].x
mov o11.w, r1.x
mul_sat o1.z, r1.y, cb0[16].y
mov o2.z, vicp[0][4].z
mov o3.xyz, cb0[17].xyzx
mul o4.xy, l(-1.000000, 1.000000, 0.000000, 0.000000), vicp[0][7].xyxx
mad o5.xy, vicp[0][4].wwww, l(1.000000, -1.000000, 0.000000, 0.000000), l(0.000000, 1.000000, 0.000000, 0.000000)
add o6.xyz, -r3.xyzx, cb0[22].xyzx
mov o7.xyz, r3.xyzx
mov o6.w, l(0)
mov o9.x, vicp[0][6].y
mov o9.y, vicp[0][7].y
mov o9.z, vicp[0][8].y
mov o10.x, -vicp[0][6].x
mov o10.y, -vicp[0][7].x
mov o10.z, -vicp[0][8].x
dp4 o11.x, r0.xyzw, cb0[8].xyzw
dp4 o11.y, r0.xyzw, cb0[9].xyzw
dp4 o11.z, r0.xyzw, cb0[10].xyzw
ret 
// Approximately 82 instruction slots used

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