//
// MusicSearchResult::getFilesMatchingSearch from 0x967370 to 0x967854 (1252 bytes)
//
// 4 xrefs:
// > SFXSearchResult::updateObjects @ 0x96ac70
// > SFXSearchResult::updateObjects @ 0x96ada0
// > MusicSearchResult::updateObjects @ 0x971e7c
// > ??> @ 0xf8a10
//
// This function is hookable on this platform (idp: arm, 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:57:36 +0000
//
cocos2d::CCArray *__fastcall MusicSearchResult::getFilesMatchingSearch(__int64 a1, __int64 a2, char *a3)
{
cocos2d::CCArray *v5; // x24
char v6; // w0
__int64 v7; // x0
unsigned __int64 v8; // x1
unsigned __int64 v9; // x23
unsigned __int64 v10; // x1
unsigned __int64 v11; // x20
_BYTE *v12; // x19
unsigned __int64 v13; // x20
int v14; // w23
unsigned __int64 v15; // x2
unsigned __int8 *v16; // x1
int v17; // w0
unsigned int *v18; // x1
__int64 *v20; // x20
__int64 v21; // x0
char *v22; // x22
__int64 v23; // x19
unsigned __int8 v24; // w3
__int64 v25; // x28
unsigned __int64 v26; // x0
int v27; // w1
unsigned __int64 v28; // x5
unsigned __int8 *v29; // x2
unsigned __int8 v30; // w0
__int64 v31; // x28
unsigned __int64 v32; // x0
unsigned __int64 v33; // x3
unsigned __int8 *v34; // x2
__int64 v35; // x28
unsigned __int64 v36; // x0
unsigned __int8 *v37; // x2
unsigned __int64 v38; // x3
unsigned __int64 v39; // x27
__int64 v40; // x0
unsigned __int8 *v41; // x2
unsigned __int8 *v42; // x1
int v43; // t1
unsigned __int64 v44; // x27
__int64 v45; // x0
__int64 v46; // x0
int v47; // w0
unsigned __int8 v48; // w3
unsigned __int64 v49; // x4
char *v50; // x8
unsigned __int64 v51; // x3
unsigned __int8 *v52; // x2
_BOOL4 v53; // w28
char *v54; // x28
__int64 v55; // x0
unsigned __int64 v56; // [xsp+60h] [xbp+60h]
char *v57; // [xsp+60h] [xbp+60h]
int v59; // [xsp+68h] [xbp+68h]
__int64 v60; // [xsp+78h] [xbp+78h] BYREF
unsigned __int64 v61; // [xsp+80h] [xbp+80h]
void *v62; // [xsp+88h] [xbp+88h]
unsigned __int64 v63[2]; // [xsp+90h] [xbp+90h] BYREF
char *v64; // [xsp+A0h] [xbp+A0h]
v5 = (cocos2d::CCArray *)cocos2d::CCArray::create(_stack_chk_guard);
v60 = 0;
v61 = 0;
v6 = *a3;
v62 = nullptr;
if ( (v6 & 1) != 0 )
{
std::string::__init(&v60, *((void **)a3 + 2), *((_QWORD *)a3 + 1));
}
else
{
v7 = *(_QWORD *)a3;
v8 = *((_QWORD *)a3 + 1);
v62 = *((void **)a3 + 2);
v60 = v7;
v61 = v8;
}
if ( (v60 & 1) != 0 )
{
v9 = v61;
if ( v61 )
goto LABEL_5;
LABEL_20:
v14 = *(_DWORD *)(a1 + 100);
v59 = 0;
goto LABEL_14;
}
v9 = (int)(unsigned __int8)v60 >> 1;
if ( !((int)(unsigned __int8)v60 >> 1) )
goto LABEL_20;
LABEL_5:
v10 = 0;
if ( (v60 & 1) == 0 )
goto LABEL_8;
while ( 1 )
{
v11 = v10 + 1;
v12 = (char *)v62 + v10;
*v12 = tolower(*((unsigned __int8 *)v62 + v10));
v10 = v11;
if ( v11 >= v9 )
break;
while ( (v60 & 1) == 0 )
{
LABEL_8:
v13 = v10 + 1;
*((_BYTE *)&v60 + v10 + 1) = tolower(*((unsigned __int8 *)&v60 + v10 + 1));
v10 = v13;
if ( v13 >= v9 )
goto LABEL_9;
}
}
LABEL_9:
v14 = *(_DWORD *)(a1 + 100);
if ( (v60 & 1) != 0 )
{
v15 = v61;
if ( v61 )
{
v16 = (unsigned __int8 *)v62;
LABEL_46:
v41 = &v16[v15];
if ( v41 == v16 )
{
LABEL_51:
v59 = 1;
goto LABEL_14;
}
if ( (unsigned int)*v16 - 48 <= 9 )
{
v42 = v16 + 1;
while ( v42 != v41 )
{
v43 = *v42++;
if ( (unsigned int)(v43 - 48) > 9 )
goto LABEL_13;
}
goto LABEL_51;
}
}
}
else
{
v17 = (int)(unsigned __int8)v60 >> 1;
if ( v17 )
{
v15 = v17;
v16 = (unsigned __int8 *)&v60 + 1;
goto LABEL_46;
}
}
LABEL_13:
v59 = 0;
LABEL_14:
if ( a2 )
{
v18 = *(unsigned int **)(a2 + 56);
if ( *v18 )
{
v20 = *((__int64 **)v18 + 2);
v21 = 8LL * *v18 - 8;
v22 = (char *)v20 + v21;
if ( v20 <= (__int64 *)((char *)v20 + v21) )
{
v23 = *v20;
if ( *v20 )
{
if ( v14 == 1 )
goto LABEL_34;
while ( 1 )
{
if ( (*(_BYTE *)(v23 + 696) & 1) != 0 )
{
v24 = v60;
v25 = *(_QWORD *)(v23 + 712);
v26 = *(_QWORD *)(v23 + 704);
v27 = v60 & 1;
if ( v27 )
goto LABEL_26;
}
else
{
v24 = v60;
v25 = v23 + 697;
v26 = *(_BYTE *)(v23 + 696) >> 1;
v27 = v60 & 1;
if ( v27 )
{
LABEL_26:
v28 = v61;
v29 = (unsigned __int8 *)v62;
if ( v26 < v61 )
goto LABEL_27;
goto LABEL_54;
}
}
v28 = v24 >> 1;
v29 = (unsigned __int8 *)&v60 + 1;
if ( v26 < v28 )
{
LABEL_27:
v30 = *(_BYTE *)(v23 + 720);
if ( (v30 & 1) != 0 )
goto LABEL_28;
goto LABEL_59;
}
LABEL_54:
if ( !v28 )
goto LABEL_55;
v44 = v25 + v26;
v45 = std::__search(
v25,
v25 + v26,
v29,
&v29[v28],
(unsigned __int8 (__fastcall *)(__int64, _QWORD))std::char_traits::eq);
if ( v44 != v45 && v45 - v25 != -1 )
goto LABEL_55;
v30 = *(_BYTE *)(v23 + 720);
v24 = v60;
v27 = v60 & 1;
if ( (v30 & 1) != 0 )
{
LABEL_28:
v31 = *(_QWORD *)(v23 + 736);
v32 = *(_QWORD *)(v23 + 728);
if ( v27 )
goto LABEL_29;
goto LABEL_60;
}
LABEL_59:
v31 = v23 + 721;
v32 = v30 >> 1;
if ( v27 )
{
LABEL_29:
v33 = v61;
v34 = (unsigned __int8 *)v62;
if ( v32 < v61 )
goto LABEL_30;
goto LABEL_61;
}
LABEL_60:
v33 = v24 >> 1;
v34 = (unsigned __int8 *)&v60 + 1;
if ( v32 < v33 )
goto LABEL_30;
LABEL_61:
if ( v33 )
{
v56 = v31 + v32;
v46 = std::__search(
v31,
v31 + v32,
v34,
&v34[v33],
(unsigned __int8 (__fastcall *)(__int64, _QWORD))std::char_traits::eq);
if ( v56 == v46 || v46 - v31 == -1 )
{
LABEL_30:
if ( !v59 )
goto LABEL_31;
GameToolbox::intToString(v63, (GameToolbox *)*(unsigned int *)(v23 + 316));
v47 = v63[0] & 1;
if ( (v63[0] & 1) != 0 )
{
v48 = v60;
v50 = v64;
v49 = v63[1];
if ( (v60 & 1) == 0 )
goto LABEL_78;
LABEL_69:
v51 = v61;
v52 = (unsigned __int8 *)v62;
if ( v49 >= v61 )
goto LABEL_70;
LABEL_79:
v53 = 0;
}
else
{
v48 = v60;
v49 = LOBYTE(v63[0]) >> 1;
v50 = (char *)v63 + 1;
if ( (v60 & 1) != 0 )
goto LABEL_69;
LABEL_78:
v51 = v48 >> 1;
v52 = (unsigned __int8 *)&v60 + 1;
if ( v49 < v51 )
goto LABEL_79;
LABEL_70:
v53 = 1;
if ( !v51 )
{
if ( (v63[0] & 1) == 0 )
goto LABEL_72;
goto LABEL_75;
}
v54 = &v50[v49];
v57 = v50;
v55 = std::__search(
(__int64)v50,
(__int64)&v50[v49],
v52,
&v52[v51],
(unsigned __int8 (__fastcall *)(__int64, _QWORD))std::char_traits::eq);
if ( v54 != (char *)v55 )
{
v53 = v55 == (_QWORD)v57;
if ( (v63[0] & 1) == 0 )
{
LABEL_72:
if ( v53 )
goto LABEL_55;
goto LABEL_31;
}
LABEL_75:
operator delete(v64);
if ( v53 )
goto LABEL_55;
goto LABEL_31;
}
v53 = 0;
v47 = v63[0] & 1;
}
if ( !v47 )
goto LABEL_72;
goto LABEL_75;
}
}
LABEL_55:
cocos2d::CCArray::addObject(v5, (cocos2d::CCObject *)v23);
while ( 1 )
{
LABEL_31:
if ( v22 < (char *)++v20 )
goto LABEL_16;
v23 = *v20;
if ( !*v20 )
goto LABEL_16;
if ( v14 != 1 )
break;
LABEL_34:
if ( !*(_BYTE *)(v23 + 72) )
{
if ( *(_BYTE *)(v23 + 73) )
goto LABEL_55;
if ( (*(_BYTE *)(v23 + 104) & 1) != 0 )
{
v35 = *(_QWORD *)(v23 + 120);
v36 = *(_QWORD *)(v23 + 112);
}
else
{
v35 = v23 + 105;
v36 = *(_BYTE *)(v23 + 104) >> 1;
}
if ( (v60 & 1) != 0 )
{
v37 = (unsigned __int8 *)v62;
v38 = v61;
}
else
{
v38 = (unsigned __int8)v60 >> 1;
v37 = (unsigned __int8 *)&v60 + 1;
}
if ( v36 >= v38 )
{
if ( !v38 )
goto LABEL_55;
v39 = v35 + v36;
v40 = std::__search(
v35,
v35 + v36,
v37,
&v37[v38],
(unsigned __int8 (__fastcall *)(__int64, _QWORD))std::char_traits::eq);
if ( v39 != v40 && v40 - v35 != -1 )
goto LABEL_55;
}
}
}
}
}
}
}
}
LABEL_16:
if ( (v60 & 1) != 0 )
operator delete(v62);
return v5;
}