//
// sub_1004AAD64 from 0x1004aad64 to 0x1004aadd8 (116 bytes)
//
// 1 xrefs:
// > ??> @ 0x1008282d8
//
// 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_1004AAD64(__int64 a1, void *__dst, unsigned int a3, _DWORD *a4)
{
__int64 v6; // x9
unsigned int v7; // w11
size_t v8; // x21
__int64 v9; // x22
v6 = *(unsigned int *)(a1 + 496);
v7 = *(_DWORD *)(a1 + 36);
if ( (unsigned int)v6 + a3 <= v7 )
v8 = a3;
else
v8 = v7 - (unsigned int)v6;
v9 = 16 * (unsigned int)((unsigned int)v6 + a3 > v7);
memcpy(__dst, (const void *)(*(_QWORD *)(a1 + 504) + v6), v8);
*a4 = v8;
*(_DWORD *)(a1 + 496) += v8;
return v9;
}