//
// sub_1004ACA10 from 0x1004aca10 to 0x1004acb2c (284 bytes)
//
// 1 xrefs:
// > ??> @ 0x100828460
//
// 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_1004ACA10(__int64 a1, __int64 a2, _DWORD *a3, int a4)
{
void (__fastcall *v8)(__int64, _QWORD); // x8
__int64 (__fastcall *v9)(__int64, int); // x9
__int64 v10; // x0
__int64 result; // x0
*(_QWORD *)a2 = *(_QWORD *)(a1 + 552);
v8 = *(void (__fastcall **)(__int64, _QWORD))(a1 + 536);
if ( v8 || !*(_QWORD *)(a1 + 520) && *(_QWORD *)(*(_QWORD *)(a1 + 408) + 70152LL) )
{
*(_DWORD *)(a1 + 476) = 46;
v9 = sub_1004AC828;
if ( !a4 )
v9 = sub_1004AC83C;
*(_QWORD *)(a2 + 48) = v9;
if ( v8 || (v8 = *(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)(a1 + 408) + 70152LL)) != nullptr )
v8(a2, *(_QWORD *)(a1 + 560));
if ( a4 )
{
v10 = *(_QWORD *)(a1 + 496);
if ( v10 )
{
sub_1004B5DA8(v10);
result = *(unsigned int *)(a1 + 476);
}
else
{
while ( 1 )
{
result = *(unsigned int *)(a1 + 476);
if ( (_DWORD)result != 46 )
break;
if ( *(_BYTE *)(a1 + 60) )
{
result = 46;
break;
}
sub_1004B586C(10);
}
}
}
else
{
result = *(unsigned int *)(a1 + 476);
if ( (_DWORD)result == 46 )
return result;
}
}
else
{
result = (*(__int64 (__fastcall **)(__int64, _QWORD, _QWORD, __int64))(*(_QWORD *)a1 + 56LL))(
a1,
*(_QWORD *)(a2 + 32),
*(unsigned int *)(a2 + 12),
a2 + 40);
}
*a3 = *(_DWORD *)(a2 + 40);
return result;
}