// ---- Created with 3Dmigoto v1.2.35 on Wed Apr 27 23:14:10 2016

cbuffer _Globals : register(b0)
{
  float2 fParam_DepthCastScaleOffset : packoffset(c0) = {1,0};
  float4 fParam_DepthOfFieldFactorScaleOffset : packoffset(c1) = {0.5,0.5,2,-1};
  float4 fParam_HDRFormatFactor_LOGRGB : packoffset(c2);
  float4 fParam_HDRFormatFactor_RGBALUM : packoffset(c3);
  float4 fParam_HDRFormatFactor_REINHARDRGB : packoffset(c4);
  float2 fParam_ScreenSpaceScale : packoffset(c5) = {1,-1};
  float4x4 m44_ModelViewProject : packoffset(c6);
  float4 vParam_LensDistortion : packoffset(c10);
  float4 afUVWQ_TexCoordScaleOffset[4] : packoffset(c11);
  float4 fParam_PerspectiveFactor : packoffset(c15);
  float fParam_FocusDistance : packoffset(c16);
  float4 fParam_DepthOfFieldConvertDepthFactor : packoffset(c17);
  float2 afXY_DepthOfFieldLevelBlendFactor16[16] : packoffset(c18);
  float fParam_DepthOfFieldLayerMaskThreshold : packoffset(c33.z) = {0.25};
  float fParam_DepthOfFieldFactorThreshold : packoffset(c33.w) = {0.00039999999};
  float4 afUV_TexCoordOffsetV16[16] : packoffset(c34);
  float4 afUV_TexCoordOffsetP32[96] : packoffset(c50);
  float4 afParam_TexCoordScaler8[8] : packoffset(c146);
  float4 afRGBA_Modulate[32] : packoffset(c154);
  float4 afRGBA_Offset[16] : packoffset(c186);
  float fParam_GammaCorrection : packoffset(c202) = {0.454545468};
  float2 fParam_DitherOffsetScale : packoffset(c202.y) = {0.00392156886,-0.00196078443};
  float4 fRGBA_Constant : packoffset(c203);
  float4 afRGBA_Constant[4] : packoffset(c204);
  float4 fParam_TonemapMaxMappingLuminance : packoffset(c208) = {1,1,1.015625,1};
  float4 fParam_BrightPassRemapFactor : packoffset(c209);
  float4x4 m44_ColorTransformMatrix : packoffset(c210);
  float4x4 m44_PreTonemapColorTransformMatrix : packoffset(c214);
  float4x4 m44_PreTonemapGlareColorTransformMatrix : packoffset(c218);
  float4 fParam_VignetteSimulate : packoffset(c222);
  float fParam_VignettePowerOfCosine : packoffset(c223);
  float4x4 am44_TransformMatrix[8] : packoffset(c224);
}

SamplerState asamp2D_Texture_s : register(s0);
Texture2D<float4> atex2D_Texture : register(t0);


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


