//
// sub_1800BE170 from 0x1800be170 to 0x1800be2c6 (342 bytes)
//
// 4 xrefs:
// > sub_1800E4E00 @ 0x1800e56aa
// > ??> @ 0x18018a308
// > ??> @ 0x18018a328
// > ??> @ 0x1801fd848
//
// 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:02 +0000
//
__int64 __fastcall sub_1800BE170(_QWORD *a1, int a2)
{
__int64 result; // rax
unsigned int v5; // ebx
void *v6; // rax
__int64 v7; // rax
void *v8; // rax
__int64 i; // rsi
_QWORD *v10; // 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_emulated.cpp",
65,
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)(112 * a2),
"C:\\buildagent1\\work\\570ad728b1678096\\core_api\\src\\fmod_output_emulated.cpp",
77,
0);
a1[131] = v8;
if ( !v8 )
return 38;
if ( a2 <= 0 )
return 0;
for ( i = 0; ; i += 112 )
{
v10 = (_QWORD *)(i + a1[131]);
sub_1800C79A0(v10);
*v10 = off_18016BB98;
result = sub_1800D0E50(a1[8], v5, a1[131] + 112LL * (int)v5);
if ( (_DWORD)result )
break;
if ( (int)++v5 >= a2 )
return 0;
}
return result;
}