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

cbuffer cbInstanceData : register(b4)
{

  struct
  {
    float4x3 mWorld;
    float4 atlasUvScaleOffset;
    float4 userClipPlane;
    uint4 matricesData;
    uint envData;
    bool dynamicLightDisable;
    uint2 envPad;
    float4 mulCol;
    float4 aSh[3];
    float4 ShLightMask;
    float4 vDominantRotateParam;
    float4 parallaxCorrectedCubemapOrigin_envMapInterpRatio;
    float4 parallaxCorrectedCubemapAabbMin_envMapColorScale0;
    float4 parallaxCorrectedCubemapAabbMax_envMapColorScale1;
    float ditherFadeAlpha;
  } VC_InstanceData[2] : packoffset(c0);

}

cbuffer cbMatrixWVP : register(b0)
{
  float4x4 VC_MatrixWVP : packoffset(c0);
  float4x4 VC_PrevMatrixWVP : packoffset(c4);
  float4x4 VC_NowToPrevView : packoffset(c8);
}

cbuffer cbObjMatrix : register(b5)
{
  float4x3 VC_aObjMatrix[2] : packoffset(c0);
}

cbuffer cbPrevObjMatrix : register(b6)
{
  float4x3 VC_aOldObjMatrix[2] : packoffset(c0);
}

cbuffer cbTexScroll : register(b11)
{
  float4 VC_TexScroll_0 : packoffset(c0);
  float4 VC_TexScroll_1 : packoffset(c1);
  float4 VC_TexScroll_2 : packoffset(c2);
  float4 VC_TexScroll_3 : packoffset(c3);
}



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


