//
// sub_1002633E4 from 0x1002633e4 to 0x10026347c (152 bytes)
//
// 2 xrefs:
// > cocos2d::CCTextFieldTTF::insertText @ 0x1002632a4
// > cocos2d::CCTextFieldTTF::deleteBackward @ 0x100263538
//
// 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 11:01:40 +0000
//
__int64 __fastcall sub_1002633E4(__int64 *a1, int a2)
{
int v2; // w8
int v3; // w9
int v4; // w10
bool v5; // nf
__int64 *v6; // x10
int v7; // w11
char v8; // w14
int v9; // w14
int v10; // w15
v2 = 0;
v3 = *((unsigned __int8 *)a1 + 23);
v4 = (char)v3;
if ( (v3 & 0x80u) != 0 )
v3 = *((_DWORD *)a1 + 2);
if ( a2 >= 1 && v3 >= 1 )
{
v2 = 0;
v5 = v4 < 0;
v6 = (__int64 *)*a1;
if ( !v5 )
v6 = a1;
v7 = 1;
do
{
v8 = *((_BYTE *)v6 + (unsigned int)v2);
if ( (v8 & 0xE0) == 0xC0 )
{
v9 = 2;
}
else
{
v10 = v8 & 0xF0;
if ( (v8 & 0xF8) == 0xF0 )
v9 = 4;
else
v9 = 1;
if ( v10 == 224 )
v9 = 3;
}
v2 += v9;
if ( v7 >= a2 )
break;
++v7;
}
while ( v2 < v3 );
}
if ( v2 >= v3 )
return (unsigned int)v3;
else
return (unsigned int)v2;
}