//Map PS 1?
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.0.10011.16384
//
//   using 3Dmigoto v1.3.16 on Thu Jan 20 19:38:25 2022
//
//
// Buffer Definitions:
//
// cbuffer ConstBuf__viewData
// {
//
//   struct ViewData
//   {
//
//       float4x4 view;                 // Index:    0
//       float4x4 invView;              // Index:    4
//       float4x4 proj;                 // Index:    8
//       float4x4 invViewProjNoZReproj; // Index:   12
//       float4x4 viewProj;             // Index:   16
//       float4x4 invViewProj;          // Index:   20
//       float4x4 previousViewProj;     // Index:   24
//       float4 prevLodEyePos;          // Index:   28
//       float4 lodEyePos;              // Index:   29
//       float4 viewDirDepthBias;       // Index:   30
//       float3 eyePos;                 // Index:   31
//       float2 viewportSize;           // Index:   32
//       float2 invViewportSize;        // Index:   32.z
//       float4 mirrorPlaneWS;          // Index:   33
//       float2 mirrorViewportSize;     // Index:   34
//       float2 opaqueRefractionViewportSize;// Index:   34.z
//       float windTime;                // Index:   35
//       float deltaTime;               // Index:   35.y
//       float depthReprojectScale;     // Index:   35.z
//       float depthReprojectBias;      // Index:   35.w
//       uint shadowViewType;           // Index:   36
//       float normalDepthBias;         // Index:   36.y
//       float noNormalAA;              // Index:   36.z
//       float noNormalFromAlpha;       // Index:   36.w
//       float noOpaqueTransparency;    // Index:   37
//       float translucentAmount;       // Index:   37.y
//       uint framePhase;               // Index:   37.z
//       float cameraAmbientExposure;   // Index:   37.w
//       float fxExposure;              // Index:   38
//       float fxAmbientExposure;       // Index:   38.y
//       uint checkerboardPhase;        // Index:   38.z
//       float sparkleIntensityScale;   // Index:   38.w
//
//   } resourceTables__viewData;        // Index:    0-38             Components:   156
//
// }
//
// cbuffer ConstBuf__materialData
// {
//
//   struct MaterialData
//   {
//
//       float cst_minHeight;           // Index:    0
//       float cst_maxHeight;           // Index:    0.y
//
//       struct MaterialTextureMap
//       {
//
//           float3 matU;               // Index:    1
//           uint swizzle;              // Index:    1.w
//           float3 matV;               // Index:    2
//           uint mode;                 // Index:    2.w
//
//       } texPerm;                     // Index:    1
//       float cst_permScale0;          // Index:    3
//
//       struct MaterialTextureMap
//       {
//
//           float3 matU;               // Index:    4
//           uint swizzle;              // Index:    4.w
//           float3 matV;               // Index:    5
//           uint mode;                 // Index:    5.w
//
//       } texAlpha;                    // Index:    4
//
//       struct MaterialTextureMap
//       {
//
//           float3 matU;               // Index:    6
//           uint swizzle;              // Index:    6.w
//           float3 matV;               // Index:    7
//           uint mode;                 // Index:    7.w
//
//       } texHeight0;                  // Index:    6
//
//       struct MaterialTextureMap
//       {
//
//           float3 matU;               // Index:    8
//           uint swizzle;              // Index:    8.w
//           float3 matV;               // Index:    9
//           uint mode;                 // Index:    9.w
//
//       } texFlowmap0;                 // Index:    8
//       float cst_flowPhase;           // Index:   10
//       float cst_flowScale;           // Index:   10.y
//       float cst_heightScale;         // Index:   10.z
//       int cst_LayerBlendFunc0;       // Index:   10.w
//
//       struct MaterialTextureMap
//       {
//
//           float3 matU;               // Index:   11
//           uint swizzle;              // Index:   11.w
//           float3 matV;               // Index:   12
//           uint mode;                 // Index:   12.w
//
//       } texHeight1;                  // Index:   11
//
//       struct MaterialTextureMap
//       {
//
//           float3 matU;               // Index:   13
//           uint swizzle;              // Index:   13.w
//           float3 matV;               // Index:   14
//           uint mode;                 // Index:   14.w
//
//       } texFlowmap1;                 // Index:   13
//       float cst_flowPhase1;          // Index:   15
//       float cst_flowScale1;          // Index:   15.y
//       float cst_heightScale1;        // Index:   15.z
//       int cst_LayerBlendFunc1;       // Index:   15.w
//
//       struct MaterialTextureMap
//       {
//
//           float3 matU;               // Index:   16
//           uint swizzle;              // Index:   16.w
//           float3 matV;               // Index:   17
//           uint mode;                 // Index:   17.w
//
//       } texHeight2;                  // Index:   16
//
//       struct MaterialTextureMap
//       {
//
//           float3 matU;               // Index:   18
//           uint swizzle;              // Index:   18.w
//           float3 matV;               // Index:   19
//           uint mode;                 // Index:   19.w
//
//       } texFlowmap2;                 // Index:   18
//       float cst_flowPhase2;          // Index:   20
//       float cst_flowScale2;          // Index:   20.y
//       float cst_heightScale2;        // Index:   20.z
//       int cst_LayerBlendFunc2;       // Index:   20.w
//
//   } resourceTables__materialData;    // Index:    0-20             Components:    84
                                        // Textures:  t11-t18
