// PreFix
cbuffer _Globals : register(b0)
{
  row_major float4x4 m_texgen : packoffset(c0);
}

cbuffer static_globals : register(b1)
{
  row_major float3x4 m_V : packoffset(c0);
  row_major float4x4 m_P : packoffset(c3);
  row_major float4x4 m_VP : packoffset(c7);
  float4 timers : packoffset(c11);
  float4 fog_plane : packoffset(c12);
  float4 fog_params : packoffset(c13);
  float4 fog_color : packoffset(c14);
  float4 L_ambient : packoffset(c15);
  float3 L_sun_color : packoffset(c16);
  float3 L_sun_dir_w : packoffset(c17);
  float4 L_hemi_color : packoffset(c18);
  float3 eye_position : packoffset(c19);
  float4 pos_decompression_params : packoffset(c20);
  float4 pos_decompression_params2 : packoffset(c21);
}



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


void main( 
  float4 v0 : POSITION0,
  float4 v1 : NORMAL0,
  float4 v2 : TANGENT0,
  float4 v3 : BINORMAL0,
  float4 v4 : COLOR0,
  int2 v5 : TEXCOORD0,
  out float2 o0 : TEXCOORD0,
  out float2 p0 : TEXCOORD1,
  out float4 o1 : TEXCOORD2,
  out float4 o2 : TEXCOORD3,
  out float4 o3 : SV_Position0)
{
  float4 r0,r1,r2;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.x = dot(v0.xz, float2(0.0316650011,0.0349950008));
  r0.x = timers.z + r0.x;
  sincos(r0.x, r0.x, r1.x);
  r0.z = r0.x;
  r0.w = r1.x;
  r1.xyzw = (int4)v5.xyxy;
  r2.xz = v2.ww;
  r2.yw = v3.ww;
  r1.xyzw = r2.xyzw + r1.xyzw;
  r1.xyzw = float4(0.0009765625,0.0009765625,0.00107421877,0.00107421877) * r1.xyzw;
  p0.xy = r0.zw * float2(0.150000006,0.150000006) + r1.xy;
  o0.xy = r1.xy;
  r0.x = dot(v0.xz, float2(0.116104998,0.128315002));
  r0.x = timers.z + r0.x;
  sincos(r0.x, r0.x, r1.x);
  r0.y = r1.x;
  o1.xy = r0.xy * float2(0.550000012,0.550000012) + r1.zw;
  r0.x = dot(v0.xyz, float3(2.75,3.25,1.75));
  r0.x = timers.x + r0.x;
  r0.x = sin(r0.x);
  r0.y = r0.x * 0.0166666675 + v0.y;
  r0.xzw = v0.xzw;
  o2.x = dot(m_texgen._m00_m01_m02_m03, r0.xyzw);
  o2.y = dot(m_texgen._m10_m11_m12_m13, r0.xyzw);
  o2.w = dot(m_texgen._m30_m31_m32_m33, r0.xyzw);
  o2.z = dot(m_V._m20_m21_m22_m23, r0.xyzw);
  o3.x = dot(m_VP._m00_m01_m02_m03, r0.xyzw);
  o3.y = dot(m_VP._m10_m11_m12_m13, r0.xyzw);
  o3.z = dot(m_VP._m20_m21_m22_m23, r0.xyzw);
  o3.w = dot(m_VP._m30_m31_m32_m33, r0.xyzw);
  
float4 stereo = StereoParams.Load(0);
float4 params = IniParams.Load(0);
o2.x += stereo.x * (o2.w - stereo.y)/2;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Original ASM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.27.952.3022
//
//
// Buffer Definitions: 
//
// cbuffer $Globals
// {
//
//   row_major float4x4 m_texgen;       // Offset:    0 Size:    64
//
// }
//
// cbuffer static_globals
// {
//
//   row_major float3x4 m_V;            // Offset:    0 Size:    48
//   row_major float4x4 m_P;            // Offset:   48 Size:    64 [unused]
//   row_major float4x4 m_VP;           // Offset:  112 Size:    64
//   float4 timers;                     // Offset:  176 Size:    16
//   float4 fog_plane;                  // Offset:  192 Size:    16 [unused]
//   float4 fog_params;                 // Offset:  208 Size:    16 [unused]
//   float4 fog_color;                  // Offset:  224 Size:    16 [unused]
//   float4 L_ambient;                  // Offset:  240 Size:    16 [unused]
//   float3 L_sun_color;                // Offset:  256 Size:    12 [unused]
//   float3 L_sun_dir_w;                // Offset:  272 Size:    12 [unused]
//   float4 L_hemi_color;               // Offset:  288 Size:    16 [unused]
//   float3 eye_position;               // Offset:  304 Size:    12 [unused]
//   float4 pos_decompression_params;   // Offset:  320 Size:    16 [unused]
//   float4 pos_decompression_params2;  // Offset:  336 Size:    16 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// $Globals                          cbuffer      NA          NA    0        1
// static_globals                    cbuffer      NA          NA    1        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyzw
// NORMAL                   0   xyzw        1     NONE   float       
// TANGENT                  0   xyzw        2     NONE   float   xyzw
// BINORMAL                 0   xyzw        3     NONE   float   xyzw
// COLOR                    0   xyzw        4     NONE   float       
// TEXCOORD                 0   xy          5     NONE     int   xy  
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                 0   xy          0     NONE   float   xy  
// TEXCOORD                 1     zw        0     NONE   float     zw
// TEXCOORD                 2   xy          1     NONE   float   xy  
// TEXCOORD                 3   xyzw        2     NONE   float   xyzw
// SV_Position              0   xyzw        3      POS   float   xyzw
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[4], immediateIndexed
dcl_constantbuffer cb1[12], immediateIndexed
dcl_input v0.xyzw
dcl_input v2.w
dcl_input v3.w
dcl_input v5.xy
dcl_output o0.xy
dcl_output o0.zw
dcl_output o1.xy
dcl_output o2.xyzw
dcl_output_siv o3.xyzw, position
dcl_temps 3
dp2 r0.x, v0.xzxx, l(0.031665, 0.034995, 0.000000, 0.000000)
add r0.x, r0.x, cb1[11].z
sincos r0.x, r1.x, r0.x
mov r0.z, r0.x
mov r0.w, r1.x
itof r1.xyzw, v5.xyxy
mov r2.xz, v2.wwww
mov r2.yw, v3.wwww
add r1.xyzw, r1.xyzw, r2.xyzw
mul r1.xyzw, r1.xyzw, l(0.000977, 0.000977, 0.001074, 0.001074)
mad o0.zw, r0.zzzw, l(0.000000, 0.000000, 0.150000, 0.150000), r1.xxxy
mov o0.xy, r1.xyxx
dp2 r0.x, v0.xzxx, l(0.116105, 0.128315, 0.000000, 0.000000)
add r0.x, r0.x, cb1[11].z
sincos r0.x, r1.x, r0.x
mov r0.y, r1.x
mad o1.xy, r0.xyxx, l(0.550000, 0.550000, 0.000000, 0.000000), r1.zwzz
dp3 r0.x, v0.xyzx, l(2.750000, 3.250000, 1.750000, 0.000000)
add r0.x, r0.x, cb1[11].x
sincos r0.x, null, r0.x
mad r0.y, r0.x, l(0.016667), v0.y
mov r0.xzw, v0.xxzw
dp4 o2.x, cb0[0].xyzw, r0.xyzw
dp4 o2.y, cb0[1].xyzw, r0.xyzw
dp4 o2.w, cb0[3].xyzw, r0.xyzw
dp4 o2.z, cb1[2].xyzw, r0.xyzw
dp4 o3.x, cb1[7].xyzw, r0.xyzw
dp4 o3.y, cb1[8].xyzw, r0.xyzw
dp4 o3.z, cb1[9].xyzw, r0.xyzw
dp4 o3.w, cb1[10].xyzw, r0.xyzw
ret 
// Approximately 31 instruction slots used

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


/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~ HLSL errors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
X:\SteamLibrary\steamapps\common\Stalker Call of Pripyat\wrapper1349(43,14-15): warning X3578: Output value 'o1' is not completely initialized
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/


/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Recompiled ASM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20789
//
//   using 3Dmigoto v1.2.29 on Thu Mar 24 07:44:16 2016
//
//
// Buffer Definitions: 
//
// cbuffer _Globals
// {
//
//   row_major float4x4 m_texgen;       // Offset:    0 Size:    64
//
// }
//
// cbuffer static_globals
// {
//
//   row_major float3x4 m_V;            // Offset:    0 Size:    48
//   row_major float4x4 m_P;            // Offset:   48 Size:    64 [unused]
//   row_major float4x4 m_VP;           // Offset:  112 Size:    64
//   float4 timers;                     // Offset:  176 Size:    16
//   float4 fog_plane;                  // Offset:  192 Size:    16 [unused]
//   float4 fog_params;                 // Offset:  208 Size:    16 [unused]
//   float4 fog_color;                  // Offset:  224 Size:    16 [unused]
//   float4 L_ambient;                  // Offset:  240 Size:    16 [unused]
//   float3 L_sun_color;                // Offset:  256 Size:    12 [unused]
//   float3 L_sun_dir_w;                // Offset:  272 Size:    12 [unused]
//   float4 L_hemi_color;               // Offset:  288 Size:    16 [unused]
//   float3 eye_position;               // Offset:  304 Size:    12 [unused]
//   float4 pos_decompression_params;   // Offset:  320 Size:    16 [unused]
//   float4 pos_decompression_params2;  // Offset:  336 Size:    16 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// _Globals                          cbuffer      NA          NA    0        1
// static_globals                    cbuffer      NA          NA    1        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyzw
// NORMAL                   0   xyzw        1     NONE   float       
// TANGENT                  0   xyzw        2     NONE   float      w
// BINORMAL                 0   xyzw        3     NONE   float      w
// COLOR                    0   xyzw        4     NONE   float       
// TEXCOORD                 0   xy          5     NONE     int   xy  
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                 0   xy          0     NONE   float   xy  
// TEXCOORD                 1     zw        0     NONE   float     zw
// TEXCOORD                 2   xyzw        1     NONE   float   xy  
// TEXCOORD                 3   xyzw        2     NONE   float   xyzw
// SV_Position              0   xyzw        3      POS   float   xyzw
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[4], immediateIndexed
dcl_constantbuffer cb1[12], immediateIndexed
dcl_input v0.xyzw
dcl_input v2.w
dcl_input v3.w
dcl_input v5.xy
dcl_output o0.xy
dcl_output o0.zw
dcl_output o1.xy
dcl_output o2.xyzw
dcl_output_siv o3.xyzw, position
dcl_temps 3
itof r0.xyzw, v5.xyxy
mov r1.xz, v2.wwww
mov r1.yw, v3.wwww
add r0.xyzw, r0.xyzw, r1.xyzw
mul r0.xyzw, r0.xyzw, l(0.000976562500, 0.000976562500, 0.00107421877, 0.00107421877)
mov o0.xy, r0.xyxx
dp2 r1.x, v0.xzxx, l(0.031665, 0.034995, 0.000000, 0.000000)
add r1.x, r1.x, cb1[11].z
sincos r1.x, r2.x, r1.x
mov r1.z, r1.x
mov r1.w, r2.x
mad o0.zw, r1.zzzw, l(0.000000, 0.000000, 0.150000, 0.150000), r0.xxxy
dp2 r0.x, v0.xzxx, l(0.116105, 0.128315, 0.000000, 0.000000)
add r0.x, r0.x, cb1[11].z
sincos r0.x, r1.x, r0.x
mov r0.y, r1.x
mad o1.xy, r0.xyxx, l(0.550000, 0.550000, 0.000000, 0.000000), r0.zwzz
dp3 r0.x, v0.xyzx, l(2.750000, 3.250000, 1.750000, 0.000000)
add r0.x, r0.x, cb1[11].x
sincos r0.x, null, r0.x
mad r0.y, r0.x, l(0.0166666675), v0.y
mov r0.xzw, v0.xxzw
dp4 o2.x, cb0[0].xyzw, r0.xyzw
dp4 o2.y, cb0[1].xyzw, r0.xyzw
dp4 o2.w, cb0[3].xyzw, r0.xyzw
dp4 o2.z, cb1[2].xyzw, r0.xyzw
dp4 o3.x, cb1[7].xyzw, r0.xyzw
dp4 o3.y, cb1[8].xyzw, r0.xyzw
dp4 o3.z, cb1[9].xyzw, r0.xyzw
dp4 o3.w, cb1[10].xyzw, r0.xyzw
ret 
// Approximately 31 instruction slots used

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