//
// MusicSearchResult::updateObjects_1 from 0x100668480 to 0x10066865a (474 bytes)
//
// 1 xrefs:
// > ??> @ 0x100b83318
//
// 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:59 +0000
//
void __fastcall MusicSearchResult::updateObjects_1(__int64 a1, int a2)
{
__int64 v3; // rax
__int64 AllMusicObjectsSorted; // r15
__int64 v5; // rax
__int64 AllMusicTags; // rax
_DWORD *v7; // rdi
__int64 v8; // r12
__int64 v9; // rax
__int64 AllMusicArtists; // rax
_DWORD *v11; // rdi
__int64 v12; // r12
char v13; // al
unsigned __int64 v14; // rdx
__int64 v15; // r13
__int64 v16; // r12
int (__cdecl *v17)(const void *, const void *); // rcx
_DWORD *v18; // rdi
__int128 v19; // [rsp+0h] [rbp-40h] BYREF
void *__p; // [rsp+10h] [rbp-30h]
*(_DWORD *)(a1 + 128) = a2;
v3 = MusicDownloadManager::sharedState();
AllMusicObjectsSorted = MusicDownloadManager::getAllMusicObjectsSorted(v3, *(_DWORD *)(a1 + 136), a2);
if ( !*(_QWORD *)(a1 + 72) )
{
v5 = MusicDownloadManager::sharedState();
AllMusicTags = MusicDownloadManager::getAllMusicTags(v5, a1 + 56);
v7 = *(_DWORD **)(a1 + 72);
if ( v7 != (_DWORD *)AllMusicTags )
{
v8 = AllMusicTags;
if ( AllMusicTags )
{
cocos2d::CCObject::retain(AllMusicTags);
v7 = *(_DWORD **)(a1 + 72);
}
if ( v7 )
cocos2d::CCObject::release(v7);
*(_QWORD *)(a1 + 72) = v8;
}
}
if ( !*(_QWORD *)(a1 + 80) )
{
v9 = MusicDownloadManager::sharedState();
AllMusicArtists = MusicDownloadManager::getAllMusicArtists(v9, a1 + 56);
v11 = *(_DWORD **)(a1 + 80);
if ( v11 != (_DWORD *)AllMusicArtists )
{
v12 = AllMusicArtists;
if ( AllMusicArtists )
{
cocos2d::CCObject::retain(AllMusicArtists);
v11 = *(_DWORD **)(a1 + 80);
}
if ( v11 )
cocos2d::CCObject::release(v11);
*(_QWORD *)(a1 + 80) = v12;
}
}
if ( *(_DWORD *)(a1 + 140) )
AllMusicObjectsSorted = sub_100667460(a1, AllMusicObjectsSorted);
v13 = *(_BYTE *)(a1 + 104);
if ( (v13 & 1) != 0 )
{
v14 = *(_QWORD *)(a1 + 112);
if ( !v14 )
goto LABEL_24;
sub_10001AD30(&v19, *(const void **)(a1 + 120), v14);
}
else
{
if ( !v13 )
goto LABEL_24;
__p = *(void **)(a1 + 120);
v19 = *(_OWORD *)(a1 + 104);
}
AllMusicObjectsSorted = MusicSearchResult::getFilesMatchingSearch(a1, AllMusicObjectsSorted, &v19);
if ( (v19 & 1) != 0 )
operator delete(__p);
LABEL_24:
v15 = MusicSearchResult::applyArtistFilters(a1, AllMusicObjectsSorted);
v16 = MusicSearchResult::applyTagFilters((_DWORD *)a1, v15);
MusicSearchResult::updateFutureCount(a1, v16, v15, AllMusicObjectsSorted);
if ( *(_DWORD *)(a1 + 140) == 3 && (unsigned int)sub_1007FEF90(v16) >= 2 )
{
if ( (unsigned int)(a2 - 1) > 5 )
v17 = (int (__cdecl *)(const void *, const void *))sub_1006496A0;
else
v17 = (int (__cdecl *)(const void *, const void *))off_100B835E0[a2 - 1];
qsort(*(void **)(*(_QWORD *)(v16 + 56) + 16LL), **(unsigned int **)(v16 + 56), 8u, v17);
}
v18 = *(_DWORD **)(a1 + 64);
if ( v18 != (_DWORD *)v16 )
{
if ( v16 )
{
cocos2d::CCObject::retain(v16);
v18 = *(_DWORD **)(a1 + 64);
}
if ( v18 )
cocos2d::CCObject::release(v18);
*(_QWORD *)(a1 + 64) = v16;
}
}