//
// sub_1800BEF40 from 0x1800bef40 to 0x1800bf11d (477 bytes)
//
// 2 xrefs:
// > _cfltcvt_init_0 @ 0x1800bf23c
// > ??> @ 0x1801fd92c
//
// 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_1800BEF40(
_QWORD *a1,
int a2,
__int64 a3,
int *a4,
_DWORD *a5,
_DWORD *a6,
_DWORD *a7,
unsigned int a8,
int a9,
int a10,
LPCCH lpMultiByteStr)
{
__int64 v11; // rax
_DWORD *v14; // rax
HANDLE *v15; // rbx
int v16; // r8d
unsigned __int64 v17; // r9
int v18; // edx
__int64 v19; // rax
const CHAR *v20; // rcx
__int64 result; // rax
void *v22; // rax
v11 = (__int64)a1 + 84;
if ( !a1 )
v11 = 92;
*(_DWORD *)v11 = 1;
if ( !*a5 )
{
*a5 = 3;
*a6 = 2;
}
*a7 = *((_DWORD *)&unk_18016BE40 + 4 * a2);
v14 = sub_1800B6880(
*((_QWORD *)off_1801AED20 + 52),
56,
"C:\\buildagent1\\work\\570ad728b1678096\\core_api\\src\\fmod_output_wavwriter.cpp",
105,
0);
*a1 = v14;
v15 = (HANDLE *)v14;
if ( !v14 )
return 38;
v16 = *a4;
LODWORD(v17) = a8;
*v14 = *a4;
v14[1] = *a6;
v14[5] = *a7;
v14[2] = a8;
v18 = (int)(1000 * a8) / v16 / 3;
if ( v18 < 1 )
v18 = 1;
v14[4] = v18;
switch ( *a7 )
{
case 1:
v19 = 8;
break;
case 2:
v19 = 16;
break;
case 3:
v19 = 24;
break;
default:
if ( (unsigned int)(*a7 - 4) > 1 )
goto LABEL_17;
v19 = 32;
break;
}
v17 = (v19 * (unsigned __int64)a8) >> 3;
LABEL_17:
v20 = off_1801AEBD8;
if ( lpMultiByteStr )
v20 = lpMultiByteStr;
*((_DWORD *)v15 + 3) = v17 * *a6;
if ( (unsigned int)FMOD_OS_File_Open(v20, 1u) )
return 51;
result = sub_18003B250(v15[6]);
if ( !(_DWORD)result )
{
v22 = sub_1800B6880(
*((_QWORD *)off_1801AED20 + 52),
*((unsigned int *)v15 + 3),
"C:\\buildagent1\\work\\570ad728b1678096\\core_api\\src\\fmod_output_wavwriter.cpp",
139,
0);
v15[5] = v22;
if ( v22 )
return 0;
return 38;
}
return result;
}