// ---- Created with 3Dmigoto v1.2.56 on Thu Mar 23 12:38:52 2017

cbuffer SceneBuffer : register(b0)
{
  float4x4 g_View : packoffset(c0);
  float4x4 g_Proj : packoffset(c4);
  float4x4 g_ViewProjection : packoffset(c8);
  float4x4 g_ViewInverseMatrix : packoffset(c12);
}

cbuffer EffectParameterIndex : register(b1)
{
  uint g_EffectParameterIndex : packoffset(c0);
}

StructuredBuffer<g_EffectVertexCommonBuffers> g_EffectVertexCommonBuffers : register(t27);


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


void main( 
  float4 v0 : POSITION0,
  float2 v1 : TEXCOORD0,
  float3 v2 : NORMAL0,
  float4 v3 : TANGENT0,
  out float4 o0 : SV_POSITION0,
  out float4 o1 : TEXCOORD0,
  out float4 o2 : TEXCOORD2,
  out float3 o3 : COLOR1,
  out float4 o4 : COLOR2,
  out float4 o5 : TEXCOORD6,
  out float3 o6 : TEXCOORD7)
{
// Needs manual fix for instruction: 
// unknown dcl_: dcl_resource_structured t27, 160 
  float4 r0,r1,r2,r3,r4;
  uint4 bitmask, uiDest;
  float4 fDest;

// Known bad code for instruction (needs manual fix):
ld_structured_indexable(structured_buffer, stride=160)(mixed,mixed,mixed,mixed) r0.xyzw, cb1[0].x, l(0), t27.xyzw
r0.x = g_EffectVertexCommonBuffers[]..swiz;
r0.y = g_EffectVertexCommonBuffers[]..swiz;
r0.z = g_EffectVertexCommonBuffers[]..swiz;
r0.w = g_EffectVertexCommonBuffers[]..swiz;
  r1.xyz = v0.xyz;
  r1.w = 1;
  r0.x = dot(r1.xyzw, r0.xyzw);
// Known bad code for instruction (needs manual fix):
ld_structured_indexable(structured_buffer, stride=160)(mixed,mixed,mixed,mixed) r2.xyzw, cb1[0].x, l(16), t27.xyzw
r2.x = g_EffectVertexCommonBuffers[]..swiz;
r2.y = g_EffectVertexCommonBuffers[]..swiz;
r2.z = g_EffectVertexCommonBuffers[]..swiz;
r2.w = g_EffectVertexCommonBuffers[]..swiz;
  r0.y = dot(r1.xyzw, r2.xyzw);
// Known bad code for instruction (needs manual fix):
ld_structured_indexable(structured_buffer, stride=160)(mixed,mixed,mixed,mixed) r2.xyzw, cb1[0].x, l(32), t27.xyzw
r2.x = g_EffectVertexCommonBuffers[]..swiz;
r2.y = g_EffectVertexCommonBuffers[]..swiz;
r2.z = g_EffectVertexCommonBuffers[]..swiz;
r2.w = g_EffectVertexCommonBuffers[]..swiz;
  r0.z = dot(r1.xyzw, r2.xyzw);
  r0.w = 1;
  o0.x = dot(r0.xyzw, g_ViewProjection._m00_m10_m20_m30);
  o0.y = dot(r0.xyzw, g_ViewProjection._m01_m11_m21_m31);
  o0.z = dot(r0.xyzw, g_ViewProjection._m02_m12_m22_m32);
  o0.w = dot(r0.xyzw, g_ViewProjection._m03_m13_m23_m33);
// Known bad code for instruction (needs manual fix):
ld_structured_indexable(structured_buffer, stride=160)(mixed,mixed,mixed,mixed) o1.xyzw, cb1[0].x, l(48), t27.xyzw
r1.x = g_EffectVertexCommonBuffers[]..swiz;
r1.y = g_EffectVertexCommonBuffers[]..swiz;
r1.z = g_EffectVertexCommonBuffers[]..swiz;
r1.w = g_EffectVertexCommonBuffers[]..swiz;
  r1.xy = float2(1,1) + -v1.xy;
// Known bad code for instruction (needs manual fix):
ld_structured_indexable(structured_buffer, stride=160)(mixed,mixed,mixed,mixed) r1.z, cb1[0].x, l(120), t27.xxxx
r1.z = g_EffectVertexCommonBuffers[]..swiz;
  r1.w = saturate(r1.z);
  r2.xyz = saturate(float3(-1,-2,-3) + r1.zzz);
  r3.xyzw = v1.yxyx * float4(1,-1,-1,1) + float4(0,1,1,0);
  r3.xy = -v1.xy + r3.xy;
  r1.zw = r1.ww * r3.xy + v1.xy;
  r1.xy = r1.xy + -r1.zw;
  r1.xy = r2.xx * r1.xy + r1.zw;
  r1.zw = r3.zw + -r1.xy;
  r1.xy = r2.yy * r1.zw + r1.xy;
  r1.zw = v1.xy + -r1.xy;
  r1.xy = r2.zz * r1.zw + r1.xy;
  r1.xy = -v1.xy + r1.xy;
// Known bad code for instruction (needs manual fix):
ld_structured_indexable(structured_buffer, stride=160)(mixed,mixed,mixed,mixed) r1.z, cb1[0].x, l(136), t27.xxxx
r1.z = g_EffectVertexCommonBuffers[]..swiz;
  r1.z = 0.5 + r1.z;
  r1.w = cmp(0 < r1.z);
  r1.z = cmp(r1.z < 0);
  r1.z = (int)r1.z + (int)-r1.w;
  r1.z = (int)r1.z;
  r1.z = saturate(r1.z);
  r1.xy = r1.zz * r1.xy + v1.xy;
// Known bad code for instruction (needs manual fix):
ld_structured_indexable(structured_buffer, stride=160)(mixed,mixed,mixed,mixed) r2.xyzw, cb1[0].x, l(96), t27.xyzw
r2.x = g_EffectVertexCommonBuffers[]..swiz;
r2.y = g_EffectVertexCommonBuffers[]..swiz;
r2.z = g_EffectVertexCommonBuffers[]..swiz;
r2.w = g_EffectVertexCommonBuffers[]..swiz;
  o2.xy = r1.xy * r2.zw + r2.xy;
  o2.zw = float2(0,0);
// Known bad code for instruction (needs manual fix):
ld_structured_indexable(structured_buffer, stride=160)(mixed,mixed,mixed,mixed) r1.xyz, cb1[0].x, l(0), t27.xyzx
r1.x = g_EffectVertexCommonBuffers[]..swiz;
r1.y = g_EffectVertexCommonBuffers[]..swiz;
r1.z = g_EffectVertexCommonBuffers[]..swiz;
  r2.x = dot(v2.xyz, r1.xyz);
// Known bad code for instruction (needs manual fix):
ld_structured_indexable(structured_buffer, stride=160)(mixed,mixed,mixed,mixed) r3.xyz, cb1[0].x, l(16), t27.xyzx
r3.x = g_EffectVertexCommonBuffers[]..swiz;
r3.y = g_EffectVertexCommonBuffers[]..swiz;
r3.z = g_EffectVertexCommonBuffers[]..swiz;
  r2.y = dot(v2.xyz, r3.xyz);
// Known bad code for instruction (needs manual fix):
ld_structured_indexable(structured_buffer, stride=160)(mixed,mixed,mixed,mixed) r4.xyz, cb1[0].x, l(32), t27.xyzx
r4.x = g_EffectVertexCommonBuffers[]..swiz;
r4.y = g_EffectVertexCommonBuffers[]..swiz;
r4.z = g_EffectVertexCommonBuffers[]..swiz;
  r2.z = dot(v2.xyz, r4.xyz);
  r1.w = dot(r2.xyz, r2.xyz);
  r1.w = rsqrt(r1.w);
  o3.xyz = r2.xyz * r1.www;
  r2.xyzw = v3.xyzw * float4(2,2,2,2) + float4(-1,-1,-1,-1);
  r2.xzw = r2.xzy * r2.www;
  r2.y = dot(r2.xwz, r1.xyz);
  r2.x = dot(r2.ywz, r3.xyz);
  r2.w = dot(r2.yxz, r4.xyz);
  r1.x = dot(r2.xyw, r2.xyw);
  r1.x = rsqrt(r1.x);
  o4.xyz = r2.yxw * r1.xxx;
  o4.w = v3.w * 2 + -1;
  r1.x = -g_ViewInverseMatrix._m30;
  r1.y = -g_ViewInverseMatrix._m31;
  r1.z = -g_ViewInverseMatrix._m32;
  o5.xyz = r1.xyz + r0.xyz;
  o6.x = dot(r0.xyzw, g_View._m00_m10_m20_m30);
  o6.y = dot(r0.xyzw, g_View._m01_m11_m21_m31);
  o6.z = dot(r0.xyzw, g_View._m02_m12_m22_m32);
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Original ASM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//
// Buffer Definitions: 
//
// cbuffer SceneBuffer
// {
//
//   float4x4 g_View;                   // Offset:    0 Size:    64
//   float4x4 g_Proj;                   // Offset:   64 Size:    64 [unused]
//   float4x4 g_ViewProjection;         // Offset:  128 Size:    64
//   float4x4 g_ViewInverseMatrix;      // Offset:  192 Size:    64
//
// }
//
// cbuffer EffectParameterIndex
// {
//
//   uint g_EffectParameterIndex;       // Offset:    0 Size:     4
//
// }
//
// Resource bind info for g_EffectVertexCommonBuffers
// {
//
//   struct EffectVertexCommonBuffer
//   {
//       
//       float4 m_WorldMatrixCol0;      // Offset:    0
//       float4 m_WorldMatrixCol1;      // Offset:   16
//       float4 m_WorldMatrixCol2;      // Offset:   32
//       float4 m_MaterialColor;        // Offset:   48
//       float4 m_UvOffSet;             // Offset:   64
//       float4 m_UvTile;               // Offset:   80
//       float4 m_UvOffsetTile2;        // Offset:   96
//       float4 m_UvRoll;               // Offset:  112
//       float4 m_TexBlend;             // Offset:  128
//       float4 m_Shadow;               // Offset:  144
//
//   } $Element;                        // Offset:    0 Size:   160
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// g_EffectVertexCommonBuffers       texture  struct         r/o   27        1
// SceneBuffer                       cbuffer      NA          NA    0        1
// EffectParameterIndex              cbuffer      NA          NA    1        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyz 
// TEXCOORD                 0   xy          1     NONE   float   xy  
// NORMAL                   0   xyz         2     NONE   float   xyz 
// TANGENT                  0   xyzw        3     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                 2   xyzw        2     NONE   float   xyzw
// COLOR                    1   xyz         3     NONE   float   xyz 
// COLOR                    2   xyzw        4     NONE   float   xyzw
// TEXCOORD                 6   xyz         5     NONE   float   xyz 
// TEXCOORD                 7   xyz         6     NONE   float   xyz 
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[15], immediateIndexed
dcl_constantbuffer cb1[1], immediateIndexed
dcl_resource_structured t27, 160 
dcl_input v0.xyz
dcl_input v1.xy
dcl_input v2.xyz
dcl_input v3.xyzw
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyz
dcl_output o4.xyzw
dcl_output o5.xyz
dcl_output o6.xyz
dcl_temps 5
ld_structured_indexable(structured_buffer, stride=160)(mixed,mixed,mixed,mixed) r0.xyzw, cb1[0].x, l(0), t27.xyzw
mov r1.xyz, v0.xyzx
mov r1.w, l(1.000000)
dp4 r0.x, r1.xyzw, r0.xyzw
ld_structured_indexable(structured_buffer, stride=160)(mixed,mixed,mixed,mixed) r2.xyzw, cb1[0].x, l(16), t27.xyzw
dp4 r0.y, r1.xyzw, r2.xyzw
ld_structured_indexable(structured_buffer, stride=160)(mixed,mixed,mixed,mixed) r2.xyzw, cb1[0].x, l(32), t27.xyzw
dp4 r0.z, r1.xyzw, r2.xyzw
mov r0.w, l(1.000000)
dp4 o0.x, r0.xyzw, cb0[8].xyzw
dp4 o0.y, r0.xyzw, cb0[9].xyzw
dp4 o0.z, r0.xyzw, cb0[10].xyzw
dp4 o0.w, r0.xyzw, cb0[11].xyzw
ld_structured_indexable(structured_buffer, stride=160)(mixed,mixed,mixed,mixed) o1.xyzw, cb1[0].x, l(48), t27.xyzw
add r1.xy, -v1.xyxx, l(1.000000, 1.000000, 0.000000, 0.000000)
ld_structured_indexable(structured_buffer, stride=160)(mixed,mixed,mixed,mixed) r1.z, cb1[0].x, l(120), t27.xxxx
mov_sat r1.w, r1.z
add_sat r2.xyz, r1.zzzz, l(-1.000000, -2.000000, -3.000000, 0.000000)
mad r3.xyzw, v1.yxyx, l(1.000000, -1.000000, -1.000000, 1.000000), l(0.000000, 1.000000, 1.000000, 0.000000)
add r3.xy, r3.xyxx, -v1.xyxx
mad r1.zw, r1.wwww, r3.xxxy, v1.xxxy
add r1.xy, -r1.zwzz, r1.xyxx
mad r1.xy, r2.xxxx, r1.xyxx, r1.zwzz
add r1.zw, -r1.xxxy, r3.zzzw
mad r1.xy, r2.yyyy, r1.zwzz, r1.xyxx
add r1.zw, -r1.xxxy, v1.xxxy
mad r1.xy, r2.zzzz, r1.zwzz, r1.xyxx
add r1.xy, r1.xyxx, -v1.xyxx
ld_structured_indexable(structured_buffer, stride=160)(mixed,mixed,mixed,mixed) r1.z, cb1[0].x, l(136), t27.xxxx
add r1.z, r1.z, l(0.500000)
lt r1.w, l(0.000000), r1.z
lt r1.z, r1.z, l(0.000000)
iadd r1.z, r1.z, -r1.w
itof r1.z, r1.z
mov_sat r1.z, r1.z
mad r1.xy, r1.zzzz, r1.xyxx, v1.xyxx
ld_structured_indexable(structured_buffer, stride=160)(mixed,mixed,mixed,mixed) r2.xyzw, cb1[0].x, l(96), t27.xyzw
mad o2.xy, r1.xyxx, r2.zwzz, r2.xyxx
mov o2.zw, l(0,0,0,0)
ld_structured_indexable(structured_buffer, stride=160)(mixed,mixed,mixed,mixed) r1.xyz, cb1[0].x, l(0), t27.xyzx
dp3 r2.x, v2.xyzx, r1.xyzx
ld_structured_indexable(structured_buffer, stride=160)(mixed,mixed,mixed,mixed) r3.xyz, cb1[0].x, l(16), t27.xyzx
dp3 r2.y, v2.xyzx, r3.xyzx
ld_structured_indexable(structured_buffer, stride=160)(mixed,mixed,mixed,mixed) r4.xyz, cb1[0].x, l(32), t27.xyzx
dp3 r2.z, v2.xyzx, r4.xyzx
dp3 r1.w, r2.xyzx, r2.xyzx
rsq r1.w, r1.w
mul o3.xyz, r1.wwww, r2.xyzx
mad r2.xyzw, v3.xyzw, l(2.000000, 2.000000, 2.000000, 2.000000), l(-1.000000, -1.000000, -1.000000, -1.000000)
mul r2.xzw, r2.wwww, r2.xxzy
dp3 r2.y, r2.xwzx, r1.xyzx
dp3 r2.x, r2.ywzy, r3.xyzx
dp3 r2.w, r2.yxzy, r4.xyzx
dp3 r1.x, r2.xywx, r2.xywx
rsq r1.x, r1.x
mul o4.xyz, r1.xxxx, r2.yxwy
mad o4.w, v3.w, l(2.000000), l(-1.000000)
mov r1.x, -cb0[12].w
mov r1.y, -cb0[13].w
mov r1.z, -cb0[14].w
add o5.xyz, r0.xyzx, r1.xyzx
dp4 o6.x, r0.xyzw, cb0[0].xyzw
dp4 o6.y, r0.xyzw, cb0[1].xyzw
dp4 o6.z, r0.xyzw, cb0[2].xyzw
ret 
// Approximately 65 instruction slots used

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


/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~ HLSL errors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
D:\SteamLibrary\steamapps\common\NieRAutomata\ShaderCache\d840ff48205bd1a2-vs_replace.txt(16,18-44): error X3000: syntax error: unexpected token 'g_EffectVertexCommonBuffers'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
