//
// sub_100549588 from 0x100549588 to 0x100549694 (268 bytes)
//
// 2 xrefs:
// > sub_1005452FC @ 0x100545524
// > sub_1005467AC @ 0x1005469f4
//
// 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:07:49 +0000
//
__int64 __fastcall sub_100549588(__int64 a1, __int64 a2)
{
__int64 v3; // x0
__int64 v4; // x20
__int64 v5; // x22
__int64 v6; // x8
__int64 v7; // x23
__int64 v8; // x0
__int64 v9; // x0
int v10; // w8
__int64 v11; // x21
int v12; // w24
v3 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 64LL))(a2);
v4 = v3;
v5 = a1 + 1352;
v6 = *(_QWORD *)(a1 + 1352);
if ( !v6 )
goto LABEL_8;
v7 = a1 + 1352;
do
{
if ( *(_DWORD *)(v6 + 28) >= (int)v3 )
v7 = v6;
v6 = *(_QWORD *)(v6 + 8LL * (*(_DWORD *)(v6 + 28) < (int)v3));
}
while ( v6 );
if ( v7 == v5 || (int)v3 < *(_DWORD *)(v7 + 28) )
LABEL_8:
v7 = a1 + 1352;
v8 = cocos2d::CCDirector::sharedDirector();
if ( !(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v8 + 192LL))(v8)
|| (v9 = cocos2d::CCDirector::sharedDirector(),
*(_BYTE *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v9 + 192LL))(v9) + 128) != 1)
|| (v10 = *(_DWORD *)(a1 + 1264), v10 < 0)
|| v10 == (_DWORD)v4 )
{
sub_100549F0C(a1, v4, v7 == v5);
}
else
{
if ( v10 >= (int)v4 )
v11 = (unsigned int)v4;
else
v11 = (unsigned int)v10;
if ( v10 <= (int)v4 )
v10 = v4;
v12 = v10 + 1;
do
{
sub_100549F0C(a1, v11, v7 == v5);
v11 = (unsigned int)(v11 + 1);
}
while ( v12 != (_DWORD)v11 );
}
*(_DWORD *)(a1 + 1264) = v4;
return sub_100544EF0(a1);
}