//
// sub_1800E6060 from 0x1800e6060 to 0x1800e62b4 (596 bytes)
//
// 6 xrefs:
// > FMOD::System::playSound @ 0x1800aff58
// > ??> @ 0x18018d7e0
// > ??> @ 0x18018d7f0
// > ??> @ 0x18018d804
// > ??> @ 0x18018d814
// > ??> @ 0x1801ffd50
//
// 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:17 +0000
//
__int64 __fastcall sub_1800E6060(__int64 a1, __int64 a2, __int64 a3, char a4, _QWORD *a5)
{
_QWORD *v5; // rbx
char v6; // r12
char v7; // di
__int64 v8; // rsi
unsigned int v11; // r15d
__int64 result; // rax
__int64 v13; // rcx
__int64 v14; // rcx
int v15; // ecx
int v16; // ecx
float v17; // xmm6_4
_QWORD *v18; // r14
_QWORD *v19; // rsi
__int64 v20; // rdi
__int64 v21; // rcx
__int64 v22; // rcx
unsigned int v23; // edi
__int64 v24; // [rsp+30h] [rbp-58h] BYREF
float v25; // [rsp+98h] [rbp+10h] BYREF
__int64 v26; // [rsp+A0h] [rbp+18h]
char v27; // [rsp+A8h] [rbp+20h]
v27 = a4;
v26 = a3;
v5 = a5;
v6 = 0;
v24 = 0;
v7 = a4;
v8 = a3;
v11 = -1;
if ( a5 )
*a5 = 0;
if ( !a2 )
return 31;
if ( *(_DWORD *)(a2 + 272) )
return 46;
if ( *(_DWORD *)(a2 + 36) == 11 )
return 19;
v13 = *(_QWORD *)(a2 + 280);
if ( v13 && *(int *)(v13 + 104) >= 0 )
{
result = sub_1800DDAC0(v13, &a5);
if ( (_DWORD)result )
return result;
v14 = *(_QWORD *)(a2 + 280);
if ( (int)a5 >= *(_DWORD *)(v14 + 104) )
{
v15 = *(_DWORD *)(v14 + 108);
if ( !v15 )
return 37;
v16 = v15 - 1;
if ( v16 )
{
if ( v16 == 1 )
{
v17 = 9999.0;
v18 = (_QWORD *)(a1 + 872);
v19 = *(_QWORD **)(a1 + 872);
if ( a1 == -496 )
v18 = nullptr;
while ( v19 != v18 )
{
v20 = (__int64)(v19 - 47);
if ( !v19 )
v20 = 0;
v21 = *(_QWORD *)(v20 + 472);
if ( v21
&& (v22 = *(_QWORD *)(v21 + 40)) != 0
&& *(_QWORD *)(v22 + 280) == *(_QWORD *)(a2 + 280)
&& ((*(void (__fastcall **)(__int64, float *))(*(_QWORD *)v20 + 64LL))(v20, &v25), v25 < v17) )
{
v24 = v20;
v17 = v25;
v11 = *(_DWORD *)(v20 + 464);
v19 = (_QWORD *)*v19;
}
else
{
v19 = (_QWORD *)*v19;
}
}
v7 = v27;
v8 = v26;
}
}
else
{
v6 = 1;
}
}
}
result = sub_1800FB080(a1, v11, a2, &v24);
if ( (_DWORD)result )
goto LABEL_31;
v23 = sub_1800CE3D0(v24, a2, v8, v7, 1, v6);
if ( v23 )
{
if ( v5 )
*v5 = 0;
sub_1800CFDB0(v24, 82);
return v23;
}
else
{
result = sub_1800D04F0(v24);
if ( (_DWORD)result || (result = sub_1800CE750(v24, 1), (_DWORD)result) )
{
LABEL_31:
if ( v5 )
*v5 = 0;
return result;
}
if ( v5 )
*v5 = *(_QWORD *)(v24 + 80);
return 0;
}
}