//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//   using 3Dmigoto v1.2.67 on Mon Jan 01 13:11:45 2018
//
//
// Buffer Definitions: 
//
// cbuffer $Globals
// {
//
//   float4 g_vParams;                  // Offset:    0 Size:    16
//   float4 g_aUVShiftData[64];         // Offset:   16 Size:  1024
//   float4 bones[192];                 // Offset: 1040 Size:  3072
//   float4x4 g_mCloudsShadowsSpace;    // Offset: 4112 Size:    64
//   float4 g_vCloudsShadowDesc;        // Offset: 4176 Size:    16
//   float4 specColor;                  // Offset: 4192 Size:    16
//   float4 ControlData;                // Offset: 4208 Size:    16
//   float4 difColor;                   // Offset: 4224 Size:    16 [unused]
//   float4 ambient;                    // Offset: 4240 Size:    16 [unused]
//   float4 lightCount;                 // Offset: 4256 Size:    16
//   float4 g_avLightPos[4];            // Offset: 4272 Size:    64
//   float4 g_avLightColor[4];          // Offset: 4336 Size:    64
//   float4 g_avConeDir[4];             // Offset: 4400 Size:    64
//   float4 g_vAmbientSettings;         // Offset: 4464 Size:    16 [unused]
//   float4x4 g_mViewProj;              // Offset: 4480 Size:    64
//   float4 g_vCamPos;                  // Offset: 4544 Size:    16
//   float4 g_vModColor;                // Offset: 4560 Size:    16 [unused]
//   float4 g_vModMask;                 // Offset: 4576 Size:    16 [unused]
//   
//   struct
//   {
//       
//       float4x4 mLightSpaceInverse;   // Offset: 4592
//       float4x4 mLightSpace;          // Offset: 4656
//       float4 vShadowBias;            // Offset: 4720
//       float4 vBiasDir;               // Offset: 4736
//       float4 vSmoothOffs;            // Offset: 4752
//       float4 vShadowsDesc;           // Offset: 4768
//       float4 avCPlane[8];            // Offset: 4784
//       float4 avCascadeZ[2];          // Offset: 4912
//       float4 avUVTransform[8];       // Offset: 4944
//       float4 avZTransformZF[8];      // Offset: 5072
//
//   } g_ShadSettings;                  // Offset: 4592 Size:   608
//
// }
//
//
// 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 
// NORMAL                   0   xyz         1     NONE   float   xyz 
// TEXCOORD                 0   xy          2     NONE   float   xy  
// BLENDINDICES             0   x           3     NONE   float   x   
// COLOR                    0   xyz         4     NONE   float   xyz 
// POSITION                 1   xyz         5     NONE   float   xyz 
// NORMAL                   1   xyz         6     NONE   float   xyz 
// COLOR                    1   xyz         7     NONE   float   xyz 
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xyzw
// TEXCOORD                 0   xy          1     NONE   float   xy  
// TEXCOORD                 1   xyzw        2     NONE   float   xyzw
// TEXCOORD                 2   xyz         3     NONE   float   xyz 
// TEXCOORD                 3   xyz         4     NONE   float   xyz 
// TEXCOORD                 4   xyzw        5     NONE   float   xyzw
// TEXCOORD                 5   xyzw        6     NONE   float   xyzw
// TEXCOORD                 6   xyz         7     NONE   float   xyz 
// COLOR                    0   xyzw        8     NONE   float   xyzw
// COLOR                    1   xyzw        9     NONE   float   xyzw
// COLOR                    2   xyzw       10     NONE   float   xyzw
//
vs_4_1
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[294], dynamicIndexed
dcl_input v0.xyz
dcl_input v1.xyz
dcl_input v2.xy
dcl_input v3.x
dcl_input v4.xyz
dcl_input v5.xyz
dcl_input v6.xyz
dcl_input v7.xyz
dcl_output_siv o0.xyzw, position
dcl_output o1.xy
dcl_output o2.xyzw
dcl_output o3.xyz
dcl_output o4.xyz
dcl_output o5.xyzw
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 12
dcl_temps 15
// added 3dmigoto declaration
dcl_resource_texture1d (float,float,float,float) t120
ld_indexable(texture1d)(float,float,float,float) r13.xyzw, l(0, 0, 0, 0), t120.xyzw
mov r14.x, r13.w
mov r14.y, r13.w
mov r14.zw, l(1.0, 1.0)
// end of 3dmigoto declaration
mul r0.x, v3.x, l(3.000000)
ftoi r0.x, r0.x
add r0.yzw, -v0.xxyz, v5.xxyz
mad r1.xyz, cb0[0].xxxx, r0.yzwy, v0.xyzx
mov r1.w, l(1.000000)
dp4 r2.x, r1.xyzw, cb0[r0.x + 65].xyzw
iadd r0.yz, r0.xxxx, l(0, 1, 2, 0)
dp4 r2.y, r1.xyzw, cb0[r0.y + 65].xyzw
dp4 r2.z, r1.xyzw, cb0[r0.z + 65].xyzw
mov r2.w, l(1.000000)
// replacing matrix usage :dp4 o0.x, r2.xyzw, cb0[280].xyzw
dp4 r12.x, r2.xyzw, cb0[280].xyzw
mul o0.x, r12.x, r14.x
// replacing matrix usage :dp4 o0.y, r2.xyzw, cb0[281].xyzw
dp4 r12.y, r2.xyzw, cb0[281].xyzw
mul o0.y, r12.y, r14.y
dp4 o0.z, r2.xyzw, cb0[282].xyzw
dp4 r0.w, r2.xyzw, cb0[283].xyzw
dp4 o4.x, r2.xyzw, cb0[257].xyzw
dp4 r1.x, r2.xyzw, cb0[258].xyzw
dp4 o4.y, r2.xyzw, cb0[259].xyzw
add r1.x, r1.x, -cb0[261].x
mad_sat o4.z, -r1.x, cb0[261].y, l(1.000000)
dp4 o5.x, r2.xyzw, cb0[291].xyzw
dp4 o5.y, r2.xyzw, cb0[292].xyzw
dp4 o5.z, r2.xyzw, cb0[293].xyzw
add r1.xyz, -v1.xyzx, v6.xyzx
mad r1.xyz, cb0[0].xxxx, r1.xyzx, v1.xyzx
dp3 r1.w, r1.xyzx, r1.xyzx
rsq r1.w, r1.w
mul r1.xyz, r1.wwww, r1.xyzx
dp3 r3.x, r1.xyzx, cb0[r0.x + 65].xyzx
dp3 r3.y, r1.xyzx, cb0[r0.y + 65].xyzx
dp3 r3.z, r1.xyzx, cb0[r0.z + 65].xyzx
dp3 r1.x, r3.xyzx, r3.xyzx
rsq r1.x, r1.x
mul r1.xyz, r1.xxxx, r3.xyzx
add r3.xyz, -r2.xyzx, cb0[284].xyzx
dp3 r1.w, r3.xyzx, r3.xyzx
rsq r2.w, r1.w
mul r4.xyz, r2.wwww, r3.xyzx
dp3 r3.w, r4.xyzx, r1.xyzx
mul r4.x, r3.w, cb0[263].z
max r4.x, r4.x, l(0.000000)
add r4.x, -r4.x, l(1.000000)
mul r4.x, r4.x, r4.x
mul o8.w, r4.x, cb0[263].y
add r4.xyz, r2.xyzx, -cb0[284].xyzx
dp3 r4.w, r4.xyzx, r1.xyzx
add r4.w, r4.w, r4.w
mad o3.xyz, r1.xyzx, -r4.wwww, r4.xyzx
ftoi r4.x, cb0[266].x
mov r5.xyzw, l(0,0,0,0)
mov r4.yzw, l(0,0,0,0)
mov r7.xyz, l(0,0,0,0)
mov r6.xyzw, l(0,0,0,0)
loop 
  ige r7.w, r6.w, r4.x
  breakc_nz r7.w
  ge r8.xy, cb0[r6.w + 271].xyxx, l(100.000000, 100.000000, 0.000000, 0.000000)
  if_nz r8.x
    add r9.x, l(-100.000000), cb0[r6.w + 271].x
  else 
    mov r9.x, cb0[r6.w + 271].x
  endif 
  if_nz r8.y
    add r9.y, l(-100.000000), cb0[r6.w + 271].y
  else 
    mov r9.y, cb0[r6.w + 271].y
  endif 
  lt r7.w, l(1.000000), cb0[r6.w + 267].w
  if_nz r7.w
    add r8.yzw, -r2.xxyz, cb0[r6.w + 267].xxyz
    dp3 r7.w, r8.yzwy, r8.yzwy
    sqrt r9.w, r7.w
    div r10.xyz, r8.yzwy, r9.wwww
    mad r7.w, r7.w, cb0[r6.w + 271].w, l(1.000000)
    div r7.w, l(1.000000, 1.000000, 1.000000, 1.000000), r7.w
    add r7.w, r7.w, l(-0.100000)
    mul_sat r7.w, r7.w, l(1.11111116)
    lt r8.y, l(2.000000), cb0[r6.w + 267].w
    if_nz r8.y
      add r8.y, l(-3.000000), cb0[r6.w + 267].w
      dp3 r8.z, r10.xyzx, cb0[r6.w + 275].xyzx
      add r8.w, -|r8.z|, l(1.000000)
      sqrt r8.w, r8.w
      mad r9.w, |r8.z|, l(-0.0187292993), l(0.074261)
      mad r9.w, r9.w, |r8.z|, l(-0.212114394)
      mad r9.w, r9.w, |r8.z|, l(1.57072878)
      mul r11.x, r8.w, r9.w
      mad r11.x, r11.x, l(-2.000000), l(3.14159274)
      lt r8.z, r8.z, -r8.z
      and r8.z, r8.z, r11.x
      mad r8.z, r9.w, r8.w, r8.z
      lt r8.w, r8.z, r8.y
      if_nz r8.w
        frc r8.w, cb0[r6.w + 275].w
        div r8.y, r8.z, r8.y
        add r8.y, -r8.w, r8.y
        add r8.z, -r8.w, l(1.000000)
        div_sat r8.y, r8.y, r8.z
        add r8.y, -r8.y, l(1.000000)
      else 
        mov r8.y, l(0)
      endif 
      mul r7.w, r7.w, r8.y
    endif 
  else 
    mov r10.xyz, -cb0[r6.w + 267].xyzx
    mov r7.w, l(1.000000)
  endif 
  dp3 r8.y, r10.xyzx, r1.xyzx
  max r8.y, r8.y, l(0.000000)
  mov r9.z, cb0[r6.w + 271].z
  mul r8.yzw, r8.yyyy, r9.xxyz
  mul r11.xyz, r7.wwww, r8.yzwy
  sqrt r10.w, r7.w
  if_z r6.w
    mov r5.xyzw, r10.xyzw
    mov r4.yzw, r11.xxyz
  else 
    mad r6.xyz, r8.yzwy, r7.wwww, r6.xyzx
    if_z r8.x
      mad r8.xyz, r3.xyzx, r2.wwww, r10.xyzx
      mul r8.xyz, r8.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000)
      dp3 r7.w, r8.xyzx, r8.xyzx
      rsq r7.w, r7.w
      mul r8.xyz, r7.wwww, r8.xyzx
      dp3 r7.w, r8.xyzx, r1.xyzx
      max r7.w, r7.w, l(0.000000)
      log r7.w, r7.w
      mul r7.w, r7.w, cb0[262].w
      exp r7.w, r7.w
      mul r7.w, r10.w, r7.w
      mul r8.xyz, r9.xyzx, r7.wwww
      mad r7.xyz, r8.xyzx, cb0[262].xyzx, r7.xyzx
    endif 
  endif 
  iadd r6.w, r6.w, l(1)
