//
// sub_100667460 from 0x100667460 to 0x1006676fe (670 bytes)
//
// 1 xrefs:
// > MusicSearchResult::updateObjects_1 @ 0x10066854b
//
// 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
//
__int64 __fastcall sub_100667460(__int64 a1, __int64 a2)
{
int v3; // eax
__int64 v4; // rbx
unsigned int *v5; // rax
__int64 *v6; // r15
unsigned __int64 v7; // r12
_QWORD *v8; // r15
__int64 v9; // r12
__int64 v10; // r12
__int64 v11; // r13
__int64 v12; // rdi
__int64 v13; // rax
int v14; // ecx
__int64 v15; // r14
__int64 v16; // rax
unsigned __int64 v17; // rdi
unsigned __int64 v18; // rcx
unsigned __int64 v19; // r9
__int64 v20; // rsi
__int64 **v21; // rax
__int64 *v22; // r8
unsigned __int64 v23; // rdi
unsigned __int64 v24; // rax
__int64 v25; // rax
v3 = *(_DWORD *)(a1 + 140);
if ( v3 == 2 )
{
v8 = (_QWORD *)(MusicDownloadManager::sharedState() + 752);
goto LABEL_8;
}
if ( v3 != 1 )
{
v8 = (_QWORD *)(a1 + 144);
LABEL_8:
v4 = sub_1007FE900(a1);
v9 = v8[1] - *v8;
if ( v9 )
{
v10 = (v9 >> 2 == 0) + (v9 >> 2);
v11 = 0;
do
{
v12 = *(_QWORD *)(MusicDownloadManager::sharedState() + 440);
if ( v12 )
{
v13 = cocos2d::CCDictionary::objectForKey_1(v12, *(int *)(*v8 + 4 * v11));
if ( v13 )
{
v14 = *(_DWORD *)(a1 + 136);
if ( v14 == -1 || *(_DWORD *)(v13 + 400) == v14 )
sub_1007FEBF0(v4, v13);
}
}
++v11;
}
while ( v10 != v11 );
}
return v4;
}
v4 = sub_1007FE900(a1);
if ( a2 )
{
v5 = *(unsigned int **)(a2 + 56);
if ( *v5 )
{
v6 = *((__int64 **)v5 + 2);
v7 = (unsigned __int64)&v6[*v5 - 1];
while ( 1 )
{
v15 = *v6;
if ( !*v6 )
return v4;
v16 = MusicDownloadManager::sharedState();
v17 = *(_QWORD *)(v16 + 696);
if ( v17 )
{
v18 = *(int *)(v15 + 316);
v19 = (0x101010101010101LL
* ((((v17 - ((v17 >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)
+ (((v17 - ((v17 >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL)
+ ((((v17 - ((v17 >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)
+ (((v17 - ((v17 >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL)) >> 4))
& 0xF0F0F0F0F0F0F0FLL)) >> 56;
if ( v19 > 1 )
{
v20 = *(int *)(v15 + 316);
if ( v17 <= v18 )
{
if ( (v17 | v18) >> 32 )
v20 = v18 % v17;
else
v20 = (unsigned int)v18 % (unsigned int)v17;
}
}
else
{
v20 = v18 & (v17 - 1);
}
v21 = *(__int64 ***)(*(_QWORD *)(v16 + 688) + 8 * v20);
if ( v21 )
{
v22 = *v21;
if ( *v21 )
break;
}
}
LABEL_18:
if ( (unsigned __int64)++v6 > v7 )
return v4;
}
if ( (unsigned int)v19 < 2 )
{
v23 = v17 - 1;
while ( 1 )
{
v25 = v22[1];
if ( v25 == v18 )
{
if ( *((_DWORD *)v22 + 4) == (_DWORD)v18 )
goto LABEL_17;
}
else if ( (v23 & v25) != v20 )
{
goto LABEL_18;
}
v22 = (__int64 *)*v22;
if ( !v22 )
goto LABEL_18;
}
}
while ( 1 )
{
v24 = v22[1];
if ( v24 == v18 )
{
if ( *((_DWORD *)v22 + 4) == (_DWORD)v18 )
{
LABEL_17:
sub_1007FEBF0(v4, v15);
goto LABEL_18;
}
}
else
{
if ( v24 < v17 )
goto LABEL_37;
if ( (v17 | v24) >> 32 )
{
v24 %= v17;
LABEL_37:
if ( v24 != v20 )
goto LABEL_18;
goto LABEL_32;
}
if ( (unsigned int)v24 % (unsigned int)v17 != v20 )
goto LABEL_18;
}
LABEL_32:
v22 = (__int64 *)*v22;
if ( !v22 )
goto LABEL_18;
}
}
}
return v4;
}