//
// sub_1005731E8 from 0x1005731e8 to 0x1005732dc (244 bytes)
//
// 3 xrefs:
// > sub_10054EF98 @ 0x10054f03c
// > sub_10057302C @ 0x100573160
// > sub_1005736F8 @ 0x100573900
//
// 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:08:19 +0000
//
__int64 __fastcall sub_1005731E8(__int64 a1, __int64 a2, __int64 a3, int a4)
{
__int64 v8; // x19
__int64 v9; // x20
__int64 v11; // x8
__int64 v12; // x8
__int64 v13; // x9
__int64 v14; // x0
v8 = *(_QWORD *)(a1 + 40);
sub_1005DBDD8(v8);
if ( !*(_BYTE *)(a1 + 720) )
{
v11 = 0;
while ( *(unsigned __int8 *)(a1 + v11 + 724) != (_DWORD)a2 || *(unsigned __int8 *)(a1 + v11 + 725) != (_DWORD)a3 )
{
v11 += 16;
if ( v11 == 512 )
{
v12 = 0;
while ( 1 )
{
v13 = a1 + v12;
if ( *(unsigned __int8 *)(a1 + v12 + 724) == 255 )
break;
v12 += 16;
if ( v12 == 512 )
{
v9 = 28;
goto LABEL_3;
}
}
*(_BYTE *)(v13 + 724) = a2;
*(_BYTE *)(v13 + 725) = a3;
*(_DWORD *)(v13 + 728) = a4;
*(_DWORD *)(v13 + 732) = 0;
v14 = *(_QWORD *)(a1 + 24);
if ( v14 )
{
v9 = (*(__int64 (__fastcall **)(__int64, __int64, __int64, __int64))(*(_QWORD *)v14 + 56LL))(v14, a1, a2, a3);
if ( (_DWORD)v9 )
goto LABEL_3;
}
break;
}
}
}
v9 = 0;
LABEL_3:
sub_1005DBE08(v8);
return v9;
}