//
// sub_6B7D64 from 0x6b7d64 to 0x6b7e18 (180 bytes)
//
// 10 xrefs:
// > CCTextInputNode::updateBlinkLabelToChar @ 0x6c1264
// > CCTextInputNode::updateCursorPosition @ 0x6c1910
// > CCTextInputNode::updateLabel @ 0x6c34b4
// > CCTextInputNode::onTextFieldDeleteBackward @ 0x6c3d78
// > CCTextInputNode::onTextFieldDeleteBackward @ 0x6c3da8
// > CCTextInputNode::insertAtCursor @ 0x6c4ccc
// > CCTextInputNode::insertAtCursor @ 0x6c4d48
// > CCTextInputNode::onTextFieldInsertText @ 0x6c5080
// > CCTextInputNode::onTextFieldInsertText @ 0x6c5380
// > CCTextInputNode::onTextFieldInsertText @ 0x6c53fc
//
// 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 12:50:53 +0000
//
__int64 __fastcall sub_6B7D64(__int64 result, int a2)
{
__int64 v2; // x7
int v3; // w4
int v4; // w2
char v5; // w3
int v6; // w5
int v7; // w6
bool v8; // zf
int v9; // w3
int v10; // w5
if ( (*(_BYTE *)result & 1) != 0 )
{
v2 = *(_QWORD *)(result + 16);
result = *(_QWORD *)(result + 8);
}
else
{
v2 = result + 1;
LODWORD(result) = *(_BYTE *)result >> 1;
}
if ( (int)result > 0 && a2 > 0 )
{
v3 = 0;
v4 = 0;
while ( 1 )
{
v5 = *(_BYTE *)(v2 + v4);
v6 = 1;
if ( (v5 & 0x80) == 0 )
goto LABEL_6;
v7 = v5 & 0xF8;
v8 = (v5 & 0xE0) == 192;
v9 = v5 & 0xF0;
v6 = 3;
if ( v8 )
break;
if ( v9 == 224 )
goto LABEL_6;
++v3;
if ( v7 == 240 )
v10 = 4;
else
v10 = 1;
v4 += v10;
if ( (int)result <= v4 )
goto LABEL_15;
LABEL_7:
if ( a2 <= v3 )
goto LABEL_15;
}
v6 = 2;
LABEL_6:
v4 += v6;
++v3;
if ( (int)result <= v4 )
goto LABEL_15;
goto LABEL_7;
}
v4 = 0;
LABEL_15:
if ( v4 > (int)result )
return (unsigned int)result;
else
return (unsigned int)v4;
}