//
// sub_776974 from 0x776974 to 0x7769e8 (116 bytes)
//
// 2 xrefs:
// > ??> @ 0x776a8e
// > sub_776A9C @ 0x776b98
//
// 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
//
_DWORD *__fastcall sub_776974(_DWORD *result)
{
_DWORD *v1; // r4
unsigned int *v2; // r3
unsigned int v3; // r2
int v4; // r3
unsigned int v5; // r3
unsigned int *v6; // r5
v1 = result;
if ( !&pthread_create )
{
v4 = result[1];
result[1] = v4 - 1;
if ( v4 != 1 )
return result;
result = (_DWORD *)(*(int (__fastcall **)(_DWORD *))(*result + 8))(result);
v5 = v1[2];
v1[2] = v5 - 1;
goto LABEL_8;
}
v2 = result + 1;
__dmb(0xFu);
do
v3 = __ldrex(v2);
while ( __strex(v3 - 1, v2) );
__dmb(0xFu);
if ( v3 == 1 )
{
v6 = result + 2;
result = (_DWORD *)(*(int (__fastcall **)(_DWORD *))(*result + 8))(result);
__dmb(0xFu);
do
v5 = __ldrex(v6);
while ( __strex(v5 - 1, v6) );
__dmb(0xFu);
LABEL_8:
if ( v5 == 1 )
return (_DWORD *)(*(int (__fastcall **)(_DWORD *))(*v1 + 12))(v1);
}
return result;
}