//
// LevelBrowserLayer::getItemsMatchingSearch from 0x4a5bd4 to 0x4a5db8 (484 bytes)
//
// 3 xrefs:
// > LevelBrowserLayer::loadPage @ 0x4a65da
// > LevelBrowserLayer::FLAlert_Clicked @ 0x4a8e24
// > LevelBrowserLayer::FLAlert_Clicked @ 0x4a8f14
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:49:54 +0000
//
cocos2d::CCArray *__fastcall LevelBrowserLayer::getItemsMatchingSearch(int a1, int a2, int a3)
{
cocos2d::CCArray *v4; // r0
int v6; // r7
cocos2d::CCArray *v7; // r0
int v8; // r1
unsigned int v9; // r4
cocos2d::CCArray *v10; // r8
char *v11; // r3
char *v12; // r5
char *v13; // r3
int v14; // r0
_DWORD *v16; // r3
cocos2d::CCObject *v17; // r6
unsigned __int8 *v18; // r1
unsigned int v19; // r10
unsigned int v20; // lr
unsigned __int8 *v21; // r3
char *v22; // r11
char *v23; // r3
int v24; // r0
unsigned __int8 *v25; // r1
int v26; // r2
char *v27; // r0
unsigned __int8 *v28; // lr
char *v29; // r2
int v30; // r9
unsigned __int8 *v31; // r12
char *v32; // r9
int v33; // t1
cocos2d::CCObject **v34; // [sp+0h] [bp-44h]
unsigned __int8 *v35; // [sp+4h] [bp-40h]
unsigned int v36; // [sp+8h] [bp-3Ch]
unsigned __int8 *v37; // [sp+10h] [bp-34h]
int v38; // [sp+18h] [bp-2Ch] BYREF
unsigned int v39; // [sp+1Ch] [bp-28h]
char *v40; // [sp+20h] [bp-24h]
int v41[3]; // [sp+24h] [bp-20h] BYREF
int v42; // [sp+30h] [bp-14h] BYREF
unsigned int v43; // [sp+34h] [bp-10h]
char *v44; // [sp+38h] [bp-Ch]
v4 = *(cocos2d::CCArray **)(a1 + 500);
if ( *((_DWORD *)v4 + 86) == 1 )
v6 = 102;
else
v6 = *((_DWORD *)v4 + 66);
v7 = (cocos2d::CCArray *)cocos2d::CCArray::create(v4);
v8 = a3;
v9 = 0;
v10 = v7;
std::string::basic_string(&v38, v8);
while ( (v38 & 1) != 0 )
{
if ( v9 >= v39 )
goto LABEL_14;
v11 = v40;
LABEL_10:
v12 = &v11[v9];
if ( (v38 & 1) != 0 )
v13 = v40;
else
v13 = (char *)&v38 + 1;
v14 = (unsigned __int8)v13[v9++];
*v12 = tolower(v14);
}
if ( v9 < (unsigned __int8)v38 >> 1 )
{
v11 = (char *)&v38 + 1;
goto LABEL_10;
}
LABEL_14:
if ( a2 )
{
v16 = *(_DWORD **)(a2 + 52);
if ( *v16 )
{
v36 = v16[3] + 4 * (*v16 + 0x3FFFFFFF);
v34 = (cocos2d::CCObject **)v16[3];
while ( 1 )
{
if ( (unsigned int)v34 > v36 )
goto LABEL_15;
v17 = *v34++;
if ( !v17 )
goto LABEL_15;
memset(v41, 0, sizeof(v41));
std::string::__init(v41, &unk_B6B226, 0);
if ( v6 == 101 )
v18 = (unsigned __int8 *)v17 + 96;
else
v18 = v6 == 102 ? (unsigned __int8 *)v17 + 348 : (unsigned __int8 *)v17 + 280;
std::string::operator=((unsigned __int8 *)v41, v18);
std::string::basic_string(&v42, (int)v41);
v19 = 0;
while ( (v42 & 1) != 0 )
{
v21 = (unsigned __int8 *)v44;
if ( v19 >= v43 )
{
v20 = v43;
goto LABEL_36;
}
LABEL_28:
v22 = (char *)&v21[v19];
if ( (v42 & 1) != 0 )
v23 = v44;
else
v23 = (char *)&v42 + 1;
v24 = (unsigned __int8)v23[v19++];
*v22 = tolower(v24);
}
v20 = (int)(unsigned __int8)v42 >> 1;
if ( v19 < v20 )
break;
v21 = (unsigned __int8 *)&v42 + 1;
LABEL_36:
if ( (v38 & 1) != 0 )
{
v25 = (unsigned __int8 *)v40;
v26 = v39;
}
else
{
v26 = (int)(unsigned __int8)v38 >> 1;
v25 = (unsigned __int8 *)&v38 + 1;
}
if ( v20 >= v26 )
{
if ( !v26 )
goto LABEL_40;
v27 = (char *)&v21[v20];
if ( (int)v20 >= v26 )
{
v28 = v21;
v35 = (unsigned __int8 *)&v27[1 - v26];
v37 = &v25[v26];
LABEL_43:
while ( 1 )
{
v29 = (char *)v28;
if ( v28 == v35 )
break;
v30 = *v28++;
if ( v30 == *v25 )
{
v31 = v25;
v32 = v29;
while ( ++v31 != v37 )
{
v33 = (unsigned __int8)*++v32;
if ( v33 != *v31 )
goto LABEL_43;
}
goto LABEL_50;
}
}
}
v29 = v27;
LABEL_50:
if ( v29 != v27 && v29 - (char *)v21 != -1 )
LABEL_40:
cocos2d::CCArray::addObject(v10, v17);
}
std::string::~string((int)&v42);
std::string::~string((int)v41);
}
v21 = (unsigned __int8 *)&v42 + 1;
goto LABEL_28;
}
}
LABEL_15:
std::string::~string((int)&v38);
return v10;
}