//
// MusicSearchResult::applyViewFilter from 0x140497fc0 to 0x1404981bc (508 bytes)
//
// 2 xrefs:
// > MusicSearchResult::updateObjects @ 0x1404989dc
// > ??> @ 0x140929078
//
// 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:53 +0000
//
// Hidden C++ exception states: #wind=3
cocos2d::CCArray *__fastcall MusicSearchResult::applyViewFilter(__int64 a1, __int64 a2)
{
int v4; // eax
cocos2d::CCArray *v5; // rbp
unsigned int *v6; // rbx
__int64 v7; // rax
struct cocos2d::CCObject **v8; // rbx
struct cocos2d::CCObject **i; // rsi
struct cocos2d::CCObject *v10; // rdi
__int64 v12; // r14
_QWORD *v13; // r14
cocos2d::CCArray *v14; // r15
unsigned __int64 v15; // rbx
unsigned __int64 v16; // rdi
int *v17; // rsi
cocos2d::CCDictionary *v18; // rcx
struct cocos2d::CCObject *v19; // rax
int v20; // ecx
void *v21; // [rsp+50h] [rbp+8h] BYREF
void *v22; // [rsp+60h] [rbp+18h]
v4 = *(_DWORD *)(a1 + 148);
if ( v4 == 1 )
{
v5 = (cocos2d::CCArray *)cocos2d::CCArray::create(a1);
if ( a2 )
{
v6 = *(unsigned int **)(a2 + 56);
v7 = *v6;
if ( (_DWORD)v7 )
{
v8 = *((struct cocos2d::CCObject ***)v6 + 2);
for ( i = &v8[v7 - 1]; v8 <= i; ++v8 )
{
v10 = *v8;
if ( !*v8 )
break;
if ( !qword_14090C070 )
{
v22 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager((__int64)v22);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
}
LODWORD(v21) = *((_DWORD *)v10 + 80);
if ( sub_140066B50((_QWORD *)(qword_14090C070 + 776), (unsigned __int8 *)&v21) )
cocos2d::CCArray::addObject(v5, v10);
}
}
}
return v5;
}
else
{
if ( v4 == 2 )
{
v12 = qword_14090C070;
if ( !qword_14090C070 )
{
v21 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager((__int64)v21);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v12 = qword_14090C070;
}
v13 = (_QWORD *)(v12 + 864);
}
else
{
v13 = (_QWORD *)(a1 + 152);
}
v14 = (cocos2d::CCArray *)cocos2d::CCArray::create(a1);
v15 = 0;
v16 = (__int64)(v13[1] - *v13) >> 2;
if ( v16 )
{
do
{
v17 = (int *)(*v13 + 4 * v15);
if ( !qword_14090C070 )
{
v21 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager((__int64)v21);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
}
v18 = *(cocos2d::CCDictionary **)(qword_14090C070 + 448);
if ( v18 )
{
v19 = cocos2d::CCDictionary::objectForKey(v18, *v17);
if ( v19 )
{
v20 = *(_DWORD *)(a1 + 144);
if ( v20 == -1 || *((_DWORD *)v19 + 108) == v20 )
cocos2d::CCArray::addObject(v14, v19);
}
}
++v15;
}
while ( v15 < v16 );
}
return v14;
}
}