//Protagonist reflection on wax chapter 16.
// ---- Created with 3Dmigoto v1.3.16 on Sat Oct  9 00:19:36 2021

cbuffer fblock : register(b0)
{
  float4 translucentparm : packoffset(c0);
  float4 clipthreshold : packoffset(c1);
  float4 smatrix : packoffset(c2);
  float4 tmatrix : packoffset(c3);
  float4 displacementscale : packoffset(c4);
  float4 smatrix1 : packoffset(c5);
  float4 tmatrix1 : packoffset(c6);
  float4 pastrate : packoffset(c7);
  float4 rimrate : packoffset(c8);
  float4 scorchcolor : packoffset(c9);
  float4 debugcolor : packoffset(c10);
  float4 albedoshifter : packoffset(c11);
  float4 albedooffset : packoffset(c12);
  float4 roughnessshifter : packoffset(c13);
  float4 roughnessoffset : packoffset(c14);
  float4 sprimrate : packoffset(c15);
  float4 itemparm : packoffset(c16);
  float4 materialid : packoffset(c17);
  float4 clothparam : packoffset(c18);
  float4 enlboostparm : packoffset(c19);
  float4 enlightenfactor : packoffset(c20);
  float4 enlightenlightingtype : packoffset(c21);
  float4 renderpositiontoviewtexture : packoffset(c22);
  float4 viewmatrixx : packoffset(c23);
  float4 viewmatrixy : packoffset(c24);
  float4 viewmatrixz : packoffset(c25);
  float4 lightprepassinverseparams : packoffset(c26);
  float4 depthblendparm : packoffset(c27);
  float4 binkmaskrate : packoffset(c28);
  float4 fsbinkblendrate : packoffset(c29);
}

SamplerState nv_albedomap_samp_state_s : register(s0);
SamplerState nv_normalmap_samp_state_s : register(s1);
SamplerState nv_roughnessmap_samp_state_s : register(s2);
SamplerState nv_metallicmap_samp_state_s : register(s3);
SamplerState transmap_samp_state_s : register(s4);
SamplerState texturemap_samp_state_s : register(s5);
SamplerState spare1map_samp_state_s : register(s6);
SamplerState spare2map_samp_state_s : register(s7);
SamplerState sparespecularmap2_samp_state_s : register(s8);
SamplerState sparespecularmap_samp_state_s : register(s9);
SamplerState viewdepthmap_samp_state_s : register(s10);
SamplerState viewblendmap2_samp_state_s : register(s11);
SamplerState viewblendmap0_samp_state_s : register(s12);
SamplerState binky_samp_state_s : register(s13);
SamplerState binkcr_samp_state_s : register(s14);
SamplerState binkcb_samp_state_s : register(s15);
Texture2D<float4> nv_albedomap_samp : register(t0);
Texture2D<float4> nv_normalmap_samp : register(t1);
Texture2D<float4> nv_roughnessmap_samp : register(t2);
Texture2D<float4> nv_metallicmap_samp : register(t3);
Texture2D<float4> transmap_samp : register(t4);
Texture2D<float4> texturemap_samp : register(t5);
Texture2D<float4> spare1map_samp : register(t6);
Texture2D<float4> spare2map_samp : register(t7);
Texture2D<float4> sparespecularmap2_samp : register(t8);
Texture2D<float4> sparespecularmap_samp : register(t9);
Texture2D<float4> viewdepthmap_samp : register(t10);
Texture2D<float4> viewblendmap2_samp : register(t11);
Texture2D<float4> viewblendmap0_samp : register(t12);
Texture2D<float4> binky_samp : register(t13);
Texture2D<float4> binkcr_samp : register(t14);
Texture2D<float4> binkcb_samp : register(t15);


