//
// ThreadDescPopup::onSave from 0xc7a9e8 to 0xc7ad68 (896 bytes)
//
// 3 xrefs:
// > ??> @ 0xf6820
// > ThreadDescPopup::buildUI @ 0xc7a0f4
// > ??> @ 0x1547788
//
// 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:35 +0000
//
__int64 __fastcall ThreadDescPopup::onSave(ThreadDescPopup *this, cocos2d::CCObject *a2)
{
CCTextInputNode *v3; // x0
EmoteSprite *String; // x0
int v5; // w0
unsigned __int8 v6; // w23
__int64 v7; // x19
int v8; // w26
size_t v9; // x2
unsigned __int8 v10; // w0
int v11; // w4
unsigned int v12; // w24
size_t v13; // x2
__int64 *v14; // x0
unsigned int v15; // w19
char *v16; // x1
size_t v17; // x2
unsigned __int8 *v19; // x0
unsigned __int8 *v20; // x1
unsigned __int8 *v21; // x3
unsigned __int8 *v22; // x2
int v23; // t1
unsigned __int8 *v24; // x0
unsigned __int8 *v25; // x1
unsigned __int8 *v26; // x3
unsigned __int8 *v27; // x2
int v28; // t1
cocos2d::CCObject *v29; // x0
GameLevelManager *updated; // x0
__int64 v31; // x0
__int64 v32; // [xsp+58h] [xbp+58h] BYREF
size_t v33; // [xsp+60h] [xbp+60h]
void *v34; // [xsp+68h] [xbp+68h]
__int64 v35[2]; // [xsp+70h] [xbp+70h] BYREF
void *v36; // [xsp+80h] [xbp+80h]
v3 = *((CCTextInputNode **)this + 131);
if ( v3 )
{
String = (EmoteSprite *)CCTextInputNode::getString(v3, &v32);
}
else
{
v32 = 0;
v33 = 0;
v34 = nullptr;
String = (EmoteSprite *)std::string::__init(&v32, &byte_11B8890, 0);
}
v5 = EmoteSprite::maxEmotesComment(String);
if ( (int)EmoteSprite::effectiveLength((char *)&v32, v5) <= 300 )
{
v6 = v32;
v7 = *((_QWORD *)this + 129);
v8 = v32 & 1;
v9 = (unsigned __int8)v32 >> 1;
if ( v8 )
v9 = v33;
v10 = *(_BYTE *)(v7 + 216);
v11 = v10 & 1;
if ( (v10 & 1) != 0 )
{
v12 = 1;
if ( v9 != *(_QWORD *)(v7 + 224) )
goto LABEL_8;
}
else
{
v12 = 1;
if ( v9 != v10 >> 1 )
goto LABEL_8;
}
v24 = (unsigned __int8 *)&v32 + 1;
if ( v8 )
v24 = (unsigned __int8 *)v34;
v25 = (unsigned __int8 *)(v7 + 217);
if ( v11 )
v25 = *(unsigned __int8 **)(v7 + 232);
if ( v8 )
{
v12 = 0;
if ( v9 )
v12 = memcmp(v24, v25, v9) != 0;
}
else
{
if ( !v9 )
{
LABEL_46:
v12 = 0;
goto LABEL_8;
}
if ( *v24 == *v25 )
{
v26 = v24 + 1;
v27 = &v24[v9];
do
{
++v25;
if ( v26 == v27 )
goto LABEL_46;
v28 = *v26++;
}
while ( *v25 == v28 );
}
v12 = 1;
}
LABEL_8:
v13 = *((_BYTE *)this + 1088) >> 1;
if ( (*((_BYTE *)this + 1088) & 1) != 0 )
v13 = *((_QWORD *)this + 137);
if ( (*(_BYTE *)(v7 + 240) & 1) != 0 )
{
if ( v13 != *(_QWORD *)(v7 + 248) )
goto LABEL_12;
}
else if ( v13 != *(_BYTE *)(v7 + 240) >> 1 )
{
goto LABEL_12;
}
v19 = (unsigned __int8 *)this + 1089;
if ( (*((_BYTE *)this + 1088) & 1) != 0 )
v19 = *((unsigned __int8 **)this + 138);
v20 = (unsigned __int8 *)(v7 + 241);
if ( (*(_BYTE *)(v7 + 240) & 1) != 0 )
v20 = *(unsigned __int8 **)(v7 + 256);
if ( (*((_BYTE *)this + 1088) & 1) != 0 )
{
v15 = 1;
if ( v13 )
v15 = memcmp(v19, v20, v13) == 0;
LABEL_32:
if ( v15 > v12 )
{
(*(void (__fastcall **)(ThreadDescPopup *, _QWORD))(*(_QWORD *)this + 1368LL))(this, 0);
if ( (v32 & 1) == 0 )
return _stack_chk_guard;
LABEL_34:
operator delete(v34);
return _stack_chk_guard;
}
v14 = (__int64 *)((char *)this + 1064);
if ( (__int64 *)((char *)this + 1064) == &v32 )
{
LABEL_16:
*((_BYTE *)this + 1112) = v12;
if ( v15 )
{
ThreadDescPopup::sendDescription(this);
goto LABEL_18;
}
goto LABEL_48;
}
LABEL_13:
if ( v8 )
{
v16 = (char *)v34;
v17 = v33;
}
else
{
v17 = v6 >> 1;
v16 = (char *)&v32 + 1;
}
v14 = std::string::assign(v14, v16, v17);
goto LABEL_16;
}
if ( !v13 )
{
LABEL_31:
v15 = 1;
goto LABEL_32;
}
if ( *v19 == *v20 )
{
v21 = v19 + 1;
v22 = &v19[v13];
do
{
++v20;
if ( v21 == v22 )
goto LABEL_31;
v23 = *v21++;
}
while ( *v20 == v23 );
}
LABEL_12:
v14 = (__int64 *)((char *)this + 1064);
v15 = 0;
if ( (__int64 *)((char *)this + 1064) == &v32 )
{
*((_BYTE *)this + 1112) = v12;
LABEL_48:
v29 = (cocos2d::CCObject *)GameLevelManager::sharedState((GameLevelManager *)v14);
updated = (GameLevelManager *)(unsigned __int8)GameLevelManager::updateThread(
v29,
(char *)*(unsigned int *)(*((_QWORD *)this + 129) + 56LL),
16,
(char *)this + 1088);
if ( (_BYTE)updated )
{
*(_QWORD *)(GameLevelManager::sharedState(updated) + 1264) = (char *)this + 1016;
*((_BYTE *)this + 1113) = 1;
}
goto LABEL_18;
}
goto LABEL_13;
}
v35[0] = 0;
v35[1] = 0;
v36 = nullptr;
std::string::__init(v35, "Description is too long.", 0x18u);
v31 = FLAlertLayer::create(0, (cocos2d::CCLabelBMFont *)"Description", (char *)v35, (ButtonSprite *)"OK", nullptr);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v31 + 1312LL))(v31);
if ( (v35[0] & 1) != 0 )
operator delete(v36);
LABEL_18:
if ( (v32 & 1) != 0 )
goto LABEL_34;
return _stack_chk_guard;
}