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

cbuffer cbTextureTilingScale : register(b1)
{
  float4 FC_TextureTilingScale[25] : packoffset(c0);
}

cbuffer cbSceneParam : register(b8)
{
  float4 FC_FarClipInfo : packoffset(c0);
  float4 FC_ScreenSize : packoffset(c1);
  float4 FC_DepthComputeParam : packoffset(c2);
  float4 SC_CameraPos : packoffset(c3);
  float4 VC_ClipPlane : packoffset(c4);
  float4x3 FC_MatrixView : packoffset(c5);
  float4x4 FC_MatrixInvViewProj : packoffset(c8);
  float4x4 FC_MatrixInvProj : packoffset(c12);
  float4x4 FC_MatrixProj : packoffset(c16);
  float4x4 FC_MatrixInvView : packoffset(c20);
  float4x4 VC_MatrixViewProj : packoffset(c24);
  float4 FC_ShadowMapParam : packoffset(c28);
  float4 FC_ShadowColor : packoffset(c29);
  float4 FC_ShadowDir : packoffset(c30);
  float4x4 VC_ShadowMapMatrix : packoffset(c31);
  float FC_ShadowDepthRate : packoffset(c35);
  float FC_ShadowDepthScale : packoffset(c35.y);
  float FC_ShadowKernelScale : packoffset(c35.z);
  float FC_ShadowRandTexInvScale : packoffset(c35.w);
  float FC_ShadowTexInvScaleX : packoffset(c36);
  float FC_ShadowTexInvScaleY : packoffset(c36.y);
  float FC_ShadowDepthOffsetScale : packoffset(c36.z);
  float4 FC_ShadowViewKernelScale : packoffset(c37);
  float4x4 FC_ProjSpaceToShadowMatrix[4] : packoffset(c38);
  float4 FC_CascadeSelectDist : packoffset(c54);
  float FC_FrustumNear : packoffset(c55);
  float FC_FrustumSliceScale : packoffset(c55.y);
  float FC_FrustumSliceBias : packoffset(c55.z);
  uint FC_LightTile_Width : packoffset(c56);
  uint FC_LightTile_NumCellX : packoffset(c56.y);
  float4 FC_CloudShadowParam0 : packoffset(c57);
  float4 FC_CloudShadowParam1 : packoffset(c58);
  float FC_ShadowScale0 : packoffset(c59);
  float FC_ShadowScale1 : packoffset(c59.y);
}

cbuffer cbMatrixWVP : register(b0)
{
  row_major float4x4 VC_View_MatrixCamera : packoffset(c0);
  float4x4 VC_View_MatrixViewProj : packoffset(c4);
  float4 VC_ViewFrustumPlanes[4] : packoffset(c8);
}

cbuffer cbvModelParam : register(b7)
{
  float4x3 VC_World : packoffset(c0);
  float4x3 VC_PrevWorld : packoffset(c3);
  float4 VC_VtxCullingParam : packoffset(c6);
  float4 VFC_PomLightDir : packoffset(c7);

  struct
  {
    int4 WindForceLoopParam;
    float4 WindForceAndTime[4];
    float4 PointWindPositionAndTime[4];
    float4 PointWindForce[4];
    float4 WindPositionAndRange[4];
    float4 WindWaveNoiseScale[4];
    float4 WindWaveNoiseScalePoint[4];
    float4 PointWindDirAndEnable[4];
    float4 WindAttractionParam[4];
  } VC_ForceParam : packoffset(c8);

  int VC_InstanceId : packoffset(c41);
  int3 VC_InstanceIdPad : packoffset(c41.y);
  float4 unused_VC_UserClipPlane : packoffset(c42);
  float4 VC_ModelSizeParam : packoffset(c43);
  float4 VC_LTWorldPosition : packoffset(c44);
  float4 VC_RTWorldPosition : packoffset(c45);
  float4 VC_LBWorldPosition : packoffset(c46);
}

