//
// LevelSearchLayer::updateSearchLabel from 0x10062a270 to 0x10062a597 (807 bytes)
//
// 5 xrefs:
// > LevelSearchLayer::init @ 0x1006283b0
// > LevelSearchLayer::textInputClosed @ 0x10062c088
// > sub_10062C0C0 @ 0x10062c0ef
// > LevelSearchLayer::textChanged @ 0x10062c158
// > sub_10062C190 @ 0x10062c1bf
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void __fastcall LevelSearchLayer::updateSearchLabel(LevelSearchLayer *a1, const char *a2)
{
double v2; // xmm0_8
const char *v3; // r13
__int64 v4; // r14
size_t v5; // rbx
char *v6; // r15
size_t v7; // rax
size_t v8; // r13
char *v9; // rbx
unsigned int v10; // r14d
size_t v11; // rax
size_t v12; // r13
char *v13; // rbx
size_t v14; // r15
char v15; // r14
size_t v16; // r15
void *v17; // r12
size_t v18; // rcx
char *v19; // rdi
char *v20; // rsi
size_t v21; // rdx
bool v22; // zf
bool v23; // r15
bool v24; // r14
CCTextInputNode *m_searchInput; // r14
char v26; // bl
std::string v28; // [rsp+10h] [rbp-90h] BYREF
__int64 __s1; // [rsp+28h] [rbp-78h] BYREF
size_t __n; // [rsp+30h] [rbp-70h]
void *__p; // [rsp+38h] [rbp-68h]
cocos2d::CCLabelBMFont *m_textLabel; // [rsp+40h] [rbp-60h]
__int64 v33; // [rsp+48h] [rbp-58h] BYREF
size_t v34; // [rsp+50h] [rbp-50h]
void *v35; // [rsp+58h] [rbp-48h]
__int128 __dst; // [rsp+60h] [rbp-40h] BYREF
void *__s2; // [rsp+70h] [rbp-30h]
m_textLabel = a1->m_searchInput->m_textLabel;
v3 = "Enter a level, user or id";
if ( a1->m_type == 1 )
v3 = "Enter a list or id";
v4 = 25;
v5 = 25;
if ( a1->m_type == 1 )
v5 = 18;
v6 = (char *)&__dst + 1;
if ( a1->m_type == 1 )
{
LOBYTE(__dst) = 36;
v4 = 18;
}
else
{
v6 = (char *)operator new(0x20u);
__s2 = v6;
*(_QWORD *)&__dst = 33;
*((_QWORD *)&__dst + 1) = 25;
}
memcpy(v6, v3, v5);
v6[v4] = 0;
v7 = strlen(a2);
if ( v7 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v2);
v8 = v7;
if ( v7 >= 0x17 )
{
v14 = 26;
if ( (v7 | 7) != 0x17 )
v14 = (v7 | 7) + 1;
v9 = (char *)operator new(v14);
v35 = v9;
v33 = v14 | 1;
v34 = v8;
}
else
{
LOBYTE(v33) = 2 * v7;
v9 = (char *)&v33 + 1;
if ( !v7 )
{
BYTE1(v33) = 0;
v10 = (unsigned __int8)v33;
if ( (v33 & 1) != 0 )
goto LABEL_12;
goto LABEL_21;
}
}
memcpy(v9, a2, v8);
v9[v8] = 0;
v10 = (unsigned __int8)v33;
if ( (v33 & 1) != 0 )
{
LABEL_12:
if ( v34 )
goto LABEL_13;
goto LABEL_22;
}
LABEL_21:
if ( v10 >> 1 )
{
LABEL_13:
v11 = strlen(a2);
if ( v11 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v2);
v12 = v11;
if ( v11 >= 0x17 )
{
v16 = 26;
if ( (v11 | 7) != 0x17 )
v16 = (v11 | 7) + 1;
v13 = (char *)operator new(v16);
__p = v13;
__s1 = v16 | 1;
__n = v12;
}
else
{
LOBYTE(__s1) = 2 * v11;
v13 = (char *)&__s1 + 1;
if ( !v11 )
{
LABEL_28:
v13[v12] = 0;
v17 = __p;
if ( (__s1 & 1) != 0 )
{
v18 = __n;
v19 = (char *)__p;
}
else
{
v19 = (char *)&__s1 + 1;
v18 = (unsigned __int8)__s1 >> 1;
}
v20 = (char *)&__dst + 1;
v21 = (unsigned __int8)__dst >> 1;
if ( (__dst & 1) != 0 )
{
v21 = *((_QWORD *)&__dst + 1);
v20 = (char *)__s2;
}
v22 = v21 == v18;
if ( v21 >= v18 )
v21 = v18;
v23 = v22;
v24 = memcmp(v19, v20, v21) == 0;
if ( (__s1 & 1) != 0 )
operator delete(v17);
v15 = v23 && v24;
if ( (v33 & 1) != 0 )
goto LABEL_38;
goto LABEL_39;
}
}
memcpy(v13, a2, v12);
goto LABEL_28;
}
LABEL_22:
v15 = 1;
if ( (v33 & 1) != 0 )
LABEL_38:
operator delete(v35);
LABEL_39:
if ( v15 )
{
m_searchInput = a1->m_searchInput;
v26 = __dst & 1;
if ( (__dst & 1) != 0 )
{
sub_100006B70(&v28, __s2, *((unsigned __int64 *)&__dst + 1), v2);
}
else
{
v28.__r_.__value_.__r.__words[2] = (std::string::size_type)__s2;
v2 = *(double *)&__dst;
*(_OWORD *)&v28.__r_.__value_.__l.0 = __dst;
}
CCTextInputNode::updateLabel(m_searchInput, &v28, v2);
if ( (*(_BYTE *)&v28.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v28.__r_.__value_.__l.__data_);
BYTE2(v33) = -40;
LOWORD(v33) = -26260;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, __int64 *))m_textLabel->setColor)(m_textLabel, &v33);
}
else
{
BYTE2(v33) = -1;
LOWORD(v33) = -1;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, __int64 *))m_textLabel->setColor)(m_textLabel, &v33);
v26 = __dst & 1;
}
if ( v26 )
operator delete(__s2);
}