//
// 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 [unused]
//   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 [unused]
//   float4 g_avLightPos[4];            // Offset:  112 Size:    64 [unused]
//   float4 g_avLightColor[4];          // Offset:  176 Size:    64 [unused]
//   float4 g_avConeDir[4];             // Offset:  240 Size:    64 [unused]
//   float4 g_vAmbientSettings;         // Offset:  304 Size:    16 [unused]
//   float4 g_vScreenDepthRect;         // Offset:  320 Size:    16 [unused]
//   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 [unused]
//   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 [unused]
//   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
// COLOR                    0   xyzw        3     NONE   float   xyzw
// TEXCOORD                 2   xy          4     NONE   float   xy  
//
vs_4_0
dcl_constantbuffer cb0[196], 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.xy
// 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, v0.wwww, l(1.000000, 2.000000, 0.000000, 0.000000)
ftou r0.xy, r0.xyxx
ftou r0.z, v0.w
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.z, r1.y, cb0[r0.x + 39].x
mad r3.x, r1.x, cb0[r0.x + 39].y, -r0.z
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 r6.x, r3.xyzx, cb0[25].xyzx
mul r1.x, r6.x, r8.x
// replacing matrix usage :dp3 r1.y, r3.xyzx, cb0[26].xyzx
dp3 r6.y, r3.xyzx, cb0[26].xyzx
mul r1.y, r6.y, r8.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 r6.x, r1.xyzw, cb0[21].xyzw
mul r3.x, r6.x, r8.x
// replacing matrix usage :dp4 r3.y, r1.xyzw, cb0[22].xyzw
dp4 r6.y, r1.xyzw, cb0[22].xyzw
mul r3.y, r6.y, r8.y
dp4 o0.z, r1.xyzw, cb0[23].xyzw
dp4 r3.w, r1.xyzw, cb0[24].xyzw
mov_sat r4.xy, v0.xyxx
div r0.zw, r3.xxxy, r3.wwww
mad o1.z, r0.z, l(0.500000), l(0.500000)
mad o1.w, -r0.w, l(0.500000), l(0.500000)
lt r0.z, l(1.001000), cb0[38].w
if_nz r0.z
  div r0.z, l(1.000000, 1.000000, 1.000000, 1.000000), cb0[38].w
  mad r0.w, cb0[38].w, cb0[38].w, l(-1.000000)
  max r2.w, l(0.000000), cb0[r0.x + 39].w
  min r0.w, r0.w, r2.w
  ftoi r2.w, r0.w
  round_z r0.w, r0.w
  mad r0.w, r0.w, r0.z, l(0.000100)
  round_ni r5.y, r0.w
  ftoi r0.w, r5.y
  imad r0.w, -r0.w, r2.w, r2.w
  itof r5.x, r0.w
  add r4.z, -r4.y, l(1.000000)
  add r5.xy, r4.xzxx, r5.xyxx
  mul o1.xy, r0.zzzz, r5.xyxx
else 
  add r4.w, -r4.y, l(1.000000)
  mov o1.xy, r4.xwxx
endif 
add r4.xyz, r1.xyzx, -cb0[37].xyzx
dp3 r0.z, r4.xyzx, r4.xyzx
sqrt r0.z, r0.z
mul r0.z, r0.z, cb0[194].x
min r0.z, r0.z, l(1.000000)
dp4 r0.w, r1.xyzw, cb0[190].xyzw
add r1.xyz, -r1.xyzx, cb0[37].xyzx
ge r1.w, cb0[189].z, l(0.000000)
if_nz r1.w
  lt r1.w, r0.w, -cb0[192].y
  if_nz r1.w
    mov r0.w, -cb0[192].y
  endif 
  ge r1.w, r0.w, l(0.000000)
  if_nz r1.w
    mov o2.w, l(0)
    mov r1.w, l(0)
    mov r2.w, l(-1)
  else 
    dp3 r3.z, r1.xyzx, r1.xyzx
    rsq r3.z, r3.z
    mul r4.xyz, r1.xyzx, r3.zzzz
    dp3 r3.z, cb0[190].xyzx, r4.xyzx
    lt r4.x, l(0.000100), |r3.z|
    if_nz r4.x
      div r3.z, l(1.000000, 1.000000, 1.000000, 1.000000), r3.z
      add r4.x, -r0.w, cb0[189].z
      mul r4.y, r3.z, cb0[189].z
      mad r1.w, r4.x, r3.z, -r4.y
    else 
      mov r1.w, l(0)
    endif 
    lt r2.w, r1.w, l(0.000100)
    if_nz r2.w
      mov o2.w, l(0)
    endif 
  endif 
  if_z r2.w
    mul r1.w, r1.w, cb0[192].x
    mul r1.w, r1.w, l(1.44254541)
    exp r1.w, r1.w
    div r1.w, l(1.000000, 1.000000, 1.000000, 1.000000), r1.w
    add o2.w, -r1.w, l(1.000000)
  endif 
