//
// sub_1004B9970 from 0x1004b9970 to 0x1004b9b20 (432 bytes)
//
// 1 xrefs:
// > sub_1004B98A0 @ 0x1004b98b8
//
// 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_1004B9970(
__int64 a1,
int a2,
__int64 a3,
int *a4,
_DWORD *a5,
_DWORD *a6,
int *a7,
int a8,
__int64 a9,
__int64 a10,
const char *a11)
{
unsigned __int64 v11; // x20
_DWORD *v16; // x0
FILE **v17; // x19
int v18; // w9
int v19; // w9
int v20; // w12
int v21; // w9
int v22; // w10
const char *v23; // x0
__int64 result; // x0
FILE *v25; // x0
int v26; // [xsp+Ch] [xbp-44h] BYREF
LODWORD(v11) = a8;
*(_DWORD *)(a1 + 84) = 1;
if ( !*a5 )
{
*a5 = 3;
*a6 = 2;
}
*a7 = *((_DWORD *)&unk_1008284E0 + 4 * a2);
v16 = sub_1004B14F8(
*((__int64 **)off_1008524C8 + 54),
56,
(char)"/opt/teamcity-agent/work/570ad728b1678096/core_api/src/fmod_output_wavwriter.cpp",
105,
0);
*(_QWORD *)a1 = v16;
if ( !v16 )
return 38;
v17 = (FILE **)v16;
v18 = *a4;
*v16 = *a4;
v19 = 1000 * (int)v11 / v18;
v20 = *a7;
v16[1] = *a6;
v16[2] = v11;
if ( v19 < 3 )
v21 = 1;
else
v21 = v19 / 3;
v16[4] = v21;
v16[5] = v20;
v22 = *a7 - 1;
if ( (unsigned int)v22 <= 4 )
v11 = (qword_10064B218[v22] * (unsigned __int64)(unsigned int)v11) >> 3;
v16[3] = v11 * *a6;
v26 = 0;
if ( a11 )
v23 = a11;
else
v23 = "fmodoutput.wav";
if ( (unsigned int)sub_1004B55E8(v23, 1, &v26, v17 + 6) )
return 51;
result = sub_100480138(v17[6], *((_DWORD *)v17 + 5), *((_DWORD *)v17 + 1), *(_DWORD *)v17, *((_DWORD *)v17 + 9));
if ( !(_DWORD)result )
{
v25 = (FILE *)sub_1004B14F8(
*((__int64 **)off_1008524C8 + 54),
*((_DWORD *)v17 + 3),
(char)"/opt/teamcity-agent/work/570ad728b1678096/core_api/src/fmod_output_wavwriter.cpp",
139,
0);
v17[5] = v25;
if ( v25 )
return 0;
else
return 38;
}
return result;
}