//
// EmoteSprite::characterCount from 0x3f362c to 0x3f3662 (54 bytes)
//
// 3 xrefs:
// > EmoteSprite::effectiveLength @ 0x3f4080
// > ShareCommentLayer::updateCharCountLabel @ 0x540d4c
// > NewThreadPopup::textChanged @ 0x748cf0
//
// 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:15 +0000
//
int __fastcall EmoteSprite::characterCount(unsigned __int8 *a1)
{
unsigned int v1; // r3
int v2; // r2
int result; // r0
int v5; // r5
unsigned int v6; // r2
unsigned __int8 *v7; // r4
unsigned __int8 v8; // r4
v1 = 0;
v2 = *a1;
result = 0;
v5 = v2 & 1;
v6 = v2 >> 1;
while ( v5 )
{
if ( v1 >= *((_DWORD *)a1 + 1) )
return result;
v7 = *((unsigned __int8 **)a1 + 2);
LABEL_7:
v8 = v7[v1++];
if ( (v8 & 0xC0) != 0x80 )
++result;
}
if ( v1 < v6 )
{
v7 = a1 + 1;
goto LABEL_7;
}
return result;
}