//
// FMOD_OS_CriticalSection_Create from 0xe6fa0 to 0xe7038 (152 bytes)
//
// 4 xrefs:
// > .FMOD_OS_CriticalSection_Create @ 0x107f6c
// > ??> @ 0x4ff0
// > .FMOD_OS_CriticalSection_Create @ 0x107f64
// > ??> @ 0x110878
//
// 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
//
__int64 __fastcall FMOD_OS_CriticalSection_Create(pthread_mutex_t **a1, char a2)
{
pthread_mutex_t *v3; // x20
__int64 v4; // x0
__int64 result; // x0
pthread_mutexattr_t attr; // [xsp+8h] [xbp-18h] BYREF
if ( (a2 & 1) != 0 )
{
v3 = (pthread_mutex_t *)&unk_155F54;
}
else
{
v4 = sub_E7334();
v3 = (pthread_mutex_t *)sub_E7390(v4);
if ( !v3 )
return 38;
}
if ( pthread_mutexattr_init(&attr) )
return 28;
if ( pthread_mutexattr_settype(&attr, 1) )
return 28;
if ( pthread_mutex_init(v3, &attr) )
return 28;
result = pthread_mutexattr_destroy(&attr);
if ( (_DWORD)result )
return 28;
*a1 = v3;
return result;
}