//
// __cxa_guard_acquire from 0x97ff80 to 0x97fff2 (114 bytes)
//
// 46 xrefs:
// > GameToolbox::gen_random @ 0x3d3e70
// > EmoteSprite::replaceTokens @ 0x3f41fc
// > sub_3F46FC @ 0x3f4710
// > LevelSettingsObject::getIDUseOrder @ 0x465b78
// > LevelSettingsObject::sanitizeIDName @ 0x468c34
// > LevelSettingsObject::getIDNames @ 0x468eb6
// > sub_587CFC @ 0x587d4c
// > cocos2d::CCCallFuncN::getClassTypeInfo @ 0x7bbabc
// > cocos2d::CCCallFuncND::getClassTypeInfo @ 0x7bbb00
// > cocos2d::CCCallFuncO::getClassTypeInfo @ 0x7bbb44
// > cocos2d::CCDirector::getClassTypeInfo @ 0x7c9be6
// > cocos2d::CCFileUtils::getClassTypeInfo @ 0x7e6ece
// > cocos2d::CCEGLView::sharedOpenGLView @ 0x7eab8a
// > sub_7EB71C @ 0x7eb730
// > cocos2d::CCIMEDispatcher::sharedDispatcher @ 0x7fe58a
// > cocos2d::CCTouchDispatcher::touchesBegan @ 0x8084b2
// > std::__ndk1::iostream_category @ 0x95c4a0
// > std::__ndk1::__cloc @ 0x95f980
// > std::__ndk1::locale::classic @ 0x96dcd0
// > std::__ndk1::locale::__global @ 0x96eb84
// > std::__ndk1::__time_get_c_storage::__weeks @ 0x9734e2
// > std::__ndk1::__time_get_c_storage::__weeks @ 0x973500
// > std::__ndk1::__time_get_c_storage::__weeks @ 0x9736d2
// > std::__ndk1::__time_get_c_storage::__weeks @ 0x9736f0
// > std::__ndk1::__time_get_c_storage::__months @ 0x9738c2
// > std::__ndk1::__time_get_c_storage::__months @ 0x9738e0
// > std::__ndk1::__time_get_c_storage::__months @ 0x973b96
// > std::__ndk1::__time_get_c_storage::__months @ 0x973bb4
// > std::__ndk1::__time_get_c_storage::__am_pm @ 0x973e68
// > std::__ndk1::__time_get_c_storage::__am_pm @ 0x973e82
// > std::__ndk1::__time_get_c_storage::__am_pm @ 0x973f4c
// > std::__ndk1::__time_get_c_storage::__am_pm @ 0x973f66
// > std::__ndk1::__time_get_c_storage::__x @ 0x974030
// > std::__ndk1::__time_get_c_storage::__x @ 0x9740c0
// > std::__ndk1::__time_get_c_storage::__X @ 0x974164
// > std::__ndk1::__time_get_c_storage::__X @ 0x9741f4
// > std::__ndk1::__time_get_c_storage::__c @ 0x974298
// > std::__ndk1::__time_get_c_storage::__c @ 0x974328
// > std::__ndk1::__time_get_c_storage::__r @ 0x9743cc
// > std::__ndk1::__time_get_c_storage::__r @ 0x97445c
// > std::__ndk1::__get_sp_mut @ 0x976fbc
// > std::__ndk1::generic_category @ 0x97e198
// > std::__ndk1::system_category @ 0x97e268
// > std::__ndk1::__thread_local_data @ 0x97ea50
// > std::__ndk1::future_category @ 0x97ef7c
// > __cxa_thread_atexit @ 0x980c64
//
// 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 12:06:06 +0000
//
int _cxa_guard_acquire(__guard *a1)
{
int v2; // r5
if ( pthread_mutex_lock((pthread_mutex_t *)&unk_D33CD4) )
sub_981FC8("__cxa_guard_acquire failed to acquire mutex");
v2 = 0;
if ( !*(_BYTE *)a1 )
{
while ( (*a1 & 0xFF00) != 0 )
{
if ( pthread_cond_wait((pthread_cond_t *)&unk_D33CD8, (pthread_mutex_t *)&unk_D33CD4) )
sub_981FC8("__cxa_guard_acquire condition variable wait failed");
}
v2 = 0;
if ( !(unsigned __int8)*a1 )
{
v2 = 1;
*a1 = 256;
}
}
if ( pthread_mutex_unlock((pthread_mutex_t *)&unk_D33CD4) )
sub_981FC8("__cxa_guard_acquire failed to release mutex");
return v2;
}