//
// }
//
// Resource bind info for resourceTables__modelData.customRTs
// {
//
//   struct CustomRTTransform
//   {
//
//       float4x4 ws2ts;                // Index:    0
//
//   } $Element;                        // Index:    0 1 2 3          Components:    16
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// resourceTables__viewData__smpLowAniso    sampler      NA          NA    2        1
// resourceTables__modelData.customRTs    texture  struct         r/o    7        1
// resourceTables__materialData.texPerm.tex    texture  float4          2d   11        1
// resourceTables__materialData.texAlpha.tex    texture  float4          2d   12        1
// resourceTables__materialData.texHeight0.tex    texture  float4          2d   13        1
// resourceTables__materialData.texFlowmap0.tex    texture  float4          2d   14        1
// resourceTables__materialData.texHeight1.tex    texture  float4          2d   15        1
// resourceTables__materialData.texFlowmap1.tex    texture  float4          2d   16        1
// resourceTables__materialData.texHeight2.tex    texture  float4          2d   17        1
// resourceTables__materialData.texFlowmap2.tex    texture  float4          2d   18        1
// ConstBuf__viewData                cbuffer      NA          NA    1        1
// ConstBuf__materialData            cbuffer      NA          NA    2        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float   xyz
// VERT_ID                  0   x           1     NONE    uint
// TEXCOORD                 0   xy          2     NONE   float   xy
// NORMAL                   0   xyz         3     NONE   float
// TANGENT                  0   xyz         4     NONE   float
// BINORMAL                 0   xyz         5     NONE   float
// COLOR                    0   xyzw        6     NONE   float
// TEXCOORD                 8   xyz         7     NONE   float
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target                0   xyzw        0   TARGET   float   xyzw
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb1[36], immediateIndexed
dcl_constantbuffer cb2[21], immediateIndexed
dcl_sampler s2, mode_default
dcl_resource_structured t7, 64
dcl_resource_texture2d (float,float,float,float) t11
dcl_resource_texture2d (float,float,float,float) t12
dcl_resource_texture2d (float,float,float,float) t13
dcl_resource_texture2d (float,float,float,float) t14
dcl_resource_texture2d (float,float,float,float) t15
dcl_resource_texture2d (float,float,float,float) t16
dcl_resource_texture2d (float,float,float,float) t17
dcl_resource_texture2d (float,float,float,float) t18
dcl_input_ps_siv linear noperspective v0.xyz, position
dcl_input_ps linear v2.xy
dcl_output o0.xyzw
dcl_temps 50
dcl_resource_texture2d (float,float,float,float) t125
ld_indexable(texture2d)(float,float,float,float) r40.xyzw, l(0, 0, 0, 0), t125.xyzw
mul r0.xy, v0.xyxx, cb1[32].zwzz
mad r0.xy, r0.xyxx, l(2.000000, -2.000000, 0.000000, 0.000000), l(-1.000000, 1.000000, 0.000000, 0.000000)
mov r0.z, v0.z
mov r0.w, l(1.000000)

add r40.w, r0.z, -r40.y
mad r0.x, -r40.x, r40.w, r0.x

dp4 r1.x, r0.xyzw, cb1[20].xyzw
dp4 r1.y, r0.xyzw, cb1[21].xyzw
dp4 r1.z, r0.xyzw, cb1[22].xyzw
dp4 r0.x, r0.xyzw, cb1[23].xyzw
div r0.xyz, r1.xyzx, r0.xxxx
ine r1.x, cb2[5].w, l(0x0000ffff)
if_nz r1.x
  uge r1.x, cb2[5].w, l(103)
  uge r1.y, l(110), cb2[5].w
  and r1.x, r1.y, r1.x
  iadd r1.y, cb2[5].w, l(-103)
  ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r2.xyzw, r1.y, l(0), t7.xyzw
  ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r3.xyzw, r1.y, l(16), t7.xyzw
  ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r4.xyzw, r1.y, l(48), t7.xyzw
  mov r0.w, l(1.000000)
  dp4 r2.x, r0.xyzw, r2.xyzw
  dp4 r2.y, r0.xyzw, r3.xyzw
  dp4 r1.y, r0.xyzw, r4.xyzw
  div r1.yz, r2.xxyx, r1.yyyy
  movc r2.xy, r1.xxxx, r1.yzyy, v2.xyxx
  mov r2.z, l(1.000000)
  dp3 r3.x, r2.xyzx, cb2[4].xyzx
  dp3 r3.y, r2.xyzx, cb2[5].xyzx
  movc r1.xy, r1.xxxx, r1.yzyy, r3.xyxx
  sample_indexable(texture2d)(float,float,float,float) r1.y, r1.xyxx, t12.yxzw, s2
