// ---- Created with 3Dmigoto v1.2.35 on Tue Apr 26 22:31:05 2016

cbuffer Constants : register(b0)
{
  float4 boundColor : packoffset(c0);
  float4 compx : packoffset(c1);
  float4 compy : packoffset(c2);
  float4 mapScale : packoffset(c3);
  float4 scale : packoffset(c4);
}

SamplerState sampler_maptex_s : register(s0);
SamplerState sampler_tex_s : register(s1);
Texture2D<float4> maptex : register(t0);
Texture2D<float4> tex : register(t1);


// 3Dmigoto declarations
#define cmp -
Texture1D<float4> IniParams : register(t120);
Texture2D<float4> StereoParams : register(t125);


void main( 
  float2 v0 : TEXCOORD0,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1,r2;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xy = v0.xy * mapScale.xy + -mapScale.zw;
  r0.zw = cmp(float2(0,0) >= r0.xy);
  r0.zw = r0.zw ? float2(1.06535322e+009,1.06535322e+009) : 0;
  r1.xy = cmp(r0.xy >= float2(1,1));
  r0.xy = scale.zw * r0.xy;
  r2.xyzw = maptex.Sample(sampler_maptex_s, r0.xy).xyzw;
  r0.xy = r1.xy ? 1.000000 : 0;
  r0.x = r0.z + r0.x;
  r0.x = r0.x + r0.w;
  r0.x = r0.x + r0.y;
  r0.x = min(1, r0.x);
  r0.x = 1 + -r0.x;
  r0.y = 1 + -r0.x;
  r0.y = 0.5 * r0.y;
  r0.xyzw = r2.xyzw * r0.xxxx + r0.yyyy;
  r1.xyzw = compx.xyzw * r0.xyzw;
  r0.xyzw = compy.xyzw * r0.xyzw;
  r0.y = dot(float4(1,1,1,1), r0.xyzw);
  r0.x = dot(float4(1,1,1,1), r1.xyzw);
  r0.xy = float2(-0.5,-0.5) + r0.xy;
  r0.xy = r0.xy * scale.xy + v0.xy;
  r0.zw = cmp(float2(0,0) >= r0.xy);
  r0.zw = r0.zw ? float2(1.06535322e+009,1.06535322e+009) : 0;
  r1.xy = cmp(r0.xy >= float2(1,1));
  r2.xyzw = tex.Sample(sampler_tex_s, r0.xy).xyzw;
  r0.xy = r1.xy ? 1.000000 : 0;
  r0.x = r0.z + r0.x;
  r0.x = r0.x + r0.w;
  r0.x = r0.x + r0.y;
  r0.x = min(1, r0.x);
  r0.x = 1 + -r0.x;
  r0.y = 1 + -r0.x;
  r1.xyzw = boundColor.xyzw * r0.yyyy;
  o0.xyzw = r2.xyzw * r0.xxxx + r1.xyzw;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Original ASM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20546
//
//
// Buffer Definitions: 
//
// cbuffer Constants
// {
//
//   float4 boundColor;                 // Offset:    0 Size:    16
//   float4 compx;                      // Offset:   16 Size:    16
//   float4 compy;                      // Offset:   32 Size:    16
//   float4 mapScale;                   // Offset:   48 Size:    16
//   float4 scale;                      // Offset:   64 Size:    16
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// sampler_maptex                    sampler      NA          NA    0        1
// sampler_tex                       sampler      NA          NA    1        1
// maptex                            texture  float4          2d    0        1
// tex                               texture  float4          2d    1        1
// Constants                         cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                 0   xy          0     NONE   float   xy  
//
//
// 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 cb0[5], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_input_ps linear v0.xy
dcl_output o0.xyzw
dcl_temps 3
mad r0.xy, v0.xyxx, cb0[3].xyxx, -cb0[3].zwzz
ge r0.zw, l(0.000000, 0.000000, 0.000000, 0.000000), r0.xxxy
and r0.zw, r0.zzzw, l(0, 0, 0x3f800000, 0x3f800000)
ge r1.xy, r0.xyxx, l(1.000000, 1.000000, 0.000000, 0.000000)
mul r0.xy, r0.xyxx, cb0[4].zwzz
sample_indexable(texture2d)(float,float,float,float) r2.xyzw, r0.xyxx, t0.xyzw, s0
and r0.xy, r1.xyxx, l(0x3f800000, 0x3f800000, 0, 0)
add r0.x, r0.x, r0.z
add r0.x, r0.w, r0.x
add r0.x, r0.y, r0.x
min r0.x, r0.x, l(1.000000)
add r0.x, -r0.x, l(1.000000)
add r0.y, -r0.x, l(1.000000)
mul r0.y, r0.y, l(0.500000)
mad r0.xyzw, r2.xyzw, r0.xxxx, r0.yyyy
mul r1.xyzw, r0.xyzw, cb0[1].xyzw
mul r0.xyzw, r0.xyzw, cb0[2].xyzw
dp4 r0.y, l(1.000000, 1.000000, 1.000000, 1.000000), r0.xyzw
dp4 r0.x, l(1.000000, 1.000000, 1.000000, 1.000000), r1.xyzw
add r0.xy, r0.xyxx, l(-0.500000, -0.500000, 0.000000, 0.000000)
mad r0.xy, r0.xyxx, cb0[4].xyxx, v0.xyxx
ge r0.zw, l(0.000000, 0.000000, 0.000000, 0.000000), r0.xxxy
and r0.zw, r0.zzzw, l(0, 0, 0x3f800000, 0x3f800000)
ge r1.xy, r0.xyxx, l(1.000000, 1.000000, 0.000000, 0.000000)
sample_indexable(texture2d)(float,float,float,float) r2.xyzw, r0.xyxx, t1.xyzw, s1
and r0.xy, r1.xyxx, l(0x3f800000, 0x3f800000, 0, 0)
add r0.x, r0.x, r0.z
add r0.x, r0.w, r0.x
add r0.x, r0.y, r0.x
min r0.x, r0.x, l(1.000000)
add r0.x, -r0.x, l(1.000000)
add r0.y, -r0.x, l(1.000000)
mul r1.xyzw, r0.yyyy, cb0[0].xyzw
mad o0.xyzw, r2.xyzw, r0.xxxx, r1.xyzw
ret 
// Approximately 35 instruction slots used

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
