//
// sub_1800F5350 from 0x1800f5350 to 0x1800f5591 (577 bytes)
//
// 7 xrefs:
// > sub_1800FD560 @ 0x1800fd5b9
// > sub_18011BE10 @ 0x18011be35
// > sub_18011C480 @ 0x18011c4a0
// > sub_18011D4A0 @ 0x18011d5db
// > ??> @ 0x18018ea2c
// > ??> @ 0x18018ea3c
// > ??> @ 0x180200860
//
// 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:23 +0000
//
__int64 __fastcall sub_1800F5350(__int64 a1, __int64 a2, __int64 a3, __int64 a4, int a5)
{
struct _RTL_CRITICAL_SECTION *v10; // r15
int v11; // ecx
__int64 v12; // r14
int v13; // r8d
__int64 v14; // r9
__int64 v15; // r10
int v16; // r9d
int v17; // r8d
__int64 v18; // r10
__int64 v19; // r11
int v20; // edx
int v21; // r8d
__int64 v22; // r10
__int64 v23; // r11
if ( !*(_DWORD *)(a1 + 24) )
return 67;
if ( !a5 )
return 31;
v10 = *(struct _RTL_CRITICAL_SECTION **)(a1 + 96);
FMOD_OS_CriticalSection_Enter(v10);
v11 = *(_DWORD *)(a1 + 24);
v12 = *(_QWORD *)(a1 + 32);
if ( a5 != 1 )
{
if ( !a4 )
{
v21 = 0;
v16 = *(_DWORD *)(a1 + 24);
if ( v11 / 2 > 0 )
{
v22 = 0;
v23 = *(_QWORD *)(a1 + 32);
do
{
v22 += 4;
v23 += 8;
++v21;
*(_DWORD *)(v23 - 8) = *(_DWORD *)(a2 + 8LL * *(_DWORD *)(v22 + *(_QWORD *)(a1 + 56) - 4) * a5);
*(_DWORD *)(v23 - 4) = *(_DWORD *)(a2 + 4LL * a5 * (2 * *(_DWORD *)(v22 + *(_QWORD *)(a1 + 56) - 4) + 1));
v16 = *(_DWORD *)(a1 + 24);
}
while ( v21 < v16 / 2 );
}
goto LABEL_19;
}
goto LABEL_12;
}
if ( a4 )
{
LABEL_12:
v17 = 0;
v16 = *(_DWORD *)(a1 + 24);
if ( v11 / 2 > 0 )
{
v18 = 0;
v19 = *(_QWORD *)(a1 + 32);
do
{
v18 += 4;
++v17;
v19 += 8;
*(float *)(v19 - 8) = *(float *)(a2 + 8LL * a5 * *(_DWORD *)(v18 + *(_QWORD *)(a1 + 56) - 4))
* *(float *)(a4 + 8LL * *(_DWORD *)(v18 + *(_QWORD *)(a1 + 56) - 4));
v20 = 2 * *(_DWORD *)(v18 + *(_QWORD *)(a1 + 56) - 4);
*(float *)(v19 - 4) = *(float *)(a2 + 4LL * a5 * (v20 + 1)) * *(float *)(a4 + 4LL * v20 + 4);
v16 = *(_DWORD *)(a1 + 24);
}
while ( v17 < v16 / 2 );
}
goto LABEL_19;
}
v13 = 0;
if ( v11 / 2 > 0 )
{
v14 = 0;
v15 = *(_QWORD *)(a1 + 32);
do
{
v14 += 4;
++v13;
v15 += 8;
*(_DWORD *)(v15 - 8) = *(_DWORD *)(a2 + 8LL * *(_DWORD *)(v14 + *(_QWORD *)(a1 + 56) - 4));
*(_DWORD *)(v15 - 4) = *(_DWORD *)(a2 + 8LL * *(_DWORD *)(v14 + *(_QWORD *)(a1 + 56) - 4) + 4);
v11 = *(_DWORD *)(a1 + 24);
}
while ( v13 < v11 / 2 );
}
v16 = v11;
LABEL_19:
(*(void (__fastcall **)(__int64, __int64, _QWORD))qword_1801F07F0)(
v12,
*(_QWORD *)(a1 + 48) + 4LL * v16,
(unsigned int)(v16 / 2));
(*(void (__fastcall **)(__int64, __int64, _QWORD, _QWORD))(qword_1801F07F0 + 16))(
v12,
a3,
*(_QWORD *)(a1 + 48),
*(unsigned int *)(a1 + 24));
FMOD_OS_CriticalSection_Leave(v10);
return 0;
}