//
// sub_575664 from 0x575664 to 0x5757b2 (334 bytes)
//
// 2 xrefs:
// > MusicDownloadManager::getCustomSFXCount @ 0x5757d6
// > MusicDownloadManager::encodeCustomSFX @ 0x575858
//
// 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:52:41 +0000
//
int __fastcall sub_575664(MusicDownloadManager *a1, _DWORD *a2, int a3)
{
_BOOL4 v5; // r10
_DWORD *i; // r9
int CustomSFXObject; // r0
int v8; // r5
int v9; // r2
int v10; // r3
_DWORD *v11; // r2
int *v12; // r5
int v13; // r6
int v14; // t1
int *v16; // [sp+0h] [bp-2Ch]
_DWORD v18[2]; // [sp+10h] [bp-1Ch] BYREF
char *v19; // [sp+18h] [bp-14h] BYREF
char *v20; // [sp+1Ch] [bp-10h]
char *v21; // [sp+20h] [bp-Ch]
if ( !a2[2] )
return 1;
v18[0] = -1;
if ( std::__tree::__count_unique(a2, v18) )
return 1;
v19 = (_BYTE *)(&dword_0 + 1);
v5 = std::__tree::__count_unique(a2, &v19) != nullptr;
if ( v5 )
return 1;
for ( i = (_DWORD *)*a2; i != a2 + 1; i = std::__tree_next *>(i) )
{
CustomSFXObject = MusicDownloadManager::getCustomSFXObject(a1, i[4]);
v8 = CustomSFXObject;
if ( CustomSFXObject && *(_BYTE *)(CustomSFXObject + 68) )
{
std::__tree::__emplace_unique_key_args(
(int)&v19,
a3,
(int *)(CustomSFXObject + 72),
(_DWORD *)(CustomSFXObject + 72));
v19 = nullptr;
v20 = nullptr;
v21 = nullptr;
v20 = (char *)operator new(4u);
v19 = v20;
v21 = v20 + 4;
*(_DWORD *)v20 = v8;
v20 += 4;
while ( v19 != v20 )
{
v9 = *((_DWORD *)v20 - 1);
v20 -= 4;
v10 = *(_DWORD *)(v9 + 112);
if ( v10 )
{
v11 = *(_DWORD **)(v10 + 52);
if ( *v11 )
{
v12 = (int *)v11[3];
v16 = &v12[*v11 - 1];
while ( v12 <= v16 )
{
v14 = *v12++;
v13 = v14;
if ( !v14 )
break;
std::__tree::__emplace_unique_key_args(
(int)v18,
a3,
(int *)(v13 + 72),
(_DWORD *)(v13 + 72));
if ( *(_BYTE *)(v13 + 68) )
{
v18[0] = v13;
if ( v20 >= v21 )
{
std::vector::__push_back_slow_path((int)&v19, v18);
}
else
{
if ( v20 )
*(_DWORD *)v20 = v13;
v20 += 4;
}
}
}
}
}
}
std::__vector_base::~__vector_base(&v19);
}
}
return v5;
}