//
// EmoteSprite::translateUnicodeEmoji from 0x1004dc788 to 0x1004dca14 (652 bytes)
//
// 2 xrefs:
// > CCTextInputNode::insertAtCursor @ 0x1001fbd84
// > CCTextInputNode::onTextFieldInsertText @ 0x1001fd7dc
//
// 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:06:34 +0000
//
void __usercall EmoteSprite::translateUnicodeEmoji(const std::string *a1@, std::string *a2@)
{
std::string::size_type size; // x1
int v5; // w9
const std::string *v6; // x25
unsigned __int64 v7; // x26
std::string::size_type v8; // x22
int v9; // w9
unsigned int v10; // w8
int v11; // w10
std::string::size_type v12; // x28
std::string::size_type v13; // x23
unsigned int v14; // w8
bool v15; // zf
__int64 v18; // x10
char *v19; // x9
__int64 v20; // x10
char v21; // t1
unsigned __int64 v22; // x10
int v23; // w11
int v24; // w12
const std::string::value_type *v26; // x24
const std::string::value_type **v27; // x9
__int64 v28; // x10
a2->__r_.__value_.__r.__words[0] = 0;
a2->__r_.__value_.__l.__size_ = 0;
a2->__r_.__value_.__r.__words[2] = 0;
if ( (a1->__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
size = HIBYTE(a1->__r_.__value_.__r.__words[2]);
else
size = a1->__r_.__value_.__l.__size_;
std::string::reserve(a2, size);
v5 = SHIBYTE(a1->__r_.__value_.__r.__words[2]);
if ( v5 >= 0 )
v6 = a1;
else
v6 = (const std::string *)a1->__r_.__value_.__r.__words[0];
if ( v5 >= 0 )
v7 = HIBYTE(a1->__r_.__value_.__r.__words[2]);
else
v7 = a1->__r_.__value_.__l.__size_;
if ( v7 )
{
v8 = 0;
while ( 1 )
{
v9 = (unsigned __int8)v6->__r_.__value_.__s.__data_[v8];
if ( (v6->__r_.__value_.__s.__data_[v8] & 0x80000000) == 0 )
break;
if ( (v9 & 0xE0) == 0xC0 )
{
v10 = 2;
goto LABEL_16;
}
if ( (v9 & 0xF0) != 0xE0 )
{
if ( (v9 & 0xF8) != 0xF0 )
goto LABEL_18;
v10 = 4;
goto LABEL_16;
}
v10 = 3;
v11 = 15;
LABEL_17:
v12 = v8 + v10;
if ( v12 <= v7 )
{
v13 = v10;
v15 = v10 == 2;
v14 = v11 & v9;
if ( v15 )
v14 = v9 & 0x1F;
if ( (_DWORD)v13 == 1 )
v14 = (unsigned __int8)v6->__r_.__value_.__s.__data_[v8];
if ( (v9 & 0x80) == 0 )
goto LABEL_25;
v18 = (unsigned int)v13 <= 2 ? 2LL : (unsigned int)v13;
v19 = (char *)&v6->__r_.__value_.__l.__data_ + v8 + 1;
v20 = v18 - 1;
do
{
v21 = *v19++;
v14 = v21 & 0x3F | (v14 << 6);
--v20;
}
while ( v20 );
if ( v12 + 7 > v7 || v14 != 128565 )
goto LABEL_25;
v22 = 0;
do
{
v23 = (unsigned __int8)v6->__r_.__value_.__s.__data_[v12 + v22];
v24 = byte_10076FF58[v22];
}
while ( v23 == v24 && v22++ < 6 );
if ( v23 == v24 )
{
std::string::append(a2, ":dizzy:");
v12 = v8 + (unsigned int)(v13 + 7);
}
else
{
LABEL_25:
v15 = v14 - 65038 < 2 || v14 == 8205;
if ( !v15 && v14 != 8419 && v14 - 127995 >= 5 )
{
if ( v14 < 0x2000 )
goto LABEL_64;
v26 = "clock";
if ( v14 - 128336 < 0x18 )
goto LABEL_63;
v27 = (const std::string::value_type **)&off_10098FD68;
v28 = 188;
while ( *((_DWORD *)v27 - 2) != v14 )
{
v27 += 2;
if ( !--v28 )
goto LABEL_64;
}
v26 = *v27;
if ( *v27 )
{
LABEL_63:
std::string::push_back(a2, 58);
std::string::append(a2, v26);
std::string::push_back(a2, 58);
}
else
{
LABEL_64:
std::string::append(a2, a1, v8, v13);
}
}
}
goto LABEL_35;
}
LABEL_18:
std::string::push_back(a2, v9);
v12 = v8 + 1;
LABEL_35:
v8 = v12;
if ( v12 >= v7 )
return;
}
v10 = 1;
LABEL_16:
v11 = 7;
goto LABEL_17;
}
}