//
// sub_BE986 from 0xbe986 to 0xbe9d0 (74 bytes)
//
// 2 xrefs:
// > sub_6505C @ 0x6510c
// > sub_6505C @ 0x65120
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:41:47 +0000
//
int __fastcall sub_BE986(int a1, int a2)
{
int v3; // r0
char v4; // r4
int v5; // r0
__int64 v6; // r0
if ( *(_BYTE *)(a1 + 56) )
{
v3 = *(_DWORD *)(a1 + 52);
v4 = a2;
if ( a2 )
{
if ( !v3 )
{
j_FMOD_OS_Time_GetUs(a1 + 12);
v3 = *(_DWORD *)(a1 + 52);
}
*(_DWORD *)(a1 + 52) = v3 + 1;
}
else
{
v5 = v3 - 1;
*(_DWORD *)(a1 + 52) = v5;
if ( !v5 )
{
j_FMOD_OS_Time_GetUs(a1 + 16);
v6 = *(_QWORD *)(a1 + 12);
if ( HIDWORD(v6) > (unsigned int)v6 )
*(_DWORD *)(a1 + 48) += HIDWORD(v6) - v6;
}
}
*(_BYTE *)(a1 + 44) = v4;
}
return 0;
}