//
// sub_140053CE0 from 0x140053ce0 to 0x140053d50 (112 bytes)
//
// 1 xrefs:
// > CCTextInputNode::updateLabel @ 0x140055e21
//
// This function is hookable on this platform (idp: pc, 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:25:39 +0000
//
__int64 __fastcall sub_140053CE0(__int64 *a1)
{
__int64 *v1; // r10
__int64 v2; // r9
unsigned int v3; // edx
__int64 v4; // r8
unsigned __int8 v5; // cl
__int64 v6; // rax
v1 = a1;
if ( (unsigned __int64)a1[3] > 0xF )
v1 = (__int64 *)*a1;
v2 = *((int *)a1 + 4);
v3 = 0;
if ( v2 > 0 )
{
v4 = 0;
do
{
v5 = *((_BYTE *)v1 + v4);
if ( v5 >= 0x80u )
{
if ( (v5 & 0xE0) == 0xC0 )
{
v6 = 2;
}
else if ( (v5 & 0xF0) == 0xE0 )
{
v6 = 3;
}
else
{
if ( (v5 & 0xF8) != 0xF0 )
return v3;
v6 = 4;
}
}
else
{
v6 = 1;
}
v4 += v6;
if ( v4 > v2 )
break;
++v3;
}
while ( v4 < v2 );
}
return v3;
}