void main( 
  float3 v0 : POSITION0,
  uint4 v1 : NORMAL0,
  uint4 v2 : TANGENT0,
  uint4 v3 : TANGENT1,
  int4 v4 : BLENDINDICES0,
  float4 v5 : BLENDWEIGHT0,
  float4 v6 : COLOR1,
  int4 v7 : TEXCOORD0,
  int4 v8 : TEXCOORD1,
  out float4 o0 : SV_Position0,
  out float4 o1 : TEXCOORD0,
  out float4 o2 : TEXCOORD1,
  out float4 o3 : TEXCOORD2,
  out float2 o4 : TEXCOORD3)
{
  float4 r0,r1,r2,r3,r4,r5,r6,r7;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.w = 1;
  r1.xyzw = (int4)v4.xyzw + (int4)VC_InstanceData[0].matricesData.xxxx;
  r1.xyzw = (int4)r1.xyzw * int4(3,3,3,3);
  r2.x = dot(float4(1,1,1,1), v5.xyzw);
  r2.x = max(0.00100000005, r2.x);
  r2.xyzw = v5.xyzw / r2.xxxx;
  r3.xyzw = VC_aObjMatrix[r1.y/3]._m00_m10_m20_m30 * r2.yyyy;
  r3.xyzw = VC_aObjMatrix[r1.x/3]._m00_m10_m20_m30 * r2.xxxx + r3.xyzw;
  r3.xyzw = VC_aObjMatrix[r1.z/3]._m00_m10_m20_m30 * r2.zzzz + r3.xyzw;
  r3.xyzw = VC_aObjMatrix[r1.w/3]._m00_m10_m20_m30 * r2.wwww + r3.xyzw;
  r4.xyz = v0.xyz;
  r4.w = 1;
  r0.x = dot(r4.xyzw, r3.xyzw);
  r5.xyzw = VC_aObjMatrix[r1.y/3]._m01_m11_m21_m31 * r2.yyyy;
  r5.xyzw = VC_aObjMatrix[r1.x/3]._m01_m11_m21_m31 * r2.xxxx + r5.xyzw;
  r5.xyzw = VC_aObjMatrix[r1.z/3]._m01_m11_m21_m31 * r2.zzzz + r5.xyzw;
  r5.xyzw = VC_aObjMatrix[r1.w/3]._m01_m11_m21_m31 * r2.wwww + r5.xyzw;
  r0.y = dot(r4.xyzw, r5.xyzw);
  r6.xyzw = VC_aObjMatrix[r1.y/3]._m02_m12_m22_m32 * r2.yyyy;
  r6.xyzw = VC_aObjMatrix[r1.x/3]._m02_m12_m22_m32 * r2.xxxx + r6.xyzw;
  r6.xyzw = VC_aObjMatrix[r1.z/3]._m02_m12_m22_m32 * r2.zzzz + r6.xyzw;
  r1.xyzw = VC_aObjMatrix[r1.w/3]._m02_m12_m22_m32 * r2.wwww + r6.xyzw;
  r0.z = dot(r4.xyzw, r1.xyzw);
  r6.x = dot(r0.xyzw, VC_MatrixWVP._m00_m10_m20_m30);
  r6.y = dot(r0.xyzw, VC_MatrixWVP._m01_m11_m21_m31);
  r6.z = dot(r0.xyzw, VC_MatrixWVP._m02_m12_m22_m32);
  r6.w = dot(r0.xyzw, VC_MatrixWVP._m03_m13_m23_m33);
  o0.xyzw = r6.xyzw;
  o1.xyzw = r6.xyzw;
  r0.xyzw = (int4)v4.xyzw * int4(3,3,3,3);
  r6.xyzw = VC_aOldObjMatrix[v4.y]._m00_m10_m20_m30 * r2.yyyy;
  r6.xyzw = VC_aOldObjMatrix[v4.x]._m00_m10_m20_m30 * r2.xxxx + r6.xyzw;
  r6.xyzw = VC_aOldObjMatrix[v4.z]._m00_m10_m20_m30 * r2.zzzz + r6.xyzw;
  r6.xyzw = VC_aOldObjMatrix[v4.w]._m00_m10_m20_m30 * r2.wwww + r6.xyzw;
  r6.x = dot(r4.xyzw, r6.xyzw);
  r7.xyzw = VC_aOldObjMatrix[v4.y]._m01_m11_m21_m31 * r2.yyyy;
  r7.xyzw = VC_aOldObjMatrix[v4.x]._m01_m11_m21_m31 * r2.xxxx + r7.xyzw;
  r7.xyzw = VC_aOldObjMatrix[v4.z]._m01_m11_m21_m31 * r2.zzzz + r7.xyzw;
  r7.xyzw = VC_aOldObjMatrix[v4.w]._m01_m11_m21_m31 * r2.wwww + r7.xyzw;
  r6.y = dot(r4.xyzw, r7.xyzw);
  r7.xyzw = VC_aOldObjMatrix[v4.y]._m02_m12_m22_m32 * r2.yyyy;
  r7.xyzw = VC_aOldObjMatrix[v4.x]._m02_m12_m22_m32 * r2.xxxx + r7.xyzw;
  r7.xyzw = VC_aOldObjMatrix[v4.z]._m02_m12_m22_m32 * r2.zzzz + r7.xyzw;
  r0.xyzw = VC_aOldObjMatrix[v4.w]._m02_m12_m22_m32 * r2.wwww + r7.xyzw;
  r6.z = dot(r4.xyzw, r0.xyzw);
  r6.w = 1;
  o2.x = dot(r6.xyzw, VC_PrevMatrixWVP._m00_m10_m20_m30);
  o2.y = dot(r6.xyzw, VC_PrevMatrixWVP._m01_m11_m21_m31);
  o2.z = dot(r6.xyzw, VC_PrevMatrixWVP._m02_m12_m22_m32);
  o2.w = dot(r6.xyzw, VC_PrevMatrixWVP._m03_m13_m23_m33);
  r0.xyz = (uint3)v1.xyz;
  r0.xyz = float3(-127,-127,-127) + r0.xyz;
  r0.xyz = float3(0.00787401572,0.00787401572,0.00787401572) * r0.xyz;
  o3.x = dot(r0.xyz, r3.xyz);
  o3.y = dot(r0.xyz, r5.xyz);
  o3.z = dot(r0.xyz, r1.xyz);
  r0.xy = (int2)v7.xy;
  r0.xy = VC_TexScroll_0.xy * r0.xy;
  o4.xy = r0.xy * float2(0.00048828125,0.00048828125) + VC_TexScroll_0.zw;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Original ASM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20546
//
//
// Buffer Definitions: 
//
// cbuffer cbInstanceData
// {
//
//   struct PerInstanceData
//   {
//       
//       float4x3 mWorld;               // Offset:    0
//       float4 atlasUvScaleOffset;     // Offset:   48
//       float4 userClipPlane;          // Offset:   64
//       uint4 matricesData;            // Offset:   80
//       uint envData;                  // Offset:   96
//       bool dynamicLightDisable;      // Offset:  100
//       uint2 envPad;                  // Offset:  104
//       float4 mulCol;                 // Offset:  112
//       float4 aSh[3];                 // Offset:  128
//       float4 ShLightMask;            // Offset:  176
//       float4 vDominantRotateParam;   // Offset:  192
//       float4 parallaxCorrectedCubemapOrigin_envMapInterpRatio;// Offset:  208
//       float4 parallaxCorrectedCubemapAabbMin_envMapColorScale0;// Offset:  224
//       float4 parallaxCorrectedCubemapAabbMax_envMapColorScale1;// Offset:  240
//       float ditherFadeAlpha;         // Offset:  256
//
//   } VC_InstanceData[2];              // Offset:    0 Size:   532
//
// }
//
// cbuffer cbMatrixWVP
// {
//
//   float4x4 VC_MatrixWVP;             // Offset:    0 Size:    64
//   float4x4 VC_PrevMatrixWVP;         // Offset:   64 Size:    64
//   float4x4 VC_NowToPrevView;         // Offset:  128 Size:    64 [unused]
//
// }
//
// cbuffer cbObjMatrix
// {
//
//   float4x3 VC_aObjMatrix[2];         // Offset:    0 Size:    96
//
// }
//
// cbuffer cbPrevObjMatrix
// {
//
//   float4x3 VC_aOldObjMatrix[2];      // Offset:    0 Size:    96
//
// }
//
// cbuffer cbTexScroll
// {
//
//   float4 VC_TexScroll_0;             // Offset:    0 Size:    16
//   float4 VC_TexScroll_1;             // Offset:   16 Size:    16 [unused]
//   float4 VC_TexScroll_2;             // Offset:   32 Size:    16 [unused]
//   float4 VC_TexScroll_3;             // Offset:   48 Size:    16 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// cbMatrixWVP                       cbuffer      NA          NA    0        1
// cbInstanceData                    cbuffer      NA          NA    4        1
// cbObjMatrix                       cbuffer      NA          NA    5        1
// cbPrevObjMatrix                   cbuffer      NA          NA    6        1
// cbTexScroll                       cbuffer      NA          NA   11        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyz         0     NONE   float   xyz 
// NORMAL                   0   xyzw        1     NONE    uint   xyz 
// TANGENT                  0   xyzw        2     NONE    uint       
// TANGENT                  1   xyzw        3     NONE    uint       
// BLENDINDICES             0   xyzw        4     NONE     int   xyzw
// BLENDWEIGHT              0   xyzw        5     NONE   float   xyzw
// COLOR                    1   xyzw        6     NONE   float       
// TEXCOORD                 0   xyzw        7     NONE     int   xy  
// TEXCOORD                 1   xyzw        8     NONE     int       
//
//
// 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                 1   xyzw        2     NONE   float   xyzw
// TEXCOORD                 2   xyz         3     NONE   float   xyz 
// TEXCOORD                 3   xy          4     NONE   float   xy  
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb4[6], immediateIndexed
dcl_constantbuffer cb0[8], immediateIndexed
dcl_constantbuffer cb5[6], dynamicIndexed
dcl_constantbuffer cb6[6], dynamicIndexed
dcl_constantbuffer cb11[1], immediateIndexed
dcl_input v0.xyz
dcl_input v1.xyz
dcl_input v4.xyzw
dcl_input v5.xyzw
dcl_input v7.xy
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyz
dcl_output o4.xy
dcl_temps 8
mov r0.w, l(1.000000)
iadd r1.xyzw, v4.xyzw, cb4[5].xxxx
imul null, r1.xyzw, r1.xyzw, l(3, 3, 3, 3)
dp4 r2.x, l(1.000000, 1.000000, 1.000000, 1.000000), v5.xyzw
max r2.x, r2.x, l(0.001000)
div r2.xyzw, v5.xyzw, r2.xxxx
mul r3.xyzw, r2.yyyy, cb5[r1.y + 0].xyzw
mad r3.xyzw, cb5[r1.x + 0].xyzw, r2.xxxx, r3.xyzw
mad r3.xyzw, cb5[r1.z + 0].xyzw, r2.zzzz, r3.xyzw
mad r3.xyzw, cb5[r1.w + 0].xyzw, r2.wwww, r3.xyzw
mov r4.xyz, v0.xyzx
mov r4.w, l(1.000000)
dp4 r0.x, r4.xyzw, r3.xyzw
mul r5.xyzw, r2.yyyy, cb5[r1.y + 1].xyzw
mad r5.xyzw, cb5[r1.x + 1].xyzw, r2.xxxx, r5.xyzw
mad r5.xyzw, cb5[r1.z + 1].xyzw, r2.zzzz, r5.xyzw
mad r5.xyzw, cb5[r1.w + 1].xyzw, r2.wwww, r5.xyzw
dp4 r0.y, r4.xyzw, r5.xyzw
mul r6.xyzw, r2.yyyy, cb5[r1.y + 2].xyzw
mad r6.xyzw, cb5[r1.x + 2].xyzw, r2.xxxx, r6.xyzw
mad r6.xyzw, cb5[r1.z + 2].xyzw, r2.zzzz, r6.xyzw
mad r1.xyzw, cb5[r1.w + 2].xyzw, r2.wwww, r6.xyzw
dp4 r0.z, r4.xyzw, r1.xyzw
dp4 r6.x, r0.xyzw, cb0[0].xyzw
dp4 r6.y, r0.xyzw, cb0[1].xyzw
dp4 r6.z, r0.xyzw, cb0[2].xyzw
dp4 r6.w, r0.xyzw, cb0[3].xyzw
mov o0.xyzw, r6.xyzw
mov o1.xyzw, r6.xyzw
imul null, r0.xyzw, v4.xyzw, l(3, 3, 3, 3)
mul r6.xyzw, r2.yyyy, cb6[r0.y + 0].xyzw
mad r6.xyzw, cb6[r0.x + 0].xyzw, r2.xxxx, r6.xyzw
mad r6.xyzw, cb6[r0.z + 0].xyzw, r2.zzzz, r6.xyzw
mad r6.xyzw, cb6[r0.w + 0].xyzw, r2.wwww, r6.xyzw
dp4 r6.x, r4.xyzw, r6.xyzw
mul r7.xyzw, r2.yyyy, cb6[r0.y + 1].xyzw
mad r7.xyzw, cb6[r0.x + 1].xyzw, r2.xxxx, r7.xyzw
mad r7.xyzw, cb6[r0.z + 1].xyzw, r2.zzzz, r7.xyzw
mad r7.xyzw, cb6[r0.w + 1].xyzw, r2.wwww, r7.xyzw
dp4 r6.y, r4.xyzw, r7.xyzw
mul r7.xyzw, r2.yyyy, cb6[r0.y + 2].xyzw
mad r7.xyzw, cb6[r0.x + 2].xyzw, r2.xxxx, r7.xyzw
mad r7.xyzw, cb6[r0.z + 2].xyzw, r2.zzzz, r7.xyzw
mad r0.xyzw, cb6[r0.w + 2].xyzw, r2.wwww, r7.xyzw
dp4 r6.z, r4.xyzw, r0.xyzw
mov r6.w, l(1.000000)
dp4 o2.x, r6.xyzw, cb0[4].xyzw
dp4 o2.y, r6.xyzw, cb0[5].xyzw
dp4 o2.z, r6.xyzw, cb0[6].xyzw
dp4 o2.w, r6.xyzw, cb0[7].xyzw
utof r0.xyz, v1.xyzx
add r0.xyz, r0.xyzx, l(-127.000000, -127.000000, -127.000000, 0.000000)
mul r0.xyz, r0.xyzx, l(0.007874, 0.007874, 0.007874, 0.000000)
dp3 o3.x, r0.xyzx, r3.xyzx
dp3 o3.y, r0.xyzx, r5.xyzx
dp3 o3.z, r0.xyzx, r1.xyzx
itof r0.xy, v7.xyxx
mul r0.xy, r0.xyxx, cb11[0].xyxx
mad o4.xy, r0.xyxx, l(0.000488, 0.000488, 0.000000, 0.000000), cb11[0].zwzz
ret 
// Approximately 60 instruction slots used

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