//
// MusicDownloadManager::clearUnusedSongs from 0x10064ebc0 to 0x10064ec94 (212 bytes)
//
// 3 xrefs:
// > GJAccountManager::backupAccount @ 0x1000a18be
// > LevelBrowserLayer::FLAlert_Clicked @ 0x1004882d1
// > GJSongBrowser::FLAlert_Clicked @ 0x1006d63ab
//
// This function is hookable on this platform (idp: pc, 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:34:48 +0000
//
__int64 __fastcall MusicDownloadManager::clearUnusedSongs(__int64 a1, double a2)
{
__int64 v3; // rdi
_QWORD *AllUsedSongIDs; // r14
__int64 v5; // r15
__int64 v6; // rax
__int64 v7; // r12
__int64 v8; // rsi
__int64 result; // rax
unsigned int v10; // r12d
__int64 v11; // r13
v3 = GameLevelManager::sharedState();
AllUsedSongIDs = GameLevelManager::getAllUsedSongIDs(v3, a2);
v5 = sub_1007FE900(v3);
v6 = *(_QWORD *)(a1 + 344);
if ( v6 )
{
v7 = *(_QWORD *)(v6 + 56);
while ( v7 )
{
v8 = *(_QWORD *)(v7 + 264);
v7 = *(_QWORD *)(v7 + 288);
sub_1007FEBF0(v5, v8);
}
}
result = sub_1007FEF90(v5);
if ( (_DWORD)result )
{
v10 = 0;
do
{
v11 = sub_1007FEFE0(v5, v10);
if ( !(unsigned __int8)MusicDownloadManager::isSongDownloaded(a1, *(unsigned int *)(v11 + 316))
&& !cocos2d::CCDictionary::objectForKey_1((__int64)AllUsedSongIDs, *(int *)(v11 + 316)) )
{
MusicDownloadManager::clearSong(a1);
}
++v10;
result = sub_1007FEF90(v5);
}
while ( v10 < (unsigned int)result );
}
return result;
}