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

cbuffer CBFxaaParam : register(b0)
{
  float4 g_vScreenSize : packoffset(c0);
  float4 g_vFilterParam : packoffset(c1);
  float4 g_vScreenSizeHalf : packoffset(c2);
}

SamplerState SS_ClampLinear_s : register(s3);
Texture2D<float4> SourceTex : register(t0);


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


void main( 
  float4 v0 : SV_Position0,
  float4 v1 : TEXCOORD0,
  float4 v2 : TEXCOORD1,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1,r2,r3,r4;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xyz = SourceTex.SampleLevel(SS_ClampLinear_s, v2.zy, 0).xyz;
  r0.x = dot(r0.xyz, float3(0.298999995,0.587000012,0.114));
  r0.x = 0.00260416674 + r0.x;
  r0.yzw = SourceTex.SampleLevel(SS_ClampLinear_s, v2.xw, 0).xyz;
  r0.y = dot(r0.yzw, float3(0.298999995,0.587000012,0.114));
  r0.z = -r0.x + r0.y;
  r1.xyz = SourceTex.SampleLevel(SS_ClampLinear_s, v2.xy, 0).xyz;
  r0.w = dot(r1.xyz, float3(0.298999995,0.587000012,0.114));
  r1.x = r0.z + -r0.w;
  r0.z = r0.z + r0.w;
  r1.yzw = SourceTex.SampleLevel(SS_ClampLinear_s, v2.zw, 0).xyz;
  r1.y = dot(r1.yzw, float3(0.298999995,0.587000012,0.114));
  r2.x = r1.x + r1.y;
  r2.y = -r1.y + r0.z;
  r0.z = dot(r2.xy, r2.xy);
  r0.z = rsqrt(r0.z);
  r1.xz = r2.xy * r0.zz;
  r0.z = min(abs(r1.x), abs(r1.z));
  r0.z = 8 * r0.z;
  r2.xy = r1.xz / r0.zz;
  r2.xy = max(float2(-2,-2), r2.xy);
  r2.xy = min(float2(2,2), r2.xy);
  r2.zw = -r2.xy * g_vScreenSizeHalf.xy + v1.xy;
  r2.xy = r2.xy * g_vScreenSizeHalf.xy + v1.xy;
  r3.xyz = SourceTex.SampleLevel(SS_ClampLinear_s, r2.xy, 0).xyz;
  r2.xyzw = SourceTex.SampleLevel(SS_ClampLinear_s, r2.zw, 0).xyzw;
  r3.w = dot(r3.xyz, float3(0.298999995,0.587000012,0.114));
  r2.xyzw = r3.xyzw + r2.xyzw;
  r3.xy = -r1.xz * g_vScreenSizeHalf.zw + v1.xy;
  r1.xz = r1.xz * g_vScreenSizeHalf.zw + v1.xy;
  r4.xyz = SourceTex.SampleLevel(SS_ClampLinear_s, r1.xz, 0).xyz;
  r3.xyz = SourceTex.SampleLevel(SS_ClampLinear_s, r3.xy, 0).xyz;
  r3.w = dot(r3.xyz, float3(0.298999995,0.587000012,0.114));
  r4.w = dot(r4.xyz, float3(0.298999995,0.587000012,0.114));
  r3.xyzw = r4.xyzw + r3.xyzw;
  r3.xyzw = float4(0.5,0.5,0.5,0.5) * r3.xyzw;
  r2.xyzw = r2.xyzw * float4(0.5,0.5,0.5,0.5) + r3.xyzw;
  r2.xyzw = float4(0.5,0.5,0.5,0.5) * r2.xyzw;
  r0.z = min(r1.y, r0.x);
  r0.x = max(r1.y, r0.x);
  r1.x = min(r0.w, r0.y);
  r0.y = max(r0.w, r0.y);
  r0.x = max(r0.y, r0.x);
  r0.y = min(r1.x, r0.z);
  r0.z = cmp(r2.w < r0.y);
  r0.w = cmp(r0.x < r2.w);
  r0.z = (int)r0.w | (int)r0.z;
  r1.xyzw = r0.zzzz ? r3.xyzw : r2.xyzw;
  r0.z = 0.125 * r0.x;
  r0.z = max(0.0500000007, r0.z);
  r2.xyz = SourceTex.SampleLevel(SS_ClampLinear_s, v1.xy, 0).xyz;
  r2.w = dot(r2.xyz, float3(0.298999995,0.587000012,0.114));
  r0.y = min(r2.w, r0.y);
  r0.x = max(r2.w, r0.x);
  r0.x = r0.x + -r0.y;
  r0.x = cmp(r0.x >= r0.z);
  o0.xyzw = r0.xxxx ? r1.xyzw : r2.xyzw;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Original ASM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20546
//
//
// Buffer Definitions: 
//
// cbuffer CBFxaaParam
// {
//
//   float4 g_vScreenSize;              // Offset:    0 Size:    16 [unused]
//   float4 g_vFilterParam;             // Offset:   16 Size:    16 [unused]
//   float4 g_vScreenSizeHalf;          // Offset:   32 Size:    16
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// SS_ClampLinear                    sampler      NA          NA    3        1
// SourceTex                         texture  float4          2d    0        1
// CBFxaaParam                       cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float       
// TEXCOORD                 0   xyzw        1     NONE   float   xy  
// TEXCOORD                 1   xyzw        2     NONE   float   xyzw
//
//
// 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[3], immediateIndexed
dcl_sampler s3, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_input_ps linear v1.xy
dcl_input_ps linear v2.xyzw
dcl_output o0.xyzw
dcl_temps 5
sample_l_indexable(texture2d)(float,float,float,float) r0.xyz, v2.zyzz, t0.xyzw, s3, l(0.000000)
dp3 r0.x, r0.xyzx, l(0.299000, 0.587000, 0.114000, 0.000000)
add r0.x, r0.x, l(0.002604)
sample_l_indexable(texture2d)(float,float,float,float) r0.yzw, v2.xwxx, t0.wxyz, s3, l(0.000000)
dp3 r0.y, r0.yzwy, l(0.299000, 0.587000, 0.114000, 0.000000)
add r0.z, r0.y, -r0.x
sample_l_indexable(texture2d)(float,float,float,float) r1.xyz, v2.xyxx, t0.xyzw, s3, l(0.000000)
dp3 r0.w, r1.xyzx, l(0.299000, 0.587000, 0.114000, 0.000000)
add r1.x, -r0.w, r0.z
add r0.z, r0.w, r0.z
sample_l_indexable(texture2d)(float,float,float,float) r1.yzw, v2.zwzz, t0.wxyz, s3, l(0.000000)
dp3 r1.y, r1.yzwy, l(0.299000, 0.587000, 0.114000, 0.000000)
add r2.x, r1.y, r1.x
add r2.y, r0.z, -r1.y
dp2 r0.z, r2.xyxx, r2.xyxx
rsq r0.z, r0.z
mul r1.xz, r0.zzzz, r2.xxyx
min r0.z, |r1.z|, |r1.x|
mul r0.z, r0.z, l(8.000000)
div r2.xy, r1.xzxx, r0.zzzz
max r2.xy, r2.xyxx, l(-2.000000, -2.000000, 0.000000, 0.000000)
min r2.xy, r2.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000)
mad r2.zw, -r2.xxxy, cb0[2].xxxy, v1.xxxy
mad r2.xy, r2.xyxx, cb0[2].xyxx, v1.xyxx
sample_l_indexable(texture2d)(float,float,float,float) r3.xyz, r2.xyxx, t0.xyzw, s3, l(0.000000)
sample_l_indexable(texture2d)(float,float,float,float) r2.xyzw, r2.zwzz, t0.xyzw, s3, l(0.000000)
dp3 r3.w, r3.xyzx, l(0.299000, 0.587000, 0.114000, 0.000000)
add r2.xyzw, r2.xyzw, r3.xyzw
mad r3.xy, -r1.xzxx, cb0[2].zwzz, v1.xyxx
mad r1.xz, r1.xxzx, cb0[2].zzwz, v1.xxyx
sample_l_indexable(texture2d)(float,float,float,float) r4.xyz, r1.xzxx, t0.xyzw, s3, l(0.000000)
sample_l_indexable(texture2d)(float,float,float,float) r3.xyz, r3.xyxx, t0.xyzw, s3, l(0.000000)
dp3 r3.w, r3.xyzx, l(0.299000, 0.587000, 0.114000, 0.000000)
dp3 r4.w, r4.xyzx, l(0.299000, 0.587000, 0.114000, 0.000000)
add r3.xyzw, r3.xyzw, r4.xyzw
mul r3.xyzw, r3.xyzw, l(0.500000, 0.500000, 0.500000, 0.500000)
mad r2.xyzw, r2.xyzw, l(0.500000, 0.500000, 0.500000, 0.500000), r3.xyzw
mul r2.xyzw, r2.xyzw, l(0.500000, 0.500000, 0.500000, 0.500000)
min r0.z, r0.x, r1.y
max r0.x, r0.x, r1.y
min r1.x, r0.y, r0.w
max r0.y, r0.y, r0.w
max r0.x, r0.x, r0.y
min r0.y, r0.z, r1.x
lt r0.z, r2.w, r0.y
lt r0.w, r0.x, r2.w
or r0.z, r0.w, r0.z
movc r1.xyzw, r0.zzzz, r3.xyzw, r2.xyzw
mul r0.z, r0.x, l(0.125000)
max r0.z, r0.z, l(0.050000)
sample_l_indexable(texture2d)(float,float,float,float) r2.xyz, v1.xyxx, t0.xyzw, s3, l(0.000000)
dp3 r2.w, r2.xyzx, l(0.299000, 0.587000, 0.114000, 0.000000)
min r0.y, r0.y, r2.w
max r0.x, r0.x, r2.w
add r0.x, -r0.y, r0.x
ge r0.x, r0.x, r0.z
movc o0.xyzw, r0.xxxx, r1.xyzw, r2.xyzw
ret 
// Approximately 58 instruction slots used

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