//
// 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 specColor;                  // Offset:    0 Size:    16 [unused]
//   float4 ControlData;                // Offset:   16 Size:    16 [unused]
//   float4 difColor;                   // Offset:   32 Size:    16 [unused]
//   float4 ambient;                    // Offset:   48 Size:    16 [unused]
//   float4 g_vDefLightDir;             // Offset:   64 Size:    16
//   float4 g_vDefLightColor;           // Offset:   80 Size:    16 [unused]
//   float4 g_vDefSpecColor;            // Offset:   96 Size:    16 [unused]
//   uint CS_FRONT;                     // Offset:  112 Size:     4 [unused]
//      = 0x00000000 
//   uint CS_RIGHT;                     // Offset:  116 Size:     4 [unused]
//      = 0x00000001 
//   uint CS_BACK;                      // Offset:  120 Size:     4 [unused]
//      = 0x00000002 
//   uint CS_LEFT;                      // Offset:  124 Size:     4 [unused]
//      = 0x00000003 
//   uint CS_TOP;                       // Offset:  128 Size:     4 [unused]
//      = 0x00000004 
//   uint CS_BOTTOM;                    // Offset:  132 Size:     4 [unused]
//      = 0x00000005 
//   float4 g_vAmbientSettings;         // Offset:  144 Size:    16
//   float4 g_vScreenDepthRect;         // Offset:  160 Size:    16 [unused]
//   float4x4 g_mCloudsShadowsSpace;    // Offset:  176 Size:    64
//   float4 g_vCloudsShadowDesc;        // Offset:  240 Size:    16 [unused]
//   
//   struct
//   {
//       
//       float4x4 mLightSpaceInverse;   // Offset:  256
//       float4x4 mLightSpace;          // Offset:  320
//       float4 vShadowBias;            // Offset:  384
//       float4 vBiasDir;               // Offset:  400
//       float4 vSmoothOffs;            // Offset:  416
//       float4 vShadowsDesc;           // Offset:  432
//       float4 avCPlane[8];            // Offset:  448
//       float4 avCascadeZ[2];          // Offset:  576
//       float4 avUVTransform[8];       // Offset:  608
//       float4 avZTransformZF[8];      // Offset:  736
//
//   } g_ShadSettings;                  // Offset:  256 Size:   608
//   
//   struct
//   {
//       
//       float4 vDesc;                  // Offset:  864
//       float4 vFogLayerPlane;         // Offset:  880
//       float4 vFogLayerColor;         // Offset:  896
//       float4 vFogLayerSettings;      // Offset:  912
//       float4 vFogColor;              // Offset:  928
//       float4 vFogDistance;           // Offset:  944
//
//   } g_FogDesc;                       // Offset:  864 Size:    96
//   float4 g_vOffset;                  // Offset:  960 Size:    16
//   float4 g_vCamPos;                  // Offset:  976 Size:    16
//   float4 g_vState;                   // Offset:  992 Size:    16
//   float4 g_vSettings;                // Offset: 1008 Size:    16
//   float4x4 g_mViewProj;              // Offset: 1024 Size:    64
//   float4x4 g_mView;                  // Offset: 1088 Size:    64 [unused]
//   float4 g_avPData[64];              // Offset: 1152 Size:  1024
//
// }
//
//
// 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   xyzw        0     NONE   float   xyzw
// NORMAL                   0   xyzw        1     NONE   float   xyzw
// NORMAL                   1   xyzw        2     NONE   float   xyzw
// TEXCOORD                 0   xyzw        3     NONE   float   xyzw
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xyzw
// TEXCOORD                 0   xyz         1     NONE   float   xyz 
// TEXCOORD                 2   xyzw        2     NONE   float   xyzw
// TEXCOORD                 3   xyzw        3     NONE   float   xyzw
// TEXCOORD                 4   xyzw        4     NONE   float   xyzw
// TEXCOORD                 5   xyz         5     NONE   float   xyz 
// TEXCOORD                 6   xyzw        6     NONE   float   xyzw
// TEXCOORD                 7   xyz         7     NONE   float   xyz 
// TEXCOORD                 8   xyzw        8     NONE   float   xyzw
// TEXCOORD                 9   xyzw        9     NONE   float   xyzw
// COLOR                    0   xyzw       10     NONE   float   xyzw
//
vs_4_1
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[136], dynamicIndexed
dcl_input v0.xyzw
dcl_input v1.xyzw
dcl_input v2.xyzw
dcl_input v3.xyzw
dcl_output_siv o0.xyzw, position
dcl_output o1.xyz
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_output o4.xyzw
dcl_output o5.xyz
dcl_output o6.xyzw
dcl_output o7.xyz
dcl_output o8.xyzw
dcl_output o9.xyzw
dcl_output o10.xyzw
// dcl_temps updated : previous = dcl_temps 11
dcl_temps 14
// added 3dmigoto declaration
dcl_resource_texture1d (float,float,float,float) t120
ld_indexable(texture1d)(float,float,float,float) r12.xyzw, l(0, 0, 0, 0), t120.xyzw
mov r13.x, r12.w
mov r13.y, r12.w
mov r13.zw, l(1.0, 1.0)
// end of 3dmigoto declaration
max r0.x, v0.w, l(0.000000)
ftoi r0.x, r0.x
add_sat r0.y, v0.w, l(1.000000)
add r1.xyz, -v0.xyzx, cb0[r0.x + 72].xyzx
mad r1.xyz, r0.yyyy, r1.xyzx, v0.xyzx
iadd r0.xzw, r0.xxxx, l(1, 0, 2, 3)
add r2.xyzw, -v1.xyzw, cb0[r0.x + 72].xyzw
mad r2.xyzw, r0.yyyy, r2.xyzw, v1.xyzw
add r3.xyzw, -v2.xyzw, cb0[r0.z + 72].xyzw
mad r3.xyzw, r0.yyyy, r3.xyzw, v2.xyzw
add r0.xzw, -v3.xxyz, cb0[r0.w + 72].xxyz
mad r0.xyz, r0.yyyy, r0.xzwx, v3.xyzx
mul r0.z, r0.z, v3.w
add r1.xyz, r1.xyzx, cb0[60].xyzx
dp3 r0.w, r3.xyzx, r3.xyzx
rsq r1.w, r0.w
mul r3.xyz, r1.wwww, r3.yzxy
mul r4.xyz, r2.zxyz, r3.xyzx
mad r4.xyz, r2.yzxy, r3.yzxy, -r4.xyzx
dp3 r1.w, r4.xyzx, r4.xyzx
rsq r1.w, r1.w
mul r4.xyz, r1.wwww, r4.xyzx
mul r5.xyz, r3.xyzx, r4.zxyz
mad r5.xyz, r4.yzxy, r3.yzxy, -r5.xyzx
sqrt r0.w, r0.w
add r0.w, r0.w, l(-1.000000)
add r0.w, -r0.w, l(1.570800)
mul r6.xyz, r0.zzzz, r4.xyzx
sincos r0.w, null, r0.w
div r6.xyz, r6.xyzx, r0.wwww
add r1.xyz, r1.xyzx, r6.xyzx
mov r1.w, l(1.000000)
// replacing matrix usage :dp4 r6.x, r1.xyzw, cb0[64].xyzw
dp4 r11.x, r1.xyzw, cb0[64].xyzw
mul r6.x, r11.x, r13.x
// replacing matrix usage :dp4 r6.y, r1.xyzw, cb0[65].xyzw
dp4 r11.y, r1.xyzw, cb0[65].xyzw
mul r6.y, r11.y, r13.y
dp4 r7.z, r1.xyzw, cb0[66].xyzw
dp4 r6.w, r1.xyzw, cb0[67].xyzw
add r8.xyz, -r1.xyzx, cb0[61].xyzx
dp4 o6.x, r1.xyzw, cb0[20].xyzw
dp4 o6.y, r1.xyzw, cb0[21].xyzw
dp4 o6.z, r1.xyzw, cb0[22].xyzw
add r9.xyz, r1.xyzx, -cb0[61].xyzx
dp3 r0.w, r9.xyzx, r9.xyzx
sqrt r0.w, r0.w
mul r4.w, r0.w, cb0[59].x
min r4.w, r4.w, l(1.000000)
dp4 r5.w, r1.xyzw, cb0[55].xyzw
ge r6.z, cb0[54].z, l(0.000000)
if_nz r6.z
  lt r6.z, r5.w, -cb0[57].y
  if_nz r6.z
    mov r5.w, -cb0[57].y
  endif 
  ge r6.z, r5.w, l(0.000000)
  if_nz r6.z
    mov o9.w, l(0)
    mov r6.z, l(0)
    mov r7.w, l(-1)
  else 
    dp3 r8.w, r8.xyzx, r8.xyzx
    rsq r8.w, r8.w
    mul r9.xyz, r8.wwww, r8.xyzx
    dp3 r8.w, cb0[55].xyzx, r9.xyzx
    lt r9.x, l(0.000100), |r8.w|
    if_nz r9.x
      div r8.w, l(1.000000, 1.000000, 1.000000, 1.000000), r8.w
      add r9.x, -r5.w, cb0[54].z
      mul r9.y, r8.w, cb0[54].z
      mad r6.z, r9.x, r8.w, -r9.y
    else 
      mov r6.z, l(0)
    endif 
    lt r7.w, r6.z, l(0.000100)
    if_nz r7.w
      mov o9.w, l(0)
    endif 
  endif 
  if_z r7.w
    mul r6.z, r6.z, cb0[57].x
    mul r6.z, r6.z, l(1.44254541)
    exp r6.z, r6.z
    div r6.z, l(1.000000, 1.000000, 1.000000, 1.000000), r6.z
    add o9.w, -r6.z, l(1.000000)
  endif 
