//
// sub_D21384 from 0xd21384 to 0xd21420 (156 bytes)
//
// 0 xrefs:
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
__int64 __fastcall sub_D21384(__int64 a1, unsigned __int64 a2)
{
__int64 v2; // x2
__int64 result; // x0
unsigned __int64 *v4; // x2
unsigned __int8 v5; // [xsp+1Fh] [xbp+1Fh] BYREF
v2 = *(_QWORD *)(a1 + 64);
if ( v2 )
return *(unsigned __int8 *)(v2 + a2);
while ( 2 )
{
switch ( *(_BYTE *)(a1 + 56) )
{
case 0:
result = *(unsigned __int8 *)(*(_QWORD *)(a1 + 112) + a2);
break;
case 1:
v4 = *(unsigned __int64 **)(a1 + 112);
if ( *v4 <= a2 )
{
a2 -= *v4;
a1 = *(_QWORD *)(a1 + 120);
}
else
{
a1 = *(_QWORD *)(a1 + 112);
}
continue;
case 2:
case 3:
(*(void (__fastcall **)(_QWORD, unsigned __int64, __int64, unsigned __int8 *))(**(_QWORD **)(a1 + 112) + 16LL))(
*(_QWORD *)(a1 + 112),
a2,
1,
&v5);
result = v5;
break;
default:
continue;
}
return result;
}
}