//
// sub_54764 from 0x54764 to 0x547cc (104 bytes)
//
// 4 xrefs:
// > sub_444D8 @ 0x445c2
// > sub_46702 @ 0x4697e
// > sub_55C40 @ 0x55cd8
// > sub_62B54 @ 0x63e0e
//
// 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
//
int __fastcall sub_54764(int a1)
{
int v2; // r0
unsigned int v3; // r0
unsigned int v4; // r5
int result; // r0
int v6; // r0
unsigned int v7; // r1
unsigned int *v8; // r0
unsigned int v9; // r1
v2 = *(_DWORD *)(a1 + 248);
if ( !v2 )
goto LABEL_10;
if ( (*(_BYTE *)(a1 + 29) & 4) != 0 )
{
v3 = *(_DWORD *)(v2 + 44);
}
else
{
v3 = *(_DWORD *)(v2 + 44);
v4 = *(_DWORD *)(a1 + 44);
if ( v4 <= v3 )
goto LABEL_7;
}
v4 = v3;
LABEL_7:
result = sub_544A4(a1, 0, v4, nullptr);
if ( (result & 0xFFFFFFEF) != 0 )
return result;
v6 = *(_DWORD *)(a1 + 248);
v7 = *(_DWORD *)(v6 + 44);
if ( v7 > v4 )
sub_553E6(v6, v4, v7 - v4);
LABEL_10:
v8 = (unsigned int *)(a1 + 64);
__dmb(0xBu);
do
v9 = __ldrex(v8);
while ( __strex(v9 & 0xFFFFFFEF, v8) );
__dmb(0xBu);
return 0;
}