//
// EmoteSprite::parseTokens from 0x3f3f0c to 0x3f405c (336 bytes)
//
// 12 xrefs:
// > MultilineBitmapFont::readEmoteInfo @ 0x3d5cf4
// > CCTextInputNode::updateLabel @ 0x3e2ee4
// > EmoteSprite::effectiveLength @ 0x3f407a
// > CommentCell::loadFromComment @ 0x432f1e
// > NewsPopup::rebuildPage @ 0x6c1dda
// > ThreadViewPopup::markShareLinks @ 0x74f708
// > InvitesPopup::buildRows @ 0x759546
// > ThreadViewPopup::measureBody @ 0x75b2ce
// > EmotePickerPopup::canAddEmote @ 0x779022
// > EditorSoundConfigUploadPopup::init @ 0x789610
// > ReportPopup::init @ 0x7a08aa
// > ReportPopup::init @ 0x7a0a3a
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:47:16 +0000
//
int __fastcall EmoteSprite::parseTokens(unsigned __int8 *a1, int a2, int a3)
{
unsigned int v3; // r5
int v6; // r8
int v7; // r2
unsigned int v8; // r11
int v10; // r3
unsigned int v11; // r1
unsigned int v12; // r10
unsigned __int8 *v13; // r2
unsigned int i; // r6
unsigned __int8 *v15; // r2
int v16; // r2
unsigned __int8 *v17; // r2
unsigned int v18; // r3
unsigned __int8 *v19; // lr
size_t v20; // r3
size_t v21; // r2
unsigned __int8 *v22; // r1
int v23; // r1
int v24; // r2
int v25; // r3
unsigned int *v26; // r3
unsigned int *v27; // r2
int v28; // r1
int v29; // r2
int v31; // [sp+14h] [bp-28h]
int v32[3]; // [sp+1Ch] [bp-20h] BYREF
unsigned int v33; // [sp+28h] [bp-14h] BYREF
int v34; // [sp+2Ch] [bp-10h]
int v35; // [sp+30h] [bp-Ch]
v3 = 0;
v6 = 0;
v7 = *a1;
if ( (v7 & 1) != 0 )
v8 = *((_DWORD *)a1 + 1);
else
v8 = v7 >> 1;
while ( v3 < v8 && v6 < a3 )
{
v10 = *a1;
v11 = v3 + 1;
v12 = v3 + 1;
if ( (v10 & 1) != 0 )
v13 = *((unsigned __int8 **)a1 + 2);
else
v13 = a1 + 1;
if ( v13[v3] == 58 )
{
for ( i = v3 + 1; ; ++i )
{
if ( i == v8 )
goto LABEL_22;
v15 = (v10 & 1) != 0 ? *((unsigned __int8 **)a1 + 2) : a1 + 1;
v16 = v15[i];
if ( (v16 & 0xFFFFFFDF) - 65 > 0x19 && (unsigned int)(v16 - 48) > 9 && v16 != 95 )
break;
if ( i == v3 + 17 )
break;
}
v17 = (v10 & 1) != 0 ? *((unsigned __int8 **)a1 + 2) : a1 + 1;
if ( v17[i] == 58 && i > v11 )
{
memset(v32, 0, sizeof(v32));
if ( (v10 & 1) != 0 )
{
v18 = *((_DWORD *)a1 + 1);
if ( v11 > v18 )
goto LABEL_31;
v19 = *((unsigned __int8 **)a1 + 2);
}
else
{
v18 = v10 >> 1;
if ( v11 > v18 )
LABEL_31:
sub_387708();
v19 = a1 + 1;
}
v20 = v18 - v11;
v21 = i - v3 - 1;
v22 = &v19[v11];
if ( v21 >= v20 )
v21 = v20;
std::string::__init(v32, v22, v21);
v31 = EmoteSprite::defForName((int)v32, v23, v24, v25);
std::string::~string((int)v32);
if ( v31 )
{
if ( a2 )
{
v35 = v31;
v26 = *(unsigned int **)(a2 + 4);
v34 = i - v3 + 1;
v27 = *(unsigned int **)(a2 + 8);
v33 = v3;
if ( v26 == v27 )
{
std::vector::__push_back_slow_path((void **)a2, (int *)&v33);
}
else
{
if ( v26 )
{
v28 = v34;
v29 = v35;
*v26 = v33;
v26[1] = v28;
v26[2] = v29;
}
*(_DWORD *)(a2 + 4) += 12;
}
}
++v6;
v12 = i + 1;
}
}
}
LABEL_22:
v3 = v12;
}
return v6;
}