//
// sub_DA101C from 0xda101c to 0xda10d0 (180 bytes)
//
// 2 xrefs:
// > cocos2d::CCTextFieldTTF::insertText @ 0xda18f0
// > cocos2d::CCTextFieldTTF::deleteBackward @ 0xda1f24
//
// 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 13:08:29 +0000
//
__int64 __fastcall sub_DA101C(__int64 a1, int a2)
{
__int64 v2; // x7
int v3; // w4
int v4; // w3
int v5; // w2
__int64 v6; // x2
char v7; // w2
int v8; // w5
int v9; // w6
int v10; // w2
LODWORD(v2) = *(_BYTE *)a1 >> 1;
if ( (*(_BYTE *)a1 & 1) != 0 )
v2 = *(_QWORD *)(a1 + 8);
if ( (int)v2 > 0 && a2 > 0 )
{
v3 = 0;
v4 = 0;
while ( 1 )
{
v6 = a1 + 1;
if ( (*(_BYTE *)a1 & 1) != 0 )
v6 = *(_QWORD *)(a1 + 16);
v7 = *(_BYTE *)(v6 + v4);
v8 = v7 & 0xE0;
v9 = v7 & 0xF0;
v10 = v7 & 0xF8;
if ( v8 == 192 )
{
++v3;
v4 += 2;
if ( (int)v2 <= v4 )
goto LABEL_16;
}
else
{
if ( v9 == 224 )
{
v5 = 3;
}
else if ( v10 == 240 )
{
v5 = 4;
}
else
{
v5 = 1;
}
v4 += v5;
++v3;
if ( (int)v2 <= v4 )
goto LABEL_16;
}
if ( a2 <= v3 )
goto LABEL_16;
}
}
v4 = 0;
LABEL_16:
if ( v4 > (int)v2 )
return (unsigned int)v2;
else
return (unsigned int)v4;
}