//
// sub_F31158 from 0xf31158 to 0xf31214 (188 bytes)
//
// 2 xrefs:
// > sub_F313B0 @ 0xf31490
// > sub_F313B0 @ 0xf31498
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 13:12:53 +0000
//
__int64 __fastcall sub_F31158(__int64 a1)
{
int i; // w20
unsigned int (__fastcall *v4)(_QWORD, _QWORD); // x2
pthread_mutex_t *v5; // x0
do
{
while ( 1 )
{
pthread_mutex_lock(*(pthread_mutex_t **)a1);
for ( i = *(_DWORD *)(a1 + 8); i == 1; i = *(_DWORD *)(a1 + 8) )
pthread_cond_wait((pthread_cond_t *)(*(_QWORD *)a1 + 40LL), *(pthread_mutex_t **)a1);
if ( i != 2 )
break;
v4 = *(unsigned int (__fastcall **)(_QWORD, _QWORD))(a1 + 16);
if ( v4 )
*(_DWORD *)(a1 + 40) |= v4(*(_QWORD *)(a1 + 24), *(_QWORD *)(a1 + 32)) == 0;
v5 = *(pthread_mutex_t **)a1;
*(_DWORD *)(a1 + 8) = 1;
pthread_cond_signal((pthread_cond_t *)&v5[1]);
pthread_mutex_unlock(*(pthread_mutex_t **)a1);
}
pthread_cond_signal((pthread_cond_t *)(*(_QWORD *)a1 + 40LL));
pthread_mutex_unlock(*(pthread_mutex_t **)a1);
}
while ( i );
return 0;
}