//
// MusicDownloadManager::clearUnusedSongs from 0x1001d4c94 to 0x1001d4d34 (160 bytes)
//
// 3 xrefs:
// > GJSongBrowser::FLAlert_Clicked @ 0x1003034a4
// > GJAccountManager::backupAccount @ 0x1004475e4
// > LevelBrowserLayer::FLAlert_Clicked @ 0x10049b0b4
//
// 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 11:00:24 +0000
//
__int64 __fastcall MusicDownloadManager::clearUnusedSongs(__int64 a1)
{
__int64 v2; // x0
__int64 v3; // x20
__int64 AllSongs; // x21
__int64 result; // x0
__int64 v6; // x22
__int64 v7; // x23
v2 = GameLevelManager::sharedState();
v3 = sub_1000CDF34(v2);
AllSongs = MusicDownloadManager::getAllSongs(a1);
result = sub_1002E757C(AllSongs);
if ( (_DWORD)result )
{
v6 = 0;
do
{
v7 = sub_1002E75A0(AllSongs, v6);
if ( (MusicDownloadManager::isSongDownloaded(a1, *(unsigned int *)(v7 + 316)) & 1) == 0
&& !cocos2d::CCDictionary::objectForKey_1(v3, *(int *)(v7 + 316)) )
{
sub_1001D4B44(a1, *(_DWORD *)(v7 + 316));
}
v6 = (unsigned int)(v6 + 1);
result = sub_1002E757C(AllSongs);
}
while ( (unsigned int)v6 < (unsigned int)result );
}
return result;
}