//
// sub_1800BEC70 from 0x1800bec70 to 0x1800bed9f (303 bytes)
//
// 4 xrefs:
// > ??> @ 0x18016bdd0
// > ??> @ 0x18018a3c0
// > ??> @ 0x18018a3d8
// > ??> @ 0x1801fd8e4
//
// 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 sub_1800BEC70(_QWORD *a1, int a2)
{
__int64 result; // rax
unsigned int v5; // ebx
void *v6; // rax
__int64 v7; // rax
void *v8; // rax
__int64 v9; // rdi
if ( !a1[9] )
return 67;
if ( !a2 )
return 0;
v5 = 0;
v6 = sub_1800B6530(
*((_QWORD *)off_1801AED20 + 52),
32,
"C:\\buildagent1\\work\\570ad728b1678096\\core_api\\src\\fmod_output_software.cpp",
72,
0,
0,
1);
if ( !v6 )
{
a1[8] = 0;
return 38;
}
v7 = sub_1800D0B60(v6);
a1[8] = v7;
if ( !v7 )
return 38;
result = sub_1800D0D00(v7, a1[9], a1, (unsigned int)a2);
if ( (_DWORD)result )
return result;
v8 = sub_1800B6880(
*((_QWORD *)off_1801AED20 + 52),
(unsigned int)(784 * a2),
"C:\\buildagent1\\work\\570ad728b1678096\\core_api\\src\\fmod_output_software.cpp",
81,
0);
a1[131] = v8;
if ( !v8 )
return 38;
if ( a2 <= 0 )
return 0;
while ( 1 )
{
v9 = 784LL * (int)v5;
sub_1800C7D90(v9 + a1[131]);
result = sub_1800D0E50(a1[8], v5, v9 + a1[131]);
if ( (_DWORD)result )
break;
if ( (int)++v5 >= a2 )
return 0;
}
return result;
}