//Yakuza 6 HUD VS heat slots.
// ---- Created with 3Dmigoto v1.3.16 on Sun Apr 11 16:57:01 2021
Buffer<uint4> t17 : register(t17);

struct t16_t {
  float val[52];
};
StructuredBuffer<t16_t> t16 : register(t16);

cbuffer cb9 : register(b9)
{
  float4 cb9[8];
}

cbuffer cb0 : register(b0)
{
  float4 cb0[6];
}




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


void main(
  float4 v0 : POSITION0,
  float4 v1 : TEXCOORD0,
  float4 v2 : TEXCOORD1,
  uint v3 : SV_InstanceID0,
  out float4 o0 : TEXCOORD0,
  out float4 o1 : TEXCOORD1,
  out float4 o2 : TEXCOORD2,
  out float4 o3 : TEXCOORD3,
  out float4 o4 : TEXCOORD4,
  out float4 o5 : TEXCOORD5,
  out float4 o6 : TEXCOORD6,
  out float4 o7 : TEXCOORD7,
  out uint o8 : TEXCOORD11,
  out float4 o9 : SV_POSITION0)
{
// Needs manual fix for instruction:
// unknown dcl_: dcl_input_sgv v3.x, instance_id
  float4 r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10;
  uint4 bitmask, uiDest;
  float4 fDest;
  
  float4 stereo = StereoParams.Load(0);
  float4 iniparams = IniParams.Load(0);
  
  r0.x = 0x00040000 & asint(cb0[1].w);
  if (r0.x != 0) {
    r0.x = t17.Load(v3.x).x;
  } else {
    r0.x = v3.x;
  }
  r1.x = t16[r0.x].val[0/4];
  r1.y = t16[r0.x].val[0/4+1];
  r1.z = t16[r0.x].val[0/4+2];
  r1.w = t16[r0.x].val[0/4+3];
  r0.y = cmp(r1.w != 0.000000);
  if (r0.y != 0) {
    r0.y = t16[r0.x].val[16/4];
    r0.z = t16[r0.x].val[16/4+1];
    r0.w = t16[r0.x].val[16/4+2];
    r2.x = t16[r0.x].val[32/4];
    r2.y = t16[r0.x].val[32/4+1];
    r2.z = t16[r0.x].val[32/4+2];
    r2.w = t16[r0.x].val[32/4+3];
    r3.x = t16[r0.x].val[48/4];
    r3.y = t16[r0.x].val[48/4+1];
    r3.z = t16[r0.x].val[48/4+2];
    r4.xyzw = int4(128,4096,0x20004000,256) & asint(cb0[1].wwww);
    if (r4.x != 0) {
      r5.x = t16[r0.x].val[176/4];
      r5.y = t16[r0.x].val[176/4+1];
      r5.z = t16[r0.x].val[176/4+2];
      r6.x = t16[r0.x].val[192/4];
      r6.y = t16[r0.x].val[192/4+1];
      r6.z = t16[r0.x].val[192/4+2];
      r7.x = 1;
    } else {
      r5.xyz = float3(0,0,0);
      r6.xyz = float3(0,0,0);
      r7.x = 0;
    }
    r3.w = r4.y ? 1 : 0;
    r8.xyz = r4.yyy ? cb0[2].xyz : float3(0,0,0);
    r9.xyz = r4.yyy ? cb0[3].xyz : float3(0,0,0);
    r3.xy = v0.xy * r3.xy;
    r5.xyz = r3.xxx * r5.xyz;
    r5.xyz = r3.yyy * r6.xyz + r5.xyz;
    r7.y = 0;
    r5.xyz = v0.zzz * r7.yyx + r5.xyz;
    sincos(r3.z, r6.x, r7.x);
    r10.x = -r6.x;
    r10.y = r7.x;
    r7.x = dot(r10.yx, r3.xy);
    r10.z = r6.x;
    r7.y = dot(r10.zy, r3.xy);
    r7.z = v0.z;
    r3.xyz = r4.xxx ? r5.xyz : r7.xyz;
    r5.x = r3.w * r3.x;
    r5.y = dot(r8.xyz, r3.xyz);
    r5.z = dot(r9.xyz, r3.xyz);
    r3.xyz = r4.yyy ? r5.xyz : r3.xyz;
    r3.xy = cb0[0].xy * r3.xy;
    r2.xyz = r3.xyz + r2.xyz;
    o9.x = dot(cb9[4].xyzw, r2.xyzw);
    o9.y = dot(cb9[5].xyzw, r2.xyzw);
    r3.x = dot(cb9[6].xyzw, r2.xyzw);
    r2.w = dot(cb9[7].xyzw, r2.xyzw);
    r5.x = t16[r0.x].val[64/4];
    r5.y = t16[r0.x].val[64/4+1];
    r5.z = t16[r0.x].val[64/4+2];
    r5.w = t16[r0.x].val[64/4+3];
    o1.xyzw = v1.xyzw + r5.xyzw;
    r5.x = t16[r0.x].val[96/4];
    r5.y = t16[r0.x].val[96/4+1];
    r5.z = t16[r0.x].val[96/4+2];
    r5.w = t16[r0.x].val[96/4+3];
    o2.xyzw = v2.xyzw + r5.xyzw;
    r5.x = t16[r0.x].val[80/4];
    r5.y = t16[r0.x].val[80/4+1];
    r5.z = t16[r0.x].val[80/4+2];
    r5.w = t16[r0.x].val[80/4+3];
    o5.xyzw = v1.xyzw + r5.xyzw;
    r5.x = t16[r0.x].val[112/4];
    r5.y = t16[r0.x].val[112/4+1];
    r5.z = t16[r0.x].val[112/4+2];
    r5.w = t16[r0.x].val[112/4+3];
    o6.xyzw = v2.xyzw + r5.xyzw;
    o7.x = t16[r0.x].val[128/4];
    o7.y = t16[r0.x].val[128/4+1];
    o7.z = t16[r0.x].val[128/4+2];
    o7.w = t16[r0.x].val[128/4+3];
    r3.yzw = cb9[0].xyz * v0.xxx;
    r3.yzw = v0.yyy * cb9[1].xyz + r3.yzw;
    r3.yzw = v0.zzz * cb9[2].xyz + r3.yzw;
    r0.yzw = r3.yzw + r0.yzw;
    o4.xyz = r4.zzz ? r0.yzw : float3(0,0,0);
    o4.w = r3.x / r2.w;
    if (r4.w != 0) {
      r2.z = t16[r0.x].val[60/4];
    } else {
      r2.z = 0;
    }
    r2.x = t16[r0.x].val[188/4];
    r2.y = t16[r0.x].val[204/4];
    o9.z = r2.w * cb0[0].z + r3.x;
    r0.y = 0x00008000 & asint(cb0[1].w);
    o8.x = r0.y ? r0.x : cb0[5].w;
    o3.xyzw = r2.xyzw;
    o9.w = r2.w;
	
	if (o9.w==1) {
	  o9.x=o9.x*iniparams.y;
  	  o9.x+=stereo.x*iniparams.x*o9.w;
	}
	
  } else {
    o1.xyzw = float4(0,0,0,0);
    o2.xyzw = float4(0,0,0,0);
    o3.xyzw = float4(0,0,0,0);
    o4.xyzw = float4(0,0,0,0);
    o5.xyzw = float4(0,0,0,0);
    o6.xyzw = float4(0,0,0,0);
    o7.xyzw = float4(0,0,0,0);
    o9.xyzw = float4(0,0,0,0);
    o8.x = 0;
  }
  o0.xyzw = r1.xyzw;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v1.3.16 on Sun Apr 11 16:57:01 2021
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyz
// TEXCOORD                 0   xyzw        1     NONE   float   xyzw
// TEXCOORD                 1   xyzw        2     NONE   float   xyzw
// SV_InstanceID            0   x           3   INSTID    uint   x
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                 0   xyzw        0     NONE   float   xyzw
// TEXCOORD                 1   xyzw        1     NONE   float   xyzw
// TEXCOORD                 2   xyzw        2     NONE   float   xyzw
// TEXCOORD                 3   xyzw        3     NONE   float   xyzw
// TEXCOORD                 4   xyzw        4     NONE   float   xyzw
// TEXCOORD                 5   xyzw        5     NONE   float   xyzw
// TEXCOORD                 6   xyzw        6     NONE   float   xyzw
// TEXCOORD                 7   xyzw        7     NONE   float   xyzw
// TEXCOORD                11   x           8     NONE    uint   x
// SV_POSITION              0   xyzw        9      POS   float   xyzw
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[6], immediateIndexed
dcl_constantbuffer cb9[8], immediateIndexed
dcl_resource_structured t16, 208
dcl_resource_buffer (uint,uint,uint,uint) t17
dcl_input v0.xyz
dcl_input v1.xyzw
dcl_input v2.xyzw
dcl_input_sgv v3.x, instance_id
dcl_output o0.xyzw
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_output o4.xyzw
dcl_output o5.xyzw
dcl_output o6.xyzw
dcl_output o7.xyzw
dcl_output o8.x
dcl_output_siv o9.xyzw, position
dcl_temps 11
and r0.x, l(0x00040000), cb0[1].w
if_nz r0.x
  ld_indexable(buffer)(uint,uint,uint,uint) r0.x, v3.xxxx, t17.xyzw
else
  mov r0.x, v3.x
endif
ld_structured_indexable(structured_buffer, stride=208)(mixed,mixed,mixed,mixed) r1.xyzw, r0.x, l(0), t16.xyzw
ne r0.y, r1.w, l(0.000000)
if_nz r0.y
  ld_structured_indexable(structured_buffer, stride=208)(mixed,mixed,mixed,mixed) r0.yzw, r0.x, l(16), t16.xxyz
  ld_structured_indexable(structured_buffer, stride=208)(mixed,mixed,mixed,mixed) r2.xyzw, r0.x, l(32), t16.xyzw
  ld_structured_indexable(structured_buffer, stride=208)(mixed,mixed,mixed,mixed) r3.xyz, r0.x, l(48), t16.xyzx
  and r4.xyzw, l(128, 4096, 0x20004000, 256), cb0[1].wwww
  if_nz r4.x
    ld_structured_indexable(structured_buffer, stride=208)(mixed,mixed,mixed,mixed) r5.xyz, r0.x, l(176), t16.xyzx
    ld_structured_indexable(structured_buffer, stride=208)(mixed,mixed,mixed,mixed) r6.xyz, r0.x, l(192), t16.xyzx
    mov r7.x, l(1.000000)
  else
    mov r5.xyz, l(0,0,0,0)
    mov r6.xyz, l(0,0,0,0)
    mov r7.x, l(0)
  endif
  movc r3.w, r4.y, l(1.000000), l(0)
  movc r8.xyz, r4.yyyy, cb0[2].xyzx, l(0,0,0,0)
  movc r9.xyz, r4.yyyy, cb0[3].xyzx, l(0,0,0,0)
  mul r3.xy, r3.xyxx, v0.xyxx
  mul r5.xyz, r5.xyzx, r3.xxxx
  mad r5.xyz, r3.yyyy, r6.xyzx, r5.xyzx
  mov r7.y, l(0)
  mad r5.xyz, v0.zzzz, r7.yyxy, r5.xyzx
  sincos r6.x, r7.x, r3.z
  mov r10.x, -r6.x
  mov r10.y, r7.x
  dp2 r7.x, r10.yxyy, r3.xyxx
  mov r10.z, r6.x
  dp2 r7.y, r10.zyzz, r3.xyxx
  mov r7.z, v0.z
  movc r3.xyz, r4.xxxx, r5.xyzx, r7.xyzx
  mul r5.x, r3.x, r3.w
  dp3 r5.y, r8.xyzx, r3.xyzx
  dp3 r5.z, r9.xyzx, r3.xyzx
  movc r3.xyz, r4.yyyy, r5.xyzx, r3.xyzx
  mul r3.xy, r3.xyxx, cb0[0].xyxx
  add r2.xyz, r2.xyzx, r3.xyzx
  dp4 o9.x, cb9[4].xyzw, r2.xyzw
  dp4 o9.y, cb9[5].xyzw, r2.xyzw
  dp4 r3.x, cb9[6].xyzw, r2.xyzw
  dp4 r2.w, cb9[7].xyzw, r2.xyzw
  ld_structured_indexable(structured_buffer, stride=208)(mixed,mixed,mixed,mixed) r5.xyzw, r0.x, l(64), t16.xyzw
  add o1.xyzw, r5.xyzw, v1.xyzw
  ld_structured_indexable(structured_buffer, stride=208)(mixed,mixed,mixed,mixed) r5.xyzw, r0.x, l(96), t16.xyzw
  add o2.xyzw, r5.xyzw, v2.xyzw
  ld_structured_indexable(structured_buffer, stride=208)(mixed,mixed,mixed,mixed) r5.xyzw, r0.x, l(80), t16.xyzw
  add o5.xyzw, r5.xyzw, v1.xyzw
  ld_structured_indexable(structured_buffer, stride=208)(mixed,mixed,mixed,mixed) r5.xyzw, r0.x, l(112), t16.xyzw
  add o6.xyzw, r5.xyzw, v2.xyzw
  ld_structured_indexable(structured_buffer, stride=208)(mixed,mixed,mixed,mixed) o7.xyzw, r0.x, l(128), t16.xyzw
  mul r3.yzw, v0.xxxx, cb9[0].xxyz
  mad r3.yzw, v0.yyyy, cb9[1].xxyz, r3.yyzw
  mad r3.yzw, v0.zzzz, cb9[2].xxyz, r3.yyzw
  add r0.yzw, r0.yyzw, r3.yyzw
  movc o4.xyz, r4.zzzz, r0.yzwy, l(0,0,0,0)
  div o4.w, r3.x, r2.w
  if_nz r4.w
    ld_structured_indexable(structured_buffer, stride=208)(mixed,mixed,mixed,mixed) r2.z, r0.x, l(60), t16.xxxx
  else
    mov r2.z, l(0)
  endif
  ld_structured_indexable(structured_buffer, stride=208)(mixed,mixed,mixed,mixed) r2.x, r0.x, l(188), t16.xxxx
  ld_structured_indexable(structured_buffer, stride=208)(mixed,mixed,mixed,mixed) r2.y, r0.x, l(204), t16.xxxx
  mad o9.z, r2.w, cb0[0].z, r3.x
  and r0.y, l(0x00008000), cb0[1].w
  movc o8.x, r0.y, r0.x, cb0[5].w
  mov o3.xyzw, r2.xyzw
  mov o9.w, r2.w
else
  mov o1.xyzw, l(0,0,0,0)
  mov o2.xyzw, l(0,0,0,0)
  mov o3.xyzw, l(0,0,0,0)
  mov o4.xyzw, l(0,0,0,0)
  mov o5.xyzw, l(0,0,0,0)
  mov o6.xyzw, l(0,0,0,0)
  mov o7.xyzw, l(0,0,0,0)
  mov o9.xyzw, l(0,0,0,0)
  mov o8.x, l(0)
endif
mov o0.xyzw, r1.xyzw
ret
// Approximately 0 instruction slots used

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