//
// sub_1800D9EB0 from 0x1800d9eb0 to 0x1800da0f0 (576 bytes)
//
// 6 xrefs:
// > FMOD::SystemI::createClientProfile @ 0x1800e2d59
// > sub_1800E4E00 @ 0x1800e59a3
// > ??> @ 0x18018c6dc
// > ??> @ 0x18018c72c
// > ??> @ 0x18018c744
// > ??> @ 0x1801ff1b0
//
// 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 10:54:13 +0000
//
__int64 __fastcall sub_1800D9EB0(_QWORD *a1, char a2, __int16 a3)
{
_QWORD *v7; // rax
_QWORD *v8; // rbx
_QWORD *v9; // rsi
__int16 v10; // ax
_QWORD *v11; // r14
unsigned int v12; // ebp
__int64 (__fastcall *v13)(_QWORD *); // rdx
int v14; // eax
SOCKET v15; // rcx
_QWORD **v16; // rax
_QWORD **v17; // rdi
_QWORD *v18; // rdi
_QWORD *v19; // rcx
struct _RTL_CRITICAL_SECTION *v20; // rcx
if ( !a1 )
return 31;
v7 = sub_1800B6530(
*((_QWORD *)off_1801AED20 + 52),
88,
"C:\\buildagent1\\work\\570ad728b1678096\\core_api\\src\\fmod_profile.cpp",
24,
0,
0,
1);
v8 = v7;
if ( !v7 )
return 38;
*v7 = off_18016CE40;
v9 = v7 + 2;
v7[9] = 0;
v10 = 9264;
v11 = v8 + 5;
v8[3] = v8 + 2;
if ( a3 )
v10 = a3;
*v9 = v9;
*((_WORD *)v8 + 41) = v10;
v8[4] = 0;
v8[6] = v8 + 5;
*v11 = v11;
v8[7] = 0;
v8[1] = -1;
v8[8] = 0;
*((_BYTE *)v8 + 80) = a2;
v12 = sub_1800B7640();
if ( v12
|| (v12 = FMOD_OS_CriticalSection_Create((struct _RTL_CRITICAL_SECTION **)v8 + 8, 0)) != 0
|| (v12 = sub_1800C1770((DWORD *)v8 + 18)) != 0 )
{
v13 = *(__int64 (__fastcall **)(_QWORD *))(*v8 + 40LL);
if ( (char *)v13 == (char *)sub_1800DA0F0 )
v14 = sub_1800DA0F0(v8);
else
v14 = v13(v8);
if ( !v14 )
{
*((_BYTE *)v8 + 80) = 0;
if ( !(unsigned int)sub_1800DA550(v8) )
{
v15 = v8[1];
if ( v15 != -1 )
sub_180109E80(v15);
v16 = (_QWORD **)*v9;
if ( (_QWORD *)*v9 == v9 )
{
LABEL_19:
v18 = (_QWORD *)*v11;
if ( (_QWORD *)*v11 == v11 )
{
LABEL_24:
v20 = (struct _RTL_CRITICAL_SECTION *)v8[8];
if ( v20 )
FMOD_OS_CriticalSection_Free(v20, 0);
if ( !(unsigned int)sub_1800B7BC0() )
sub_1800B6AA0(*((_QWORD *)off_1801AED20 + 52), v8);
}
else
{
while ( 1 )
{
v19 = v18 - 1;
if ( !v18 )
v19 = nullptr;
v18 = (_QWORD *)v19[1];
*(_QWORD *)v19[2] = v18;
*(_QWORD *)(v19[1] + 8LL) = v19[2];
v19[2] = v19 + 1;
v19[1] = v19 + 1;
if ( (*(unsigned int (__fastcall **)(_QWORD *))(*v19 + 16LL))(v19) )
break;
if ( v18 == v11 )
goto LABEL_24;
}
}
}
else
{
while ( 1 )
{
v17 = (_QWORD **)*v16;
*v16[1] = *v16;
(*v16)[1] = v16[1];
v16[1] = v16;
*v16 = v16;
if ( (unsigned int)sub_1801128D0(v16) )
break;
v16 = v17;
if ( v17 == v9 )
goto LABEL_19;
}
}
}
}
return v12;
}
else
{
*a1 = v8;
return 0;
}
}