// ---- Created with 3Dmigoto v1.2.35 on Tue Apr 26 22:30:43 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 cbObjMatrix : register(b5)
{
  float4x3 VC_aObjMatrix[2] : packoffset(c0);
}

cbuffer cbInstanceIdxParam : register(b10)
{
  int VC_InstanceIdxOffset : packoffset(c0);
  int3 pad : packoffset(c0.y);
}

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,
  int4 v2 : BLENDINDICES0,
  float4 v3 : BLENDWEIGHT0,
  int4 v4 : TEXCOORD0,
  int4 v5 : TEXCOORD1,
  int4 v6 : TEXCOORD2,
  uint v7 : SV_INSTANCEID0,
  out float3 o0 : POSITION0,
  out float4 o1 : NORMAL0,
  out float4 o2 : TANGENT0,
  out float4 o3 : TANGENT1,
  out float3 o4 : NORMAL1,
  out float2 o5 : TEXCOORD0,
  out float2 p5 : TEXCOORD1,
  out float2 o6 : TEXCOORD2,
  out float2 p6 : TEXCOORD3,
  out int4 o7 : TEXCOORD5,
  out float4 o8 : TEXCOORD6)
{
// Needs manual fix for instruction: 
// unknown dcl_: dcl_input_sgv v7.x, instance_id
  float4 r0,r1,r2,r3,r4,r5;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xyz = v0.xyz;
  r0.w = 1;
  r1.x = (int)v7.x + VC_InstanceIdxOffset;
  r1.x = (int)r1.x * 17;
  r1.xyzw = (int4)v2.xyzw + (int4)VC_InstanceData[r1.x].matricesData.xxxx;
  r1.xyzw = (int4)r1.xyzw * int4(3,3,3,3);
  r2.x = dot(float4(1,1,1,1), v3.xyzw);
  r2.x = max(0.00100000005, r2.x);
  r2.xyzw = v3.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;
  o0.x = dot(r0.xyzw, r3.xyzw);
  r4.xyzw = VC_aObjMatrix[r1.y/3]._m01_m11_m21_m31 * r2.yyyy;
  r4.xyzw = VC_aObjMatrix[r1.x/3]._m01_m11_m21_m31 * r2.xxxx + r4.xyzw;
  r4.xyzw = VC_aObjMatrix[r1.z/3]._m01_m11_m21_m31 * r2.zzzz + r4.xyzw;
  r4.xyzw = VC_aObjMatrix[r1.w/3]._m01_m11_m21_m31 * r2.wwww + r4.xyzw;
  o0.y = dot(r0.xyzw, r4.xyzw);
  r5.xyzw = VC_aObjMatrix[r1.y/3]._m02_m12_m22_m32 * r2.yyyy;
  r5.xyzw = VC_aObjMatrix[r1.x/3]._m02_m12_m22_m32 * r2.xxxx + r5.xyzw;
  r5.xyzw = VC_aObjMatrix[r1.z/3]._m02_m12_m22_m32 * r2.zzzz + r5.xyzw;
  r1.xyzw = VC_aObjMatrix[r1.w/3]._m02_m12_m22_m32 * r2.wwww + r5.xyzw;
  o0.z = dot(r0.xyzw, r1.xyzw);
  r0.xyz = (uint3)v1.xyz;
  r0.xyz = float3(-127,-127,-127) + r0.xyz;
  r0.xyz = float3(0.00787401572,0.00787401572,0.00787401572) * r0.xyz;
  o1.x = dot(r0.xyz, r3.xyz);
  o1.y = dot(r0.xyz, r4.xyz);
  o1.z = dot(r0.xyz, r1.xyz);
  o1.w = 0;
  o2.xyzw = float4(0,0,0,0);
  o3.xyzw = float4(0,0,0,0);
  r0.xyz = (int3)v6.xyz;
  r0.xyz = float3(0.00787401572,0.00787401572,0.00787401572) * r0.xyz;
  o4.x = dot(r0.xyz, r3.xyz);
  o4.y = dot(r0.xyz, r4.xyz);
  o4.z = dot(r0.xyz, r1.xyz);
  r0.xyzw = (int4)v4.xyzw;
  r0.xy = VC_TexScroll_0.xy * r0.xy;
  r0.zw = VC_TexScroll_1.xy * r0.zw;
  p5.xy = r0.zw * float2(0.00048828125,0.00048828125) + VC_TexScroll_1.zw;
  o5.xy = r0.xy * float2(0.00048828125,0.00048828125) + VC_TexScroll_0.zw;
  o6.xyzw = float4(0,0,0,0);
  o7.xyzw = float4(0,0,0,0);
  o8.xyzw = float4(0,0,0,1);
  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 cbObjMatrix
// {
//
//   float4x3 VC_aObjMatrix[2];         // Offset:    0 Size:    96
//
// }
//
// cbuffer cbInstanceIdxParam
// {
//
//   int VC_InstanceIdxOffset;          // Offset:    0 Size:     4
//   int3 pad;                          // Offset:    4 Size:    12 [unused]
//
// }
//
// cbuffer cbTexScroll
// {
//
//   float4 VC_TexScroll_0;             // Offset:    0 Size:    16
//   float4 VC_TexScroll_1;             // Offset:   16 Size:    16
//   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
// ------------------------------ ---------- ------- ----------- ---- --------
// cbInstanceData                    cbuffer      NA          NA    4        1
// cbObjMatrix                       cbuffer      NA          NA    5        1
// cbInstanceIdxParam                cbuffer      NA          NA   10        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 
// BLENDINDICES             0   xyzw        2     NONE     int   xyzw
// BLENDWEIGHT              0   xyzw        3     NONE   float   xyzw
// TEXCOORD                 0   xyzw        4     NONE     int   xyzw
// TEXCOORD                 1   xyzw        5     NONE     int       
// TEXCOORD                 2   xyzw        6     NONE     int   xyz 
// SV_INSTANCEID            0   x           7   INSTID    uint   x   
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyz         0     NONE   float   xyz 
// NORMAL                   0   xyzw        1     NONE   float   xyzw
// TANGENT                  0   xyzw        2     NONE   float   xyzw
// TANGENT                  1   xyzw        3     NONE   float   xyzw
// NORMAL                   1   xyz         4     NONE   float   xyz 
// TEXCOORD                 0   xy          5     NONE   float   xy  
// TEXCOORD                 1     zw        5     NONE   float     zw
// TEXCOORD                 2   xy          6     NONE   float   xy  
// TEXCOORD                 3     zw        6     NONE   float     zw
// TEXCOORD                 5   xyzw        7     NONE     int   xyzw
// TEXCOORD                 6   xyzw        8     NONE   float   xyzw
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb4[34], dynamicIndexed
dcl_constantbuffer cb5[6], dynamicIndexed
dcl_constantbuffer cb10[1], immediateIndexed
dcl_constantbuffer cb11[2], immediateIndexed
dcl_input v0.xyz
dcl_input v1.xyz
dcl_input v2.xyzw
dcl_input v3.xyzw
dcl_input v4.xyzw
dcl_input v6.xyz
dcl_input_sgv v7.x, instance_id
dcl_output o0.xyz
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_output o4.xyz
dcl_output o5.xy
dcl_output o5.zw
dcl_output o6.xy
dcl_output o6.zw
dcl_output o7.xyzw
dcl_output o8.xyzw
dcl_temps 6
mov r0.xyz, v0.xyzx
mov r0.w, l(1.000000)
iadd r1.x, v7.x, cb10[0].x
imul null, r1.x, r1.x, l(17)
iadd r1.xyzw, v2.xyzw, cb4[r1.x + 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), v3.xyzw
max r2.x, r2.x, l(0.001000)
div r2.xyzw, v3.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
dp4 o0.x, r0.xyzw, r3.xyzw
mul r4.xyzw, r2.yyyy, cb5[r1.y + 1].xyzw
mad r4.xyzw, cb5[r1.x + 1].xyzw, r2.xxxx, r4.xyzw
mad r4.xyzw, cb5[r1.z + 1].xyzw, r2.zzzz, r4.xyzw
mad r4.xyzw, cb5[r1.w + 1].xyzw, r2.wwww, r4.xyzw
dp4 o0.y, r0.xyzw, r4.xyzw
mul r5.xyzw, r2.yyyy, cb5[r1.y + 2].xyzw
mad r5.xyzw, cb5[r1.x + 2].xyzw, r2.xxxx, r5.xyzw
mad r5.xyzw, cb5[r1.z + 2].xyzw, r2.zzzz, r5.xyzw
mad r1.xyzw, cb5[r1.w + 2].xyzw, r2.wwww, r5.xyzw
dp4 o0.z, r0.xyzw, r1.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 o1.x, r0.xyzx, r3.xyzx
dp3 o1.y, r0.xyzx, r4.xyzx
dp3 o1.z, r0.xyzx, r1.xyzx
mov o1.w, l(0)
mov o2.xyzw, l(0,0,0,0)
mov o3.xyzw, l(0,0,0,0)
itof r0.xyz, v6.xyzx
mul r0.xyz, r0.xyzx, l(0.007874, 0.007874, 0.007874, 0.000000)
dp3 o4.x, r0.xyzx, r3.xyzx
dp3 o4.y, r0.xyzx, r4.xyzx
dp3 o4.z, r0.xyzx, r1.xyzx
itof r0.xyzw, v4.xyzw
mul r0.xy, r0.xyxx, cb11[0].xyxx
mul r0.zw, r0.zzzw, cb11[1].xxxy
mad o5.zw, r0.zzzw, l(0.000000, 0.000000, 0.000488, 0.000488), cb11[1].zzzw
mad o5.xy, r0.xyxx, l(0.000488, 0.000488, 0.000000, 0.000000), cb11[0].zwzz
mov o6.xyzw, l(0,0,0,0)
mov o7.xyzw, l(0,0,0,0)
mov o8.xyzw, l(0,0,0,1.000000)
ret 
// Approximately 47 instruction slots used

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