//
// sub_10059AC20 from 0x10059ac20 to 0x10059acb0 (144 bytes)
//
// 0 xrefs:
//
// This function is hookable on this platform (idp: pc, 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 12:32:30 +0000
//
int __fastcall sub_10059AC20(__int64 a1, int a2)
{
_QWORD *v2; // r15
_QWORD *v3; // rax
__int64 v4; // r14
pthread_mutex_t *v5; // rbx
__int64 *v6; // r14
_QWORD *v7; // rax
__int64 v8; // rcx
v2 = operator new(0x10u);
v2[1] = 0;
*(_DWORD *)v2 = 3;
v3 = operator new(0x10u);
*(_OWORD *)v3 = 0;
*(_DWORD *)v3 = a2;
v3[1] = a1;
v2[1] = v3;
v4 = *(_QWORD *)(a1 + 136);
v5 = (pthread_mutex_t *)(v4 + 64);
pthread_mutex_lock((pthread_mutex_t *)(v4 + 64));
v6 = *(__int64 **)(v4 + 56);
v7 = operator new(0x18u);
v7[2] = v2;
v7[1] = v6;
v8 = *v6;
*v7 = *v6;
*(_QWORD *)(v8 + 8) = v7;
*v6 = (__int64)v7;
++v6[2];
return pthread_mutex_unlock(v5);
}