else
  mov r1.y, l(1.000000)
endif
ine r2.x, cb2[2].w, l(0x0000ffff)
if_nz r2.x
  uge r2.x, cb2[2].w, l(103)
  uge r2.y, l(110), cb2[2].w
  and r2.x, r2.y, r2.x
  iadd r2.y, cb2[2].w, l(-103)
  ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r3.xyzw, r2.y, l(0), t7.xyzw
  ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r4.xyzw, r2.y, l(16), t7.xyzw
  ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r5.xyzw, r2.y, l(48), t7.xyzw
  mov r0.w, l(1.000000)
  dp4 r3.x, r0.xyzw, r3.xyzw
  dp4 r3.y, r0.xyzw, r4.xyzw
  dp4 r2.y, r0.xyzw, r5.xyzw
  div r2.yz, r3.xxyx, r2.yyyy
  movc r3.xy, r2.xxxx, r2.yzyy, v2.xyxx
  mov r3.z, l(1.000000)
  dp3 r4.x, r3.xyzx, cb2[1].xyzx
  dp3 r4.y, r3.xyzx, cb2[2].xyzx
  movc r2.xy, r2.xxxx, r2.yzyy, r4.xyxx
  sample_indexable(texture2d)(float,float,float,float) r2.x, r2.xyxx, t11.xyzw, s2
  lt r2.y, r2.x, r0.y
  add r2.x, r0.y, -r2.x
  mul r2.x, r2.x, cb2[3].x
  and r2.x, r2.x, r2.y
else
  mov r2.x, l(0)
endif
ine r2.y, cb2[7].w, l(0x0000ffff)
if_nz r2.y
  ine r2.y, cb2[9].w, l(0x0000ffff)
  if_nz r2.y
    uge r2.y, cb2[9].w, l(103)
    uge r2.z, l(110), cb2[9].w
    and r2.y, r2.z, r2.y
    iadd r2.z, cb2[9].w, l(-103)
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r3.xyzw, r2.z, l(0), t7.xyzw
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r4.xyzw, r2.z, l(16), t7.xyzw
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r5.xyzw, r2.z, l(48), t7.xyzw
    mov r0.w, l(1.000000)
    dp4 r3.x, r0.xyzw, r3.xyzw
    dp4 r3.y, r0.xyzw, r4.xyzw
    dp4 r2.z, r0.xyzw, r5.xyzw
    div r2.zw, r3.xxxy, r2.zzzz
    movc r3.xy, r2.yyyy, r2.zwzz, v2.xyxx
    mov r3.z, l(1.000000)
    dp3 r4.x, r3.xyzx, cb2[8].xyzx
    dp3 r4.y, r3.xyzx, cb2[9].xyzx
    movc r2.yz, r2.yyyy, r2.zzwz, r4.xxyx
    sample_indexable(texture2d)(float,float,float,float) r2.yz, r2.yzyy, t14.zxyw, s2
    mad r2.yz, r2.yyzy, l(0.000000, 2.000000, 2.000000, 0.000000), l(0.000000, -0.996078432, -0.996078432, 0.000000)
    div r2.w, cb1[35].x, cb2[10].x
    frc r2.w, r2.w
    uge r3.x, cb2[7].w, l(103)
    uge r3.y, l(110), cb2[7].w
    and r3.x, r3.y, r3.x
    iadd r3.y, cb2[7].w, l(-103)
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r4.xyzw, r3.y, l(0), t7.xyzw
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r5.xyzw, r3.y, l(16), t7.xyzw
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r6.xyzw, r3.y, l(48), t7.xyzw
    dp4 r4.x, r0.xyzw, r4.xyzw
    dp4 r4.y, r0.xyzw, r5.xyzw
    dp4 r3.y, r0.xyzw, r6.xyzw
    div r3.yz, r4.xxyx, r3.yyyy
    movc r4.xy, r3.xxxx, r3.yzyy, v2.xyxx
    mov r4.z, l(1.000000)
    dp3 r5.x, r4.xyzx, cb2[6].xyzx
    dp3 r5.y, r4.xyzx, cb2[7].xyzx
    movc r3.xy, r3.xxxx, r3.yzyy, r5.xyxx
    add r3.z, r2.w, l(-0.500000)
    mul r2.yz, r2.yyzy, cb2[10].yyyy
    mad r3.zw, r2.yyyz, r3.zzzz, r3.xxxy
    sample_indexable(texture2d)(float,float,float,float) r3.z, r3.zwzz, t13.yzxw, s2
    mad r3.w, cb2[10].x, l(0.500000), cb1[35].x
    div r3.w, r3.w, cb2[10].x
    frc r3.w, r3.w
    add r3.w, r3.w, l(-0.500000)
    mad r2.yz, r2.yyzy, r3.wwww, r3.xxyx
    sample_indexable(texture2d)(float,float,float,float) r2.y, r2.yzyy, t13.yxzw, s2
    mul r2.z, r2.w, l(6.28318548)
    sincos null, r2.z, r2.z
    mad r2.z, r2.z, l(0.500000), l(0.500000)
    add r2.y, -r3.z, r2.y
    mad r2.y, r2.z, r2.y, r3.z
  else
    uge r2.z, cb2[7].w, l(103)
    uge r2.w, l(110), cb2[7].w
    and r2.z, r2.w, r2.z
    iadd r2.w, cb2[7].w, l(-103)
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r3.xyzw, r2.w, l(0), t7.xyzw
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r4.xyzw, r2.w, l(16), t7.xyzw
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r5.xyzw, r2.w, l(48), t7.xyzw
    mov r0.w, l(1.000000)
    dp4 r3.x, r0.xyzw, r3.xyzw
    dp4 r3.y, r0.xyzw, r4.xyzw
    dp4 r2.w, r0.xyzw, r5.xyzw
    div r3.xy, r3.xyxx, r2.wwww
    movc r4.xy, r2.zzzz, r3.xyxx, v2.xyxx
    mov r4.z, l(1.000000)
    dp3 r5.x, r4.xyzx, cb2[6].xyzx
    dp3 r5.y, r4.xyzx, cb2[7].xyzx
    movc r2.zw, r2.zzzz, r3.xxxy, r5.xxxy
    sample_indexable(texture2d)(float,float,float,float) r2.y, r2.zwzz, t13.yxzw, s2
  endif
  mul r2.z, r2.y, cb2[10].z
  if_nz cb2[10].w
    ine r2.w, cb2[10].w, l(1)
    if_nz r2.w
      mad_sat r2.w, r2.y, cb2[10].z, -r2.x
      mul r3.x, r2.z, r2.x
      max r3.y, r2.z, r2.x
      ieq r4.xyzw, cb2[10].wwww, l(2, 3, 4, 5)
      min r3.z, r2.z, r2.x
      movc r2.z, r4.w, r3.z, r2.z
      movc r2.z, r4.z, r3.y, r2.z
      movc r2.z, r4.y, r3.x, r2.z
      movc r2.x, r4.x, r2.w, r2.z
    else
      mad_sat r2.x, -r2.y, cb2[10].z, r2.x
    endif
  else
    mad_sat r2.x, r2.y, cb2[10].z, r2.x
  endif
