//
// 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
// {
//
//   struct
//   {
//       
//       float4 vPlane;                 // Offset:    0
//       float4 vSettings;              // Offset:   16
//
//   } g_ClipPlane;                     // Offset:    0 Size:    32
//   float4 specColor;                  // Offset:   32 Size:    16 [unused]
//   float4 ControlData;                // Offset:   48 Size:    16 [unused]
//   float4 difColor;                   // Offset:   64 Size:    16 [unused]
//   float4 ambient;                    // Offset:   80 Size:    16 [unused]
//   float4 lightCount;                 // Offset:   96 Size:    16
//   float4 g_avLightPos[4];            // Offset:  112 Size:    64
//   float4 g_avLightColor[4];          // Offset:  176 Size:    64
//   float4 g_avConeDir[4];             // Offset:  240 Size:    64
//   float4 g_vAmbientSettings;         // Offset:  304 Size:    16 [unused]
//   float4 g_vScreenDepthRect;         // Offset:  320 Size:    16
//   float4x4 g_mViewProj;              // Offset:  336 Size:    64
//   float4x4 g_mIView;                 // Offset:  400 Size:    64
//   float4x4 g_mWM;                    // Offset:  464 Size:    64
//   float4x4 g_mView;                  // Offset:  528 Size:    64
//   float4 g_vCamPos;                  // Offset:  592 Size:    16
//   float4 g_vDistortionDesc;          // Offset:  608 Size:    16
//   float4 g_avPData[150];             // Offset:  624 Size:  2400
//   
//   struct
//   {
//       
//       float4 vDesc;                  // Offset: 3024
//       float4 vFogLayerPlane;         // Offset: 3040
//       float4 vFogLayerColor;         // Offset: 3056
//       float4 vFogLayerSettings;      // Offset: 3072
//       float4 vFogColor;              // Offset: 3088
//       float4 vFogDistance;           // Offset: 3104
//
//   } g_FogDesc;                       // Offset: 3024 Size:    96
//   float4 ExPos[4];                   // Offset: 3120 Size:    64
//   float4 ExRad[4];                   // Offset: 3184 Size:    64 [unused]
//   float4 g_vExVolumeSettings;        // Offset: 3248 Size:    16 [unused]
//   float4 g_vExVolumeRect;            // Offset: 3264 Size:    16
//   float4 GrayK;                      // Offset: 3280 Size:    16 [unused]
//      = 0x3eaa7efa 0x3eaa7efa 0x3eaa7efa 0x00000000 
//
// }
//
//
// 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
//
//
// 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
// TEXCOORD                 4   xy          5     NONE   float   xy  
// TEXCOORD                 5     zw        5     NONE   float     zw
// COLOR                    0   xyzw        6     NONE   float   xyzw
// COLOR                    1   xyzw        7     NONE   float   xyzw
// COLOR                    2   xyzw        8     NONE   float   xyzw
// COLOR                    3   xyzw        9     NONE   float   xyzw
// SV_ClipDistance          0   x          10  CLIPDST   float   x   
//
vs_4_0
dcl_constantbuffer cb0[205], dynamicIndexed
dcl_input v0.xyzw
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.xy
dcl_output o5.zw
dcl_output o6.xyzw
dcl_output o7.xyzw
dcl_output o8.xyzw
dcl_output o9.xyzw
dcl_output_siv o10.x, clip_distance
// 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
add r0.xy, v0.wwww, l(1.000000, 2.000000, 0.000000, 0.000000)
ftou r0.z, v0.w
ftou r0.xy, r0.xyxx
mov r1.xyz, cb0[r0.z + 39].xyzx
mov r1.w, l(1.000000)
dp4 r2.x, r1.xyzw, cb0[29].xyzw
dp4 r2.y, r1.xyzw, cb0[30].xyzw
dp4 r2.z, r1.xyzw, cb0[31].xyzw
mul r1.xyz, v0.xyzx, cb0[r0.z + 39].wwww
mul r0.w, r1.y, cb0[r0.x + 39].x
mad r3.x, r1.x, cb0[r0.x + 39].y, -r0.w
dp2 r3.y, r1.xyxx, cb0[r0.x + 39].xyxx
mov r3.z, r1.z
// replacing matrix usage :dp3 r1.x, r3.xyzx, cb0[25].xyzx
dp3 r12.x, r3.xyzx, cb0[25].xyzx
mul r1.x, r12.x, r14.x
// replacing matrix usage :dp3 r1.y, r3.xyzx, cb0[26].xyzx
dp3 r12.y, r3.xyzx, cb0[26].xyzx
mul r1.y, r12.y, r14.y
dp3 r1.z, r3.xyzx, cb0[27].xyzx
add r1.xyz, r2.xyzx, r1.xyzx
mov r1.w, l(1.000000)
// replacing matrix usage :dp4 r3.x, r1.xyzw, cb0[21].xyzw
dp4 r12.x, r1.xyzw, cb0[21].xyzw
mul r3.x, r12.x, r14.x
// replacing matrix usage :dp4 r3.y, r1.xyzw, cb0[22].xyzw
dp4 r12.y, r1.xyzw, cb0[22].xyzw
mul r3.y, r12.y, r14.y
dp4 o0.z, r1.xyzw, cb0[23].xyzw
dp4 r3.w, r1.xyzw, cb0[24].xyzw
lt r0.w, l(0.500000), cb0[1].x
if_nz r0.w
  dp4 o10.x, cb0[0].xyzw, r1.xyzw
