//
// sub_1800B8DF0 from 0x1800b8df0 to 0x1800b8e8b (155 bytes)
//
// 5 xrefs:
// > cocos2d::CCTextFieldTTF::deleteBackward @ 0x1800b8f80
// > cocos2d::CCTextFieldTTF::insertText @ 0x1800b97a6
// > ??> @ 0x18014a8bc
// > ??> @ 0x18014a8cc
// > ??> @ 0x1801c2d3c
//
// 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:22:22 +0000
//
__int64 __fastcall sub_1800B8DF0(__int64 *a1, int a2)
{
__int64 v2; // rdi
int v3; // r11d
int v6; // ebx
__int64 v7; // r9
__int64 *v8; // rcx
char v9; // cl
__int64 v10; // rdx
__int64 v11; // r8
v2 = *((int *)a1 + 4);
v3 = 0;
v6 = 0;
if ( a2 > 0 )
{
v7 = 0;
while ( 1 )
{
if ( v7 >= v2 )
goto LABEL_14;
v8 = a1;
if ( (unsigned __int64)a1[3] > 0xF )
v8 = (__int64 *)*a1;
v9 = *((_BYTE *)v8 + v7);
LODWORD(v10) = 1;
v11 = 1;
if ( (v9 & 0xE0) == 0xC0 )
break;
if ( (v9 & 0xF0) == 0xE0 )
{
v10 = 3;
goto LABEL_12;
}
if ( (v9 & 0xF8) == 0xF0 )
{
v10 = 4;
goto LABEL_12;
}
LABEL_13:
v3 += v10;
v7 += v11;
if ( ++v6 >= a2 )
goto LABEL_14;
}
v10 = 2;
LABEL_12:
v11 = v10;
goto LABEL_13;
}
LABEL_14:
if ( v3 < (int)v2 )
LODWORD(v2) = v3;
return (unsigned int)v2;
}