// 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,
  float4 v3 : TEXCOORD3,
  float4 v4 : TEXCOORD4,
  float4 v5 : TEXCOORD5,
  float4 v6 : SV_Position0,
  uint v7 : SV_IsFrontFace0,
  out float4 o0 : SV_Target0,
  out float4 o1 : SV_Target1,
  out float4 o2 : SV_Target2,
  out float4 o3 : SV_Target3)
{
  float4 r0,r1,r2,r3,r4,r5,r6,r7;
  uint4 bitmask, uiDest;
  float4 fDest;
  
  float4 stereo = StereoParams.Load(0);
  
  r0.xyzw = nv_albedomap_samp.Sample(nv_albedomap_samp_state_s, v0.xy, int2(0, 0)).xyzw;
  r0.w = -clipthreshold.x + r0.w;
  r0.xyz = scorchcolor.xyz * r0.xyz;
  r0.xyz = r0.xyz * debugcolor.www + debugcolor.xyz;
  r0.xyz = albedoshifter.xyz + r0.xyz;
  r0.xyz = saturate(albedooffset.xxx + r0.xyz);
  r0.w = cmp(r0.w < 0);
  if (r0.w != 0) discard;
  r1.xy = v0.xy;
  r1.z = 1;
  r2.x = dot(r1.xyz, smatrix.xyw);
  r2.y = dot(r1.xyz, tmatrix.xyw);
  r2.xy = transmap_samp.Sample(transmap_samp_state_s, r2.xy, int2(0, 0)).xy;
  r2.xy = float2(-0.5,-0.5) + r2.xy;
  r0.w = dot(r2.xy, r2.xy);
  r0.w = -0.25 + r0.w;
  r2.z = sqrt(abs(r0.w));
  r0.w = dot(r2.xyz, r2.xyz);
  r0.w = rsqrt(r0.w);
  r2.zw = nv_normalmap_samp.Sample(nv_normalmap_samp_state_s, v0.xy, int2(0, 0)).xy;
  r3.xy = float2(-0.5,-0.5) + r2.wz;
  r2.xy = r2.xy * r0.ww + r3.xy;
  r0.w = dot(r3.xy, r3.xy);
  r0.w = -0.25 + r0.w;
  r2.z = sqrt(abs(r0.w));
  r0.w = dot(r2.xyz, r2.xyz);
  r0.w = rsqrt(r0.w);
  r3.z = r2.z;
  r2.xyz = r2.xyz * r0.www + -r3.xyz;
  r0.w = texturemap_samp.Sample(texturemap_samp_state_s, v0.xy, int2(0, 0)).x;
  r0.w = saturate(displacementscale.x * r0.w);
  r2.xyz = r0.www * r2.xyz + r3.xyz;
  r0.w = dot(r2.xyz, r2.xyz);
  r0.w = rsqrt(r0.w);
  r2.xyz = r2.xyz * r0.www;
  r3.x = dot(r1.xyz, smatrix1.xyw);
  r3.y = dot(r1.xyz, tmatrix1.xyw);
  r1.xy = spare1map_samp.Sample(spare1map_samp_state_s, r3.xy, int2(0, 0)).xy;
  r1.xy = float2(-0.5,-0.5) + r1.xy;
  r0.w = dot(r1.xy, r1.xy);
  r0.w = -0.25 + r0.w;
  r1.z = sqrt(abs(r0.w));
  r0.w = dot(r1.xyz, r1.xyz);
  r0.w = rsqrt(r0.w);
  r1.xy = r1.xy * r0.ww + r2.xy;
  r1.z = r2.z;
  r0.w = dot(r1.xyz, r1.xyz);
  r0.w = rsqrt(r0.w);
  r1.xyz = r1.xyz * r0.www + -r2.xyz;
  r0.w = spare2map_samp.Sample(spare2map_samp_state_s, v0.xy, int2(0, 0)).x;
  r1.w = saturate(displacementscale.z);
  r0.w = r1.w * r0.w;
  r1.xyz = r0.www * r1.xyz + r2.xyz;
  r0.w = dot(r1.xyz, r1.xyz);
  r0.w = rsqrt(r0.w);
  r1.xyz = r1.xyz * r0.www;
  r2.y = dot(r1.xyz, v1.xyz);
  r2.z = dot(r1.xyz, v2.xyz);
  r2.x = dot(r1.xyz, v3.xyz);
  r0.w = dot(r2.xyz, r2.xyz);
  r0.w = rsqrt(r0.w);
  r1.xyz = r2.xyz * r0.www;
  r0.w = v7.x ? 1 : -1;
  r2.xyz = r1.xyz * r0.www;
  r3.z = dot(r2.yzx, viewmatrixz.xyz);
  r3.x = dot(r2.yzx, viewmatrixx.xyz);
  r3.y = dot(r2.yzx, viewmatrixy.xyz);
  r1.w = dot(r3.xyz, r3.xyz);
  r1.w = rsqrt(r1.w);
  r3.xy = r3.xy * r1.ww;
  r3.xy = renderpositiontoviewtexture.zw * r3.xy;
  r3.zw = v6.xy * renderpositiontoviewtexture.zw + renderpositiontoviewtexture.xy;
  r3.xy = r3.xy * float2(64,64) + r3.zw;
  
  r3.x-=stereo.x*(1-stereo.y/v6.w)*0.5;
  
  r1.w = binkcb_samp.Sample(binkcb_samp_state_s, r3.xy, int2(0, 0)).x;
  r4.xyz = float3(0,-0.391448975,2.01782227) * r1.www;
  r1.w = binkcr_samp.Sample(binkcr_samp_state_s, r3.xy, int2(0, 0)).x;
  r2.w = binky_samp.Sample(binky_samp_state_s, r3.xy, int2(0, 0)).x;
  r4.xyz = r1.www * float3(1.59579468,-0.813476563,0) + r4.xyz;
  r4.xyz = r2.www * float3(1.16412354,1.16412354,1.16412354) + r4.xyz;
  r4.xyz = float3(-0.87065506,0.529705048,-1.08166885) + r4.xyz;
  r4.xyz = binkmaskrate.xyz * r4.xyz;
  r5.xyzw = -v5.xyzw + v4.xyzw;
  r6.xyzw = v6.zzzz * r5.xyzw + v5.xyzw;
  r6.xyz = r6.xyz / r6.www;
  r6.xyz = lightprepassinverseparams.xyz + r6.xyz;
  r1.w = viewdepthmap_samp.Sample(viewdepthmap_samp_state_s, r3.zw, int2(0, 0)).x;
  r5.xyzw = r1.wwww * r5.xyzw + v5.xyzw;
  r5.xyz = r5.xyz / r5.www;
  r5.xyz = lightprepassinverseparams.xyz + r5.xyz;
  r5.xyz = r5.xyz + -r6.xyz;
  r1.w = dot(r5.xyz, r5.xyz);
  r1.w = sqrt(r1.w);
  r2.w = cmp(depthblendparm.x < r1.w);
  r1.w = saturate(r1.w / depthblendparm.x);
  r1.w = r2.w ? 1 : r1.w;
  r2.w = 1 + -r1.w;
  r1.w = cmp(r1.w < 1);
  r5.xyzw = viewblendmap2_samp.Sample(viewblendmap2_samp_state_s, r3.zw, int2(0, 0)).xyzw;
  r3.xy = viewblendmap0_samp.Sample(viewblendmap0_samp_state_s, r3.zw, int2(0, 0)).zw;
  r3.xy = float2(65535,65535) * r3.xy;
  r3.xy = (uint2)r3.xy;
  r3.xy = (int2)r3.xy & int2(255,255);
  r5.xyzw = float4(65535,65535,65535,65535) * r5.xyzw;
  r5.xyzw = (uint4)r5.xyzw;
  r6.xyzw = (int4)r5.xyzw & int4(255,255,255,255);
  if (8 == 0) r3.z = 0; else if (8+8 < 32) {   r3.z = (uint)r5.x << (32-(8 + 8)); r3.z = (uint)r3.z >> (32-8);  } else r3.z = (uint)r5.x >> 8;
  if (8 == 0) r3.w = 0; else if (8+8 < 32) {   r3.w = (uint)r5.y << (32-(8 + 8)); r3.w = (uint)r3.w >> (32-8);  } else r3.w = (uint)r5.y >> 8;
  r3.xyzw = (uint4)r3.xyzw;
  r3.zw = r3.zw * float2(0.00784313772,0.00784313772) + float2(-1,-1);
  r5.xyzw = (uint4)r6.xyzw;
  r5.xyz = r5.xyz * float3(0.00392156886,0.00392156886,0.00392156886) + -r0.xyz;
  r5.xyz = r2.www * r5.xyz + r0.xyz;
  r0.xyz = r1.www ? r5.xyz : r0.xyz;
  r4.xyz = r4.xyz * fsbinkblendrate.xxx + r0.xyz;
  r0.x = (uint)materialid.x;
  r0.xyz = (int3)r0.xxx & int3(1,4,-5);
  r0.z = (uint)r0.z;
  r0.xy = cmp((int2)r0.xy == int2(1,4));
  r0.z = 0.03125 * r0.z;
  r0.z = frac(r0.z);
  r5.x = cmp(0 < rimrate.x);
  r5.y = itemparm.w + sprimrate.x;
  r5.z = 32 + r5.y;
  r5.x = r5.x ? r5.z : r5.y;
  r0.z = r0.z * 32 + r5.x;
  r6.x = 0.00392156886 * r0.z;
  r0.z = 0.03125 * materialid.x;
  r5.y = cmp(r0.z >= -r0.z);
  r0.z = frac(abs(r0.z));
  r0.z = r5.y ? r0.z : -r0.z;
  r0.z = r0.z * 32 + r5.x;
  r5.x = 0.00392156886 * r0.z;
  r0.z = sparespecularmap_samp.SampleLevel(sparespecularmap_samp_state_s, v0.xy, 0).x;
  r7.x = cmp(r0.z == 0.000000);
  r7.y = nv_roughnessmap_samp.Sample(nv_roughnessmap_samp_state_s, v0.xy, int2(0, 0)).x;
  r7.y = roughnessshifter.x + r7.y;
  r6.y = saturate(roughnessoffset.x + r7.y);
  r5.y = saturate(clothparam.y + r6.y);
  r7.xy = r7.xx ? r6.xy : r5.xy;
  r6.x = cmp(0 < clothparam.z);
  r7.w = cmp(clothparam.z != 2.000000);
  r7.z = r7.w ? clothparam.x : r0.z;
  r5.z = clothparam.x;
  r7.xyz = r6.xxx ? r7.xyz : r5.xyz;
  r6.z = r5.x;
  r6.w = 0;
  r5.xyz = r0.yyy ? r7.xyz : r6.zyw;
  r0.y = r5.w * 0.00392156886 + -r5.y;
  r6.y = r2.w * r0.y + r5.y;
  r0.y = nv_metallicmap_samp.Sample(nv_metallicmap_samp_state_s, v0.xy, int2(0, 0)).x;
  r0.z = sparespecularmap2_samp.SampleLevel(sparespecularmap2_samp_state_s, v0.xy, 0).x;
  r0.x = r0.x ? r0.z : r0.y;
  r0.z = translucentparm.x;
  r3.xy = r3.xy * float2(0.00392156886,0.00392156886) + -r0.xz;
  r6.xz = r2.ww * r3.xy + r0.xz;
  r0.y = r5.y;
  r6.xzw = r1.www ? r6.yxz : r0.yxz;
  r4.w = saturate(r6.x);
  r4.xyzw = float4(255,255,255,255) * r4.xyzw;
  r4.xyzw = (uint4)r4.xyzw;
  r0.xy = cmp(r3.zw >= float2(0,0));
  r0.xy = r0.xy ? float2(1,1) : float2(-1,-1);
  r7.xyz = float3(1,1,1) + -abs(r3.zwz);
  r0.xy = r7.yz * r0.xy;
  r7.x = r7.x + -abs(r3.w);
  r0.z = cmp(r7.x >= 0);
  r7.yz = r0.zz ? r3.zw : r0.xy;
  r0.x = dot(r7.xyz, r7.xyz);
  r0.x = rsqrt(r0.x);
  r0.xyz = r7.xyz * r0.xxx;
  r0.xyz = r0.xyz * float3(0.5,0.5,0.5) + float3(0.5,0.5,0.5);
  r0.xyz = r0.xyz * float3(2,2,2) + float3(-1,-1,-1);
  r0.xyz = -r1.xyz * r0.www + r0.xyz;
  r1.xyz = r1.xyz * r0.www + float3(1,1,1);
  r1.xyz = float3(0.5,0.5,0.5) * r1.xyz;
  r0.xyz = r2.www * r0.xyz + r2.xyz;
  r0.xyz = float3(1,1,1) + r0.xyz;
  r0.xyz = float3(0.5,0.5,0.5) * r0.xyz;
  r0.xyz = r1.www ? r0.xyz : r1.xyz;
  r0.xyz = r0.xyz * float3(2,2,2) + float3(-1,-1,-1);
  r0.w = abs(r0.y) + abs(r0.z);
  r0.w = r0.w + abs(r0.x);
  r0.xyz = r0.xyz / r0.www;
  r1.xy = float2(1,1) + -abs(r0.zy);
  r2.xyz = cmp(r0.xyz >= float3(0,0,0));
  r0.xw = r2.yz ? float2(1,1) : float2(-1,-1);
  r0.xw = r1.xy * r0.xw;
  r0.xy = r2.xx ? r0.yz : r0.xw;
  r0.xy = r0.xy * float2(0.5,0.5) + float2(0.5,0.5);
  r1.y = v1.z;
  r1.z = v2.z;
  r1.x = v3.z;
  r1.w = dot(r1.xyz, r1.xyz);
  r1.w = rsqrt(r1.w);
  r1.xyz = r1.xyz * r1.www;
  r1.w = abs(r1.y) + abs(r1.z);
  r1.w = r1.w + abs(r1.x);
  r1.xyz = r1.xyz / r1.www;
  r2.xy = float2(1,1) + -abs(r1.zy);
  r3.xyz = cmp(r1.xyz >= float3(0,0,0));
  r1.xw = r3.yz ? float2(1,1) : float2(-1,-1);
  r1.xw = r2.xy * r1.xw;
  r1.xy = r3.xx ? r1.yz : r1.xw;
  r0.zw = r1.xy * float2(0.5,0.5) + float2(0.5,0.5);
  r0.xyzw = float4(255,255,255,255) * r0.xyzw;
  r0.xyzw = (uint4)r0.xyzw;
  bitmask.x = ((~(-1 << 8)) << 8) & 0xffffffff;  r0.x = (((uint)r0.x << 8) & bitmask.x) | ((uint)0 & ~bitmask.x);
  bitmask.y = ((~(-1 << 8)) << 8) & 0xffffffff;  r0.y = (((uint)r0.y << 8) & bitmask.y) | ((uint)0 & ~bitmask.y);
  bitmask.z = ((~(-1 << 8)) << 8) & 0xffffffff;  r0.z = (((uint)r0.z << 8) & bitmask.z) | ((uint)0 & ~bitmask.z);
  bitmask.w = ((~(-1 << 8)) << 8) & 0xffffffff;  r0.w = (((uint)r0.w << 8) & bitmask.w) | ((uint)0 & ~bitmask.w);
  bitmask.x = ((~(-1 << 8)) << 0) & 0xffffffff;  r0.x = (((uint)r4.x << 0) & bitmask.x) | ((uint)r0.x & ~bitmask.x);
  bitmask.y = ((~(-1 << 8)) << 0) & 0xffffffff;  r0.y = (((uint)r4.y << 0) & bitmask.y) | ((uint)r0.y & ~bitmask.y);
  bitmask.z = ((~(-1 << 8)) << 0) & 0xffffffff;  r0.z = (((uint)r4.z << 0) & bitmask.z) | ((uint)r0.z & ~bitmask.z);
  bitmask.w = ((~(-1 << 8)) << 0) & 0xffffffff;  r0.w = (((uint)r4.w << 0) & bitmask.w) | ((uint)r0.w & ~bitmask.w);
  r0.xyzw = (uint4)r0.xyzw;
  o0.xyzw = float4(1.52590219e-05,1.52590219e-05,1.52590219e-05,1.52590219e-05) * r0.xyzw;
  r6.y = r5.x;
  r0.x = 255 * r5.z;
  r1.x = 127 * pastrate.x;
  r1.y = cmp(rimrate.z == 0.000000);
  r1.z = pastrate.x * 127 + 128;
  r6.x = r1.y ? r1.x : r1.z;
  r1.xyzw = float4(1,255,255,255) * r6.xyzw;
  r1.xyzw = (uint4)r1.xyzw;
  r0.yzw = float3(0,0,0);
  r0.xyzw = (uint4)r0.xyzw;
  bitmask.x = ((~(-1 << 8)) << 8) & 0xffffffff;  r0.x = (((uint)r0.x << 8) & bitmask.x) | ((uint)0 & ~bitmask.x);
  bitmask.y = ((~(-1 << 24)) << 8) & 0xffffffff;  r0.y = (((uint)r0.y << 8) & bitmask.y) | ((uint)0 & ~bitmask.y);
  bitmask.z = ((~(-1 << 24)) << 8) & 0xffffffff;  r0.z = (((uint)r0.z << 8) & bitmask.z) | ((uint)0 & ~bitmask.z);
  bitmask.w = ((~(-1 << 24)) << 8) & 0xffffffff;  r0.w = (((uint)r0.w << 8) & bitmask.w) | ((uint)0 & ~bitmask.w);
  bitmask.x = ((~(-1 << 8)) << 0) & 0xffffffff;  r0.x = (((uint)r1.x << 0) & bitmask.x) | ((uint)r0.x & ~bitmask.x);
  bitmask.y = ((~(-1 << 8)) << 0) & 0xffffffff;  r0.y = (((uint)r1.y << 0) & bitmask.y) | ((uint)r0.y & ~bitmask.y);
  bitmask.z = ((~(-1 << 8)) << 0) & 0xffffffff;  r0.z = (((uint)r1.z << 0) & bitmask.z) | ((uint)r0.z & ~bitmask.z);
  bitmask.w = ((~(-1 << 8)) << 0) & 0xffffffff;  r0.w = (((uint)r1.w << 0) & bitmask.w) | ((uint)r0.w & ~bitmask.w);
  r0.xyzw = (uint4)r0.xyzw;
  o1.xyzw = float4(1.52590219e-05,1.52590219e-05,1.52590219e-05,1.52590219e-05) * r0.xyzw;
  r0.x = enlightenfactor.z * enlboostparm.y;
  r0.x = enlightenlightingtype.y * r0.x;
  r0.x = max(0, r0.x);
  r0.x = min(32, r0.x);
  o2.xyz = r0.xxx * float3(10,10,10) + float3(32,32,32);
  o2.w = 1;
  o3.xyzw = float4(0,0,0,0);
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//   using 3Dmigoto v1.3.16 on Sat Oct  9 00:19:36 2021
//
//
// Buffer Definitions:
//
// cbuffer fblock
// {
//
//   float4 translucentparm;            // Offset:    0 Size:    16
//   float4 clipthreshold;              // Offset:   16 Size:    16
//   float4 smatrix;                    // Offset:   32 Size:    16
//   float4 tmatrix;                    // Offset:   48 Size:    16
//   float4 displacementscale;          // Offset:   64 Size:    16
//   float4 smatrix1;                   // Offset:   80 Size:    16
//   float4 tmatrix1;                   // Offset:   96 Size:    16
//   float4 pastrate;                   // Offset:  112 Size:    16
//   float4 rimrate;                    // Offset:  128 Size:    16
//   float4 scorchcolor;                // Offset:  144 Size:    16
//   float4 debugcolor;                 // Offset:  160 Size:    16
//   float4 albedoshifter;              // Offset:  176 Size:    16
//   float4 albedooffset;               // Offset:  192 Size:    16
//   float4 roughnessshifter;           // Offset:  208 Size:    16
//   float4 roughnessoffset;            // Offset:  224 Size:    16
//   float4 sprimrate;                  // Offset:  240 Size:    16
//   float4 itemparm;                   // Offset:  256 Size:    16
//   float4 materialid;                 // Offset:  272 Size:    16
//   float4 clothparam;                 // Offset:  288 Size:    16
//   float4 enlboostparm;               // Offset:  304 Size:    16
//   float4 enlightenfactor;            // Offset:  320 Size:    16
//   float4 enlightenlightingtype;      // Offset:  336 Size:    16
//   float4 renderpositiontoviewtexture;// Offset:  352 Size:    16
//   float4 viewmatrixx;                // Offset:  368 Size:    16
//   float4 viewmatrixy;                // Offset:  384 Size:    16
//   float4 viewmatrixz;                // Offset:  400 Size:    16
//   float4 lightprepassinverseparams;  // Offset:  416 Size:    16
//   float4 depthblendparm;             // Offset:  432 Size:    16
//   float4 binkmaskrate;               // Offset:  448 Size:    16
//   float4 fsbinkblendrate;            // Offset:  464 Size:    16
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// nv_albedomap_samp_state           sampler      NA          NA    0        1
// nv_normalmap_samp_state           sampler      NA          NA    1        1
// nv_roughnessmap_samp_state        sampler      NA          NA    2        1
// nv_metallicmap_samp_state         sampler      NA          NA    3        1
// transmap_samp_state               sampler      NA          NA    4        1
// texturemap_samp_state             sampler      NA          NA    5        1
// spare1map_samp_state              sampler      NA          NA    6        1
// spare2map_samp_state              sampler      NA          NA    7        1
// sparespecularmap2_samp_state      sampler      NA          NA    8        1
// sparespecularmap_samp_state       sampler      NA          NA    9        1
// viewdepthmap_samp_state           sampler      NA          NA   10        1
// viewblendmap2_samp_state          sampler      NA          NA   11        1
// viewblendmap0_samp_state          sampler      NA          NA   12        1
// binky_samp_state                  sampler      NA          NA   13        1
// binkcr_samp_state                 sampler      NA          NA   14        1
// binkcb_samp_state                 sampler      NA          NA   15        1
// nv_albedomap_samp                 texture  float4          2d    0        1
// nv_normalmap_samp                 texture  float4          2d    1        1
// nv_roughnessmap_samp              texture  float4          2d    2        1
// nv_metallicmap_samp               texture  float4          2d    3        1
// transmap_samp                     texture  float4          2d    4        1
// texturemap_samp                   texture  float4          2d    5        1
// spare1map_samp                    texture  float4          2d    6        1
// spare2map_samp                    texture  float4          2d    7        1
// sparespecularmap2_samp            texture  float4          2d    8        1
// sparespecularmap_samp             texture  float4          2d    9        1
// viewdepthmap_samp                 texture  float4          2d   10        1
// viewblendmap2_samp                texture  float4          2d   11        1
// viewblendmap0_samp                texture  float4          2d   12        1
// binky_samp                        texture  float4          2d   13        1
// binkcr_samp                       texture  float4          2d   14        1
// binkcb_samp                       texture  float4          2d   15        1
// fblock                            cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                 0   xyzw        0     NONE   float   xy
// TEXCOORD                 1   xyzw        1     NONE   float   xyz
// TEXCOORD                 2   xyzw        2     NONE   float   xyz
// TEXCOORD                 3   xyzw        3     NONE   float   xyz
// TEXCOORD                 4   xyzw        4     NONE   float   xyzw
// TEXCOORD                 5   xyzw        5     NONE   float   xyzw
// SV_Position              0   xyzw        6      POS   float   xyz
// SV_IsFrontFace           0   x           7    FFACE    uint   x
//
//
// 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
// SV_Target                2   xyzw        2   TARGET   float   xyzw
// SV_Target                3   xyzw        3   TARGET   float   xyzw
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[30], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_sampler s2, mode_default
dcl_sampler s3, mode_default
dcl_sampler s4, mode_default
dcl_sampler s5, mode_default
dcl_sampler s6, mode_default
dcl_sampler s7, mode_default
dcl_sampler s8, mode_default
dcl_sampler s9, mode_default
dcl_sampler s10, mode_default
dcl_sampler s11, mode_default
dcl_sampler s12, mode_default
dcl_sampler s13, mode_default
dcl_sampler s14, mode_default
dcl_sampler s15, 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) t2
dcl_resource_texture2d (float,float,float,float) t3
dcl_resource_texture2d (float,float,float,float) t4
dcl_resource_texture2d (float,float,float,float) t5
dcl_resource_texture2d (float,float,float,float) t6
dcl_resource_texture2d (float,float,float,float) t7
dcl_resource_texture2d (float,float,float,float) t8
dcl_resource_texture2d (float,float,float,float) t9
dcl_resource_texture2d (float,float,float,float) t10
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_input_ps linear v0.xy
dcl_input_ps linear v1.xyz
dcl_input_ps linear v2.xyz
dcl_input_ps linear v3.xyz
dcl_input_ps linear v4.xyzw
dcl_input_ps linear v5.xyzw
dcl_input_ps_siv linear noperspective v6.xyz, position
dcl_input_ps_sgv v7.x, is_front_face
dcl_output o0.xyzw
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_temps 8
sample_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r0.xyzw, v0.xyxx, t0.xyzw, s0
add r0.w, r0.w, -cb0[1].x
mul r0.xyz, r0.xyzx, cb0[9].xyzx
mad r0.xyz, r0.xyzx, cb0[10].wwww, cb0[10].xyzx
add r0.xyz, r0.xyzx, cb0[11].xyzx
add_sat r0.xyz, r0.xyzx, cb0[12].xxxx
lt r0.w, r0.w, l(0.000000)
discard_nz r0.w
mov r1.xy, v0.xyxx
mov r1.z, l(1.000000)
dp3 r2.x, r1.xyzx, cb0[2].xywx
dp3 r2.y, r1.xyzx, cb0[3].xywx
sample_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r2.xy, r2.xyxx, t4.xyzw, s4
add r2.xy, r2.xyxx, l(-0.500000, -0.500000, 0.000000, 0.000000)
dp2 r0.w, r2.xyxx, r2.xyxx
add r0.w, r0.w, l(-0.250000)
sqrt r2.z, |r0.w|
dp3 r0.w, r2.xyzx, r2.xyzx
rsq r0.w, r0.w
sample_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r2.zw, v0.xyxx, t1.zwxy, s1
add r3.xy, r2.wzww, l(-0.500000, -0.500000, 0.000000, 0.000000)
mad r2.xy, r2.xyxx, r0.wwww, r3.xyxx
dp2 r0.w, r3.xyxx, r3.xyxx
add r0.w, r0.w, l(-0.250000)
sqrt r2.z, |r0.w|
dp3 r0.w, r2.xyzx, r2.xyzx
rsq r0.w, r0.w
mov r3.z, r2.z
mad r2.xyz, r2.xyzx, r0.wwww, -r3.xyzx
sample_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r0.w, v0.xyxx, t5.yzwx, s5
mul_sat r0.w, r0.w, cb0[4].x
mad r2.xyz, r0.wwww, r2.xyzx, r3.xyzx
dp3 r0.w, r2.xyzx, r2.xyzx
rsq r0.w, r0.w
mul r2.xyz, r0.wwww, r2.xyzx
dp3 r3.x, r1.xyzx, cb0[5].xywx
dp3 r3.y, r1.xyzx, cb0[6].xywx
sample_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r1.xy, r3.xyxx, t6.xyzw, s6
add r1.xy, r1.xyxx, l(-0.500000, -0.500000, 0.000000, 0.000000)
dp2 r0.w, r1.xyxx, r1.xyxx
add r0.w, r0.w, l(-0.250000)
sqrt r1.z, |r0.w|
dp3 r0.w, r1.xyzx, r1.xyzx
rsq r0.w, r0.w
mad r1.xy, r1.xyxx, r0.wwww, r2.xyxx
mov r1.z, r2.z
dp3 r0.w, r1.xyzx, r1.xyzx
rsq r0.w, r0.w
mad r1.xyz, r1.xyzx, r0.wwww, -r2.xyzx
sample_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r0.w, v0.xyxx, t7.yzwx, s7
mov_sat r1.w, cb0[4].z
mul r0.w, r0.w, r1.w
mad r1.xyz, r0.wwww, r1.xyzx, r2.xyzx
dp3 r0.w, r1.xyzx, r1.xyzx
rsq r0.w, r0.w
mul r1.xyz, r0.wwww, r1.xyzx
dp3 r2.y, r1.xyzx, v1.xyzx
dp3 r2.z, r1.xyzx, v2.xyzx
dp3 r2.x, r1.xyzx, v3.xyzx
dp3 r0.w, r2.xyzx, r2.xyzx
rsq r0.w, r0.w
mul r1.xyz, r0.wwww, r2.xyzx
movc r0.w, v7.x, l(1.000000), l(-1.000000)
mul r2.xyz, r0.wwww, r1.xyzx
dp3 r3.z, r2.yzxy, cb0[25].xyzx
dp3 r3.x, r2.yzxy, cb0[23].xyzx
dp3 r3.y, r2.yzxy, cb0[24].xyzx
dp3 r1.w, r3.xyzx, r3.xyzx
rsq r1.w, r1.w
mul r3.xy, r1.wwww, r3.xyxx
mul r3.xy, r3.xyxx, cb0[22].zwzz
mad r3.zw, v6.xxxy, cb0[22].zzzw, cb0[22].xxxy
mad r3.xy, r3.xyxx, l(64.000000, 64.000000, 0.000000, 0.000000), r3.zwzz
sample_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r1.w, r3.xyxx, t15.yzwx, s15
mul r4.xyz, r1.wwww, l(0.000000, -0.391448975, 2.01782227, 0.000000)
sample_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r1.w, r3.xyxx, t14.yzwx, s14
sample_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r2.w, r3.xyxx, t13.yzwx, s13
mad r4.xyz, r1.wwww, l(1.59579468, -0.813476563, 0.000000, 0.000000), r4.xyzx
mad r4.xyz, r2.wwww, l(1.16412354, 1.16412354, 1.16412354, 0.000000), r4.xyzx
add r4.xyz, r4.xyzx, l(-0.870655060, 0.529705048, -1.08166885, 0.000000)
mul r4.xyz, r4.xyzx, cb0[28].xyzx
add r5.xyzw, v4.xyzw, -v5.xyzw
mad r6.xyzw, v6.zzzz, r5.xyzw, v5.xyzw
div r6.xyz, r6.xyzx, r6.wwww
add r6.xyz, r6.xyzx, cb0[26].xyzx
sample_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r1.w, r3.zwzz, t10.yzwx, s10
mad r5.xyzw, r1.wwww, r5.xyzw, v5.xyzw
div r5.xyz, r5.xyzx, r5.wwww
add r5.xyz, r5.xyzx, cb0[26].xyzx
add r5.xyz, -r6.xyzx, r5.xyzx
dp3 r1.w, r5.xyzx, r5.xyzx
sqrt r1.w, r1.w
lt r2.w, cb0[27].x, r1.w
div_sat r1.w, r1.w, cb0[27].x
movc r1.w, r2.w, l(1.000000), r1.w
add r2.w, -r1.w, l(1.000000)
lt r1.w, r1.w, l(1.000000)
sample_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r5.xyzw, r3.zwzz, t11.xyzw, s11
sample_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r3.xy, r3.zwzz, t12.zwxy, s12
mul r3.xy, r3.xyxx, l(65535.000000, 65535.000000, 0.000000, 0.000000)
ftou r3.xy, r3.xyxx
and r3.xy, r3.xyxx, l(255, 255, 0, 0)
mul r5.xyzw, r5.xyzw, l(65535.000000, 65535.000000, 65535.000000, 65535.000000)
ftou r5.xyzw, r5.xyzw
and r6.xyzw, r5.xyzw, l(255, 255, 255, 255)
ubfe r3.zw, l(0, 0, 8, 8), l(0, 0, 8, 8), r5.xxxy
utof r3.xyzw, r3.xyzw
mad r3.zw, r3.zzzw, l(0.000000, 0.000000, 0.00784313772, 0.00784313772), l(0.000000, 0.000000, -1.000000, -1.000000)
utof r5.xyzw, r6.xyzw
mad r5.xyz, r5.xyzx, l(0.00392156886, 0.00392156886, 0.00392156886, 0.000000), -r0.xyzx
mad r5.xyz, r2.wwww, r5.xyzx, r0.xyzx
movc r0.xyz, r1.wwww, r5.xyzx, r0.xyzx
mad r4.xyz, r4.xyzx, cb0[29].xxxx, r0.xyzx
ftou r0.x, cb0[17].x
and r0.xyz, r0.xxxx, l(1, 4, -5, 0)
utof r0.z, r0.z
ieq r0.xy, r0.xyxx, l(1, 4, 0, 0)
mul r0.z, r0.z, l(0.031250)
frc r0.z, r0.z
lt r5.x, l(0.000000), cb0[8].x
add r5.y, cb0[15].x, cb0[16].w
add r5.z, r5.y, l(32.000000)
movc r5.x, r5.x, r5.z, r5.y
mad r0.z, r0.z, l(32.000000), r5.x
mul r6.x, r0.z, l(0.00392156886)
mul r0.z, cb0[17].x, l(0.031250)
ge r5.y, r0.z, -r0.z
frc r0.z, |r0.z|
movc r0.z, r5.y, r0.z, -r0.z
mad r0.z, r0.z, l(32.000000), r5.x
mul r5.x, r0.z, l(0.00392156886)
sample_l_indexable(texture2d)(float,float,float,float) r0.z, v0.xyxx, t9.yzxw, s9, l(0.000000)
eq r7.x, r0.z, l(0.000000)
sample_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r7.y, v0.xyxx, t2.yxzw, s2
add r7.y, r7.y, cb0[13].x
add_sat r6.y, r7.y, cb0[14].x
add_sat r5.y, r6.y, cb0[18].y
movc r7.xy, r7.xxxx, r6.xyxx, r5.xyxx
lt r6.x, l(0.000000), cb0[18].z
ne r7.w, cb0[18].z, l(2.000000)
movc r7.z, r7.w, cb0[18].x, r0.z
mov r5.z, cb0[18].x
movc r7.xyz, r6.xxxx, r7.xyzx, r5.xyzx
mov r6.z, r5.x
mov r6.w, l(0)
movc r5.xyz, r0.yyyy, r7.xyzx, r6.zywz
mad r0.y, r5.w, l(0.00392156886), -r5.y
mad r6.y, r2.w, r0.y, r5.y
sample_aoffimmi_indexable(0,0,0)(texture2d)(float,float,float,float) r0.y, v0.xyxx, t3.yxzw, s3
sample_l_indexable(texture2d)(float,float,float,float) r0.z, v0.xyxx, t8.yzxw, s8, l(0.000000)
movc r0.x, r0.x, r0.z, r0.y
mov r0.z, cb0[0].x
mad r3.xy, r3.xyxx, l(0.00392156886, 0.00392156886, 0.000000, 0.000000), -r0.xzxx
mad r6.xz, r2.wwww, r3.xxyx, r0.xxzx
mov r0.y, r5.y
movc r6.xzw, r1.wwww, r6.yyxz, r0.yyxz
mov_sat r4.w, r6.x
mul r4.xyzw, r4.xyzw, l(255.000000, 255.000000, 255.000000, 255.000000)
ftou r4.xyzw, r4.xyzw
ge r0.xy, r3.zwzz, l(0.000000, 0.000000, 0.000000, 0.000000)
movc r0.xy, r0.xyxx, l(1.000000,1.000000,0,0), l(-1.000000,-1.000000,0,0)
add r7.xyz, -|r3.zwzz|, l(1.000000, 1.000000, 1.000000, 0.000000)
mul r0.xy, r0.xyxx, r7.yzyy
add r7.x, -|r3.w|, r7.x
ge r0.z, r7.x, l(0.000000)
movc r7.yz, r0.zzzz, r3.zzwz, r0.xxyx
dp3 r0.x, r7.xyzx, r7.xyzx
rsq r0.x, r0.x
mul r0.xyz, r0.xxxx, r7.xyzx
mad r0.xyz, r0.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000), l(0.500000, 0.500000, 0.500000, 0.000000)
mad r0.xyz, r0.xyzx, l(2.000000, 2.000000, 2.000000, 0.000000), l(-1.000000, -1.000000, -1.000000, 0.000000)
mad r0.xyz, -r1.xyzx, r0.wwww, r0.xyzx
mad r1.xyz, r1.xyzx, r0.wwww, l(1.000000, 1.000000, 1.000000, 0.000000)
mul r1.xyz, r1.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000)
mad r0.xyz, r2.wwww, r0.xyzx, r2.xyzx
add r0.xyz, r0.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
mul r0.xyz, r0.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000)
movc r0.xyz, r1.wwww, r0.xyzx, r1.xyzx
mad r0.xyz, r0.xyzx, l(2.000000, 2.000000, 2.000000, 0.000000), l(-1.000000, -1.000000, -1.000000, 0.000000)
add r0.w, |r0.z|, |r0.y|
add r0.w, |r0.x|, r0.w
div r0.xyz, r0.xyzx, r0.wwww
add r1.xy, -|r0.zyzz|, l(1.000000, 1.000000, 0.000000, 0.000000)
ge r2.xyz, r0.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
movc r0.xw, r2.yyyz, l(1.000000,0,0,1.000000), l(-1.000000,0,0,-1.000000)
mul r0.xw, r0.xxxw, r1.xxxy
movc r0.xy, r2.xxxx, r0.yzyy, r0.xwxx
mad r0.xy, r0.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000), l(0.500000, 0.500000, 0.000000, 0.000000)
mov r1.y, v1.z
mov r1.z, v2.z
mov r1.x, v3.z
dp3 r1.w, r1.xyzx, r1.xyzx
rsq r1.w, r1.w
mul r1.xyz, r1.wwww, r1.xyzx
add r1.w, |r1.z|, |r1.y|
add r1.w, |r1.x|, r1.w
div r1.xyz, r1.xyzx, r1.wwww
add r2.xy, -|r1.zyzz|, l(1.000000, 1.000000, 0.000000, 0.000000)
ge r3.xyz, r1.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
movc r1.xw, r3.yyyz, l(1.000000,0,0,1.000000), l(-1.000000,0,0,-1.000000)
mul r1.xw, r1.xxxw, r2.xxxy
movc r1.xy, r3.xxxx, r1.yzyy, r1.xwxx
mad r0.zw, r1.xxxy, l(0.000000, 0.000000, 0.500000, 0.500000), l(0.000000, 0.000000, 0.500000, 0.500000)
mul r0.xyzw, r0.xyzw, l(255.000000, 255.000000, 255.000000, 255.000000)
ftou r0.xyzw, r0.xyzw
bfi r0.xyzw, l(8, 8, 8, 8), l(8, 8, 8, 8), r0.xyzw, l(0, 0, 0, 0)
bfi r0.xyzw, l(8, 8, 8, 8), l(0, 0, 0, 0), r4.xyzw, r0.xyzw
utof r0.xyzw, r0.xyzw
mul o0.xyzw, r0.xyzw, l(0.0000152590219, 0.0000152590219, 0.0000152590219, 0.0000152590219)
mov r6.y, r5.x
mul r0.x, r5.z, l(255.000000)
mul r1.x, cb0[7].x, l(127.000000)
eq r1.y, cb0[8].z, l(0.000000)
mad r1.z, cb0[7].x, l(127.000000), l(128.000000)
movc r6.x, r1.y, r1.x, r1.z
mul r1.xyzw, r6.xyzw, l(1.000000, 255.000000, 255.000000, 255.000000)
ftou r1.xyzw, r1.xyzw
mov r0.yzw, l(0,0,0,0)
ftou r0.xyzw, r0.xyzw
bfi r0.xyzw, l(8, 24, 24, 24), l(8, 8, 8, 8), r0.xyzw, l(0, 0, 0, 0)
bfi r0.xyzw, l(8, 8, 8, 8), l(0, 0, 0, 0), r1.xyzw, r0.xyzw
utof r0.xyzw, r0.xyzw
mul o1.xyzw, r0.xyzw, l(0.0000152590219, 0.0000152590219, 0.0000152590219, 0.0000152590219)
mul r0.x, cb0[19].y, cb0[20].z
mul r0.x, r0.x, cb0[21].y
max r0.x, r0.x, l(0.000000)
min r0.x, r0.x, l(32.000000)
mad o2.xyz, r0.xxxx, l(10.000000, 10.000000, 10.000000, 0.000000), l(32.000000, 32.000000, 32.000000, 0.000000)
mov o2.w, l(1.000000)
mov o3.xyzw, l(0,0,0,0)
ret
// Approximately 231 instruction slots used

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