else 
  mov o10.x, l(1.000000)
endif 
div r4.xy, r3.xyxx, r3.wwww
mul r4.xy, r4.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000)
mad r4.zw, r4.xxxy, l(0.000000, 0.000000, 1.000000, -1.000000), l(0.000000, 0.000000, 0.500000, 0.500000)
mad o5.xy, r4.zwzz, cb0[204].zwzz, cb0[204].xyxx
add r4.zw, r4.xxxw, l(0.000000, 0.000000, 0.500000, 0.000000)
mad o4.xy, r4.zwzz, cb0[20].zwzz, cb0[20].xyxx
mul r0.z, l(0.500000), cb0[r0.z + 39].w
div r0.z, l(1.000000, 1.000000, 1.000000, 1.000000), r0.z
mov_sat r5.xy, v0.xyxx
lt r0.w, l(1.001000), cb0[38].w
if_nz r0.w
  div r0.w, l(1.000000, 1.000000, 1.000000, 1.000000), cb0[38].w
  mad r2.w, cb0[38].w, cb0[38].w, l(-1.000000)
  max r3.z, l(0.000000), cb0[r0.x + 39].w
  min r2.w, r2.w, r3.z
  ftoi r3.z, r2.w
  round_z r2.w, r2.w
  mad r2.w, r2.w, r0.w, l(0.000100)
  round_ni r6.y, r2.w
  ftoi r2.w, r6.y
  imad r2.w, -r2.w, r3.z, r3.z
  itof r6.x, r2.w
  add r5.z, -r5.y, l(1.000000)
  add r6.xy, r5.xzxx, r6.xyxx
  mul r4.xy, r0.wwww, r6.xyxx
else 
  add r5.w, -r5.y, l(1.000000)
  mov r4.xy, r5.xwxx
endif 
add r6.xyz, r1.xyzx, -cb0[37].xyzx
dp3 r0.w, r6.xyzx, r6.xyzx
sqrt r0.w, r0.w
mul r0.w, r0.w, cb0[194].x
min r0.w, r0.w, l(1.000000)
dp4 r1.w, r1.xyzw, cb0[190].xyzw
add r1.xyz, -r1.xyzx, cb0[37].xyzx
ge r2.w, cb0[189].z, l(0.000000)
if_nz r2.w
  lt r2.w, r1.w, -cb0[192].y
  if_nz r2.w
    mov r1.w, -cb0[192].y
  endif 
  ge r2.w, r1.w, l(0.000000)
  if_nz r2.w
    mov o2.w, l(0)
    mov r2.w, l(0)
    mov r3.z, l(-1)
  else 
    dp3 r5.z, r1.xyzx, r1.xyzx
    rsq r5.z, r5.z
    mul r6.xyz, r1.xyzx, r5.zzzz
    dp3 r5.z, cb0[190].xyzx, r6.xyzx
    lt r5.w, l(0.000100), |r5.z|
    if_nz r5.w
      div r5.z, l(1.000000, 1.000000, 1.000000, 1.000000), r5.z
      add r5.w, -r1.w, cb0[189].z
      mul r6.x, r5.z, cb0[189].z
      mad r2.w, r5.w, r5.z, -r6.x
    else 
      mov r2.w, l(0)
    endif 
    lt r3.z, r2.w, l(0.000100)
    if_nz r3.z
      mov o2.w, l(0)
    endif 
  endif 
  if_z r3.z
    mul r2.w, r2.w, cb0[192].x
    mul r2.w, r2.w, l(1.44254541)
    exp r2.w, r2.w
    div r2.w, l(1.000000, 1.000000, 1.000000, 1.000000), r2.w
    add o2.w, -r2.w, l(1.000000)
  endif 
