//
// sub_1004B816C from 0x1004b816c to 0x1004b8214 (168 bytes)
//
// 1 xrefs:
// > sub_1004B7EC4 @ 0x1004b8098
//
// 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_1004B816C(__int64 a1, void *a2, __int64 a3, _DWORD *a4, _DWORD *a5)
{
__int64 result; // x0
__int64 v9; // x22
__int64 v10; // x8
size_t v11; // x20
__int64 v12; // [xsp+8h] [xbp-28h]
v12 = 0;
result = (*(__int64 (**)(void))(*(_QWORD *)(a1 + 40) + 88LL))();
if ( !(_DWORD)result )
{
v9 = v12;
v10 = *(_QWORD *)(v12 + 32);
if ( v10 )
{
v11 = (unsigned int)(4 * *a4 * *a5);
memcpy(a2, (const void *)(v10 + *(unsigned int *)(v12 + 72)), v11);
*(_DWORD *)(v9 + 72) += v11;
}
else
{
result = sub_1004469A8(*(_QWORD *)(v12 + 16), a2);
if ( (_DWORD)result )
return result;
}
return 0;
}
return result;
}