//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//   using 3Dmigoto v1.2.67 on Mon Jan 01 13:11:46 2018
//
//
// Buffer Definitions: 
//
// cbuffer $Globals
// {
//
//   float4 g_vDitherSettings;          // Offset:    0 Size:    16 [unused]
//   float4 g_vKSettings;               // Offset:   16 Size:    16 [unused]
//   float4x4 g_mPrevObjViewProj;       // Offset:   32 Size:    64 [unused]
//   float4 specColor;                  // Offset:   96 Size:    16 [unused]
//   float4 ControlData;                // Offset:  112 Size:    16 [unused]
//   float4 difColor;                   // Offset:  128 Size:    16 [unused]
//   float4 ambient;                    // Offset:  144 Size:    16 [unused]
//   float4 lightCount;                 // Offset:  160 Size:    16 [unused]
//   float4 g_avLightPos[4];            // Offset:  176 Size:    64 [unused]
//   float4 g_avLightColor[4];          // Offset:  240 Size:    64 [unused]
//   float4 g_avConeDir[4];             // Offset:  304 Size:    64 [unused]
//   float4 g_vAmbientSettings;         // Offset:  368 Size:    16
//   float4 g_vScreenDepthRect;         // Offset:  384 Size:    16 [unused]
//   
//   struct
//   {
//       
//       float4 vDesc;                  // Offset:  400
//       float4 vFogLayerPlane;         // Offset:  416
//       float4 vFogLayerColor;         // Offset:  432
//       float4 vFogLayerSettings;      // Offset:  448
//       float4 vFogColor;              // Offset:  464
//       float4 vFogDistance;           // Offset:  480
//
//   } g_FogDesc;                       // Offset:  400 Size:    96
//   float4x4 g_mViewProj;              // Offset:  496 Size:    64
//   float4x4 g_mView;                  // Offset:  560 Size:    64
//   float4 g_vOffset;                  // Offset:  624 Size:    16
//   float4 g_vPixelOffset;             // Offset:  640 Size:    16
//   float4 g_vMaskCoord;               // Offset:  656 Size:    16
//   float4 g_vTerrainNormCoord;        // Offset:  672 Size:    16 [unused]
//   float4 g_vExclusionMask;           // Offset:  688 Size:    16 [unused]
//      = 0x3f800000 0x3f800000 0x3f800000 0x3f800000 
//   float4 g_avFaceK[2];               // Offset:  704 Size:    32
//   float4 g_vCamPos;                  // Offset:  736 Size:    16
//   float4 g_vConstraints;             // Offset:  752 Size:    16
//   float4 g_avTreeCenter[128];        // Offset:  768 Size:  2048 [unused]
//   float4x4 g_mCloudsShadowsSpace;    // Offset: 2816 Size:    64
//   float4 g_vCloudsShadowDesc;        // Offset: 2880 Size:    16 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// $Globals                          cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyz         0     NONE   float   xyz 
// POSITION                 1   xyzw        1     NONE   float   xyz 
// NORMAL                   0   xyz         2     NONE   float   xyz 
// TEXCOORD                 0   xy          3     NONE   float   xy  
//
//
// 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
// TEXCOORD                 3   xyzw        4     NONE   float   xyzw
// COLOR                    0   xyzw        5     NONE   float   xyzw
// COLOR                    1   xyzw        6     NONE   float   xyzw
// TEXCOORD                 4   xyzw        7     NONE   float   xyzw
// TEXCOORD                 5   xyz         8     NONE   float   xyz 
//
vs_4_0
dcl_constantbuffer cb0[179], dynamicIndexed
dcl_input v0.xyz
dcl_input v1.xyz
dcl_input v2.xyz
dcl_input v3.xy
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_output o4.xyzw
dcl_output o5.xyzw
dcl_output o6.xyzw
dcl_output o7.xyzw
dcl_output o8.xyz
// dcl_temps updated : previous = dcl_temps 6
dcl_temps 9
// added 3dmigoto declaration
dcl_resource_texture1d (float,float,float,float) t120
ld_indexable(texture1d)(float,float,float,float) r7.xyzw, l(0, 0, 0, 0), t120.xyzw
mov r8.x, r7.w
mov r8.y, r7.w
mov r8.zw, l(1.0, 1.0)
// end of 3dmigoto declaration
add r0.xy, v1.zyzz, -cb0[40].wyww
ftou r0.x, r0.x
add r0.z, -v1.x, cb0[40].x
mad r0.z, cb0[r0.x + 44].x, r0.z, cb0[r0.x + 44].z
mad r0.x, cb0[r0.x + 44].y, r0.y, r0.z
mov r1.xz, v1.xxyx
mov r1.yw, l(0,0,0,1.000000)
add r1.xyzw, r1.xyzw, cb0[39].xyzw
mov r2.xyz, v0.xyzx
mov r2.w, l(1.000000)
add r2.xyzw, r2.xyzw, cb0[39].xyzw
mad r2.y, r0.x, cb0[44].w, r2.y
mad r1.y, r0.x, cb0[44].w, r1.y
// replacing matrix usage :dp4 r0.x, r2.xyzw, cb0[31].xyzw
dp4 r6.x, r2.xyzw, cb0[31].xyzw
mul r0.x, r6.x, r8.x
// replacing matrix usage :dp4 r0.y, r2.xyzw, cb0[32].xyzw
dp4 r6.y, r2.xyzw, cb0[32].xyzw
mul r0.y, r6.y, r8.y
dp4 r3.z, r2.xyzw, cb0[33].xyzw
dp4 r0.w, r2.xyzw, cb0[34].xyzw
mov r2.w, l(1.000000)
dp4 o2.z, r2.xyzw, cb0[176].xyzw
dp4 o2.w, r2.xyzw, cb0[178].xyzw
lt r3.w, l(0.500000), cb0[23].y
if_nz r3.w
// replacing matrix usage :  dp3 r4.x, v2.xyzx, cb0[35].xyzx
dp3 r6.x, v2.xyzx, cb0[35].xyzx
mul r4.x, r6.x, r8.x
// replacing matrix usage :  dp3 r4.y, v2.xyzx, cb0[36].xyzx
dp3 r6.y, v2.xyzx, cb0[36].xyzx
mul r4.y, r6.y, r8.y
  dp3 r4.z, v2.xyzx, cb0[37].xyzx