else 
  ge r5.w, r5.w, l(0.000000)
  if_nz r5.w
    dp3 r5.w, r8.xyzx, r8.xyzx
    rsq r5.w, r5.w
    mul r9.xyz, r5.wwww, r8.xyzx
    dp3 r5.w, cb0[55].xyzx, r9.xyzx
    lt r6.z, l(0.000100), |r5.w|
    if_nz r6.z
      div r5.w, cb0[54].z, r5.w
    endif 
    lt r6.z, r5.w, l(0.000100)
    if_nz r6.z
      mov o9.w, l(0)
    endif 
  else 
    dp3 r7.w, r8.xyzx, r8.xyzx
    sqrt r5.w, r7.w
    mov r6.z, l(0)
  endif 
  if_z r6.z
    mul r5.w, r5.w, cb0[57].x
    mul r5.w, r5.w, l(1.44254541)
    exp r5.w, r5.w
    div r5.w, l(1.000000, 1.000000, 1.000000, 1.000000), r5.w
    add r5.w, r5.w, l(-1.000000)
    mov o9.w, -r5.w
  endif 
endif 
dp3 r5.w, cb0[58].xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
lt r5.w, l(0.001000), r5.w
lt r6.z, r4.w, cb0[54].x
if_nz r6.z
  mul r6.z, r4.w, cb0[54].y
  div r6.z, r6.z, cb0[54].x
