//
// sub_1800BF120 from 0x1800bf120 to 0x1800bf20e (238 bytes)
//
// 2 xrefs:
// > _cfltcvt_init_0 @ 0x1800bf266
// > ??> @ 0x1801fd938
//
// 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_1800BF120(__int64 *a1)
{
__int64 v1; // rbx
int v3; // edi
__int64 result; // rax
__int64 v5; // r9
int v6; // ecx
__int64 v7; // r8
int v8; // edx
__int64 v9; // rdx
_BYTE *v10; // rax
int v11; // [rsp+30h] [rbp+8h] BYREF
v1 = *a1;
v3 = 0;
v11 = 0;
result = sub_1800C1770(&v11);
if ( !(_DWORD)result )
{
v6 = 0;
v7 = *(unsigned int *)(v1 + 8);
v8 = v11 - *(_DWORD *)(v1 + 24);
*(_DWORD *)(v1 + 24) = v11;
if ( v8 <= 1000 )
v6 = v8;
v9 = (unsigned int)(*(_DWORD *)v1 * v6 / 1000);
*(_DWORD *)(v1 + 32) += v9;
if ( *(_DWORD *)(v1 + 32) - *(_DWORD *)(v1 + 28) >= (int)v7 )
{
result = ((__int64 (__fastcall *)(__int64 *, _QWORD))a1[1])(a1, *(_QWORD *)(v1 + 40));
if ( !(_DWORD)result )
{
*(_DWORD *)(v1 + 28) += *(_DWORD *)(v1 + 8);
if ( *(_DWORD *)(v1 + 20) == 1 )
{
v10 = *(_BYTE **)(v1 + 40);
if ( *(int *)(v1 + 12) > 0 )
{
do
{
*v10++ ^= 0x80u;
++v3;
}
while ( v3 < *(_DWORD *)(v1 + 12) );
}
}
result = FMOD_OS_File_Write(*(HANDLE *)(v1 + 48));
if ( !(_DWORD)result )
{
*(_DWORD *)(v1 + 36) += *(_DWORD *)(v1 + 12);
return 0;
}
}
}
else
{
FMOD_OS_Time_Sleep(*(unsigned int *)(v1 + 16), v9, v7, v5);
return 0;
}
}
return result;
}