else 
  add r3.w, r0.w, r0.x
  mul r3.x, r3.w, l(0.500000)
  add r3.w, -r0.y, r0.w
  mul r3.y, r3.w, l(0.500000)
  mov r4.xyz, r3.xyzx
endif 
add r1.xyzw, r1.xyzw, -cb0[46].xyzw
dp4 r1.x, r1.xyzw, r1.xyzw
sqrt r1.x, r1.x
lt r1.y, cb0[47].x, r1.x
if_nz r1.y
  mov r5.xyzw, l(0,0,0,0)
else 
  mov r0.z, r3.z
  mov r5.xyzw, r0.xyzw
endif 
add r0.x, -r1.x, cb0[47].x
mul_sat o1.w, r0.x, l(0.010000)
div r0.x, l(0.500000), r5.w
mad o3.x, r5.x, r0.x, l(0.500000)
mad o3.y, -r5.y, r0.x, l(0.500000)
add r0.xyz, r2.xyzx, -cb0[46].xyzx
dp3 r0.x, r0.xyzx, r0.xyzx
sqrt r0.x, r0.x
mul r0.x, r0.x, cb0[30].x
min r0.x, r0.x, l(1.000000)
dp4 r0.y, r2.xyzw, cb0[26].xyzw
add r1.xyz, -r2.xyzx, cb0[46].xyzx
ge r0.z, cb0[25].z, l(0.000000)
if_nz r0.z
  lt r0.z, r0.y, -cb0[28].y
  if_nz r0.z
    mov r0.y, -cb0[28].y
  endif 
  ge r0.z, r0.y, l(0.000000)
  if_nz r0.z
    mov o7.w, l(0)
    mov r0.z, l(0)
    mov r1.w, l(-1)
  else 
    dp3 r2.w, r1.xyzx, r1.xyzx
    rsq r2.w, r2.w
    mul r3.xyz, r1.xyzx, r2.wwww
    dp3 r2.w, cb0[26].xyzx, r3.xyzx
    lt r3.x, l(0.000100), |r2.w|
    if_nz r3.x
      div r2.w, l(1.000000, 1.000000, 1.000000, 1.000000), r2.w
      add r3.x, -r0.y, cb0[25].z
      mul r3.y, r2.w, cb0[25].z
      mad r0.z, r3.x, r2.w, -r3.y
    else 
      mov r0.z, l(0)
    endif 
    lt r1.w, r0.z, l(0.000100)
    if_nz r1.w
      mov o7.w, l(0)
    endif 
  endif 
  if_z r1.w
    mul r0.z, r0.z, cb0[28].x
    mul r0.z, r0.z, l(1.44254541)
    exp r0.z, r0.z
    div r0.z, l(1.000000, 1.000000, 1.000000, 1.000000), r0.z
    add o7.w, -r0.z, l(1.000000)
  endif 