endif
ine r2.y, cb2[12].w, l(0x0000ffff)
if_nz r2.y
  ine r2.y, cb2[14].w, l(0x0000ffff)
  if_nz r2.y
    uge r2.y, cb2[14].w, l(103)
    uge r2.z, l(110), cb2[14].w
    and r2.y, r2.z, r2.y
    iadd r2.z, cb2[14].w, l(-103)
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r3.xyzw, r2.z, l(0), t7.xyzw
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r4.xyzw, r2.z, l(16), t7.xyzw
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r5.xyzw, r2.z, l(48), t7.xyzw
    mov r0.w, l(1.000000)
    dp4 r3.x, r0.xyzw, r3.xyzw
    dp4 r3.y, r0.xyzw, r4.xyzw
    dp4 r2.z, r0.xyzw, r5.xyzw
    div r2.zw, r3.xxxy, r2.zzzz
    movc r3.xy, r2.yyyy, r2.zwzz, v2.xyxx
    mov r3.z, l(1.000000)
    dp3 r4.x, r3.xyzx, cb2[13].xyzx
    dp3 r4.y, r3.xyzx, cb2[14].xyzx
    movc r2.yz, r2.yyyy, r2.zzwz, r4.xxyx
    sample_indexable(texture2d)(float,float,float,float) r2.yz, r2.yzyy, t16.zxyw, s2
    mad r2.yz, r2.yyzy, l(0.000000, 2.000000, 2.000000, 0.000000), l(0.000000, -0.996078432, -0.996078432, 0.000000)
    div r2.w, cb1[35].x, cb2[15].x
    frc r2.w, r2.w
    uge r3.x, cb2[12].w, l(103)
    uge r3.y, l(110), cb2[12].w
    and r3.x, r3.y, r3.x
    iadd r3.y, cb2[12].w, l(-103)
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r4.xyzw, r3.y, l(0), t7.xyzw
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r5.xyzw, r3.y, l(16), t7.xyzw
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r6.xyzw, r3.y, l(48), t7.xyzw
    dp4 r4.x, r0.xyzw, r4.xyzw
    dp4 r4.y, r0.xyzw, r5.xyzw
    dp4 r3.y, r0.xyzw, r6.xyzw
    div r3.yz, r4.xxyx, r3.yyyy
    movc r4.xy, r3.xxxx, r3.yzyy, v2.xyxx
    mov r4.z, l(1.000000)
    dp3 r5.x, r4.xyzx, cb2[11].xyzx
    dp3 r5.y, r4.xyzx, cb2[12].xyzx
    movc r3.xy, r3.xxxx, r3.yzyy, r5.xyxx
    add r3.z, r2.w, l(-0.500000)
    mul r2.yz, r2.yyzy, cb2[15].yyyy
    mad r3.zw, r2.yyyz, r3.zzzz, r3.xxxy
    sample_indexable(texture2d)(float,float,float,float) r3.z, r3.zwzz, t15.yzxw, s2
    mad r3.w, cb2[15].x, l(0.500000), cb1[35].x
    div r3.w, r3.w, cb2[15].x
    frc r3.w, r3.w
    add r3.w, r3.w, l(-0.500000)
    mad r2.yz, r2.yyzy, r3.wwww, r3.xxyx
    sample_indexable(texture2d)(float,float,float,float) r2.y, r2.yzyy, t15.yxzw, s2
    mul r2.z, r2.w, l(6.28318548)
    sincos null, r2.z, r2.z
    mad r2.z, r2.z, l(0.500000), l(0.500000)
    add r2.y, -r3.z, r2.y
    mad r2.y, r2.z, r2.y, r3.z
  else
    uge r2.z, cb2[12].w, l(103)
    uge r2.w, l(110), cb2[12].w
    and r2.z, r2.w, r2.z
    iadd r2.w, cb2[12].w, l(-103)
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r3.xyzw, r2.w, l(0), t7.xyzw
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r4.xyzw, r2.w, l(16), t7.xyzw
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r5.xyzw, r2.w, l(48), t7.xyzw
    mov r0.w, l(1.000000)
    dp4 r3.x, r0.xyzw, r3.xyzw
    dp4 r3.y, r0.xyzw, r4.xyzw
    dp4 r2.w, r0.xyzw, r5.xyzw
    div r3.xy, r3.xyxx, r2.wwww
    movc r4.xy, r2.zzzz, r3.xyxx, v2.xyxx
    mov r4.z, l(1.000000)
    dp3 r5.x, r4.xyzx, cb2[11].xyzx
    dp3 r5.y, r4.xyzx, cb2[12].xyzx
    movc r2.zw, r2.zzzz, r3.xxxy, r5.xxxy
    sample_indexable(texture2d)(float,float,float,float) r2.y, r2.zwzz, t15.yxzw, s2
  endif
  mul r2.z, r2.y, cb2[15].z
  if_nz cb2[15].w
    ine r2.w, cb2[15].w, l(1)
    if_nz r2.w
      mad_sat r2.w, r2.y, cb2[15].z, -r2.x
      mul r3.x, r2.z, r2.x
      max r3.y, r2.z, r2.x
      ieq r4.xyzw, cb2[15].wwww, l(2, 3, 4, 5)
      min r3.z, r2.z, r2.x
      movc r2.z, r4.w, r3.z, r2.z
      movc r2.z, r4.z, r3.y, r2.z
      movc r2.z, r4.y, r3.x, r2.z
      movc r2.x, r4.x, r2.w, r2.z
    else
      mad_sat r2.x, -r2.y, cb2[15].z, r2.x
    endif
  else
    mad_sat r2.x, r2.y, cb2[15].z, r2.x
  endif
