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

cbuffer cbMatDynParam : register(b2)
{
  bool FC_isDitherAlpha : packoffset(c0);
  float FC_TranslucencyScale : packoffset(c1);
  float4 FC_EmissiveColor : packoffset(c2);
  float4 FC_BlendMaskParam : packoffset(c3);
  float FC_PomHeightScale : packoffset(c4);
  float FC_PomHeightBias : packoffset(c4.y);
  float FC_PomMinSamples : packoffset(c4.z);
  float FC_PomMaxSamples : packoffset(c4.w);
  float FC_PomShadowSoftening : packoffset(c5);
  bool FC_bPomDisplayShadows : packoffset(c5.y);
  float4 FC_ParallaxParam : packoffset(c6);
  float FC_Pom2HeightScale : packoffset(c7);
  float FC_Pom2HeightBias : packoffset(c7.y);
  float FC_Pom2MinSamples : packoffset(c7.z);
  float FC_Pom2MaxSamples : packoffset(c7.w);
  bool VC_isEnableCloth : packoffset(c8);
  float FC_EnvMapDolBlendRate : packoffset(c9);
  float4 FC_SnowMaskParam : packoffset(c10);
  float FC_FROZEN_THRESHOLD : packoffset(c11);
  float FC_FROZEN_POW : packoffset(c11.y);
  float FC_BlendRate : packoffset(c12);
  float4 FC_FlowMapUvTiling : packoffset(c13);
  float4 FC_FlowMapIntencity : packoffset(c14);
  float FC_SoftVolume : packoffset(c15);
  float FC_PointCloudRate : packoffset(c16);
  float4 FC_WaterNormalUvScrollSpeed : packoffset(c17);
  float4 FC_WaterDiffuseUvScrollSpeed : packoffset(c18);
  float4 FC_WaterMiddleUvScrollSpeed : packoffset(c19);
  float4 FC_WaterFogParam0 : packoffset(c20);
  float4 FC_WaterFogParam1 : packoffset(c21);
  float4 FC_WaterFresnel : packoffset(c22);
  float4 FC_WaterFadeParam : packoffset(c23);
  float4 FC_DynamicDiffuseColor : packoffset(c24);
  float FC_SSS_ID : packoffset(c25);
  float4 FC_PhantomEdgeColor : packoffset(c26);
  float4 FC_PhantomFrontColor : packoffset(c27);
  float4 FC_PhantomDiffColor : packoffset(c28);
  float4 FC_PhantomSpecColor : packoffset(c29);
  float4 FC_PhantomLightColor : packoffset(c30);
  float VC_VelocityOffset : packoffset(c31);
  float4 FC_DamagedNormalParam : packoffset(c32);
  float4 FC_DamagedNormalUvTiling : packoffset(c33);
  float4 FC_DamagedNormal2UvTiling : packoffset(c34);
  float4 FC_WetDiffuseColor : packoffset(c35);
  float4 FC_WetParam1 : packoffset(c36);
  float4 FC_WetRefrectanceColor : packoffset(c37);
  float4 FC_WetParam2 : packoffset(c38);
}

cbuffer cbMtdParam : register(b3)
{
  float4 FC_DifMapMulCol : packoffset(c0);
  float4 FC_SpcMapMulCol : packoffset(c1);
  float4 FC_SpcParam : packoffset(c2);
  float4 FC_SSAOParam : packoffset(c3);
  float3 FC_CDRFParam : packoffset(c4);
  float4 FC_AlphaRef : packoffset(c5);
  float FC_BloodAmount : packoffset(c6);
  float4 old_FC_ParallaxParam : packoffset(c7);
  float FC_IOR : packoffset(c8);
  float4 FC_GlowScale : packoffset(c9);
  float4 FC_GhostEdgeColor : packoffset(c10);
  float4 FC_GhostEdgeParam : packoffset(c11);
  float4 FC_BmpBlendParam0 : packoffset(c12);
  float4 FC_BmpBlendParam1 : packoffset(c13);
  float FC_UNUSED_SSS_ID : packoffset(c14);
  float4 FC_HairSpecularParam0 : packoffset(c20);
  float4 FC_HairSpecularParam1 : packoffset(c21);
  float4 FC_HairSpecularParam2 : packoffset(c22);
  float4 FC_RimLightingParam : packoffset(c23);
}

