// ---- Created with 3Dmigoto v1.2.31 on Fri Feb 26 09:45:33 2016

cbuffer PER_BATCH : register(b0)
{
  float4 PBAlphaTest : packoffset(c0);
  float4 _InstancingParams : packoffset(c1);
}

cbuffer STATIC_INSTANCE : register(b2)
{
  row_major float3x4 ObjWorldMatrix : packoffset(c0);
  float4 BendInfo : packoffset(c3);
}

cbuffer PER_FRAME : register(b3)
{
  row_major float4x4 g_VS_ViewProjMatr : packoffset(c0);
  float4 g_VS_WorldViewPos : packoffset(c6);
  float4 g_VS_AnimGenParams : packoffset(c8);
  row_major float4x4 g_VS_ViewProjZeroMatr : packoffset(c10);
}

cbuffer PER_MATERIAL : register(b4)
{
  float3 __0bendDetailFrequency__1bendDetailLeafAmplitude__2bendDetailBranchAmplitude__3 : packoffset(c2);
  float4 __0AnimFrequency__1AnimAmplitudeWav0__2AnimPhase__3AnimAmplitudeWav2 : packoffset(c3);
  float3 __0__1DetailTilling__2AlphaTestSoftening__3 : packoffset(c4);
}

cbuffer SKIN_DATA : register(b7)
{
  row_major float2x4 _g_SkinQuat[150] : packoffset(c0);
}