void main( 
  float4 v0 : TEXCOORD0,
  float4 v1 : TEXCOORD1,
  float4 v2 : TEXCOORD2,
  float2 v3 : TEXCOORD3,
  out float4 o0 : SV_TARGET0)
{
  float4 r0,r1,r2,r3;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xyzw = atex2D_Texture.Sample(asamp2D_Texture_s, v1.xy, int2(0, 0)).xyzw;
  r1.x = r0.w * afXY_DepthOfFieldLevelBlendFactor16[0].x + afXY_DepthOfFieldLevelBlendFactor16[0].y;
  r1.x = cmp(-fParam_DepthOfFieldLayerMaskThreshold < r1.x);
  r1.x = r1.x ? 1.000000 : 0;
  r2.xyzw = r1.xxxx * r0.xyzw;
  r3.xyzw = atex2D_Texture.Sample(asamp2D_Texture_s, v0.xy, int2(0, 0)).xyzw;
  r0.x = r3.w * afXY_DepthOfFieldLevelBlendFactor16[0].x + afXY_DepthOfFieldLevelBlendFactor16[0].y;
  r0.x = cmp(-fParam_DepthOfFieldLayerMaskThreshold < r0.x);
  r0.x = r0.x ? 1.000000 : 0;
  r2.xyzw = r3.xyzw * r0.xxxx + r2.xyzw;
  r0.x = r0.x + r1.x;
  r0.y = min(65504, r3.w);
  r0.y = min(r0.y, r0.w);
  r1.xyzw = atex2D_Texture.Sample(asamp2D_Texture_s, v2.xy, int2(0, 0)).xyzw;
  r0.z = r1.w * afXY_DepthOfFieldLevelBlendFactor16[0].x + afXY_DepthOfFieldLevelBlendFactor16[0].y;
  r0.z = cmp(-fParam_DepthOfFieldLayerMaskThreshold < r0.z);
  r0.z = r0.z ? 1.000000 : 0;
  r2.xyzw = r1.xyzw * r0.zzzz + r2.xyzw;
  r0.x = r0.x + r0.z;
  r0.y = min(r1.w, r0.y);
  r1.xyzw = atex2D_Texture.Sample(asamp2D_Texture_s, v3.xy, int2(0, 0)).xyzw;
  r0.z = r1.w * afXY_DepthOfFieldLevelBlendFactor16[0].x + afXY_DepthOfFieldLevelBlendFactor16[0].y;
  r0.z = cmp(-fParam_DepthOfFieldLayerMaskThreshold < r0.z);
  r0.z = r0.z ? 1.000000 : 0;
  r2.xyzw = r1.xyzw * r0.zzzz + r2.xyzw;
  r0.x = r0.x + r0.z;
  r1.w = min(r1.w, r0.y);
  r1.xyz = r2.xyz / r0.xxx;
  r0.x = cmp(0 < r0.x);
  o0.xyzw = r0.xxxx ? r1.xyzw : r2.xyzw;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Original ASM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//
// Buffer Definitions: 
//
// cbuffer $Globals
// {
//
//   float2 fParam_DepthCastScaleOffset;// Offset:    0 Size:     8 [unused]
//      = 0x3f800000 0x00000000 
//   float4 fParam_DepthOfFieldFactorScaleOffset;// Offset:   16 Size:    16 [unused]
//      = 0x3f000000 0x3f000000 0x40000000 0xbf800000 
//   float4 fParam_HDRFormatFactor_LOGRGB;// Offset:   32 Size:    16 [unused]
//   float4 fParam_HDRFormatFactor_RGBALUM;// Offset:   48 Size:    16 [unused]
//   float4 fParam_HDRFormatFactor_REINHARDRGB;// Offset:   64 Size:    16 [unused]
//   float2 fParam_ScreenSpaceScale;    // Offset:   80 Size:     8 [unused]
//      = 0x3f800000 0xbf800000 
//   float4x4 m44_ModelViewProject;     // Offset:   96 Size:    64 [unused]
//   float4 vParam_LensDistortion;      // Offset:  160 Size:    16 [unused]
//   float4 afUVWQ_TexCoordScaleOffset[4];// Offset:  176 Size:    64 [unused]
//   float4 fParam_PerspectiveFactor;   // Offset:  240 Size:    16 [unused]
//   float fParam_FocusDistance;        // Offset:  256 Size:     4 [unused]
//   float4 fParam_DepthOfFieldConvertDepthFactor;// Offset:  272 Size:    16 [unused]
//   float2 afXY_DepthOfFieldLevelBlendFactor16[16];// Offset:  288 Size:   248
//   float fParam_DepthOfFieldLayerMaskThreshold;// Offset:  536 Size:     4
//      = 0x3e800000 
//   float fParam_DepthOfFieldFactorThreshold;// Offset:  540 Size:     4 [unused]
//      = 0x39d1b717 
//   float4 afUV_TexCoordOffsetV16[16]; // Offset:  544 Size:   256 [unused]
//   float4 afUV_TexCoordOffsetP32[96]; // Offset:  800 Size:  1536 [unused]
//   float4 afParam_TexCoordScaler8[8]; // Offset: 2336 Size:   128 [unused]
//   float4 afRGBA_Modulate[32];        // Offset: 2464 Size:   512 [unused]
//   float4 afRGBA_Offset[16];          // Offset: 2976 Size:   256 [unused]
//   float fParam_GammaCorrection;      // Offset: 3232 Size:     4 [unused]
//      = 0x3ee8ba2f 
//   float2 fParam_DitherOffsetScale;   // Offset: 3236 Size:     8 [unused]
//      = 0x3b808081 0xbb008081 
//   float4 fRGBA_Constant;             // Offset: 3248 Size:    16 [unused]
//   float4 afRGBA_Constant[4];         // Offset: 3264 Size:    64 [unused]
//   float4 fParam_TonemapMaxMappingLuminance;// Offset: 3328 Size:    16 [unused]
//      = 0x3f800000 0x3f800000 0x3f820000 0x3f800000 
//   float4 fParam_BrightPassRemapFactor;// Offset: 3344 Size:    16 [unused]
//   float4x4 m44_ColorTransformMatrix; // Offset: 3360 Size:    64 [unused]
//   float4x4 m44_PreTonemapColorTransformMatrix;// Offset: 3424 Size:    64 [unused]
//   float4x4 m44_PreTonemapGlareColorTransformMatrix;// Offset: 3488 Size:    64 [unused]
//   float4 fParam_VignetteSimulate;    // Offset: 3552 Size:    16 [unused]
//   float fParam_VignettePowerOfCosine;// Offset: 3568 Size:     4 [unused]
//   float4x4 am44_TransformMatrix[8];  // Offset: 3584 Size:   512 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// asamp2D_Texture                   sampler      NA          NA    0        1
// atex2D_Texture                    texture  float4          2d    0        1
// $Globals                          cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                 0   xy          0     NONE   float   xy  
// TEXCOORD                 1   xy          1     NONE   float   xy  
// TEXCOORD                 2   xy          2     NONE   float   xy  
// TEXCOORD                 3   xy          3     NONE   float   xy  
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_TARGET                0   xyzw        0   TARGET   float   xyzw
//
ps_4_0
dcl_constantbuffer cb0[34], immediateIndexed
dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_input_ps linear v0.xy
dcl_input_ps linear v1.xy
dcl_input_ps linear v2.xy
dcl_input_ps linear v3.xy
dcl_output o0.xyzw
dcl_temps 4
sample_aoffimmi(0,0,0) r0.xyzw, v1.xyxx, t0.xyzw, s0
mad r1.x, r0.w, cb0[18].x, cb0[18].y
lt r1.x, -cb0[33].z, r1.x
and r1.x, r1.x, l(0x3f800000)
mul r2.xyzw, r0.xyzw, r1.xxxx
sample_aoffimmi(0,0,0) r3.xyzw, v0.xyxx, t0.xyzw, s0
mad r0.x, r3.w, cb0[18].x, cb0[18].y
lt r0.x, -cb0[33].z, r0.x
and r0.x, r0.x, l(0x3f800000)
mad r2.xyzw, r3.xyzw, r0.xxxx, r2.xyzw
add r0.x, r1.x, r0.x
min r0.y, r3.w, l(65504.000000)
min r0.y, r0.w, r0.y
sample_aoffimmi(0,0,0) r1.xyzw, v2.xyxx, t0.xyzw, s0
mad r0.z, r1.w, cb0[18].x, cb0[18].y
lt r0.z, -cb0[33].z, r0.z
and r0.z, r0.z, l(0x3f800000)
mad r2.xyzw, r1.xyzw, r0.zzzz, r2.xyzw
add r0.x, r0.z, r0.x
min r0.y, r0.y, r1.w
sample_aoffimmi(0,0,0) r1.xyzw, v3.xyxx, t0.xyzw, s0
mad r0.z, r1.w, cb0[18].x, cb0[18].y
lt r0.z, -cb0[33].z, r0.z
and r0.z, r0.z, l(0x3f800000)
mad r2.xyzw, r1.xyzw, r0.zzzz, r2.xyzw
add r0.x, r0.z, r0.x
min r1.w, r0.y, r1.w
div r1.xyz, r2.xyzx, r0.xxxx
lt r0.x, l(0.000000), r0.x
movc o0.xyzw, r0.xxxx, r1.xyzw, r2.xyzw
ret 
// Approximately 31 instruction slots used

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