//
// sub_1005878F4 from 0x1005878f4 to 0x1005879c4 (208 bytes)
//
// 1 xrefs:
// > sub_1005834D0 @ 0x10058432c
//
// 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_1005878F4(__int64 a1, int a2)
{
int *v4; // x21
int v5; // w8
void **v6; // x22
__int64 v7; // x23
void *v8; // x0
__int64 v9; // x8
v4 = (int *)(a1 + 35944);
v5 = *(_DWORD *)(a1 + 35944);
if ( v5 )
{
v6 = (void **)(a1 + 35952);
if ( v5 >= 1 )
{
v7 = 0;
do
{
sub_100574898(*((_QWORD *)*v6 + v7));
*((_QWORD *)*v6 + v7++) = 0;
}
while ( v7 < *v4 );
}
off_10085DEB8(*v6);
*v6 = nullptr;
*v4 = 0;
}
v8 = off_10085DED0(a2, 8u);
if ( !v8 )
return 27;
v9 = 0;
*v4 = a2;
*(_QWORD *)(a1 + 35952) = v8;
return v9;
}