//
// LevelPickerPopup::refreshUseID from 0xc707c8 to 0xc70afc (820 bytes)
//
// 4 xrefs:
// > LevelPickerPopup::onToggleKind @ 0xc847c8
// > LevelPickerPopup::onOnlineMode @ 0xc84d54
// > LevelPickerPopup::textChanged @ 0xc84e70
// > ??> @ 0x101d10
//
// 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 13:05:30 +0000
//
__int64 __fastcall LevelPickerPopup::refreshUseID(LevelPickerPopup *this)
{
char *v1; // x2
char v3; // w0
__int64 v4; // x0
__int64 v5; // x1
char *v6; // x3
__int64 v7; // x0
unsigned __int64 v8; // x2
char *v9; // x0
char *v10; // x2
char *v11; // x1
__int64 v12; // x0
char *v13; // x0
int v14; // w2
char *v15; // x0
int v16; // t1
unsigned __int64 v17; // x1
int v18; // w23
char *v19; // x26
char *v20; // x22
char *v21; // x26
const char *v22; // x0
char *v23; // x0
__int64 v24; // x0
unsigned int v25; // w22
int v26; // w0
ButtonSprite *v27; // x20
char *v28; // x1
cocos2d::CCString *v29; // x0
const char *CString; // x0
char *v32; // x24
__int64 v33; // [xsp+50h] [xbp+50h] BYREF
__int64 v34; // [xsp+58h] [xbp+58h]
char *v35; // [xsp+60h] [xbp+60h]
v1 = (char *)this + 872;
v33 = 0;
v3 = *((_BYTE *)this + 872);
v34 = 0;
v35 = nullptr;
if ( (v3 & 1) != 0 )
{
std::string::__init(&v33, *((void **)v1 + 2), *((_QWORD *)v1 + 1));
}
else
{
v4 = *(_QWORD *)v1;
v5 = *((_QWORD *)v1 + 1);
v35 = *((char **)v1 + 2);
v33 = v4;
v34 = v5;
}
if ( (v33 & 1) != 0 )
{
v6 = v35;
v7 = v34;
}
else
{
v7 = (unsigned __int8)v33 >> 1;
v6 = (char *)&v33 + 1;
}
v8 = -1;
if ( v7 )
{
v9 = &v6[v7];
if ( v9 != v6 )
{
v10 = v6;
if ( *v6 == 32 )
{
do
{
if ( v9 == ++v10 )
{
v8 = -1;
goto LABEL_12;
}
}
while ( *v10 == 32 );
v8 = v10 - v6;
}
else
{
v8 = 0;
}
}
}
LABEL_12:
std::string::erase((char *)&v33, 0, v8);
if ( (v33 & 1) != 0 )
{
v11 = v35;
v12 = v34;
}
else
{
v12 = (unsigned __int8)v33 >> 1;
v11 = (char *)&v33 + 1;
}
v13 = &v11[v12];
if ( v13 == v11 )
goto LABEL_19;
v14 = (unsigned __int8)*(v13 - 1);
v15 = v13 - 1;
if ( v14 == 32 )
{
while ( v15 != v11 )
{
v16 = (unsigned __int8)*--v15;
if ( v16 != 32 )
goto LABEL_52;
}
LABEL_19:
v17 = 0;
goto LABEL_20;
}
LABEL_52:
v17 = v15 - v11 + 1;
LABEL_20:
std::string::erase((char *)&v33, v17, 0xFFFFFFFFFFFFFFFFLL);
v18 = v33 & 1;
if ( v18 )
{
if ( (unsigned __int64)(v34 - 1) > 9 )
{
v24 = *((_QWORD *)this + 116);
v25 = 0;
if ( !v24 )
goto LABEL_43;
goto LABEL_35;
}
v19 = v35;
v20 = &v35[v34];
if ( v35 == &v35[v34] )
{
v21 = v35;
goto LABEL_24;
}
LABEL_46:
v32 = v19;
while ( memchr("0123456789", (unsigned __int8)*v32, 0xAu) )
{
if ( v20 == ++v32 )
goto LABEL_55;
}
if ( v32 - v19 != -1 )
goto LABEL_50;
LABEL_55:
v22 = (char *)&v33 + 1;
if ( !v18 )
{
LABEL_25:
if ( atoll(v22) <= 0 )
goto LABEL_50;
v23 = (char *)&v33 + 1;
if ( v18 )
v23 = v35;
if ( atoll(v23) > 0x7FFFFFFF )
{
LABEL_50:
v24 = *((_QWORD *)this + 116);
v25 = 0;
if ( !v24 )
goto LABEL_40;
}
else
{
v24 = *((_QWORD *)this + 116);
v25 = 1;
if ( !v24 )
{
LABEL_36:
v27 = *((ButtonSprite **)this + 117);
if ( v27 )
{
v28 = (char *)&v33 + 1;
if ( v18 )
v28 = v35;
v29 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"Use ID %s", v28);
CString = (const char *)cocos2d::CCString::getCString(v29);
ButtonSprite::setString(v27, CString);
v18 = v33 & 1;
}
LABEL_40:
if ( !v18 )
return _stack_chk_guard;
LABEL_43:
operator delete(v35);
return _stack_chk_guard;
}
}
LABEL_35:
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v24 + 344LL))(v24, v25);
v18 = v33 & 1;
if ( !v25 )
goto LABEL_40;
goto LABEL_36;
}
v21 = v35;
LABEL_24:
v22 = v21;
goto LABEL_25;
}
v26 = (int)(unsigned __int8)v33 >> 1;
if ( v26 && v26 <= 10 )
{
v19 = (char *)&v33 + 1;
v22 = (char *)&v33 + v26 + 1;
v20 = (char *)v22;
if ( v22 == (char *)&v33 + 1 )
goto LABEL_25;
goto LABEL_46;
}
v24 = *((_QWORD *)this + 116);
v25 = 0;
if ( v24 )
goto LABEL_35;
return _stack_chk_guard;
}