cbuffer cbInstanceData : register(b4)
{

  struct
  {
    float4x3 mWorld;
    float4 atlasUvScaleOffset;
    float4 userClipPlane;
    uint4 matricesData;
    uint envData;
    bool dynamicLightDisable;
    uint2 envPad;
    float4 mulCol;
    float4 aSh[3];
    float4 ShLightMask;
    float4 vDominantRotateParam;
    float4 parallaxCorrectedCubemapOrigin_envMapInterpRatio;
    float4 parallaxCorrectedCubemapAabbMin_envMapColorScale0;
    float4 parallaxCorrectedCubemapAabbMax_envMapColorScale1;
    float ditherFadeAlpha;
  } VC_InstanceData[2] : packoffset(c0);

}

cbuffer cbPaintParam : register(b10)
{
  float4x4 FC_PaintMatrixView : packoffset(c0);
  float4 FC_PaintParam : packoffset(c4);
  float4 FC_OccTexRcpSize : packoffset(c5);
  float4x4 FC_PaintCubeProjMatrix : packoffset(c6);
  float4 g_PaintMaterialParamScale : packoffset(c10);
  float4 FC_PaintEraseColor : packoffset(c11);
  float4 FC_PaintFadeParam : packoffset(c12);
}

SamplerState SS_DiffuseMap_s : register(s0);
SamplerState SS_SpecularMap_s : register(s1);
SamplerState SS_BumpMap_s : register(s2);
SamplerState SS_MaskMap_s : register(s3);
SamplerState SS_ClampPoint_s : register(s7);
Texture2D<float4> g_DiffuseTexture : register(t0);
Texture2D<float4> g_SpecularTexture : register(t1);
Texture2D<float4> g_BumpmapTexture : register(t3);
Texture2D<float4> g_MaskTexture : register(t4);
Texture2D<float4> g_DepthTexture : register(t32);


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