endloop 
mov o8.xyz, r4.yzwy
mov o9.xyz, r6.xyzx
mov o10.xyz, r7.xyzx
mad r2.xyz, v4.xyzx, l(2.000000, 2.000000, 2.000000, 0.000000), l(-1.000000, -1.000000, -1.000000, 0.000000)
mad r4.xyz, v7.xyzx, l(2.000000, 2.000000, 2.000000, 0.000000), l(-1.000000, -1.000000, -1.000000, 0.000000)
add r4.xyz, -r2.xyzx, r4.xyzx
mad r2.xyz, cb0[0].xxxx, r4.xyzx, r2.xyzx
dp3 r4.x, r2.xyzx, r2.xyzx
rsq r4.x, r4.x
mul r2.xyz, r2.xyzx, r4.xxxx
dp3 r4.x, r2.xyzx, cb0[r0.x + 65].xyzx
dp3 r4.y, r2.xyzx, cb0[r0.y + 65].xyzx
dp3 r4.z, r2.xyzx, cb0[r0.z + 65].xyzx
dp3 r0.x, r4.xyzx, r4.xyzx
rsq r0.x, r0.x
mul r0.xyz, r0.xxxx, r4.xyzx
mul r2.xyz, r0.yzxy, r1.zxyz
mad r2.xyz, r1.yzxy, r0.zxyz, -r2.xyzx
mad r4.xyz, r3.xyzx, r2.wwww, r5.xyzx
mul r4.xyz, r4.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000)
dp3 r2.w, r4.xyzx, r4.xyzx
rsq r2.w, r2.w
mul r4.xyz, r2.wwww, r4.xyzx
dp3 o2.x, r4.xyzx, r2.xyzx
dp3 o2.y, r4.xyzx, r1.xyzx
dp3 o2.z, r4.xyzx, r0.xyzx
lt r0.x, l(0.000000), r3.w
dp3 r0.y, r5.xyzx, r1.xyzx
lt r0.y, l(0.000000), r0.y
ieq r0.x, r0.x, r0.y
if_nz r0.x
  mov o10.w, l(0)
else 
  sqrt r0.x, r1.w
  add r0.x, r0.x, l(-1.000000)
  add_sat r0.x, r0.x, r0.x
  add o10.w, -r0.x, l(1.000000)
endif 
ftou r0.x, v3.x
mul r0.y, l(0.00390625000), cb0[r0.x + 1].w
round_ni r0.y, r0.y
mul r0.z, r0.y, l(0.00392156886)
mad r0.y, -r0.y, l(256.000000), cb0[r0.x + 1].w
mul o6.z, r0.y, l(0.00392156886)
mov o0.w, r0.w
mov o2.w, r5.w
mov o5.w, r0.w
mov o6.x, cb0[r0.x + 1].z
mov o6.y, r0.z
mov o6.w, l(0)
mov o9.w, l(0)
mov o7.xyz, r3.xyzx
mov o1.xy, v2.xyxx
ret 
// Approximately 190 instruction slots used