cbuffer cbTessScene : register(b5)
{
  float4x4 g_f4x4ViewProjection : packoffset(c0);
  float4 g_f4Eye : packoffset(c4);
  float4 g_f4ViewVector : packoffset(c5);
  float4 g_f4GUIParams2 : packoffset(c6);
  float4 g_f4ViewFrustumPlanes[4] : packoffset(c7);
  float g_fGlobalTime : packoffset(c11);
}

cbuffer cbPNTriangles : register(b6)
{
  float4 g_f4TessFactors : packoffset(c0);
  float4 g_f4GUIParams1 : packoffset(c1);
  float2 g_fDetailTessellationHeightParam : packoffset(c2);
}

SamplerState SS_DisplacementMap_s : register(s4);
Texture2D<float4> g_DisplacementTexture : register(t5);


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


void main( 
  float3 v0 : POSITION0,
  float4 v1 : NORMAL0,
  float2 v2 : TEXCOORD0,
  float2 w2 : TEXCOORD2,
  float4 v3 : COLOR1,
  float3 v4 : TEXCOORD16,
  out float4 o0 : SV_Position0,
  out float o1 : SV_ClipDistance0,
  out float p1 : SV_ClipDistance1)
{
// Needs manual fix for instruction: 
// unknown dcl_: dcl_input_control_point_count 3
// Needs manual fix for instruction: 
// unknown dcl_: dcl_tessellator_domain domain_tri
  float4 r0,r1;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.x = VC_InstanceId;
  r0.y = 0.100000001 * r0.x;
  r0.x = r0.x + r0.x;
  r0.z = cmp(r0.y >= -r0.y);
  r0.y = frac(abs(r0.y));
  r0.y = r0.z ? r0.y : -r0.y;
  r0.y = 10 * r0.y;
  r0.y = max(1, r0.y);
  r0.y = 1 / r0.y;
  r0.y = r0.y * 0.0500000007 + 1;
  r0.x = g_fGlobalTime * r0.y + r0.x;
  r0.yz = vicp[1][2].xy * vDomain.xx;
  r0.yz = vicp[0][2].xy * vDomain.zz + r0.yz;
  r0.yz = vicp[2][2].xy * vDomain.yy + r0.yz;
  r0.yz = r0.yz * FC_TextureTilingScale[5].xy + FC_TextureTilingScale[5].zw;
  r0.xy = r0.xx * float2(-0.0198507495,0.300000012) + r0.yz;
  r0.x = g_DisplacementTexture.SampleLevel(SS_DisplacementMap_s, r0.xy, 0).x;
  r0.y = vicp[1][4].x * vDomain.x;
  r0.y = vicp[0][4].x * vDomain.z + r0.y;
  r0.y = vicp[2][4].x * vDomain.y + r0.y;
  r0.y = r0.y * r0.y;
  r0.x = r0.y * r0.x + -g_fDetailTessellationHeightParam.y;
  r0.x = g_fDetailTessellationHeightParam.x * r0.x;
  r0.yzw = vicp[1][1].xyz * vDomain.xxx;
  r0.yzw = vicp[0][1].xyz * vDomain.zzz + r0.yzw;
  r0.yzw = vicp[2][1].xyz * vDomain.yyy + r0.yzw;
  r1.x = dot(r0.yzw, r0.yzw);
  r1.x = rsqrt(r1.x);
  r0.yzw = r1.xxx * r0.yzw;
  r1.xyz = vicp[1][0].xyz * vDomain.xxx;
  r1.xyz = vicp[0][0].xyz * vDomain.zzz + r1.xyz;
  r1.xyz = vicp[2][0].xyz * vDomain.yyy + r1.xyz;
  r0.xyz = r0.yzw * r0.xxx + r1.xyz;
  r0.xyz = -VC_View_MatrixCamera._m30_m31_m32 + r0.xyz;
  r0.w = 1;
  r1.x = dot(r0.xyzw, VC_View_MatrixViewProj._m00_m10_m20_m30);
  r1.y = dot(r0.xyzw, VC_View_MatrixViewProj._m01_m11_m21_m31);
  r1.z = dot(r0.xyzw, VC_View_MatrixViewProj._m02_m12_m22_m32);
  r1.w = dot(r0.xyzw, VC_View_MatrixViewProj._m03_m13_m23_m33);
  o0.xyzw = r1.xyzw;
  o1.x = dot(r1.xyzw, VC_ClipPlane.xyzw);
  p1.x = 0;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Original ASM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20546
//
//
// Buffer Definitions: 
//
// cbuffer cbTextureTilingScale
// {
//
//   float4 FC_TextureTilingScale[25];  // Offset:    0 Size:   400
//
// }
//
// cbuffer cbSceneParam
// {
//
//   float4 FC_FarClipInfo;             // Offset:    0 Size:    16 [unused]
//   float4 FC_ScreenSize;              // Offset:   16 Size:    16 [unused]
//   float4 FC_DepthComputeParam;       // Offset:   32 Size:    16 [unused]
//   float4 SC_CameraPos;               // Offset:   48 Size:    16 [unused]
//   float4 VC_ClipPlane;               // Offset:   64 Size:    16
//   float4x3 FC_MatrixView;            // Offset:   80 Size:    48 [unused]
//   float4x4 FC_MatrixInvViewProj;     // Offset:  128 Size:    64 [unused]
//   float4x4 FC_MatrixInvProj;         // Offset:  192 Size:    64 [unused]
//   float4x4 FC_MatrixProj;            // Offset:  256 Size:    64 [unused]
//   float4x4 FC_MatrixInvView;         // Offset:  320 Size:    64 [unused]
//   float4x4 VC_MatrixViewProj;        // Offset:  384 Size:    64 [unused]
//   float4 FC_ShadowMapParam;          // Offset:  448 Size:    16 [unused]
//   float4 FC_ShadowColor;             // Offset:  464 Size:    16 [unused]
//   float4 FC_ShadowDir;               // Offset:  480 Size:    16 [unused]
//   float4x4 VC_ShadowMapMatrix;       // Offset:  496 Size:    64 [unused]
//   float FC_ShadowDepthRate;          // Offset:  560 Size:     4 [unused]
//   float FC_ShadowDepthScale;         // Offset:  564 Size:     4 [unused]
//   float FC_ShadowKernelScale;        // Offset:  568 Size:     4 [unused]
//   float FC_ShadowRandTexInvScale;    // Offset:  572 Size:     4 [unused]
//   float FC_ShadowTexInvScaleX;       // Offset:  576 Size:     4 [unused]
//   float FC_ShadowTexInvScaleY;       // Offset:  580 Size:     4 [unused]
//   float FC_ShadowDepthOffsetScale;   // Offset:  584 Size:     4 [unused]
//   float4 FC_ShadowViewKernelScale;   // Offset:  592 Size:    16 [unused]
//   float4x4 FC_ProjSpaceToShadowMatrix[4];// Offset:  608 Size:   256 [unused]
//   float4 FC_CascadeSelectDist;       // Offset:  864 Size:    16 [unused]
//   float FC_FrustumNear;              // Offset:  880 Size:     4 [unused]
//   float FC_FrustumSliceScale;        // Offset:  884 Size:     4 [unused]
//   float FC_FrustumSliceBias;         // Offset:  888 Size:     4 [unused]
//   uint FC_LightTile_Width;           // Offset:  896 Size:     4 [unused]
//   uint FC_LightTile_NumCellX;        // Offset:  900 Size:     4 [unused]
//   float4 FC_CloudShadowParam0;       // Offset:  912 Size:    16 [unused]
//   float4 FC_CloudShadowParam1;       // Offset:  928 Size:    16 [unused]
//   float FC_ShadowScale0;             // Offset:  944 Size:     4 [unused]
//   float FC_ShadowScale1;             // Offset:  948 Size:     4 [unused]
//
// }
//
// cbuffer cbMatrixWVP
// {
//
//   row_major float4x4 VC_View_MatrixCamera;// Offset:    0 Size:    64
//   float4x4 VC_View_MatrixViewProj;   // Offset:   64 Size:    64
//   float4 VC_ViewFrustumPlanes[4];    // Offset:  128 Size:    64 [unused]
//
// }
//
// cbuffer cbvModelParam
// {
//
//   float4x3 VC_World;                 // Offset:    0 Size:    48 [unused]
//   float4x3 VC_PrevWorld;             // Offset:   48 Size:    48 [unused]
//   float4 VC_VtxCullingParam;         // Offset:   96 Size:    16 [unused]
//   float4 VFC_PomLightDir;            // Offset:  112 Size:    16 [unused]
//   
//   struct ForceParamST
//   {
//       
//       int4 WindForceLoopParam;       // Offset:  128
//       float4 WindForceAndTime[4];    // Offset:  144
//       float4 PointWindPositionAndTime[4];// Offset:  208
//       float4 PointWindForce[4];      // Offset:  272
//       float4 WindPositionAndRange[4];// Offset:  336
//       float4 WindWaveNoiseScale[4];  // Offset:  400
//       float4 WindWaveNoiseScalePoint[4];// Offset:  464
//       float4 PointWindDirAndEnable[4];// Offset:  528
//       float4 WindAttractionParam[4]; // Offset:  592
//
//   } VC_ForceParam;                   // Offset:  128 Size:   528 [unused]
//   int VC_InstanceId;                 // Offset:  656 Size:     4
//   int3 VC_InstanceIdPad;             // Offset:  660 Size:    12 [unused]
//   float4 unused_VC_UserClipPlane;    // Offset:  672 Size:    16 [unused]
//   float4 VC_ModelSizeParam;          // Offset:  688 Size:    16 [unused]
//   float4 VC_LTWorldPosition;         // Offset:  704 Size:    16 [unused]
//   float4 VC_RTWorldPosition;         // Offset:  720 Size:    16 [unused]
//   float4 VC_LBWorldPosition;         // Offset:  736 Size:    16 [unused]
//
// }
//
// cbuffer cbTessScene
// {
//
//   float4x4 g_f4x4ViewProjection;     // Offset:    0 Size:    64 [unused]
//   float4 g_f4Eye;                    // Offset:   64 Size:    16 [unused]
//   float4 g_f4ViewVector;             // Offset:   80 Size:    16 [unused]
//   float4 g_f4GUIParams2;             // Offset:   96 Size:    16 [unused]
//   float4 g_f4ViewFrustumPlanes[4];   // Offset:  112 Size:    64 [unused]
//   float g_fGlobalTime;               // Offset:  176 Size:     4
//
// }
//
// cbuffer cbPNTriangles
// {
//
//   float4 g_f4TessFactors;            // Offset:    0 Size:    16 [unused]
//   float4 g_f4GUIParams1;             // Offset:   16 Size:    16 [unused]
//   float2 g_fDetailTessellationHeightParam;// Offset:   32 Size:     8
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// SS_DisplacementMap                sampler      NA          NA    4        1
// g_DisplacementTexture             texture  float4          2d    5        1
// cbMatrixWVP                       cbuffer      NA          NA    0        1
// cbTextureTilingScale              cbuffer      NA          NA    1        1
// cbTessScene                       cbuffer      NA          NA    5        1
// cbPNTriangles                     cbuffer      NA          NA    6        1
// cbvModelParam                     cbuffer      NA          NA    7        1
// cbSceneParam                      cbuffer      NA          NA    8        1
//
//
//
// Patch Constant signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_TessFactor            0   x           0  TRIEDGE   float       
// SV_TessFactor            1   x           1  TRIEDGE   float       
// SV_TessFactor            2   x           2  TRIEDGE   float       
// SV_InsideTessFactor      0   x           3   TRIINT   float       
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyz         0     NONE   float   xyz 
// NORMAL                   0   xyzw        1     NONE   float   xyz 
// TEXCOORD                 0   xy          2     NONE   float   xy  
// TEXCOORD                 2     zw        2     NONE   float       
// COLOR                    1   xyzw        3     NONE   float       
// TEXCOORD                16   xyz         4     NONE   float   x   
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xyzw
// SV_ClipDistance          0   x           1  CLIPDST   float   x   
// SV_ClipDistance          1    y          1  CLIPDST   float    y  
//
// Tessellation Domain   # of control points
// -------------------- --------------------
// Triangle                                3
//
ds_5_0
dcl_input_control_point_count 3
dcl_tessellator_domain domain_tri
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb1[6], immediateIndexed
dcl_constantbuffer cb8[5], immediateIndexed
dcl_constantbuffer cb0[8], immediateIndexed
dcl_constantbuffer cb7[42], immediateIndexed
dcl_constantbuffer cb5[12], immediateIndexed
dcl_constantbuffer cb6[3], immediateIndexed
dcl_sampler s4, mode_default
dcl_resource_texture2d (float,float,float,float) t5
dcl_input vDomain.xyz
dcl_input vicp[3][0].xyz
dcl_input vicp[3][1].xyz
dcl_input vicp[3][2].xy
dcl_input vicp[3][4].x
dcl_output_siv o0.xyzw, position
dcl_output_siv o1.x, clip_distance
dcl_output_siv o1.y, clip_distance
dcl_temps 2
itof r0.x, cb7[41].x
mul r0.y, r0.x, l(0.100000)
add r0.x, r0.x, r0.x
ge r0.z, r0.y, -r0.y
frc r0.y, |r0.y|
movc r0.y, r0.z, r0.y, -r0.y
mul r0.y, r0.y, l(10.000000)
max r0.y, r0.y, l(1.000000)
div r0.y, l(1.000000, 1.000000, 1.000000, 1.000000), r0.y
mad r0.y, r0.y, l(0.050000), l(1.000000)
mad r0.x, cb5[11].x, r0.y, r0.x
mul r0.yz, vDomain.xxxx, vicp[1][2].xxyx
mad r0.yz, vicp[0][2].xxyx, vDomain.zzzz, r0.yyzy
mad r0.yz, vicp[2][2].xxyx, vDomain.yyyy, r0.yyzy
mad r0.yz, r0.yyzy, cb1[5].xxyx, cb1[5].zzwz
mad r0.xy, r0.xxxx, l(-0.019851, 0.300000, 0.000000, 0.000000), r0.yzyy
sample_l_indexable(texture2d)(float,float,float,float) r0.x, r0.xyxx, t5.xyzw, s4, l(0.000000)
mul r0.y, vDomain.x, vicp[1][4].x
mad r0.y, vicp[0][4].x, vDomain.z, r0.y
mad r0.y, vicp[2][4].x, vDomain.y, r0.y
mul r0.y, r0.y, r0.y
mad r0.x, r0.y, r0.x, -cb6[2].y
mul r0.x, r0.x, cb6[2].x
mul r0.yzw, vDomain.xxxx, vicp[1][1].xxyz
mad r0.yzw, vicp[0][1].xxyz, vDomain.zzzz, r0.yyzw
mad r0.yzw, vicp[2][1].xxyz, vDomain.yyyy, r0.yyzw
dp3 r1.x, r0.yzwy, r0.yzwy
rsq r1.x, r1.x
mul r0.yzw, r0.yyzw, r1.xxxx
mul r1.xyz, vDomain.xxxx, vicp[1][0].xyzx
mad r1.xyz, vicp[0][0].xyzx, vDomain.zzzz, r1.xyzx
mad r1.xyz, vicp[2][0].xyzx, vDomain.yyyy, r1.xyzx
mad r0.xyz, r0.yzwy, r0.xxxx, r1.xyzx
add r0.xyz, r0.xyzx, -cb0[3].xyzx
mov r0.w, l(1.000000)
dp4 r1.x, r0.xyzw, cb0[4].xyzw
dp4 r1.y, r0.xyzw, cb0[5].xyzw
dp4 r1.z, r0.xyzw, cb0[6].xyzw
dp4 r1.w, r0.xyzw, cb0[7].xyzw
mov o0.xyzw, r1.xyzw
dp4 o1.x, r1.xyzw, cb8[4].xyzw
mov o1.y, l(0)
ret 
// Approximately 43 instruction slots used

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