//
// sub_1005D2B78 from 0x1005d2b78 to 0x1005d2c94 (284 bytes)
//
// 1 xrefs:
// > ??> @ 0x1009abad0
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:09:32 +0000
//
__int64 __fastcall sub_1005D2B78(__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_1005D2990;
if ( !a4 )
v9 = sub_1005D29A4;
*(_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_1005DBF10(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_1005DB9D4(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;
}