//
// ProfilePage::onCopyName from 0x1007bd7e0 to 0x1007bd9cb (491 bytes)
//
// 1 xrefs:
// > ProfilePage::loadPageFromUserInfo @ 0x1007bb467
//
// 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 ProfilePage::onCopyName(ProfilePage *a1, cocos2d::CCObject *a2)
{
double v2; // xmm0_8
GameLevelManager *v4; // rax
__int64 v5; // r8
__int64 v6; // r9
__int64 v7; // rcx
__int64 v8; // rdx
char v9; // al
const std::string::value_type *size; // rsi
std::string::size_type v11; // rdi
GJUserScore *m_score; // rcx
cocos2d::CCObject *v13; // rax
std::string m_userName; // [rsp+0h] [rbp-80h] BYREF
__int128 v15; // [rsp+18h] [rbp-68h] BYREF
void *v16; // [rsp+28h] [rbp-58h]
__int128 v17; // [rsp+30h] [rbp-50h] BYREF
void *__p; // [rsp+40h] [rbp-40h]
void *v19[3]; // [rsp+48h] [rbp-38h] BYREF
std::string v20; // [rsp+60h] [rbp-20h] BYREF
if ( !a1->m_score )
return;
v4 = GameLevelManager::sharedState();
GameLevelManager::tryGetUsername(&v20, (__int64)v4, a1->m_score->m_accountID, v2);
v7 = (__int64)v20.__r_.__value_.__l.0;
v8 = *(_BYTE *)&v20.__r_.__value_.__l.0 >> 1;
v9 = *(_BYTE *)&v20.__r_.__value_.__s.0 & 1;
size = (const std::string::value_type *)v20.__r_.__value_.__l.__size_;
v11 = v20.__r_.__value_.__l.__size_;
if ( (*(_BYTE *)&v20.__r_.__value_.__s.0 & 1) == 0 )
v11 = *(_BYTE *)&v20.__r_.__value_.__l.0 >> 1;
if ( v11 )
{
if ( v9 )
v8 = v20.__r_.__value_.__l.__size_;
if ( v8 )
goto LABEL_8;
LABEL_16:
size = "-";
std::string::assign(&v20, "-");
v7 = (__int64)v20.__r_.__value_.__l.0;
if ( (*(_BYTE *)&v20.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_9;
LABEL_17:
size = v20.__r_.__value_.__l.__data_;
sub_100006B70(&v17, v20.__r_.__value_.__l.__data_, v20.__r_.__value_.__l.__size_, v2);
goto LABEL_18;
}
m_score = a1->m_score;
if ( (m_score->m_userName.m_data.m_short.sizex2 & 1) == 0 )
{
m_userName = (std::string)m_score->m_userName;
if ( !v9 )
goto LABEL_13;
goto LABEL_12;
}
sub_100006B70(&m_userName, m_score->m_userName.m_data.m_long.longStorage, m_score->m_userName.m_data.m_long.size, v2);
if ( (*(_BYTE *)&v20.__r_.__value_.__s.0 & 1) != 0 )
LABEL_12:
operator delete(v20.__r_.__value_.__l.__data_);
LABEL_13:
v20 = m_userName;
v2 = *(double *)m_userName.__r_.__value_.__r.__words;
v7 = (__int64)m_userName.__r_.__value_.__l.0;
size = (const std::string::value_type *)m_userName.__r_.__value_.__l.__size_;
v8 = *(_BYTE *)&m_userName.__r_.__value_.__l.0 >> 1;
if ( (*(_BYTE *)&m_userName.__r_.__value_.__s.0 & 1) != 0 )
v8 = m_userName.__r_.__value_.__l.__size_;
if ( !v8 )
goto LABEL_16;
LABEL_8:
if ( (v7 & 1) != 0 )
goto LABEL_17;
LABEL_9:
__p = v20.__r_.__value_.__l.__data_;
v17 = *(_OWORD *)&v20.__r_.__value_.__l.0;
LABEL_18:
PlatformToolbox::copyToClipboard((__int64)&v17, (__int64)size, v8, v7, v5, v6);
if ( (v17 & 1) != 0 )
operator delete(__p);
strcpy((char *)v19, "&Copied to clipboard");
LOWORD(v15) = 0;
v13 = TextAlertPopup::create((__int64)v19, 0x96u, &v15, (__m128)0x3F000000u, 0.60000002);
((void (__fastcall *)(ProfilePage *, cocos2d::CCObject *, __int64))a1->addChild_0)(a1, v13, 100);
if ( (v15 & 1) != 0 )
{
operator delete(v16);
if ( ((__int64)v19[0] & 1) == 0 )
{
LABEL_22:
if ( (*(_BYTE *)&v20.__r_.__value_.__s.0 & 1) == 0 )
return;
goto LABEL_23;
}
}
else if ( ((__int64)v19[0] & 1) == 0 )
{
goto LABEL_22;
}
operator delete(v19[2]);
if ( (*(_BYTE *)&v20.__r_.__value_.__s.0 & 1) != 0 )
LABEL_23:
operator delete(v20.__r_.__value_.__l.__data_);
}