else 
  add r9.xy, -cb0[54].yxyy, l(1.000000, 1.000000, 0.000000, 0.000000)
  add r7.w, r4.w, -cb0[54].x
  mul r7.w, r7.w, r9.x
  div r7.w, r7.w, r9.y
  add r6.z, r7.w, cb0[54].y
endif 
mul r9.xyz, r6.zzzz, cb0[58].xyzx
log r9.xyz, r9.xyzx
mul r9.xyz, r9.xyzx, cb0[58].wwww
exp r9.xyz, r9.xyzx
mul r9.xyz, r9.xyzx, l(-1.442695, -1.442695, -1.442695, 0.000000)
exp r9.xyz, r9.xyzx
add r9.xyz, -r9.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
lt r6.z, l(0.800000), r4.w
and r5.w, r5.w, r6.z
if_nz r5.w
  add r4.w, r4.w, l(-0.800000)
  mul r4.w, r4.w, l(5.000000)
  add r10.xyz, -r9.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
  mad r9.xyz, r4.wwww, r10.xyzx, r9.xyzx
endif 
add r4.w, cb0[59].w, l(-0.250000)
add r4.w, r4.w, r4.w
dp3 r5.w, r9.xyzx, l(0.333300, 0.333300, 0.333300, 0.000000)
add r10.xyz, -r9.xyzx, r5.wwww
mad o9.xyz, r4.wwww, r10.xyzx, r9.xyzx
dp4 o7.x, r1.xyzw, cb0[11].xyzw
dp4 o7.y, r1.xyzw, cb0[13].xyzw
add r1.w, r0.w, -cb0[27].x
mul_sat o7.z, r1.w, cb0[27].y
lt r1.w, l(0.500000), cb0[9].y
if_nz r1.w
  mov r9.xyz, l(0,0,0,0)
else 
  add r1.w, r6.w, r6.x
  mul r7.x, r1.w, l(0.500000)
  add r1.w, -r6.y, r6.w
  mul r7.y, r1.w, l(0.500000)
  mov r9.xyz, r7.xyzx
endif 
dp3 r1.w, r2.xyzx, -cb0[4].xyzx
mul_sat r2.x, r1.w, l(10.000000)
lt r1.w, r3.w, cb0[62].w
if_nz r1.w
  mov r2.y, l(0)
else 
  add r0.y, -r0.y, cb0[62].x
  mad r0.y, r0.y, cb0[62].y, l(-0.800000)
  mul_sat r0.y, r0.y, l(5.000000)
  add r0.y, -r0.y, l(1.000000)
  mul r0.y, r0.y, r2.w
  mul r1.w, cb0[63].w, l(0.300000)
  mad r0.w, -cb0[63].w, l(0.700000), r0.w
  div r0.w, r0.w, r1.w
  add_sat r0.w, -r0.w, l(1.000000)
  mul r2.y, r0.w, r0.y
endif 
mul_sat r0.y, r0.z, l(-100.000000)
mul o1.y, r0.y, cb0[63].z
mul o1.x, r0.x, cb0[62].z
mov o0.z, r7.z
mov o0.xyw, r6.xyxw
mov o2.x, r3.z
mov o2.y, r4.x
mov o2.z, r5.x
mov o2.w, r1.x
mov o3.x, r3.x
mov o3.y, r4.y
mov o3.z, r5.y
mov o3.w, r1.y
mov o4.x, r3.y
mov o4.y, r4.z
mov o4.z, r5.z
mov o4.w, r1.z
mov r9.w, r6.w
mov o6.w, r9.w
mov o8.xyzw, r9.xyzw
mov o10.xyzw, r2.xxxy
mov o1.z, r0.x
mov o5.xyz, r8.xyzx
ret 
// Approximately 200 instruction slots used
