//
// sub_E80BC from 0xe80bc to 0xe8170 (180 bytes)
//
// 1 xrefs:
// > sub_E817C @ 0xe8214
//
// 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_E80BC(int a1, __int64 a2, char *src, unsigned int a4)
{
int v5; // w8
unsigned int v6; // w9
unsigned int v9; // w21
int v10; // w22
int v11; // w21
if ( *(_BYTE *)(a2 + 32) )
return 1;
v5 = *(_DWORD *)(a2 + 8);
v6 = *(_DWORD *)(a2 + 12);
if ( v6 >= a4 )
v9 = a4;
else
v9 = *(_DWORD *)(a2 + 12);
if ( v9 + v5 >= v6 )
{
v10 = v6 - v5;
memcpy(
(void *)(*(_QWORD *)(a2 + 24) + (unsigned int)(*(_DWORD *)(a2 + 16) * v5)),
src,
*(_DWORD *)(a2 + 16) * (v6 - v5));
v5 = 0;
*(_DWORD *)(a2 + 8) = 0;
}
else
{
v10 = 0;
}
v11 = v9 - v10;
memcpy(
(void *)(*(_QWORD *)(a2 + 24) + (unsigned int)(*(_DWORD *)(a2 + 16) * v5)),
&src[*(_DWORD *)(a2 + 16) * v10],
(unsigned int)(*(_DWORD *)(a2 + 16) * v11));
*(_DWORD *)(a2 + 8) += v11;
return 0;
}