else 
  ge r1.w, r1.w, l(0.000000)
  if_nz r1.w
    dp3 r1.w, r1.xyzx, r1.xyzx
    rsq r1.w, r1.w
    mul r6.xyz, r1.wwww, r1.xyzx
    dp3 r1.w, cb0[190].xyzx, r6.xyzx
    lt r2.w, l(0.000100), |r1.w|
    if_nz r2.w
      div r1.w, cb0[189].z, r1.w
    endif 
    lt r2.w, r1.w, l(0.000100)
    if_nz r2.w
      mov o2.w, l(0)
    endif 
  else 
    dp3 r1.x, r1.xyzx, r1.xyzx
    sqrt r1.w, r1.x
    mov r2.w, l(0)
  endif 
  if_z r2.w
    mul r1.x, r1.w, cb0[192].x
    mul r1.x, r1.x, l(1.44254541)
    exp r1.x, r1.x
    div r1.x, l(1.000000, 1.000000, 1.000000, 1.000000), r1.x
    add r1.x, r1.x, l(-1.000000)
    mov o2.w, -r1.x
  endif 
endif 
dp3 r1.x, cb0[193].xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
lt r1.x, l(0.001000), r1.x
lt r1.y, r0.w, cb0[189].x
if_nz r1.y
  mul r1.y, r0.w, cb0[189].y
  div r1.y, r1.y, cb0[189].x
else 
  add r1.zw, -cb0[189].yyyx, l(0.000000, 0.000000, 1.000000, 1.000000)
  add r2.w, r0.w, -cb0[189].x
  mul r1.z, r1.z, r2.w
  div r1.z, r1.z, r1.w
  add r1.y, r1.z, cb0[189].y
endif 
mul r1.yzw, r1.yyyy, cb0[193].xxyz
log r1.yzw, r1.yyzw
mul r1.yzw, r1.yyzw, cb0[193].wwww
exp r1.yzw, r1.yyzw
mul r1.yzw, r1.yyzw, l(0.000000, -1.442695, -1.442695, -1.442695)
exp r1.yzw, r1.yyzw
add r1.yzw, -r1.yyzw, l(0.000000, 1.000000, 1.000000, 1.000000)
lt r2.w, l(0.800000), r0.w
and r1.x, r1.x, r2.w
if_nz r1.x
  add r0.w, r0.w, l(-0.800000)
  mul r0.w, r0.w, l(5.000000)
  add r6.xyz, -r1.yzwy, l(1.000000, 1.000000, 1.000000, 0.000000)
  mad r1.yzw, r0.wwww, r6.xxyz, r1.yyzw