cbuffer SHAPE_DATA : register(b8)
{
  float4 _g_ShapeDeformationData[8] : packoffset(c0);
}



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


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

  r0.xyzw = float4(255.001953,255.001953,255.001953,255.001953) * v5.xyzw;
  r0.xyzw = (int4)r0.xyzw;
  r0.xyzw = (uint4)r0.xyzw << int4(1,1,1,1);
  r1.xyzw = _g_SkinQuat[r0.y/2]._m10_m11_m12_m13 * v4.yyyy;
  r1.xyzw = _g_SkinQuat[r0.x/2]._m10_m11_m12_m13 * v4.xxxx + r1.xyzw;
  r1.xyzw = _g_SkinQuat[r0.z/2]._m10_m11_m12_m13 * v4.zzzz + r1.xyzw;
  r1.xyzw = _g_SkinQuat[r0.w/2]._m10_m11_m12_m13 * v4.wwww + r1.xyzw;
  r2.xyzw = _g_SkinQuat[r0.y/2]._m00_m01_m02_m03 * v4.yyyy;
  r2.xyzw = _g_SkinQuat[r0.x/2]._m00_m01_m02_m03 * v4.xxxx + r2.xyzw;
  r2.xyzw = _g_SkinQuat[r0.z/2]._m00_m01_m02_m03 * v4.zzzz + r2.xyzw;
  r0.xyzw = _g_SkinQuat[r0.w/2]._m00_m01_m02_m03 * v4.wwww + r2.xyzw;
  r2.x = dot(r0.xyzw, r0.xyzw);
  r2.x = rsqrt(r2.x);
  r1.xyzw = r2.xxxx * r1.xyzw;
  r0.xyzw = r2.xxxx * r0.xyzw;
  r2.xyz = r1.www * r0.xyz;
  r2.xyz = r0.www * r1.xyz + -r2.xyz;
  r3.xyz = r0.zxy * r1.yzx;
  r1.xyz = r0.yzx * r1.zxy + -r3.xyz;
  r1.xyz = r2.xyz + r1.xyz;
  r1.w = 255.001953 * v6.w;
  r1.w = (int)r1.w;
  r1.w = min(8, (int)r1.w);
  r2.xyz = _g_ShapeDeformationData[r1.w].xxx * v7.xyz;
  r3.xyz = v0.xyz * _g_ShapeDeformationData[r1.w].yyy + r2.xyz;
  r3.xyz = v8.xyz * _g_ShapeDeformationData[r1.w].zzz + r3.xyz;
  r4.xyz = r3.zxy * r0.xyz;
  r4.xyz = r0.zxy * r3.xyz + -r4.xyz;
  r4.xyz = r0.www * r3.yzx + r4.xyz;
  r5.xyz = r4.xyz * r0.zxy;
  r4.xyz = r0.yzx * r4.yzx + -r5.xyz;
  r3.xyz = r4.xyz * float3(2,2,2) + r3.xyz;
  r3.xyz = r1.xyz * float3(2,2,2) + r3.xyz;
  r4.w = -g_VS_WorldViewPos.x + ObjWorldMatrix._m03;
  r4.xyz = ObjWorldMatrix._m00_m01_m02;
  r3.w = 1;
  r5.x = dot(r4.xyzw, r3.xyzw);
  r6.w = -g_VS_WorldViewPos.y + ObjWorldMatrix._m13;
  r6.xyz = ObjWorldMatrix._m10_m11_m12;
  r5.y = dot(r6.xyzw, r3.xyzw);
  r7.w = -g_VS_WorldViewPos.z + ObjWorldMatrix._m23;
  r7.xyz = ObjWorldMatrix._m20_m21_m22;
  r5.z = dot(r7.xyzw, r3.xyzw);
  r5.w = 1;
  r2.w = dot(g_VS_ViewProjZeroMatr._m20_m21_m22_m23, r5.xyzw);
  r3.z = -0.00999999978 + r2.w;
  r3.x = dot(g_VS_ViewProjZeroMatr._m00_m01_m02_m03, r5.xyzw);
  r3.y = dot(g_VS_ViewProjZeroMatr._m10_m11_m12_m13, r5.xyzw);
  r3.w = dot(g_VS_ViewProjZeroMatr._m30_m31_m32_m33, r5.xyzw);
  o0.xyzw = r3.xyzw;
  
  float4 stereo = StereoParams.Load(0);
  r3.x += stereo.x * (r3.w - stereo.y);
  
  o2.zw = r3.zw;
  r3.xy = r3.xy * float2(1,-1) + r3.ww;
  o2.xy = float2(0.5,0.5) * r3.xy;
  o1.xy = v1.xy;
  o1.zw = PBAlphaTest.xw;
  r3.xyz = float3(0,9.99999997e-007,0) + v3.zxy;
  r5.xyz = float3(0,0,9.99999997e-007) + v3.yzx;
  r5.xyz = r5.xyz * r0.zxy;
  r3.xyz = r0.yzx * r3.xyz + -r5.xyz;
  r5.xyzw = float4(9.99999997e-007,0,0,0) + v3.xyzw;
  r8.xyz = float3(9.99999997e-007,0,0) + v3.xyz;
  r2.w = dot(r0.xyz, r8.xyz);
  r3.w = -r2.w;
  r3.xyzw = r5.xyzw * r0.wwww + r3.xyzw;
  r3.xyz = r0.xyz * v3.www + r3.xyz;
  r5.xy = r3.ww + r3.ww;
  r8.xy = float2(-1,1) * r3.zw;
  r3.xyzw = r3.xyzw * -r3.yyyx;
  r5.z = r3.w;
  r8.z = -2;
  r5.xyz = r8.xyz * r5.xyz + float3(0,-1,0);
  r3.xyz = r3.xyz * float3(-2,-2,-2) + r5.xyz;
  r3.xyz = r3.xyz * __0__1DetailTilling__2AlphaTestSoftening__3.zzz + v0.xyz;
  r2.xyz = r3.xyz * _g_ShapeDeformationData[r1.w].yyy + r2.xyz;
  r2.xyz = v8.xyz * _g_ShapeDeformationData[r1.w].zzz + r2.xyz;
  r3.xyz = r2.zxy * r0.xyz;
  r3.xyz = r0.zxy * r2.xyz + -r3.xyz;
  r3.xyz = r0.www * r2.yzx + r3.xyz;
  r5.xyz = r3.xyz * r0.zxy;
  r0.xyz = r0.yzx * r3.yzx + -r5.xyz;
  r0.xyz = r0.xyz * float3(2,2,2) + r2.xyz;
  r0.xyz = r1.xyz * float3(2,2,2) + r0.xyz;
  r0.w = 1;
  r1.x = dot(r4.xyzw, r0.xyzw);
  r1.y = dot(r6.xyzw, r0.xyzw);
  r1.z = dot(r7.xyzw, r0.xyzw);
  r1.w = 1;
  r0.x = dot(g_VS_ViewProjZeroMatr._m00_m01_m02_m03, r1.xyzw);
  r0.y = dot(g_VS_ViewProjZeroMatr._m10_m11_m12_m13, r1.xyzw);
  r0.z = dot(g_VS_ViewProjZeroMatr._m30_m31_m32_m33, r1.xyzw);
  o3.z = dot(g_VS_ViewProjZeroMatr._m20_m21_m22_m23, r1.xyzw);
  r0.xy = r0.xy * float2(1,-1) + r0.zz;
  o3.w = r0.z;
  o3.xy = float2(0.5,0.5) * r0.xy;
  
  o0 = 0;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//   using 3Dmigoto v1.2.31 on Fri Feb 26 09:45:33 2016