void main( 
  float4 v0 : SV_Position0,
  float4 v1 : TEXCOORD0,
  uint v2 : SV_IsFrontFace0,
  out float4 o0 : SV_Target0,
  out float4 o1 : SV_Target1)
{
  float4 r0,r1,r2;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xyz = v1.xyz / v1.www;
  r0.xy = r0.xy * float2(0.5,-0.5) + float2(0.5,0.5);
  r0.w = g_DepthTexture.SampleLevel(SS_ClampPoint_s, r0.xy, 0, int2(1, 1)).x;
  r1.x = g_DepthTexture.SampleLevel(SS_ClampPoint_s, r0.xy, 0, int2(-1, 1)).x;
  r0.w = max(r1.x, r0.w);
  r1.x = g_DepthTexture.SampleLevel(SS_ClampPoint_s, r0.xy, 0, int2(1, -1)).x;
  r1.y = g_DepthTexture.SampleLevel(SS_ClampPoint_s, r0.xy, 0, int2(-1, -1)).x;
  r1.x = max(r1.x, r1.y);
  r0.w = max(r1.x, r0.w);
  r0.w = 0.00100000005 + r0.w;
  r0.z = cmp(r0.w < r0.z);
  r0.z = r0.z ? 0 : 1;
  r0.w = g_MaskTexture.Sample(SS_MaskMap_s, r0.xy).x;
  r1.xyzw = g_DiffuseTexture.Sample(SS_DiffuseMap_s, r0.xy).xyzw;
  r0.w = r1.w * r0.w;
  r0.z = r0.z * r0.w;
  r0.w = cmp(r0.z < 0.00392156886);
  r0.z = VC_InstanceData[0].mulCol.w * r0.z;
  r0.z = r0.w ? 0 : r0.z;
  if (r0.w != 0) discard;
  r0.w = FC_WetParam1.y + -FC_WetParam1.x;
  r2.xyz = g_SpecularTexture.Sample(SS_SpecularMap_s, r0.xy).xyz;
  r0.x = g_BumpmapTexture.Sample(SS_BumpMap_s, r0.xy).z;
  r0.y = dot(r2.xyz, float3(0.298909992,0.586610019,0.114480004));
  r0.y = r0.y * r0.w + FC_WetParam1.x;
  r0.y = saturate(12 * r0.y);
  r0.w = FC_WetDiffuseColor.w * r0.y;
  r2.yzw = FC_WetDiffuseColor.xyz + -r1.xyz;
  r1.xyz = r0.www * r2.yzw + r1.xyz;
  r1.xyz = FC_DifMapMulCol.xyz * r1.xyz;
  o0.xyz = VC_InstanceData[0].mulCol.xyz * r1.xyz;
  o0.w = r0.z;
  o1.w = r0.z;
  r0.z = FC_WetRefrectanceColor.x + -r2.x;
  r0.w = FC_WetRefrectanceColor.w * r0.y;
  r0.y = FC_WetParam2.z * r0.y;
  r0.z = r0.w * r0.z + r2.x;
  r0.z = sqrt(r0.z);
  o1.y = g_PaintMaterialParamScale.x * r0.z;
  r0.z = FC_SpcParam.x * 0.00390625;
  r0.w = r0.x * r0.z;
  r0.x = -r0.x * r0.z + FC_WetParam2.x;
  r0.x = r0.y * r0.x + r0.w;
  o1.x = g_PaintMaterialParamScale.y * r0.x;
  o1.z = 0;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Original ASM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20546
//
//
// Buffer Definitions: 
//
// cbuffer cbMatDynParam
// {
//
//   bool FC_isDitherAlpha;             // Offset:    0 Size:     4 [unused]
//   float FC_TranslucencyScale;        // Offset:   16 Size:     4 [unused]
//   float4 FC_EmissiveColor;           // Offset:   32 Size:    16 [unused]
//   float4 FC_BlendMaskParam;          // Offset:   48 Size:    16 [unused]
//   float FC_PomHeightScale;           // Offset:   64 Size:     4 [unused]
//   float FC_PomHeightBias;            // Offset:   68 Size:     4 [unused]
//   float FC_PomMinSamples;            // Offset:   72 Size:     4 [unused]
//   float FC_PomMaxSamples;            // Offset:   76 Size:     4 [unused]
//   float FC_PomShadowSoftening;       // Offset:   80 Size:     4 [unused]
//   bool FC_bPomDisplayShadows;        // Offset:   84 Size:     4 [unused]
//   float4 FC_ParallaxParam;           // Offset:   96 Size:    16 [unused]
//   float FC_Pom2HeightScale;          // Offset:  112 Size:     4 [unused]
//   float FC_Pom2HeightBias;           // Offset:  116 Size:     4 [unused]
//   float FC_Pom2MinSamples;           // Offset:  120 Size:     4 [unused]
//   float FC_Pom2MaxSamples;           // Offset:  124 Size:     4 [unused]
//   bool VC_isEnableCloth;             // Offset:  128 Size:     4 [unused]
//   float FC_EnvMapDolBlendRate;       // Offset:  144 Size:     4 [unused]
//   float4 FC_SnowMaskParam;           // Offset:  160 Size:    16 [unused]
//   float FC_FROZEN_THRESHOLD;         // Offset:  176 Size:     4 [unused]
//   float FC_FROZEN_POW;               // Offset:  180 Size:     4 [unused]
//   float FC_BlendRate;                // Offset:  192 Size:     4 [unused]
//   float4 FC_FlowMapUvTiling;         // Offset:  208 Size:    16 [unused]
//   float4 FC_FlowMapIntencity;        // Offset:  224 Size:    16 [unused]
//   float FC_SoftVolume;               // Offset:  240 Size:     4 [unused]
//   float FC_PointCloudRate;           // Offset:  256 Size:     4 [unused]
//   float4 FC_WaterNormalUvScrollSpeed;// Offset:  272 Size:    16 [unused]
//   float4 FC_WaterDiffuseUvScrollSpeed;// Offset:  288 Size:    16 [unused]
//   float4 FC_WaterMiddleUvScrollSpeed;// Offset:  304 Size:    16 [unused]
//   float4 FC_WaterFogParam0;          // Offset:  320 Size:    16 [unused]
//   float4 FC_WaterFogParam1;          // Offset:  336 Size:    16 [unused]
//   float4 FC_WaterFresnel;            // Offset:  352 Size:    16 [unused]
//   float4 FC_WaterFadeParam;          // Offset:  368 Size:    16 [unused]
//   float4 FC_DynamicDiffuseColor;     // Offset:  384 Size:    16 [unused]
//   float FC_SSS_ID;                   // Offset:  400 Size:     4 [unused]
//   float4 FC_PhantomEdgeColor;        // Offset:  416 Size:    16 [unused]
//   float4 FC_PhantomFrontColor;       // Offset:  432 Size:    16 [unused]
//   float4 FC_PhantomDiffColor;        // Offset:  448 Size:    16 [unused]
//   float4 FC_PhantomSpecColor;        // Offset:  464 Size:    16 [unused]
//   float4 FC_PhantomLightColor;       // Offset:  480 Size:    16 [unused]
//   float VC_VelocityOffset;           // Offset:  496 Size:     4 [unused]
//   float4 FC_DamagedNormalParam;      // Offset:  512 Size:    16 [unused]
//   float4 FC_DamagedNormalUvTiling;   // Offset:  528 Size:    16 [unused]
//   float4 FC_DamagedNormal2UvTiling;  // Offset:  544 Size:    16 [unused]
//   float4 FC_WetDiffuseColor;         // Offset:  560 Size:    16
//   float4 FC_WetParam1;               // Offset:  576 Size:    16
//   float4 FC_WetRefrectanceColor;     // Offset:  592 Size:    16
//   float4 FC_WetParam2;               // Offset:  608 Size:    16
//
// }
//
// cbuffer cbMtdParam
// {
//
//   float4 FC_DifMapMulCol;            // Offset:    0 Size:    16
//   float4 FC_SpcMapMulCol;            // Offset:   16 Size:    16 [unused]
//   float4 FC_SpcParam;                // Offset:   32 Size:    16
//   float4 FC_SSAOParam;               // Offset:   48 Size:    16 [unused]
//   float3 FC_CDRFParam;               // Offset:   64 Size:    12 [unused]
//   float4 FC_AlphaRef;                // Offset:   80 Size:    16 [unused]
//   float FC_BloodAmount;              // Offset:   96 Size:     4 [unused]
//   float4 old_FC_ParallaxParam;       // Offset:  112 Size:    16 [unused]
//   float FC_IOR;                      // Offset:  128 Size:     4 [unused]
//   float4 FC_GlowScale;               // Offset:  144 Size:    16 [unused]
//   float4 FC_GhostEdgeColor;          // Offset:  160 Size:    16 [unused]
//   float4 FC_GhostEdgeParam;          // Offset:  176 Size:    16 [unused]
//   float4 FC_BmpBlendParam0;          // Offset:  192 Size:    16 [unused]
//   float4 FC_BmpBlendParam1;          // Offset:  208 Size:    16 [unused]
//   float FC_UNUSED_SSS_ID;            // Offset:  224 Size:     4 [unused]
//   float4 FC_HairSpecularParam0;      // Offset:  320 Size:    16 [unused]
//   float4 FC_HairSpecularParam1;      // Offset:  336 Size:    16 [unused]
//   float4 FC_HairSpecularParam2;      // Offset:  352 Size:    16 [unused]
//   float4 FC_RimLightingParam;        // Offset:  368 Size:    16 [unused]
//
// }
//
// cbuffer cbInstanceData
// {
//
//   struct PerInstanceData
//   {
//       
//       float4x3 mWorld;               // Offset:    0
//       float4 atlasUvScaleOffset;     // Offset:   48
//       float4 userClipPlane;          // Offset:   64
//       uint4 matricesData;            // Offset:   80
//       uint envData;                  // Offset:   96
//       bool dynamicLightDisable;      // Offset:  100
//       uint2 envPad;                  // Offset:  104
//       float4 mulCol;                 // Offset:  112
//       float4 aSh[3];                 // Offset:  128
//       float4 ShLightMask;            // Offset:  176
//       float4 vDominantRotateParam;   // Offset:  192
//       float4 parallaxCorrectedCubemapOrigin_envMapInterpRatio;// Offset:  208
//       float4 parallaxCorrectedCubemapAabbMin_envMapColorScale0;// Offset:  224
//       float4 parallaxCorrectedCubemapAabbMax_envMapColorScale1;// Offset:  240
//       float ditherFadeAlpha;         // Offset:  256
//
//   } VC_InstanceData[2];              // Offset:    0 Size:   532
//
// }
//
// cbuffer cbPaintParam
// {
//
//   float4x4 FC_PaintMatrixView;       // Offset:    0 Size:    64 [unused]
//   float4 FC_PaintParam;              // Offset:   64 Size:    16 [unused]
//   float4 FC_OccTexRcpSize;           // Offset:   80 Size:    16 [unused]
//   float4x4 FC_PaintCubeProjMatrix;   // Offset:   96 Size:    64 [unused]
//   float4 g_PaintMaterialParamScale;  // Offset:  160 Size:    16
//   float4 FC_PaintEraseColor;         // Offset:  176 Size:    16 [unused]
//   float4 FC_PaintFadeParam;          // Offset:  192 Size:    16 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// SS_DiffuseMap                     sampler      NA          NA    0        1
// SS_SpecularMap                    sampler      NA          NA    1        1
// SS_BumpMap                        sampler      NA          NA    2        1
// SS_MaskMap                        sampler      NA          NA    3        1
// SS_ClampPoint                     sampler      NA          NA    7        1
// g_DiffuseTexture                  texture  float4          2d    0        1
// g_SpecularTexture                 texture  float4          2d    1        1
// g_BumpmapTexture                  texture  float4          2d    3        1
// g_MaskTexture                     texture  float4          2d    4        1
// g_DepthTexture                    texture  float4          2d   32        1
// cbMatDynParam                     cbuffer      NA          NA    2        1
// cbMtdParam                        cbuffer      NA          NA    3        1
// cbInstanceData                    cbuffer      NA          NA    4        1
// cbPaintParam                      cbuffer      NA          NA   10        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float       
// TEXCOORD                 0   xyzw        1     NONE   float   xyzw
// SV_IsFrontFace           0   x           2    FFACE    uint       
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target                0   xyzw        0   TARGET   float   xyzw
// SV_Target                1   xyzw        1   TARGET   float   xyzw
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb2[39], immediateIndexed
dcl_constantbuffer cb3[3], immediateIndexed
dcl_constantbuffer cb4[8], immediateIndexed
dcl_constantbuffer cb10[11], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_sampler s2, mode_default
dcl_sampler s3, mode_default
dcl_sampler s7, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_resource_texture2d (float,float,float,float) t3
dcl_resource_texture2d (float,float,float,float) t4
dcl_resource_texture2d (float,float,float,float) t32
dcl_input_ps linear v1.xyzw
dcl_output o0.xyzw
dcl_output o1.xyzw
dcl_temps 3
div r0.xyz, v1.xyzx, v1.wwww
mad r0.xy, r0.xyxx, l(0.500000, -0.500000, 0.000000, 0.000000), l(0.500000, 0.500000, 0.000000, 0.000000)
sample_l_aoffimmi_indexable(1,1,0)(texture2d)(float,float,float,float) r0.w, r0.xyxx, t32.yzwx, s7, l(0.000000)
sample_l_aoffimmi_indexable(-1,1,0)(texture2d)(float,float,float,float) r1.x, r0.xyxx, t32.xyzw, s7, l(0.000000)
max r0.w, r0.w, r1.x
sample_l_aoffimmi_indexable(1,-1,0)(texture2d)(float,float,float,float) r1.x, r0.xyxx, t32.xyzw, s7, l(0.000000)
sample_l_aoffimmi_indexable(-1,-1,0)(texture2d)(float,float,float,float) r1.y, r0.xyxx, t32.yxzw, s7, l(0.000000)
max r1.x, r1.y, r1.x
max r0.w, r0.w, r1.x
add r0.w, r0.w, l(0.001000)
lt r0.z, r0.w, r0.z
movc r0.z, r0.z, l(0), l(1.000000)
sample_indexable(texture2d)(float,float,float,float) r0.w, r0.xyxx, t4.yzwx, s3
sample_indexable(texture2d)(float,float,float,float) r1.xyzw, r0.xyxx, t0.xyzw, s0
mul r0.w, r0.w, r1.w
mul r0.z, r0.w, r0.z
lt r0.w, r0.z, l(0.003922)
mul r0.z, r0.z, cb4[7].w
movc r0.z, r0.w, l(0), r0.z
discard_nz r0.w
add r0.w, -cb2[36].x, cb2[36].y
sample_indexable(texture2d)(float,float,float,float) r2.xyz, r0.xyxx, t1.xyzw, s1
sample_indexable(texture2d)(float,float,float,float) r0.x, r0.xyxx, t3.zxyw, s2
dp3 r0.y, r2.xyzx, l(0.298910, 0.586610, 0.114480, 0.000000)
mad r0.y, r0.y, r0.w, cb2[36].x
mul_sat r0.y, r0.y, l(12.000000)
mul r0.w, r0.y, cb2[35].w
add r2.yzw, -r1.xxyz, cb2[35].xxyz
mad r1.xyz, r0.wwww, r2.yzwy, r1.xyzx
mul r1.xyz, r1.xyzx, cb3[0].xyzx
mul o0.xyz, r1.xyzx, cb4[7].xyzx
mov o0.w, r0.z
mov o1.w, r0.z
add r0.z, -r2.x, cb2[37].x
mul r0.w, r0.y, cb2[37].w
mul r0.y, r0.y, cb2[38].z
mad r0.z, r0.w, r0.z, r2.x
sqrt r0.z, r0.z
mul o1.y, r0.z, cb10[10].x
mul r0.z, l(0.003906), cb3[2].x
mul r0.w, r0.z, r0.x
mad r0.x, -r0.x, r0.z, cb2[38].x
mad r0.x, r0.y, r0.x, r0.w
mul o1.x, r0.x, cb10[10].y
mov o1.z, l(0)
ret 
// Approximately 46 instruction slots used

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