endif 
add r0.w, cb0[194].w, l(-0.250000)
add r0.w, r0.w, r0.w
dp3 r1.x, r1.yzwy, l(0.333300, 0.333300, 0.333300, 0.000000)
add r6.xyz, -r1.yzwy, r1.xxxx
mad o2.xyz, r0.wwww, r6.xyzx, r1.yzwy
min r0.w, cb0[6].x, l(4.000000)
ftoi r0.w, r0.w
mov r1.xyzw, l(0,0,0,0)
mov r6.xyzw, l(0,0,0,0)
mov r7.xyzw, l(0,0,0,0)
mov r8.xyzw, l(0,0,0,0)
mov r2.w, l(0)
loop 
  ige r3.z, r2.w, r0.w
  breakc_nz r3.z
  lt r3.z, l(1.000000), cb0[r2.w + 7].w
  if_nz r3.z
    add r9.xyz, -r2.xyzx, cb0[r2.w + 7].xyzx
    dp3 r3.z, r9.xyzx, r9.xyzx
    sqrt r5.z, r3.z
    div r9.xyz, r9.xyzx, r5.zzzz
    mad r3.z, r3.z, cb0[r2.w + 11].w, l(1.000000)
    div r3.z, l(1.000000, 1.000000, 1.000000, 1.000000), r3.z
    add r3.z, r3.z, l(-0.100000)
    mul_sat r10.w, r3.z, l(1.11111116)
    lt r3.z, l(2.000000), cb0[r2.w + 7].w
    if_nz r3.z
      add r3.z, l(-3.000000), cb0[r2.w + 7].w
      dp3 r5.z, r9.xyzx, cb0[r2.w + 15].xyzx
      add r5.w, -|r5.z|, l(1.000000)
      sqrt r5.w, r5.w
      mad r9.w, |r5.z|, l(-0.0187292993), l(0.074261)
      mad r9.w, r9.w, |r5.z|, l(-0.212114394)
      mad r9.w, r9.w, |r5.z|, l(1.57072878)
      mul r11.x, r5.w, r9.w
      mad r11.x, r11.x, l(-2.000000), l(3.14159274)
      lt r5.z, r5.z, -r5.z
      and r5.z, r5.z, r11.x
      mad r5.z, r9.w, r5.w, r5.z
      lt r5.w, r5.z, r3.z
      if_nz r5.w
        frc r5.w, cb0[r2.w + 15].w
        div r3.z, r5.z, r3.z
        add r3.z, -r5.w, r3.z
        add r5.z, -r5.w, l(1.000000)
        div_sat r3.z, r3.z, r5.z
        add r3.z, -r3.z, l(1.000000)
      else 
        mov r3.z, l(0)
      endif 
      mul r10.w, r3.z, r10.w
    endif 
  else 
    mov r9.xyz, -cb0[r2.w + 7].xyzx
    mov r10.w, l(1.000000)
  endif 
// replacing matrix usage :  dp3 r3.z, r9.xyzx, cb0[33].xyzx
dp3 r12.z, r9.xyzx, cb0[33].xyzx
// replacing matrix usage :  dp3 r5.z, r9.xyzx, cb0[34].xyzx
dp3 r12.z, r9.xyzx, cb0[34].xyzx
  dp3 r9.z, r9.xyzx, cb0[35].xyzx
  mul r5.zw, r5.zzzz, cb0[r0.x + 39].xxxy
  mad r9.x, r3.z, cb0[r0.x + 39].y, r5.z
  mad r9.y, -r3.z, cb0[r0.x + 39].x, r5.w
  mad r10.xyz, r9.xyzx, l(0.500000, 0.500000, -0.500000, 0.000000), l(0.500000, 0.500000, 0.500000, 0.000000)
  if_z r2.w
    mov r1.xyzw, r10.xyzw
  else 
    ieq r3.z, r2.w, l(1)
    if_nz r3.z
      mov r6.xyzw, r10.xyzw
    else 
      ieq r3.z, r2.w, l(2)
      if_nz r3.z
        mov r7.xyzw, r10.xyzw
      else 
        mov r8.xyzw, r10.xyzw
      endif 
    endif 
  endif 
  iadd r2.w, r2.w, l(1)
endloop 
mov o6.xyzw, r1.xyzw
mov o7.xyzw, r6.xyzw
mov o8.xyzw, r7.xyzw
mov o9.xyzw, r8.xyzw
add r1.xyz, -r2.xyzx, cb0[37].xyzx
dp3 r0.w, r1.xyzx, r1.xyzx
sqrt r0.w, r0.w
add r1.x, r2.y, -cb0[195].y
mad_sat r1.x, -r1.x, cb0[195].x, l(1.000000)
mul r0.w, r0.w, l(0.005000)
min r0.w, r0.w, l(1.000000)
add r1.x, r1.x, l(-1.000000)
mad r0.w, r0.w, r1.x, l(1.000000)
mul r0.x, r0.w, cb0[r0.x + 39].z
mul_sat r0.w, r0.z, r3.w
mul o3.w, r0.w, r0.x
mov o0.xyw, r3.xyxw
mov o1.xyzw, r4.xyzw
mov o3.xyz, cb0[r0.y + 39].xyzx
mov o4.z, r3.w
mov o4.w, r0.z
mad o5.zw, r5.xxxy, l(0.000000, 0.000000, 1.000000, -1.000000), l(0.000000, 0.000000, 0.000000, 1.000000)
ret 
// Approximately 261 instruction slots used
