//
// sub_687EA from 0x687ea to 0x6888c (162 bytes)
//
// 1 xrefs:
// > sub_692D0 @ 0x692d2
//
// 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_687EA(int *a1)
{
int result; // r0
int v3; // r3
unsigned int *v4; // r0
unsigned int v5; // r1
int v6; // r5
int v7; // r0
int *v8; // r0
int v9; // r1
a1[95] = 0;
a1[96] = 1065353216;
result = sub_64BD4(a1[32], 0, a1 + 102);
if ( !result )
{
v4 = (unsigned int *)(a1 + 23);
__dmb(0xBu);
do
v5 = __ldrex(v4);
while ( __strex(v5 | 0x10, v4) );
v6 = 0;
__dmb(0xBu);
while ( 1 )
{
v7 = a1[41];
if ( v6 >= *(_DWORD *)(v7 + 72) )
{
a1[117] = 0;
a1[118] = 0;
return sub_57958((_DWORD *)a1[32], a1 + 119);
}
v8 = *(int **)(*(_DWORD *)(v7 + 76) + 4 * v6);
v9 = *v8;
if ( *v8 )
{
if ( v9 == 2 )
{
result = sub_AB2D2(a1, v6, v8[10] != 0);
}
else
{
if ( v9 != 1 )
goto LABEL_14;
result = sub_AB28A(a1, v6, v8[12], v3);
}
}
else
{
result = sub_AB218(a1, v6, v8[12]);
}
if ( result )
return result;
LABEL_14:
++v6;
}
}
return result;
}