//
// sub_7769EC from 0x7769ec to 0x776a72 (134 bytes)
//
// 0 xrefs:
//
// 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_7769EC(int *a1)
{
int v1; // r1
unsigned int *v2; // r4
unsigned int *v3; // r3
unsigned int v4; // r2
unsigned int v6; // r3
unsigned int v7; // r3
unsigned int *v8; // r2
v1 = *a1;
v2 = (unsigned int *)a1[2];
a1[1] = 0;
a1[2] = 0;
(*(void (**)(void))(v1 + 8))();
if ( v2 )
{
if ( &pthread_create )
{
v3 = v2 + 1;
__dmb(0xFu);
do
v4 = __ldrex(v3);
while ( __strex(v4 - 1, v3) );
__dmb(0xFu);
if ( v4 != 1 )
return 0;
(*(void (__fastcall **)(unsigned int *))(*v2 + 8))(v2);
v8 = v2 + 2;
__dmb(0xFu);
do
v7 = __ldrex(v8);
while ( __strex(v7 - 1, v8) );
__dmb(0xFu);
}
else
{
v6 = v2[1];
v2[1] = v6 - 1;
if ( v6 != 1 )
return 0;
(*(void (__fastcall **)(unsigned int *))(*v2 + 8))(v2);
v7 = v2[2];
v2[2] = v7 - 1;
}
if ( v7 == 1 )
(*(void (__fastcall **)(unsigned int *))(*v2 + 12))(v2);
}
return 0;
}