//
// std::__ndk1::recursive_timed_mutex::lock from 0xf7a060 to 0xf7a170 (272 bytes)
//
// 1 xrefs:
// > ??> @ 0xfcb50
//
// 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:13:45 +0000
//
__int64 __fastcall std::recursive_timed_mutex::lock(std::recursive_timed_mutex *this)
{
pthread_t v2; // x20
int v3; // w0
__int64 result; // x0
__int64 v5; // x8
pthread_mutex_t *mutex; // [xsp+8h] [xbp-38h] BYREF
char v7; // [xsp+10h] [xbp-30h]
__int64 v8; // [xsp+18h] [xbp-28h]
v8 = *(_QWORD *)(_ReadStatusReg(TPIDR_EL0) + 40);
v2 = pthread_self();
mutex = (pthread_mutex_t *)this;
v7 = 1;
v3 = pthread_mutex_lock((pthread_mutex_t *)this);
if ( v3 )
std::__throw_system_error(v3, "mutex lock failed");
result = pthread_equal(v2, *((_QWORD *)this + 12));
v5 = *((_QWORD *)this + 11);
if ( (_DWORD)result )
{
if ( v5 == -1 )
{
result = std::__throw_system_error(11, "recursive_timed_mutex lock limit reached");
v5 = *((_QWORD *)this + 11);
}
*((_QWORD *)this + 11) = v5 + 1;
}
else
{
if ( v5 )
{
do
result = std::condition_variable::wait((pthread_cond_t *)((char *)this + 40), (__int64)&mutex);
while ( *((_QWORD *)this + 11) );
}
*((_QWORD *)this + 11) = 1;
*((_QWORD *)this + 12) = v2;
}
if ( v7 )
result = pthread_mutex_unlock(mutex);
_ReadStatusReg(TPIDR_EL0);
return result;
}