//
// FriendsProfilePage::filterUsersWithQuery from 0x100736f80 to 0x1007372e1 (865 bytes)
//
// 6 xrefs:
// > FriendsProfilePage::onClearSearch @ 0x100735cf8
// > FriendsProfilePage::onToggleSort @ 0x100735e31
// > FriendsProfilePage::onToggleSortDir @ 0x100735f8d
// > FriendsProfilePage::getUserListFinished @ 0x100737502
// > FriendsProfilePage::textChanged @ 0x100737d3b
// > sub_100737D60 @ 0x100737dc7
//
// 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:36:25 +0000
//
void __fastcall FriendsProfilePage::filterUsersWithQuery(__int64 a1, __int128 *a2)
{
__int64 v2; // r15
_DWORD *v3; // rdi
unsigned __int64 p_s2; // rdi
unsigned __int64 v5; // rdx
char *v6; // rbx
char *v7; // r14
__int64 v8; // rax
__int64 v9; // rax
unsigned int *v10; // rax
_QWORD *v11; // r13
__int64 v12; // rbx
char *v13; // rbx
char *v14; // r14
char v15; // cl
char *v16; // rax
signed __int64 v17; // rdx
unsigned int v18; // r13d
signed __int64 v19; // r13
char *v20; // r14
char *v21; // r12
int v22; // r15d
void *v23; // rbx
size_t v24; // rdx
char *v25; // rax
char *v26; // rbx
_QWORD *v27; // [rsp+0h] [rbp-B0h]
__int64 v28; // [rsp+8h] [rbp-A8h]
unsigned __int64 v29; // [rsp+10h] [rbp-A0h]
char *v30; // [rsp+18h] [rbp-98h]
__int128 v31; // [rsp+20h] [rbp-90h] BYREF
void *__p; // [rsp+30h] [rbp-80h]
__int64 v33; // [rsp+38h] [rbp-78h]
__int128 v34; // [rsp+40h] [rbp-70h] BYREF
void *__s; // [rsp+50h] [rbp-60h]
__int128 __s2; // [rsp+60h] [rbp-50h] BYREF
void *v37; // [rsp+70h] [rbp-40h]
char v38; // [rsp+87h] [rbp-29h]
v2 = a1;
v3 = *(_DWORD **)(a1 + 864);
if ( v3 )
{
cocos2d::CCObject::release(v3);
*(_QWORD *)(v2 + 864) = 0;
}
p_s2 = *(_QWORD *)(v2 + 856);
if ( p_s2 && (unsigned int)sub_1007FEF90(p_s2) )
{
if ( (*(_BYTE *)a2 & 1) != 0 )
{
v5 = *((_QWORD *)a2 + 1);
if ( !v5 )
return;
p_s2 = (unsigned __int64)&__s2;
sub_10001AD30(&__s2, *((const void **)a2 + 2), v5);
}
else
{
if ( !*(_BYTE *)a2 )
return;
v37 = *((void **)a2 + 2);
__s2 = *a2;
}
v6 = (char *)v37;
v7 = (char *)&__s2 + ((unsigned __int8)__s2 >> 1) + 1;
if ( (__s2 & 1) != 0 )
v7 = (char *)v37 + *((_QWORD *)&__s2 + 1);
else
v6 = (char *)&__s2 + 1;
for ( ; v6 != v7; ++v6 )
{
p_s2 = (unsigned __int8)*v6;
*v6 = __tolower(p_s2);
}
v8 = sub_1007FE900(p_s2);
*(_QWORD *)(v2 + 864) = v8;
cocos2d::CCObject::retain(v8);
v9 = *(_QWORD *)(v2 + 856);
if ( v9 )
{
v10 = *(unsigned int **)(v9 + 56);
if ( *v10 )
{
v11 = *((_QWORD **)v10 + 2);
v29 = (unsigned __int64)&v11[*v10 - 1];
v33 = v2;
do
{
v12 = *v11;
if ( !*v11 )
break;
if ( (*(_BYTE *)(v12 + 320) & 1) != 0 )
{
sub_10001AD30(&v31, *(const void **)(v12 + 336), *(_QWORD *)(v12 + 328));
}
else
{
__p = *(void **)(v12 + 336);
v31 = *(_OWORD *)(v12 + 320);
}
v28 = v12;
if ( (v31 & 1) != 0 )
{
sub_10001AD30(&v34, __p, *((unsigned __int64 *)&v31 + 1));
}
else
{
__s = __p;
v34 = v31;
}
v13 = (char *)__s;
v14 = (char *)&v34 + ((unsigned __int8)v34 >> 1) + 1;
if ( (v34 & 1) != 0 )
v14 = (char *)__s + *((_QWORD *)&v34 + 1);
else
v13 = (char *)&v34 + 1;
for ( ; v13 != v14; ++v13 )
*v13 = __tolower((unsigned __int8)*v13);
if ( (v31 & 1) != 0 )
operator delete(__p);
v15 = v34 & 1;
v27 = v11;
if ( (v34 & 1) != 0 )
{
v16 = (char *)__s;
v17 = *((_QWORD *)&v34 + 1);
v18 = (unsigned __int8)__s2;
if ( (__s2 & 1) == 0 )
goto LABEL_35;
}
else
{
v17 = (unsigned __int8)v34 >> 1;
v16 = (char *)&v34 + 1;
v18 = (unsigned __int8)__s2;
if ( (__s2 & 1) == 0 )
{
LABEL_35:
v19 = v18 >> 1;
v20 = (char *)&__s2 + 1;
if ( v19 )
goto LABEL_39;
goto LABEL_47;
}
}
v20 = (char *)v37;
v19 = *((_QWORD *)&__s2 + 1);
if ( *((_QWORD *)&__s2 + 1) )
{
LABEL_39:
if ( v17 < v19 )
goto LABEL_48;
v38 = v34 & 1;
v21 = &v16[v17];
v22 = *v20;
v30 = v16;
v23 = v16;
while ( 1 )
{
v24 = v17 - v19 + 1;
if ( !v24 || (v25 = (char *)memchr(v23, v22, v24)) == nullptr )
{
LABEL_45:
v2 = v33;
v15 = v38;
goto LABEL_48;
}
v26 = v25;
if ( !memcmp(v25, v20, v19) )
break;
v23 = v26 + 1;
v17 = v21 - (_BYTE *)v23;
if ( v21 - (_BYTE *)v23 < v19 )
goto LABEL_45;
}
v2 = v33;
v15 = v38;
if ( v26 == v21 || v26 - v30 == -1 )
goto LABEL_48;
}
LABEL_47:
sub_1007FEBF0(*(_QWORD *)(v2 + 864), v28);
v15 = v34 & 1;
LABEL_48:
if ( v15 )
operator delete(__s);
v11 = v27 + 1;
}
while ( (unsigned __int64)(v27 + 1) <= v29 );
}
}
if ( (__s2 & 1) != 0 )
operator delete(v37);
}
}