//
//
// Buffer Definitions: 
//
// cbuffer PER_BATCH
// {
//
//   float4 PBAlphaTest;                // Offset:    0 Size:    16
//   float4 _InstancingParams;          // Offset:   16 Size:    16 [unused]
//
// }
//
// cbuffer STATIC_INSTANCE
// {
//
//   row_major float3x4 ObjWorldMatrix; // Offset:    0 Size:    48
//   float4 BendInfo;                   // Offset:   48 Size:    16 [unused]
//
// }
//
// cbuffer PER_FRAME
// {
//
//   row_major float4x4 g_VS_ViewProjMatr;// Offset:    0 Size:    64 [unused]
//   float4 g_VS_WorldViewPos;          // Offset:   96 Size:    16
//   float4 g_VS_AnimGenParams;         // Offset:  128 Size:    16 [unused]
//   row_major float4x4 g_VS_ViewProjZeroMatr;// Offset:  160 Size:    64
//
// }
//
// cbuffer PER_MATERIAL
// {
//
//   float3 __0bendDetailFrequency__1bendDetailLeafAmplitude__2bendDetailBranchAmplitude__3;// Offset:   32 Size:    12 [unused]
//   float4 __0AnimFrequency__1AnimAmplitudeWav0__2AnimPhase__3AnimAmplitudeWav2;// Offset:   48 Size:    16 [unused]
//   float3 __0__1DetailTilling__2AlphaTestSoftening__3;// Offset:   64 Size:    12
//
// }
//
// cbuffer SKIN_DATA
// {
//
//   row_major float2x4 _g_SkinQuat[150];// Offset:    0 Size:  4800
//
// }
//
// cbuffer SHAPE_DATA
// {
//
//   float4 _g_ShapeDeformationData[8]; // Offset:    0 Size:   128
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// PER_BATCH                         cbuffer      NA          NA    0        1
// STATIC_INSTANCE                   cbuffer      NA          NA    2        1
// PER_FRAME                         cbuffer      NA          NA    3        1
// PER_MATERIAL                      cbuffer      NA          NA    4        1
// SKIN_DATA                         cbuffer      NA          NA    7        1
// SHAPE_DATA                        cbuffer      NA          NA    8        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyz 
// TEXCOORD                 0   xyzw        1     NONE   float   xy  
// COLOR                    0   xyzw        2     NONE   float       
// TANGENT                  0   xyzw        3     NONE   float   xyzw
// BLENDWEIGHT              0   xyzw        4     NONE   float   xyzw
// BLENDINDICES             0   xyzw        5     NONE   float   xyzw
// COLOR                    1   xyzw        6     NONE   float      w
// TEXCOORD                 4   xyz         7     NONE   float   xyz 
// TEXCOORD                 5   xyz         8     NONE   float   xyz 
//
//
// 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   xyzw        3     NONE   float   xyzw
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[1], immediateIndexed
dcl_constantbuffer cb2[3], immediateIndexed
dcl_constantbuffer cb3[14], immediateIndexed
dcl_constantbuffer cb4[5], immediateIndexed
dcl_constantbuffer cb7[300], dynamicIndexed
dcl_constantbuffer cb8[8], dynamicIndexed
dcl_input v0.xyz
dcl_input v1.xy
dcl_input v3.xyzw
dcl_input v4.xyzw
dcl_input v5.xyzw
dcl_input v6.w
dcl_input v7.xyz
dcl_input v8.xyz
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_temps 9
mul r0.xyzw, v5.xyzw, l(255.001953, 255.001953, 255.001953, 255.001953)
ftoi r0.xyzw, r0.xyzw
ishl r0.xyzw, r0.xyzw, l(1, 1, 1, 1)
mul r1.xyzw, v4.yyyy, cb7[r0.y + 1].xyzw
mad r1.xyzw, cb7[r0.x + 1].xyzw, v4.xxxx, r1.xyzw
mad r1.xyzw, cb7[r0.z + 1].xyzw, v4.zzzz, r1.xyzw
mad r1.xyzw, cb7[r0.w + 1].xyzw, v4.wwww, r1.xyzw
mul r2.xyzw, v4.yyyy, cb7[r0.y + 0].xyzw
mad r2.xyzw, cb7[r0.x + 0].xyzw, v4.xxxx, r2.xyzw
mad r2.xyzw, cb7[r0.z + 0].xyzw, v4.zzzz, r2.xyzw
mad r0.xyzw, cb7[r0.w + 0].xyzw, v4.wwww, r2.xyzw
dp4 r2.x, r0.xyzw, r0.xyzw
rsq r2.x, r2.x
mul r1.xyzw, r1.xyzw, r2.xxxx
mul r0.xyzw, r0.xyzw, r2.xxxx
mul r2.xyz, r0.xyzx, r1.wwww
mad r2.xyz, r0.wwww, r1.xyzx, -r2.xyzx
mul r3.xyz, r1.yzxy, r0.zxyz
mad r1.xyz, r0.yzxy, r1.zxyz, -r3.xyzx
add r1.xyz, r1.xyzx, r2.xyzx
mul r1.w, v6.w, l(255.001953)
ftoi r1.w, r1.w
imin r1.w, r1.w, l(8)
mul r2.xyz, v7.xyzx, cb8[r1.w + 0].xxxx
mad r3.xyz, v0.xyzx, cb8[r1.w + 0].yyyy, r2.xyzx
mad r3.xyz, v8.xyzx, cb8[r1.w + 0].zzzz, r3.xyzx
mul r4.xyz, r0.xyzx, r3.zxyz
mad r4.xyz, r0.zxyz, r3.xyzx, -r4.xyzx
mad r4.xyz, r0.wwww, r3.yzxy, r4.xyzx
mul r5.xyz, r0.zxyz, r4.xyzx
mad r4.xyz, r0.yzxy, r4.yzxy, -r5.xyzx
mad r3.xyz, r4.xyzx, l(2.000000, 2.000000, 2.000000, 0.000000), r3.xyzx
mad r3.xyz, r1.xyzx, l(2.000000, 2.000000, 2.000000, 0.000000), r3.xyzx
add r4.w, cb2[0].w, -cb3[6].x
mov r4.xyz, cb2[0].xyzx
mov r3.w, l(1.000000)
dp4 r5.x, r4.xyzw, r3.xyzw
add r6.w, cb2[1].w, -cb3[6].y
mov r6.xyz, cb2[1].xyzx
dp4 r5.y, r6.xyzw, r3.xyzw
add r7.w, cb2[2].w, -cb3[6].z
mov r7.xyz, cb2[2].xyzx
dp4 r5.z, r7.xyzw, r3.xyzw
mov r5.w, l(1.000000)
dp4 r2.w, cb3[12].xyzw, r5.xyzw
add r3.z, r2.w, l(-0.010000)
dp4 r3.x, cb3[10].xyzw, r5.xyzw
dp4 r3.y, cb3[11].xyzw, r5.xyzw
dp4 r3.w, cb3[13].xyzw, r5.xyzw
mov o0.xyzw, r3.xyzw
mov o2.zw, r3.zzzw
mad r3.xy, r3.xyxx, l(1.000000, -1.000000, 0.000000, 0.000000), r3.wwww
mul o2.xy, r3.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000)
mov o1.xy, v1.xyxx
mov o1.zw, cb0[0].xxxw
add r3.xyz, v3.zxyz, l(0.000000, 0.000001, 0.000000, 0.000000)
add r5.xyz, v3.yzxy, l(0.000000, 0.000000, 0.000001, 0.000000)
mul r5.xyz, r0.zxyz, r5.xyzx
mad r3.xyz, r0.yzxy, r3.xyzx, -r5.xyzx
add r5.xyzw, v3.xyzw, l(0.000001, 0.000000, 0.000000, 0.000000)
add r8.xyz, v3.xyzx, l(0.000001, 0.000000, 0.000000, 0.000000)
dp3 r2.w, r0.xyzx, r8.xyzx
mov r3.w, -r2.w
mad r3.xyzw, r5.xyzw, r0.wwww, r3.xyzw
mad r3.xyz, r0.xyzx, v3.wwww, r3.xyzx
add r5.xy, r3.wwww, r3.wwww
mul r8.xy, r3.zwzz, l(-1.000000, 1.000000, 0.000000, 0.000000)
mul r3.xyzw, -r3.yyyx, r3.xyzw
mov r5.z, r3.w
mov r8.z, l(-2.000000)
mad r5.xyz, r8.xyzx, r5.xyzx, l(0.000000, -1.000000, 0.000000, 0.000000)
mad r3.xyz, r3.xyzx, l(-2.000000, -2.000000, -2.000000, 0.000000), r5.xyzx
mad r3.xyz, r3.xyzx, cb4[4].zzzz, v0.xyzx
mad r2.xyz, r3.xyzx, cb8[r1.w + 0].yyyy, r2.xyzx
mad r2.xyz, v8.xyzx, cb8[r1.w + 0].zzzz, r2.xyzx
mul r3.xyz, r0.xyzx, r2.zxyz
mad r3.xyz, r0.zxyz, r2.xyzx, -r3.xyzx
mad r3.xyz, r0.wwww, r2.yzxy, r3.xyzx
mul r5.xyz, r0.zxyz, r3.xyzx
mad r0.xyz, r0.yzxy, r3.yzxy, -r5.xyzx
mad r0.xyz, r0.xyzx, l(2.000000, 2.000000, 2.000000, 0.000000), r2.xyzx
mad r0.xyz, r1.xyzx, l(2.000000, 2.000000, 2.000000, 0.000000), r0.xyzx
mov r0.w, l(1.000000)
dp4 r1.x, r4.xyzw, r0.xyzw
dp4 r1.y, r6.xyzw, r0.xyzw
dp4 r1.z, r7.xyzw, r0.xyzw
mov r1.w, l(1.000000)
dp4 r0.x, cb3[10].xyzw, r1.xyzw
dp4 r0.y, cb3[11].xyzw, r1.xyzw
dp4 r0.z, cb3[13].xyzw, r1.xyzw
dp4 o3.z, cb3[12].xyzw, r1.xyzw
mad r0.xy, r0.xyxx, l(1.000000, -1.000000, 0.000000, 0.000000), r0.zzzz
mov o3.w, r0.z
mul o3.xy, r0.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000)
ret 
// Approximately 95 instruction slots used

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