endif
ine r2.y, cb2[17].w, l(0x0000ffff)
if_nz r2.y
  ine r2.y, cb2[19].w, l(0x0000ffff)
  if_nz r2.y
    uge r2.y, cb2[19].w, l(103)
    uge r2.z, l(110), cb2[19].w
    and r2.y, r2.z, r2.y
    iadd r2.z, cb2[19].w, l(-103)
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r3.xyzw, r2.z, l(0), t7.xyzw
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r4.xyzw, r2.z, l(16), t7.xyzw
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r5.xyzw, r2.z, l(48), t7.xyzw
    mov r0.w, l(1.000000)
    dp4 r3.x, r0.xyzw, r3.xyzw
    dp4 r3.y, r0.xyzw, r4.xyzw
    dp4 r2.z, r0.xyzw, r5.xyzw
    div r2.zw, r3.xxxy, r2.zzzz
    movc r3.xy, r2.yyyy, r2.zwzz, v2.xyxx
    mov r3.z, l(1.000000)
    dp3 r4.x, r3.xyzx, cb2[18].xyzx
    dp3 r4.y, r3.xyzx, cb2[19].xyzx
    movc r2.yz, r2.yyyy, r2.zzwz, r4.xxyx
    sample_indexable(texture2d)(float,float,float,float) r2.yz, r2.yzyy, t18.zxyw, s2
    mad r2.yz, r2.yyzy, l(0.000000, 2.000000, 2.000000, 0.000000), l(0.000000, -0.996078432, -0.996078432, 0.000000)
    div r2.w, cb1[35].x, cb2[20].x
    frc r2.w, r2.w
    uge r3.x, cb2[17].w, l(103)
    uge r3.y, l(110), cb2[17].w
    and r3.x, r3.y, r3.x
    iadd r3.y, cb2[17].w, l(-103)
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r4.xyzw, r3.y, l(0), t7.xyzw
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r5.xyzw, r3.y, l(16), t7.xyzw
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r6.xyzw, r3.y, l(48), t7.xyzw
    dp4 r4.x, r0.xyzw, r4.xyzw
    dp4 r4.y, r0.xyzw, r5.xyzw
    dp4 r3.y, r0.xyzw, r6.xyzw
    div r3.yz, r4.xxyx, r3.yyyy
    movc r4.xy, r3.xxxx, r3.yzyy, v2.xyxx
    mov r4.z, l(1.000000)
    dp3 r5.x, r4.xyzx, cb2[16].xyzx
    dp3 r5.y, r4.xyzx, cb2[17].xyzx
    movc r3.xy, r3.xxxx, r3.yzyy, r5.xyxx
    add r3.z, r2.w, l(-0.500000)
    mul r2.yz, r2.yyzy, cb2[20].yyyy
    mad r3.zw, r2.yyyz, r3.zzzz, r3.xxxy
    sample_indexable(texture2d)(float,float,float,float) r3.z, r3.zwzz, t17.yzxw, s2
    mad r3.w, cb2[20].x, l(0.500000), cb1[35].x
    div r3.w, r3.w, cb2[20].x
    frc r3.w, r3.w
    add r3.w, r3.w, l(-0.500000)
    mad r2.yz, r2.yyzy, r3.wwww, r3.xxyx
    sample_indexable(texture2d)(float,float,float,float) r2.y, r2.yzyy, t17.yxzw, s2
    mul r2.z, r2.w, l(6.28318548)
    sincos null, r2.z, r2.z
    mad r2.z, r2.z, l(0.500000), l(0.500000)
    add r2.y, -r3.z, r2.y
    mad r2.y, r2.z, r2.y, r3.z
  else
    uge r2.z, cb2[17].w, l(103)
    uge r2.w, l(110), cb2[17].w
    and r2.z, r2.w, r2.z
    iadd r2.w, cb2[17].w, l(-103)
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r3.xyzw, r2.w, l(0), t7.xyzw
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r4.xyzw, r2.w, l(16), t7.xyzw
    ld_structured_indexable(structured_buffer, stride=64)(mixed,mixed,mixed,mixed) r5.xyzw, r2.w, l(48), t7.xyzw
    mov r0.w, l(1.000000)
    dp4 r3.x, r0.xyzw, r3.xyzw
    dp4 r3.y, r0.xyzw, r4.xyzw
    dp4 r0.x, r0.xyzw, r5.xyzw
    div r0.xy, r3.xyxx, r0.xxxx
    movc r3.xy, r2.zzzz, r0.xyxx, v2.xyxx
    mov r3.z, l(1.000000)
    dp3 r4.x, r3.xyzx, cb2[16].xyzx
    dp3 r4.y, r3.xyzx, cb2[17].xyzx
    movc r0.xy, r2.zzzz, r0.xyxx, r4.xyxx
    sample_indexable(texture2d)(float,float,float,float) r2.y, r0.xyxx, t17.yxzw, s2
  endif
  mul r0.x, r2.y, cb2[20].z
  if_nz cb2[20].w
    ine r0.y, cb2[20].w, l(1)
    if_nz r0.y
      mad_sat r0.y, r2.y, cb2[20].z, -r2.x
      mul r0.z, r0.x, r2.x
      max r0.w, r0.x, r2.x
      ieq r3.xyzw, cb2[20].wwww, l(2, 3, 4, 5)
      min r2.z, r0.x, r2.x
      movc r0.x, r3.w, r2.z, r0.x
      movc r0.x, r3.z, r0.w, r0.x
      movc r0.x, r3.y, r0.z, r0.x
      movc r2.x, r3.x, r0.y, r0.x
    else
      mad_sat r2.x, -r2.y, cb2[20].z, r2.x
    endif
  else
    mad_sat r2.x, r2.y, cb2[20].z, r2.x
  endif
