//
// sub_100505798 from 0x100505798 to 0x1005059b4 (540 bytes)
//
// 3 xrefs:
// > sub_100505178 @ 0x1005052c8
// > sub_1005054E4 @ 0x1005055d4
// > LevelPickerPopup::textChanged @ 0x100506338
//
// 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 11:06:56 +0000
//
void __fastcall sub_100505798(__int64 a1)
{
unsigned __int128 v2; // kr00_16
std::string::size_type v3; // x2
std::string::size_type size; // x8
std::string *p_dst; // x9
char *v6; // x9
int v7; // w10
std::string::size_type v8; // x1
char v9; // w21
std::string::size_type v10; // x22
std::string *v11; // x23
__int64 v12; // x24
std::string *v13; // x20
_BOOL8 v14; // x20
__int64 v15; // x0
__int64 v16; // x19
std::string *v17; // x8
void *v18; // x0
const std::string::value_type *CString; // x0
std::string __dst; // [xsp+10h] [xbp-50h] BYREF
if ( *(char *)(a1 + 895) < 0 )
sub_1000097D0(&__dst, *(void **)(a1 + 872), *(_QWORD *)(a1 + 880));
else
__dst = *(std::string *)(a1 + 872);
v2 = __PAIR128__(HIBYTE(__dst.__r_.__value_.__r.__words[2]), &__dst);
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
v2 = *(_OWORD *)&__dst.__r_.__value_.__l.__data_;
if ( *((_QWORD *)&v2 + 1) )
{
v3 = 0;
while ( *(_BYTE *)(v2 + v3) == 32 )
{
if ( *((_QWORD *)&v2 + 1) == ++v3 )
goto LABEL_10;
}
}
else
{
LABEL_10:
v3 = -1;
}
std::string::erase(&__dst, 0, v3);
size = HIBYTE(__dst.__r_.__value_.__r.__words[2]);
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
p_dst = &__dst;
else
p_dst = (std::string *)__dst.__r_.__value_.__r.__words[0];
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
size = __dst.__r_.__value_.__l.__size_;
v6 = (char *)&p_dst[-1].__r_.__value_.__r.__words[2] + 7;
while ( size )
{
v7 = (unsigned __int8)v6[size--];
if ( v7 != 32 )
{
v8 = size + 1;
goto LABEL_21;
}
}
v8 = 0;
LABEL_21:
std::string::erase(&__dst, v8, 0xFFFFFFFFFFFFFFFFLL);
v9 = HIBYTE(__dst.__r_.__value_.__r.__words[2]);
if ( SHIBYTE(__dst.__r_.__value_.__r.__words[2]) < 0 )
{
v10 = __dst.__r_.__value_.__l.__size_;
if ( __dst.__r_.__value_.__l.__size_ - 1 >= 0xA )
goto LABEL_35;
v11 = (std::string *)__dst.__r_.__value_.__r.__words[0];
}
else
{
if ( (unsigned int)HIBYTE(__dst.__r_.__value_.__r.__words[2]) - 1 >= 0xA )
goto LABEL_35;
v10 = HIBYTE(__dst.__r_.__value_.__r.__words[2]);
v11 = &__dst;
}
v12 = 0;
while ( memchr("0123456789", v11->__r_.__value_.__s.__data_[v12], 0xAu) )
{
if ( v10 == ++v12 )
goto LABEL_31;
}
if ( v12 != -1 )
goto LABEL_35;
LABEL_31:
if ( v9 < 0 )
{
v13 = (std::string *)__dst.__r_.__value_.__r.__words[0];
if ( atoll(__dst.__r_.__value_.__l.__data_) > 0 )
goto LABEL_33;
}
else
{
v13 = &__dst;
if ( atoll((const char *)&__dst) >= 1 )
{
LABEL_33:
v14 = atoll((const char *)v13) < 0x80000000LL;
goto LABEL_36;
}
}
LABEL_35:
v14 = 0;
LABEL_36:
v15 = *(_QWORD *)(a1 + 928);
if ( v15 )
(*(void (__fastcall **)(__int64, _BOOL8))(*(_QWORD *)v15 + 344LL))(v15, v14);
if ( v14 )
{
v16 = *(_QWORD *)(a1 + 936);
if ( v16 )
{
v17 = &__dst;
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
v17 = (std::string *)__dst.__r_.__value_.__r.__words[0];
v18 = sub_1003065B0("Use ID %s", (const char *)v17);
CString = (const std::string::value_type *)cocos2d::CCString::getCString((__int64)v18);
ButtonSprite::setString(v16, CString);
}
}
if ( SHIBYTE(__dst.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
}