else 
  ge r0.w, r0.w, l(0.000000)
  if_nz r0.w
    dp3 r0.w, r1.xyzx, r1.xyzx
    rsq r0.w, r0.w
    mul r4.xyz, r0.wwww, r1.xyzx
    dp3 r0.w, cb0[190].xyzx, r4.xyzx
    lt r1.w, l(0.000100), |r0.w|
    if_nz r1.w
      div r0.w, cb0[189].z, r0.w
    endif 
    lt r1.w, r0.w, l(0.000100)
    if_nz r1.w
      mov o2.w, l(0)
    endif 
  else 
    dp3 r1.x, r1.xyzx, r1.xyzx
    sqrt r0.w, r1.x
    mov r1.w, l(0)
  endif 
  if_z r1.w
    mul r0.w, r0.w, cb0[192].x
    mul r0.w, r0.w, l(1.44254541)
    exp r0.w, r0.w
    div r0.w, l(1.000000, 1.000000, 1.000000, 1.000000), r0.w
    add r0.w, r0.w, l(-1.000000)
    mov o2.w, -r0.w
  endif 
endif 
dp3 r0.w, cb0[193].xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
lt r0.w, l(0.001000), r0.w
lt r1.x, r0.z, cb0[189].x
if_nz r1.x
  mul r1.x, r0.z, cb0[189].y
  div r1.x, r1.x, cb0[189].x
else 
  add r1.yz, -cb0[189].yyxy, l(0.000000, 1.000000, 1.000000, 0.000000)
  add r1.w, r0.z, -cb0[189].x
  mul r1.y, r1.w, r1.y
  div r1.y, r1.y, r1.z
  add r1.x, r1.y, cb0[189].y
endif 
mul r1.xyz, r1.xxxx, cb0[193].xyzx
log r1.xyz, r1.xyzx
mul r1.xyz, r1.xyzx, cb0[193].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 r1.w, l(0.800000), r0.z
and r0.w, r0.w, r1.w
if_nz r0.w
  add r0.z, r0.z, l(-0.800000)
  mul r0.z, r0.z, l(5.000000)
  add r4.xyz, -r1.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
  mad r1.xyz, r0.zzzz, r4.xyzx, r1.xyzx
endif 
add r0.z, cb0[194].w, l(-0.250000)
add r0.z, r0.z, r0.z
dp3 r0.w, r1.xyzx, l(0.333300, 0.333300, 0.333300, 0.000000)
add r4.xyz, -r1.xyzx, r0.wwww
mad o2.xyz, r0.zzzz, r4.xyzx, r1.xyzx
add r1.xyz, -r2.xyzx, cb0[37].xyzx
dp3 r0.z, r1.xyzx, r1.xyzx
sqrt r0.z, r0.z
add r0.w, r2.y, -cb0[195].y
mad_sat r0.w, -r0.w, cb0[195].x, l(1.000000)
mul r1.x, r0.z, l(0.005000)
min r1.x, r1.x, l(1.000000)
add r0.w, r0.w, l(-1.000000)
mad r0.w, r1.x, r0.w, l(1.000000)
mul r0.w, r0.w, cb0[r0.x + 39].z
div r0.z, r0.z, cb0[38].x
add r0.z, -r0.z, l(1.000000)
mul_sat r0.z, r0.z, l(3.000000)
mul o3.w, r0.z, r0.w
mov o0.xyw, r3.xyxw
mov o3.xyz, cb0[r0.y + 39].xyzx
mul o4.xy, l(1.000000, -1.000000, 0.000000, 0.000000), cb0[r0.x + 39].yxyy
ret 
// Approximately 170 instruction slots used