endif
add r0.x, -cb2[0].x, cb2[0].y
mad r1.x, r2.x, r0.x, cb2[0].x
mov r1.zw, l(0,0,1.000000,0)
mov o0.xyzw, r1.xzwy
ret
// Approximately 352 instruction slots used

///////////////////////////////// HLSL Code /////////////////////////////////
// // ---- Created with 3Dmigoto v1.3.16 on Thu Jan 20 19:38:25 2022
//
// struct CustomRTTransform
// {
//     float4x4 ws2ts;                // Offset:    0
// };
//
// cbuffer ConstBuf__viewData : register(b1)
// {
//
//   struct
//   {
//     float4x4 view;
//     float4x4 invView;
//     float4x4 proj;
//     float4x4 invViewProjNoZReproj;
//     float4x4 viewProj;
//     float4x4 invViewProj;
//     float4x4 previousViewProj;
//     float4 prevLodEyePos;
//     float4 lodEyePos;
//     float4 viewDirDepthBias;
//     float3 eyePos;
//     float2 viewportSize;
//     float2 invViewportSize;
//     float4 mirrorPlaneWS;
//     float2 mirrorViewportSize;
//     float2 opaqueRefractionViewportSize;
//     float windTime;
//     float deltaTime;
//     float depthReprojectScale;
//     float depthReprojectBias;
//     uint shadowViewType;
//     float normalDepthBias;
//     float noNormalAA;
//     float noNormalFromAlpha;
//     float noOpaqueTransparency;
//     float translucentAmount;
//     uint framePhase;
//     float cameraAmbientExposure;
//     float fxExposure;
//     float fxAmbientExposure;
//     uint checkerboardPhase;
//     float sparkleIntensityScale;
//   } resourceTables__viewData : packoffset(c0);
//
// }
//
// cbuffer ConstBuf__materialData : register(b2)
// {
//
//   struct
//   {
//     float cst_minHeight;
//     float cst_maxHeight;
//
//     struct
//     {
//       float3 matU;
//       uint swizzle;
//       float3 matV;
//       uint mode;
//     } texPerm;
//
//     float cst_permScale0;
//
//     struct
//     {
//       float3 matU;
//       uint swizzle;
//       float3 matV;
//       uint mode;
//     } texAlpha;
//
//
//     struct
//     {
//       float3 matU;
//       uint swizzle;
//       float3 matV;
//       uint mode;
//     } texHeight0;
//
//
//     struct
//     {
//       float3 matU;
//       uint swizzle;
//       float3 matV;
//       uint mode;
//     } texFlowmap0;
//
//     float cst_flowPhase;
//     float cst_flowScale;
//     float cst_heightScale;
//     int cst_LayerBlendFunc0;
//
//     struct
//     {
//       float3 matU;
//       uint swizzle;
//       float3 matV;
//       uint mode;
//     } texHeight1;
//
//
//     struct
//     {
//       float3 matU;
//       uint swizzle;
//       float3 matV;
//       uint mode;
//     } texFlowmap1;
//
//     float cst_flowPhase1;
//     float cst_flowScale1;
//     float cst_heightScale1;
//     int cst_LayerBlendFunc1;
//
//     struct
//     {
//       float3 matU;
//       uint swizzle;
//       float3 matV;
//       uint mode;
//     } texHeight2;
//
//
//     struct
//     {
//       float3 matU;
//       uint swizzle;
//       float3 matV;
//       uint mode;
//     } texFlowmap2;
//
//     float cst_flowPhase2;
//     float cst_flowScale2;
//     float cst_heightScale2;
//     int cst_LayerBlendFunc2;
//   } resourceTables__materialData : packoffset(c0);
//
//
// SamplerState resourceTables__viewData__smpLowAniso_s : register(s2);
// StructuredBuffer<CustomRTTransform> resourceTables__modelData.customRTs : register(t7);
// Texture2D<float4> resourceTables__materialData.texPerm.tex : register(t11);
// Texture2D<float4> resourceTables__materialData.texAlpha.tex : register(t12);
// Texture2D<float4> resourceTables__materialData.texHeight0.tex : register(t13);
// Texture2D<float4> resourceTables__materialData.texFlowmap0.tex : register(t14);
// Texture2D<float4> resourceTables__materialData.texHeight1.tex : register(t15);
// Texture2D<float4> resourceTables__materialData.texFlowmap1.tex : register(t16);
// Texture2D<float4> resourceTables__materialData.texHeight2.tex : register(t17);
// Texture2D<float4> resourceTables__materialData.texFlowmap2.tex : register(t18);
//
//
// // 3Dmigoto declarations
// #define cmp -
// Texture1D<float4> IniParams : register(t120);
// Texture2D<float4> StereoParams : register(t125);
//
//
// void main(
//   float4 v0 : SV_POSITION0,
//   uint v1 : VERT_ID0,
//   float2 v2 : TEXCOORD0,
//   float3 v3 : NORMAL0,
//   float3 v4 : TANGENT0,
//   float3 v5 : BINORMAL0,
//   float4 v6 : COLOR0,
//   float3 v7 : TEXCOORD8,
//   out float4 o0 : SV_Target0)
// {
//   Textures: =  * t11-t18;
//   float4 r0,r1,r2,r3,r4,r5,r6;
//   uint4 bitmask, uiDest;
//   float4 fDest;
//
//   r0.xy = v0.xy * resourceTables__viewData.invViewportSize.xy + ;
//   r0.xy = r0.xy;
//   r0.z = v0.z;
//   r0.w = dot(1.000000, );
//   r1.x = dot(r0.xyzw, resourceTables__viewData.invViewProj._m00_m10_m20_m30);
//   r1.y = dot(r0.xyzw, resourceTables__viewData.invViewProj._m01_m11_m21_m31);
//   r1.z = dot(r0.xyzw, resourceTables__viewData.invViewProj._m02_m12_m22_m32);
//   r0.x = r0.x / resourceTables__viewData.invViewProj._m03;
//   r0.xyz = cmp((int3)r1.xyz != (int3)r0.xxx);
//   if (r1.x != 0) {
//     r1.x = cmp( >= );
//     r1.x = cmp((uint4)resourceTables__materialData.texAlpha.mode >= 103);
//     r1.y = 110 & (int4)resourceTables__materialData.texAlpha.mode;
//     r1.x = (int)r1.y + (int)r1.x;
//     r1.x = [resourceTables__materialData.texAlpha.mode].val[-103/4];
//     r1.y = [resourceTables__materialData.texAlpha.mode].val[-103/4+1];
//     r1.z = [resourceTables__materialData.texAlpha.mode].val[-103/4+2];
//     r1.w = [resourceTables__materialData.texAlpha.mode].val[-103/4+3];
//     r2.x = resourceTables__modelData.customRTs[r1.y].ws2ts._m00;
//     r2.y = resourceTables__modelData.customRTs[r1.y].ws2ts._m10;
//     r2.z = resourceTables__modelData.customRTs[r1.y].ws2ts._m20;
//     r2.w = resourceTables__modelData.customRTs[r1.y].ws2ts._m30;
//     r3.x = resourceTables__modelData.customRTs[r1.y].ws2ts._m01;
//     r3.y = resourceTables__modelData.customRTs[r1.y].ws2ts._m11;
//     r3.z = resourceTables__modelData.customRTs[r1.y].ws2ts._m21;
//     r3.w = resourceTables__modelData.customRTs[r1.y].ws2ts._m31;
//     stride=64)(mixed = r4.x;
//     r0.w = dot(1.000000, );
//     r2.x = dot(r0.xyzw, r2.xyzw);
//     r2.y = dot(r0.xyzw, r3.xyzw);
//     r1.y = r0.y / r4.y;
//     r1.yz = r2.xy ? r1.yy : ;
//     r2.xy = r1.xx;
//     r2.z = dot(1.000000, );
//     r3.x = dot(r2.xyz, resourceTables__materialData.texAlpha.matU.xyz);
//     r3.y = r2.y ? resourceTables__materialData.texAlpha.matV.y : ;
//     r1.xy = .Sample(, r1.xxxx).yz;
//   } else {
//      = ;
//   }
//    = cmp( != );
//   if (r2.x != 0) {
//     r2.x = cmp( >= );
//     r2.x = cmp((uint4)resourceTables__materialData.texPerm.mode >= 103);
//     r2.y = 110 & (int4)resourceTables__materialData.texPerm.mode;
//     r2.x = (int)r2.y + (int)r2.x;
//     r2.x = [resourceTables__materialData.texPerm.mode].val[-103/4];
//     r2.y = [resourceTables__materialData.texPerm.mode].val[-103/4+1];
//     r2.z = [resourceTables__materialData.texPerm.mode].val[-103/4+2];
//     r2.w = [resourceTables__materialData.texPerm.mode].val[-103/4+3];
//     r3.x = resourceTables__modelData.customRTs[r2.y].ws2ts._m00;
//     r3.y = resourceTables__modelData.customRTs[r2.y].ws2ts._m10;
//     r3.z = resourceTables__modelData.customRTs[r2.y].ws2ts._m20;
//     r3.w = resourceTables__modelData.customRTs[r2.y].ws2ts._m30;
//     r4.x = resourceTables__modelData.customRTs[r2.y].ws2ts._m01;
//     r4.y = resourceTables__modelData.customRTs[r2.y].ws2ts._m11;
//     r4.z = resourceTables__modelData.customRTs[r2.y].ws2ts._m21;
//     r4.w = resourceTables__modelData.customRTs[r2.y].ws2ts._m31;
//     stride=64)(mixed = r5.x;
//     r0.w = dot(1.000000, );
//     r3.x = dot(r0.xyzw, r3.xyzw);
//     r3.y = dot(r0.xyzw, r4.xyzw);
//     r2.y = r0.y / r5.y;
//     r2.yz = r3.xy ? r2.yy : ;
//     r3.xy = r2.xx;
//     r3.z = dot(1.000000, );
//     r4.x = dot(r3.xyz, resourceTables__materialData.texPerm.matU.xyz);
//     r4.y = r3.y ? resourceTables__materialData.texPerm.matV.y : ;
//     r2.xy = .Sample(, r2.xxxx).yz;
//     r2.x = cmp(r2.x < t11.x);
// }
//////////////////////////////// HLSL Errors ////////////////////////////////
// error X3506: unrecognized compiler target '                                        // Textures:  t11-t18'
/////////////////////////////////////////////////////////////////////////////
