//
// GameManager::addRecentEmote from 0x71f110 to 0x71f3a0 (656 bytes)
//
// 2 xrefs:
// > EmotePickerPopup::onPickEmote @ 0xcba524
// > ??> @ 0xaacc8
//
// 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 12:52:22 +0000
//
__int64 __fastcall GameManager::addRecentEmote(GameManager *this, char *a2)
{
__int64 *v2; // x24
size_t v4; // x0
_BYTE *v5; // x26
__int64 v6; // x19
unsigned __int64 v7; // x20
int v8; // w21
int v9; // w2
size_t *v10; // x27
size_t v11; // x28
char *v12; // x3
void *v13; // x1
size_t v14; // x2
size_t v15; // x2
char *v16; // x1
char *v17; // x19
char *v18; // x0
int v20; // w2
const void *v21; // x0
void *v22; // [xsp+78h] [xbp+78h] BYREF
char *v23; // [xsp+80h] [xbp+80h]
__int64 v24; // [xsp+88h] [xbp+88h]
__int64 v25; // [xsp+90h] [xbp+90h] BYREF
size_t v26; // [xsp+98h] [xbp+98h]
void *v27; // [xsp+A0h] [xbp+A0h]
v2 = (__int64 *)((char *)this + 1664);
v22 = nullptr;
v23 = nullptr;
v24 = 0;
sub_71A920((unsigned __int8 *)this + 1664, &byte_1169BE0, (__int64 *)&v22);
v25 = 0;
v26 = 0;
v27 = nullptr;
v4 = strlen(a2);
std::string::__init(&v25, a2, v4);
v5 = v22;
if ( 0xAAAAAAAAAAAAAAABLL * ((v23 - (_BYTE *)v22) >> 3) )
{
v6 = 0;
v7 = 0;
v8 = 1;
do
{
v9 = (unsigned __int8)v5[v6];
v10 = (size_t *)&v5[v6];
if ( (v9 & 1) != 0 )
{
v11 = v10[1];
if ( !v11 )
goto LABEL_9;
if ( strlen(a2) != v11 )
goto LABEL_6;
if ( v11 == -1 )
sub_62BEDC();
v21 = (const void *)v10[2];
}
else
{
v20 = v9 >> 1;
if ( !v20 )
goto LABEL_9;
v11 = v20;
if ( v20 != strlen(a2) )
goto LABEL_6;
v21 = (char *)v10 + 1;
}
if ( v11 && memcmp(v21, a2, v11) )
{
LABEL_6:
std::string::append((__int64)&v25, &byte_1169BE0, 1u);
v12 = (char *)v22 + v6;
if ( (*((_BYTE *)v22 + v6) & 1) != 0 )
{
v13 = *((void **)v12 + 2);
v14 = *((_QWORD *)v12 + 1);
}
else
{
v13 = v12 + 1;
v14 = *((_BYTE *)v22 + v6) >> 1;
}
std::string::append((__int64)&v25, v13, v14);
v5 = v22;
++v8;
}
LABEL_9:
++v7;
v6 += 24;
}
while ( v8 <= 15 && v7 < 0xAAAAAAAAAAAAAAABLL * ((v23 - v5) >> 3) );
}
if ( v2 != &v25 )
{
if ( (v25 & 1) != 0 )
{
v16 = (char *)v27;
v15 = v26;
}
else
{
v15 = (unsigned __int8)v25 >> 1;
v16 = (char *)&v25 + 1;
}
std::string::assign(v2, v16, v15);
}
if ( (v25 & 1) != 0 )
operator delete(v27);
v17 = (char *)v22;
if ( v22 )
{
v18 = v23;
if ( v22 != v23 )
{
do
{
v23 = v18 - 24;
std::string::~string((__int64)(v18 - 24));
v18 = v23;
}
while ( v17 != v23 );
v18 = (char *)v22;
}
operator delete(v18);
}
return _stack_chk_guard;
}