//
// MusicDownloadManager::sumLocalAudioSizeBytes from 0x961e14 to 0x9621a0 (908 bytes)
//
// 2 xrefs:
// > AudioAssetsPopup::init @ 0xc8e624
// > ??> @ 0xf5698
//
// This function is hookable on this platform (idp: arm, 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 12:57:34 +0000
//
__int64 __fastcall MusicDownloadManager::sumLocalAudioSizeBytes(
MusicDownloadManager *a1,
unsigned __int8 *a2,
unsigned __int8 *a3)
{
char *v5; // x20
char *v6; // x24
unsigned int v7; // w21
void *v8; // x28
int v9; // w0
unsigned __int64 v10; // x1
__int64 SongInfoObject; // x0
__int64 v12; // x1
int v13; // w0
char *v14; // x20
char *v15; // x24
void *v16; // x26
int v17; // w1
__int64 SFXObject; // x0
__int64 v19; // x1
char *v20; // x0
char *v21; // x19
char *v22; // x0
void *v24; // [xsp+70h] [xbp+70h] BYREF
char *v25; // [xsp+78h] [xbp+78h]
__int64 v26; // [xsp+80h] [xbp+80h]
void *v27; // [xsp+88h] [xbp+88h] BYREF
char *v28; // [xsp+90h] [xbp+90h]
__int64 v29; // [xsp+98h] [xbp+98h]
void *v30; // [xsp+A0h] [xbp+A0h] BYREF
__int64 v31; // [xsp+A8h] [xbp+A8h]
void *v32; // [xsp+B0h] [xbp+B0h]
v24 = nullptr;
v25 = nullptr;
v26 = 0;
sub_961B60(a2, &byte_1169BE0, (__int64 *)&v24);
v5 = (char *)v24;
v6 = v25;
if ( v24 != v25 )
{
v7 = 0;
while ( 1 )
{
while ( 1 )
{
v30 = nullptr;
v31 = 0;
v32 = nullptr;
if ( (*v5 & 1) != 0 )
{
std::string::__init((__int64 *)&v30, *((void **)v5 + 2), *((_QWORD *)v5 + 1));
}
else
{
v12 = *((_QWORD *)v5 + 1);
v30 = *(void **)v5;
v31 = v12;
v32 = *((void **)v5 + 2);
}
if ( ((unsigned __int8)v30 & 1) == 0 )
break;
v8 = v32;
v9 = atoi((const char *)v32);
v10 = (unsigned int)v9;
if ( v9 > 0 )
goto LABEL_4;
operator delete(v8);
LABEL_9:
v5 += 24;
if ( v6 == v5 )
goto LABEL_15;
}
v13 = atoi((const char *)&v30 + 1);
v10 = (unsigned int)v13;
if ( v13 > 0 )
{
LABEL_4:
SongInfoObject = MusicDownloadManager::getSongInfoObject(a1, (const char *)v10);
if ( SongInfoObject && !*(_BYTE *)(SongInfoObject + 432) )
v7 += (int)(float)(*(float *)(SongInfoObject + 396) * 1048600.0);
if ( ((unsigned __int8)v30 & 1) != 0 )
operator delete(v32);
goto LABEL_9;
}
v5 += 24;
if ( v6 == v5 )
goto LABEL_15;
}
}
v7 = 0;
LABEL_15:
v27 = nullptr;
v28 = nullptr;
v29 = 0;
sub_961B60(a3, &byte_1169BE0, (__int64 *)&v27);
v14 = (char *)v27;
v15 = v28;
if ( v27 == v28 )
goto LABEL_29;
do
{
while ( 1 )
{
v30 = nullptr;
v31 = 0;
v32 = nullptr;
if ( (*v14 & 1) != 0 )
{
std::string::__init((__int64 *)&v30, *((void **)v14 + 2), *((_QWORD *)v14 + 1));
}
else
{
v19 = *((_QWORD *)v14 + 1);
v30 = *(void **)v14;
v31 = v19;
v32 = *((void **)v14 + 2);
}
if ( ((unsigned __int8)v30 & 1) == 0 )
break;
v16 = v32;
v17 = atoi((const char *)v32);
if ( v17 > 0 )
goto LABEL_18;
operator delete(v16);
LABEL_22:
v14 += 24;
if ( v15 == v14 )
goto LABEL_28;
}
v17 = atoi((const char *)&v30 + 1);
if ( v17 > 0 )
{
LABEL_18:
SFXObject = MusicDownloadManager::getSFXObject(a1, v17);
if ( SFXObject )
v7 += *(_DWORD *)(SFXObject + 64);
if ( ((unsigned __int8)v30 & 1) != 0 )
operator delete(v32);
goto LABEL_22;
}
v14 += 24;
}
while ( v15 != v14 );
LABEL_28:
v15 = (char *)v27;
LABEL_29:
if ( v15 )
{
v20 = v28;
if ( v15 != v28 )
{
do
{
v28 = v20 - 24;
std::string::~string((__int64)(v20 - 24));
v20 = v28;
}
while ( v15 != v28 );
v20 = (char *)v27;
}
operator delete(v20);
}
v21 = (char *)v24;
if ( v24 )
{
v22 = v25;
if ( v24 != v25 )
{
do
{
v25 = v22 - 24;
std::string::~string((__int64)(v22 - 24));
v22 = v25;
}
while ( v21 != v25 );
v22 = (char *)v24;
}
operator delete(v22);
}
return v7;
}