//
// NewThreadPopup::insertShareToken from 0xc74374 to 0xc7464c (728 bytes)
//
// 4 xrefs:
// > NewThreadPopup::levelPicked @ 0xc74710
// > NewThreadPopup::listPicked @ 0xc74844
// > NewThreadPopup::shareIDPicked @ 0xc74950
// > ??> @ 0xdfee8
//
// 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:32 +0000
//
__int64 __fastcall NewThreadPopup::insertShareToken(NewThreadPopup *a1, __int64 a2)
{
CCTextInputNode *v4; // x0
char *v5; // x1
size_t v6; // x2
int v7; // w0
int v8; // w21
cocos2d::CCDirector *v9; // x0
_QWORD *v10; // x20
int v12; // w0
int v13; // w0
__int64 *v14; // x20
__int64 v15; // x3
void (__fastcall *v16)(__int64 *, __int64, __int64); // x23
__int64 v17; // x0
__int64 v18; // [xsp+40h] [xbp+40h] BYREF
size_t v19; // [xsp+48h] [xbp+48h]
void *v20; // [xsp+50h] [xbp+50h]
unsigned __int64 v21[2]; // [xsp+58h] [xbp+58h] BYREF
void *v22; // [xsp+68h] [xbp+68h]
__int64 v23[2]; // [xsp+70h] [xbp+70h] BYREF
void *v24; // [xsp+80h] [xbp+80h]
__int64 v25[2]; // [xsp+88h] [xbp+88h] BYREF
void *v26; // [xsp+98h] [xbp+98h]
__int64 v27; // [xsp+A0h] [xbp+A0h] BYREF
size_t v28; // [xsp+A8h] [xbp+A8h]
void *v29; // [xsp+B0h] [xbp+B0h]
v4 = *((CCTextInputNode **)a1 + 111);
if ( !v4 )
return _stack_chk_guard;
CCTextInputNode::getString(v4, &v18);
if ( (v18 & 1) != 0 )
{
if ( v19 )
{
v13 = (unsigned __int8)*((char *)v20 + v19 - 1);
if ( v13 != 32 )
goto LABEL_25;
}
}
else
{
v12 = (int)(unsigned __int8)v18 >> 1;
if ( v12 )
{
v13 = *((unsigned __int8 *)&v18 + v12);
if ( v13 != 32 )
{
LABEL_25:
if ( v13 != 10 )
std::string::append((__int64)&v18, &byte_11E1A70);
}
}
}
std::operator+(&byte_11E1A70, a2, v21);
if ( (v21[0] & 1) != 0 )
{
v5 = (char *)v22;
v6 = v21[1];
}
else
{
v6 = LOBYTE(v21[0]) >> 1;
v5 = (char *)v21 + 1;
}
std::string::append((__int64)&v18, v5, v6);
if ( (v21[0] & 1) != 0 )
operator delete(v22);
v7 = NewThreadPopup::bodyEmoteCap(a1);
v8 = EmoteSprite::effectiveLength((char *)&v18, v7);
v9 = (cocos2d::CCDirector *)NewThreadPopup::bodyCharLimit(a1);
if ( v8 > (int)v9 )
{
v14 = *(__int64 **)(cocos2d::CCDirector::sharedDirector(v9) + 272);
v15 = *v14;
v23[0] = 0;
v23[1] = 0;
v16 = *(void (__fastcall **)(__int64 *, __int64, __int64))(v15 + 464);
v24 = nullptr;
std::string::__init(v23, "Message too long", 0x10u);
v25[0] = 0;
v25[1] = 0;
v26 = nullptr;
std::string::__init(v25, &byte_11B8890, 0);
v17 = TextAlertPopup::create((char *)v23, 150, (char *)v25, 0.5, 0.6);
v16(v14, v17, 1000);
if ( (v25[0] & 1) != 0 )
operator delete(v26);
if ( (v23[0] & 1) != 0 )
operator delete(v24);
}
else
{
v27 = 0;
v28 = 0;
v29 = nullptr;
v10 = *((_QWORD **)a1 + 111);
if ( (v18 & 1) != 0 )
{
std::string::__init(&v27, v20, v19);
}
else
{
v27 = v18;
v28 = v19;
v29 = v20;
}
CCTextInputNode::setString(v10, (char *)&v27);
if ( (v27 & 1) != 0 )
operator delete(v29);
}
if ( (v18 & 1) != 0 )
operator delete(v20);
return _stack_chk_guard;
}