//
// MusicDownloadManager::clearSortedMusicCache from 0x14048ef50 to 0x14048f029 (217 bytes)
//
// 3 xrefs:
// > MusicDownloadManager::dMusicDownloadManager @ 0x140482449
// > MusicDownloadManager::parseMusicLibrary @ 0x14048d1ba
// > ??> @ 0x140928dfc
//
// 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 11:32:50 +0000
//
void __fastcall MusicDownloadManager::clearSortedMusicCache(__int64 a1)
{
_QWORD *v1; // rsi
_QWORD *v2; // rdi
_QWORD *v3; // rbx
__int64 **v4; // rcx
__int64 i; // rax
__int64 *j; // rcx
_QWORD *v7; // rbx
void *v8; // rcx
v1 = (_QWORD *)(a1 + 488);
v2 = *(_QWORD **)(a1 + 488);
v3 = (_QWORD *)*v2;
if ( (_QWORD *)*v2 != v2 )
{
do
{
cocos2d::CCObject::release((cocos2d::CCObject *)v3[5]);
v4 = (__int64 **)v3[2];
if ( *((_BYTE *)v4 + 25) )
{
for ( i = v3[1]; !*(_BYTE *)(i + 25); i = *(_QWORD *)(i + 8) )
{
if ( v3 != *(_QWORD **)(i + 16) )
break;
v3 = (_QWORD *)i;
}
v3 = (_QWORD *)i;
}
else
{
v3 = (_QWORD *)v3[2];
for ( j = *v4; !*((_BYTE *)j + 25); j = (__int64 *)*j )
v3 = j;
}
v2 = (_QWORD *)*v1;
}
while ( v3 != (_QWORD *)*v1 );
}
v7 = (_QWORD *)v2[1];
while ( !*((_BYTE *)v7 + 25) )
{
sub_140083780((__int64)v1, (__int64)v1, v7[2]);
v8 = v7;
v7 = (_QWORD *)*v7;
j_j_free(v8);
}
v2[1] = v2;
*v2 = v2;
v2[2] = v2;
v1[1] = 0;
}