//
// sub_10046F678 from 0x10046f678 to 0x10046f80c (404 bytes)
//
// 1 xrefs:
// > sub_10046F80C @ 0x10046fdec
//
// 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_10046F678(__int64 a1)
{
int v2; // w23
__int64 result; // x0
__int64 v4; // x8
unsigned int v5; // w24
unsigned int v6; // w22
__int64 v7; // x8
unsigned int v8; // w9
__int64 v9; // x0
unsigned int v10; // w21
unsigned int v11; // [xsp+4h] [xbp-4Ch] BYREF
_BYTE v12[4]; // [xsp+8h] [xbp-48h] BYREF
unsigned int v13; // [xsp+Ch] [xbp-44h] BYREF
v2 = *(_DWORD *)(a1 + 452);
result = sub_1004AAA30(*(_QWORD *)(a1 + 368), &v13);
if ( !(_DWORD)result )
{
*(_DWORD *)(a1 + 460) = 0;
v4 = *(_QWORD *)(a1 + 8);
*(_DWORD *)(v4 + 24) = 0;
if ( *(_DWORD *)(v4 + 20) )
{
v5 = 0;
v6 = 0;
while ( !(unsigned int)sub_1004AA0BC(*(_QWORD *)(a1 + 368), v12, 1, 4, 0) )
{
if ( (unsigned int)sub_100470740(a1, v12, 0, 0, &v11)
|| (v7 = *(_QWORD *)(a1 + 8), v11 + v5 >= *(_DWORD *)(v7 + 20)) )
{
sub_1004AA8B8(*(_QWORD *)(a1 + 368), 4294967293LL, 1);
}
else
{
v8 = *(_DWORD *)(a1 + 460);
if ( v6 >= v8 )
{
*(_DWORD *)(a1 + 460) = v8 + 1000;
v9 = sub_1004B152C(
*((_QWORD *)off_1008524C8 + 54),
*(_QWORD *)(a1 + 464),
4 * (v8 + 1000),
"/opt/teamcity-agent/work/570ad728b1678096/core_api/src/fmod_codec_mpeg.cpp",
275,
0);
*(_QWORD *)(a1 + 464) = v9;
if ( !v9 )
return 38;
v7 = *(_QWORD *)(a1 + 8);
}
else
{
v9 = *(_QWORD *)(a1 + 464);
}
*(_DWORD *)(v9 + 4LL * v6) = v5;
*(_DWORD *)(v7 + 24) += v2;
v10 = v11;
++v6;
if ( (unsigned int)sub_1004AA8B8(*(_QWORD *)(a1 + 368), v11, 1) )
break;
v5 += v10 + 4;
}
if ( v5 >= *(_DWORD *)(*(_QWORD *)(a1 + 8) + 20LL) )
break;
}
}
else
{
v6 = 0;
}
result = sub_1004AA8B8(*(_QWORD *)(a1 + 368), v13, 0);
if ( !(_DWORD)result )
*(_DWORD *)(a1 + 460) = v6;
}
return result;
}