//
// EmoteSprite::parseTokens from 0x6e0d18 to 0x6e0fb0 (664 bytes)
//
// 13 xrefs:
// > MultilineBitmapFont::readEmoteInfo @ 0x6abd7c
// > CCTextInputNode::updateLabel @ 0x6c3468
// > EmoteSprite::effectiveLength @ 0x6e0fe4
// > CommentCell::loadFromComment @ 0x74c010
// > NewsPopup::rebuildPage @ 0xb8b214
// > ThreadViewPopup::markShareLinks @ 0xc7274c
// > InvitesPopup::buildRows @ 0xc81d48
// > ThreadViewPopup::measureBody @ 0xc851c0
// > EmotePickerPopup::canAddEmote @ 0xcb94d4
// > EditorSoundConfigUploadPopup::init @ 0xcd4cf8
// > ReportPopup::init @ 0xd00888
// > ReportPopup::init @ 0xd00b88
// > ??> @ 0xb1c28
//
// 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:51:39 +0000
//
__int64 __fastcall EmoteSprite::parseTokens(char *a1, _QWORD *a2, int a3)
{
unsigned __int8 v6; // w0
unsigned __int64 v7; // x19
unsigned __int64 v8; // x22
unsigned int v9; // w24
char *v10; // x0
unsigned __int64 v12; // x23
unsigned __int64 v13; // x20
unsigned __int64 v14; // x0
char *v15; // x1
int v16; // w1
char *v17; // x1
unsigned __int64 v18; // x3
size_t v19; // x2
size_t v20; // x3
char *v21; // x1
__int64 v22; // x1
unsigned __int64 *v23; // x23
unsigned __int64 *v24; // x26
unsigned __int64 v25; // x1
__int64 v26; // [xsp+60h] [xbp+60h]
unsigned __int64 v27; // [xsp+68h] [xbp+68h]
__int64 v28; // [xsp+78h] [xbp+78h] BYREF
__int64 v29; // [xsp+80h] [xbp+80h]
void *v30; // [xsp+88h] [xbp+88h]
unsigned __int64 v31; // [xsp+90h] [xbp+90h] BYREF
unsigned __int64 v32; // [xsp+98h] [xbp+98h]
__int64 v33; // [xsp+A0h] [xbp+A0h]
v6 = *a1;
v7 = v6 >> 1;
if ( (v6 & 1) != 0 )
v7 = *((_QWORD *)a1 + 1);
v8 = 0;
v9 = 0;
LABEL_4:
while ( (int)v9 < a3 )
{
while ( 1 )
{
if ( v8 >= v7 )
return v9;
v10 = a1 + 1;
if ( (*a1 & 1) != 0 )
v10 = *((char **)a1 + 2);
if ( v10[v8] == 58 )
break;
++v8;
if ( (int)v9 >= a3 )
return v9;
}
v12 = v8 + 1;
if ( v8 + 1 >= v7 )
goto LABEL_35;
v13 = v8 + 17;
v14 = v8 + 1;
while ( 1 )
{
v15 = a1 + 1;
if ( (*a1 & 1) != 0 )
v15 = *((char **)a1 + 2);
v16 = (unsigned __int8)v15[v14];
if ( (unsigned __int8)((v16 & 0xDF) - 65) > 0x19u && v16 != 95 && (unsigned __int8)(v16 - 48) > 9u )
break;
if ( v14 == v13 )
goto LABEL_19;
if ( ++v14 >= v7 )
{
++v8;
goto LABEL_4;
}
}
v13 = v14;
LABEL_19:
if ( v7 <= v13 )
{
LABEL_35:
++v8;
continue;
}
if ( (*a1 & 1) != 0 )
{
v17 = *((char **)a1 + 2);
if ( v17[v13] != 58 || v12 >= v13 )
goto LABEL_35;
v18 = *((_QWORD *)a1 + 1);
v28 = 0;
v19 = v13 - v8 - 1;
v27 = v13 - v8;
v29 = 0;
v30 = nullptr;
if ( v12 > v18 )
goto LABEL_42;
}
else
{
v17 = a1 + 1;
if ( a1[v13 + 1] != 58 || v12 >= v13 )
goto LABEL_35;
v18 = (unsigned __int8)*a1 >> 1;
v28 = 0;
v29 = 0;
v19 = v13 - v8 - 1;
v30 = nullptr;
v27 = v13 - v8;
if ( v12 > v18 )
LABEL_42:
sub_62BB24();
}
v20 = v18 - v12;
v21 = &v17[v12];
if ( v20 <= v19 )
v19 = v20;
std::string::__init(&v28, v21, v19);
v22 = EmoteSprite::defForName((char *)&v28);
if ( (v28 & 1) != 0 )
{
v26 = v22;
operator delete(v30);
v22 = v26;
if ( !v26 )
goto LABEL_35;
}
else if ( !v22 )
{
goto LABEL_35;
}
if ( a2 )
{
v23 = (unsigned __int64 *)a2[1];
v24 = (unsigned __int64 *)a2[2];
v31 = v8;
v32 = v27 + 1;
v33 = v22;
if ( v23 == v24 )
{
std::vector::__push_back_slow_path(a2, &v31);
}
else
{
if ( v23 )
{
v25 = v32;
*v23 = v31;
v23[1] = v25;
v23[2] = v33;
v23 = (unsigned __int64 *)a2[1];
}
a2[1] = v23 + 3;
}
}
++v9;
v8 = v13 + 1;
}
return v9;
}