//
// sub_1801129D0 from 0x1801129d0 to 0x180112abd (237 bytes)
//
// 4 xrefs:
// > sub_1800DA460 @ 0x1800da502
// > sub_180111FC0 @ 0x18011202e
// > sub_1801125B0 @ 0x180112764
// > ??> @ 0x180201c64
//
// 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:36 +0000
//
__int64 __fastcall sub_1801129D0(__int64 a1, unsigned __int8 a2, unsigned __int8 a3, int a4)
{
struct _RTL_CRITICAL_SECTION *v4; // r14
unsigned int v9; // ebx
unsigned int v10; // r10d
_BYTE *v11; // rax
__int64 v12; // rax
_BYTE *v13; // rcx
__int64 v14; // rax
__int64 v15; // rcx
unsigned int v16; // eax
v4 = *(struct _RTL_CRITICAL_SECTION **)(a1 + 40);
FMOD_OS_CriticalSection_Enter(v4);
v9 = 0;
if ( !*(_BYTE *)(a1 + 720) )
{
v10 = 0;
v11 = (_BYTE *)(a1 + 725);
while ( *(v11 - 1) != a2 || *v11 != a3 )
{
++v10;
v11 += 16;
if ( v10 >= 0x20 )
{
v12 = 0;
v13 = (_BYTE *)(a1 + 724);
while ( *v13 != 0xFF )
{
v12 = (unsigned int)(v12 + 1);
v13 += 16;
if ( (unsigned int)v12 >= 0x20 )
{
v9 = 28;
goto LABEL_13;
}
}
v14 = 2 * v12;
*(_BYTE *)(a1 + 8 * v14 + 724) = a2;
*(_BYTE *)(a1 + 8 * v14 + 725) = a3;
*(_DWORD *)(a1 + 8 * v14 + 728) = a4;
*(_DWORD *)(a1 + 8 * v14 + 732) = 0;
v15 = *(_QWORD *)(a1 + 24);
if ( v15 )
{
v16 = (*(__int64 (__fastcall **)(__int64, __int64, _QWORD, _QWORD))(*(_QWORD *)v15 + 56LL))(v15, a1, a2, a3);
if ( v16 )
v9 = v16;
}
break;
}
}
}
LABEL_13:
FMOD_OS_CriticalSection_Leave(v4);
return v9;
}