//
// FMOD_OS_Thread_Create from 0xe6e6c to 0xe6f9c (304 bytes)
//
// 4 xrefs:
// > .FMOD_OS_Thread_Create @ 0x109b0c
// > ??> @ 0x16a8
// > .FMOD_OS_Thread_Create @ 0x109b04
// > ??> @ 0x111648
//
// 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_Thread_Create(char *a1, __int64 a2, __int64 a3, __int64 a4, int a5, int a6, pthread_t *a7)
{
__int64 result; // x0
__int64 v15; // x8
__int64 v16; // x2
_QWORD *v17; // x0
void *v18; // x24
pthread_attr_t attr; // [xsp+8h] [xbp-78h] BYREF
pthread_t newthread; // [xsp+48h] [xbp-38h] BYREF
if ( !pthread_attr_init(&attr) && !pthread_attr_setdetachstate(&attr, 1) )
{
if ( (unsigned int)(a5 + 32775) <= 5 )
a5 = *((_DWORD *)&unk_4E7EC + a5 + 32775);
if ( (unsigned __int64)(a4 - 0x4000000000000001LL) < 3 )
a4 = 0;
if ( !pthread_attr_setstacksize(&attr, (unsigned int)(a6 + 0x8000)) )
{
sub_E7334();
v17 = sub_E2AC4(*(_QWORD *)(*(_QWORD *)v15 + 432LL), 288, v16, 483, 0);
if ( !v17 )
return 38;
v18 = v17;
*((_DWORD *)v17 + 2) = a5;
v17[35] = a4;
*v17 = a2;
v17[2] = a3;
sub_E3C94((_BYTE *)v17 + 24, a1, 256);
if ( !pthread_create(&newthread, &attr, (void *(*)(void *))sub_E6D38, v18) )
{
result = pthread_attr_destroy(&attr);
if ( !(_DWORD)result )
{
*a7 = newthread;
return result;
}
}
}
}
return 28;
}