//
// sub_1005135EC from 0x1005135ec to 0x1005137e8 (508 bytes)
//
// 1 xrefs:
// > ThreadDescPopup::buildUI @ 0x100513184
//
// 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:07:04 +0000
//
void __fastcall sub_1005135EC(__int64 a1)
{
__int64 v2; // x0
int v3; // w0
__int64 v4; // x0
__int64 v5; // x21
size_t size; // x2
__int64 v7; // x10
int v8; // w9
std::string *p_str; // x0
const void *v10; // x1
bool v11; // w22
int v12; // w8
size_t v13; // x2
__int64 v14; // x10
int v15; // w9
const void *v16; // x0
const void *v17; // x8
const void *v18; // x21
const void *v19; // t1
const void *v20; // x1
int v21; // w0
_BOOL4 v22; // w21
__int64 v23; // x0
void *__p[2]; // [xsp+0h] [xbp-50h] BYREF
char v25; // [xsp+17h] [xbp-39h]
std::string __str; // [xsp+18h] [xbp-38h] BYREF
v2 = *(_QWORD *)(a1 + 1048);
if ( v2 )
CCTextInputNode::getString(v2, &__str);
else
sub_100009900(&__str, "");
v3 = EmoteSprite::maxEmotesComment();
if ( (int)EmoteSprite::effectiveLength(&__str, v3) < 301 )
{
v5 = *(_QWORD *)(a1 + 1032);
if ( (__str.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
size = HIBYTE(__str.__r_.__value_.__r.__words[2]);
else
size = __str.__r_.__value_.__l.__size_;
v7 = *(unsigned __int8 *)(v5 + 239);
v8 = (char)v7;
if ( (v7 & 0x80u) != 0LL )
v7 = *(_QWORD *)(v5 + 224);
if ( size == v7 )
{
if ( (__str.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
p_str = &__str;
else
p_str = (std::string *)__str.__r_.__value_.__r.__words[0];
if ( v8 >= 0 )
v10 = (const void *)(v5 + 216);
else
v10 = *(const void **)(v5 + 216);
v11 = memcmp(p_str, v10, size) != 0;
}
else
{
v11 = 1;
}
v12 = *(char *)(a1 + 1111);
if ( v12 >= 0 )
v13 = *(unsigned __int8 *)(a1 + 1111);
else
v13 = *(_QWORD *)(a1 + 1096);
v14 = *(unsigned __int8 *)(v5 + 263);
v15 = (char)v14;
if ( (v14 & 0x80u) != 0LL )
v14 = *(_QWORD *)(v5 + 248);
if ( v13 == v14 )
{
if ( v12 >= 0 )
v16 = (const void *)(a1 + 1088);
else
v16 = *(const void **)(a1 + 1088);
v19 = *(const void **)(v5 + 240);
v18 = (const void *)(v5 + 240);
v17 = v19;
if ( v15 >= 0 )
v20 = v18;
else
v20 = v17;
v21 = memcmp(v16, v20, v13);
v22 = v21 != 0;
if ( !v11 && !v21 )
{
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a1 + 1368LL))(a1, 0);
goto LABEL_41;
}
}
else
{
v22 = 1;
}
std::string::operator=((std::string *)(a1 + 1064), &__str);
*(_BYTE *)(a1 + 1112) = v11;
if ( v22 )
{
v23 = GameLevelManager::sharedState();
if ( (unsigned int)sub_1000C8838(v23, *(_DWORD *)(*(_QWORD *)(a1 + 1032) + 56LL), 16, a1 + 1088) )
{
*(_QWORD *)(GameLevelManager::sharedState() + 1264) = a1 + 1016;
*(_BYTE *)(a1 + 1113) = 1;
}
}
else
{
sub_100513BD8(a1);
}
}
else
{
sub_100009900(__p, "Description is too long.");
v4 = sub_10034A8F8(0, (__int64)"Description", (__int64)__p, (__int64)"OK", 0);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v4 + 1312LL))(v4);
if ( v25 < 0 )
operator delete(__p[0]);
}
LABEL_41:
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
}