//
// sub_3DC602 from 0x3dc602 to 0x3dc656 (84 bytes)
//
// 4 xrefs:
// > CCTextInputNode::updateLabel @ 0x3e2e12
// > CCTextInputNode::onTextFieldDeleteBackward @ 0x3e3536
// > CCTextInputNode::insertAtCursor @ 0x3e4092
// > CCTextInputNode::onTextFieldInsertText @ 0x3e43cc
//
// 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:46:48 +0000
//
int __fastcall sub_3DC602(unsigned __int8 *a1)
{
int v1; // r3
int v2; // r2
int v3; // r3
unsigned __int8 *v4; // r4
int result; // r0
unsigned __int8 v6; // r1
int v7; // r1
v1 = *a1;
v2 = 0;
if ( (v1 & 1) != 0 )
{
v4 = *((unsigned __int8 **)a1 + 2);
v3 = *((_DWORD *)a1 + 1);
}
else
{
v3 = v1 >> 1;
v4 = a1 + 1;
}
for ( result = 0; v2 < v3; ++result )
{
v6 = v4[v2];
if ( (v6 & 0x80) != 0 )
{
if ( (v6 & 0xE0) == 0xC0 )
{
v7 = 2;
}
else if ( (v6 & 0xF0) == 0xE0 )
{
v7 = 3;
}
else
{
if ( (v6 & 0xF8) != 0xF0 )
return result;
v7 = 4;
}
}
else
{
v7 = 1;
}
v2 += v7;
if ( v2 > v3 )
break;
}
return result;
}