//
// sub_7B958 from 0x7b958 to 0x7ba64 (268 bytes)
//
// 1 xrefs:
// > sub_7BA6C @ 0x7be88
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:41:14 +0000
//
int __fastcall sub_7B958(_DWORD *a1, int a2, int a3, int a4)
{
int v5; // r11
int result; // r0
int v7; // r0
unsigned int v8; // r10
unsigned int v9; // r8
int v10; // r1
unsigned int v11; // r0
int v12; // r0
int v13; // r6
int v14; // [sp+4h] [bp-34h]
int v15; // [sp+8h] [bp-30h]
int v16; // [sp+10h] [bp-28h] BYREF
_BYTE v17[4]; // [sp+14h] [bp-24h] BYREF
int v18; // [sp+18h] [bp-20h]
v14 = a3;
v15 = a4;
v5 = a1[72];
result = sub_BBC8C(a1[55]);
if ( !result )
{
a1[74] = 0;
v7 = a1[1];
v8 = 0;
v9 = 0;
*(_DWORD *)(v7 + 20) = 0;
while ( v9 < *(_DWORD *)(v7 + 16) && !sub_BB750(a1[55], v17, 1, 4, 0) )
{
if ( sub_7C558(a1, v17, 0, 0, &v16, v14, v15) || (v10 = a1[1], v16 + v9 >= *(_DWORD *)(v10 + 16)) )
{
sub_BBB84(a1[55], -3);
}
else
{
v11 = a1[74];
if ( v8 >= v11 )
{
a1[74] = v11 + 1000;
v12 = sub_BD598(
*(int *)((char *)&dword_14C + (_DWORD)off_E8000),
a1[75],
4 * (v11 + 1000),
"../../src/fmod_codec_mpeg.cpp",
275,
0);
a1[75] = v12;
if ( !v12 )
return 38;
v10 = a1[1];
}
else
{
v12 = a1[75];
}
*(_DWORD *)(v12 + 4 * v8) = v9;
*(_DWORD *)(v10 + 20) += v5;
v13 = v16;
++v8;
if ( sub_BBB84(a1[55], v16) )
break;
v9 += v13 + 4;
}
v7 = a1[1];
}
result = sub_BBB84(a1[55], v18);
if ( !result )
{
result = 0;
a1[74] = v8;
}
}
return result;
}