//
// sub_96E158 from 0x96e158 to 0x96e3d0 (632 bytes)
//
// 2 xrefs:
// > MusicDownloadManager::getCustomSFXCount @ 0x96e40c
// > MusicDownloadManager::encodeCustomSFX @ 0x96e514
//
// 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:39 +0000
//
__int64 __fastcall sub_96E158(MusicDownloadManager *a1, _QWORD *a2, __int64 **a3)
{
_QWORD *v7; // x24
_QWORD *v8; // x27
_QWORD *v9; // t1
__int64 CustomSFXObject; // x0
__int64 v11; // x19
_QWORD *v12; // x0
_QWORD *v13; // x0
_QWORD *v14; // x0
void *v15; // x2
char *v16; // x0
__int64 v17; // x1
__int64 v18; // x0
unsigned int *v19; // x0
__int64 *v20; // x20
__int64 *v21; // x22
__int64 v22; // x19
char *v23; // x0
__int64 v24; // [xsp+68h] [xbp+68h] BYREF
void *v25; // [xsp+70h] [xbp+70h] BYREF
void *v26; // [xsp+78h] [xbp+78h]
char *v27; // [xsp+80h] [xbp+80h]
if ( !a2[2] )
return 1;
LODWORD(v24) = -1;
if ( std::__tree::__count_unique((__int64)a2, (int *)&v24) )
return 1;
LODWORD(v25) = 1;
if ( std::__tree::__count_unique((__int64)a2, (int *)&v25) )
return 1;
v9 = (_QWORD *)*a2;
v8 = a2 + 1;
v7 = v9;
while ( v7 != v8 )
{
while ( 1 )
{
CustomSFXObject = MusicDownloadManager::getCustomSFXObject(a1, *((_DWORD *)v7 + 7));
v11 = CustomSFXObject;
if ( CustomSFXObject && *(_BYTE *)(CustomSFXObject + 72) )
{
std::__tree::__emplace_unique_key_args(
a3,
(int *)(CustomSFXObject + 76),
(_DWORD *)(CustomSFXObject + 76));
v25 = nullptr;
v26 = nullptr;
v27 = nullptr;
v26 = (void *)operator new(8u);
v25 = v26;
v27 = (char *)v26 + 8;
*(_QWORD *)v26 = v11;
v15 = v25;
v16 = (char *)v26 + 8;
v26 = v16;
if ( v16 != v25 )
{
do
{
v17 = *((_QWORD *)v16 - 1);
v26 = v16 - 8;
v18 = *(_QWORD *)(v17 + 152);
if ( v18 )
{
v19 = *(unsigned int **)(v18 + 56);
if ( *v19 )
{
v20 = *((__int64 **)v19 + 2);
v21 = &v20[*v19 - 1];
if ( v20 <= v21 )
{
v22 = *v20;
if ( *v20 )
{
do
{
std::__tree::__emplace_unique_key_args(
a3,
(int *)(v22 + 76),
(_DWORD *)(v22 + 76));
if ( *(_BYTE *)(v22 + 72) )
{
v23 = (char *)v26;
v24 = v22;
if ( v26 >= v27 )
{
std::vector::__push_back_slow_path((__int64)&v25, &v24);
}
else
{
if ( v26 )
{
*(_QWORD *)v26 = v22;
v23 = (char *)v26;
}
v26 = v23 + 8;
}
}
if ( v21 < ++v20 )
break;
v22 = *v20;
}
while ( *v20 );
v15 = v25;
}
}
}
}
v16 = (char *)v26;
}
while ( v26 != v15 );
}
if ( v16 )
operator delete(v16);
}
v12 = (_QWORD *)v7[1];
if ( !v12 )
break;
do
{
v7 = v12;
v12 = (_QWORD *)*v12;
}
while ( v12 );
if ( v7 == v8 )
return 0;
}
do
{
v13 = v7;
v7 = (_QWORD *)v7[2];
if ( v13 == (_QWORD *)*v7 )
break;
v14 = v7;
v7 = (_QWORD *)v7[2];
}
while ( v14 != (_QWORD *)*v7 );
}
return 0;
}