else 
  ge r0.y, r0.y, l(0.000000)
  if_nz r0.y
    dp3 r0.y, r1.xyzx, r1.xyzx
    rsq r0.y, r0.y
    mul r3.xyz, r0.yyyy, r1.xyzx
    dp3 r0.y, cb0[26].xyzx, r3.xyzx
    lt r0.z, l(0.000100), |r0.y|
    if_nz r0.z
      div r0.y, cb0[25].z, r0.y
    endif 
    lt r0.z, r0.y, l(0.000100)
    if_nz r0.z
      mov o7.w, l(0)
    endif 
  else 
    dp3 r1.x, r1.xyzx, r1.xyzx
    sqrt r0.y, r1.x
    mov r0.z, l(0)
  endif 
  if_z r0.z
    mul r0.y, r0.y, cb0[28].x
    mul r0.y, r0.y, l(1.44254541)
    exp r0.y, r0.y
    div r0.y, l(1.000000, 1.000000, 1.000000, 1.000000), r0.y
    add r0.y, r0.y, l(-1.000000)
    mov o7.w, -r0.y
  endif 
endif 
dp3 r0.y, cb0[29].xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
lt r0.z, r0.x, cb0[25].x
if_nz r0.z
  mul r0.z, r0.x, cb0[25].y
  div r0.z, r0.z, cb0[25].x
else 
  add r1.xy, -cb0[25].yxyy, l(1.000000, 1.000000, 0.000000, 0.000000)
  add r1.z, r0.x, -cb0[25].x
  mul r1.x, r1.z, r1.x
  div r1.x, r1.x, r1.y
  add r0.z, r1.x, cb0[25].y
endif 
mul r1.xyz, r0.zzzz, cb0[29].xyzx
log r1.xyz, r1.xyzx
mul r1.xyz, r1.xyzx, cb0[29].wwww
exp r1.xyz, r1.xyzx
mul r1.xyz, r1.xyzx, l(-1.442695, -1.442695, -1.442695, 0.000000)
exp r1.xyz, r1.xyzx
add r1.xyz, -r1.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
lt r0.yz, l(0.000000, 0.001000, 0.800000, 0.000000), r0.yyxy
and r0.y, r0.y, r0.z
if_nz r0.y
  add r0.x, r0.x, l(-0.800000)
  mul r0.x, r0.x, l(5.000000)
  add r3.xyz, -r1.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
  mad r1.xyz, r0.xxxx, r3.xyzx, r1.xyzx
endif 
add r0.x, cb0[30].w, l(-0.250000)
add r0.x, r0.x, r0.x
dp3 r0.y, r1.xyzx, l(0.333300, 0.333300, 0.333300, 0.000000)
add r3.xyz, -r1.xyzx, r0.yyyy
mad o7.xyz, r0.xxxx, r3.xyzx, r1.xyzx
mad o2.x, v1.x, cb0[41].w, cb0[41].y
mad r0.x, -v1.y, cb0[41].w, cb0[41].z
add o2.y, r0.x, cb0[41].x
mov o0.xyzw, r5.xyzw
mov o1.xy, v3.xyxx
mov o1.z, l(0)
mov o3.zw, r5.zzzw
mov r4.w, r0.w
mov o4.xyzw, r4.xyzw
mov o5.xyzw, l(0,0,0,0)
mov o6.xyzw, l(0,0,0,0)
mov o8.xyz, r2.xyzx
ret 
// Approximately 165 instruction slots used
