//
// CCTextInputNode::displayToRawIndex from 0x6c14dc to 0x6c1688 (428 bytes)
//
// 4 xrefs:
// > CCTextInputNode::updateCursorPosition @ 0x6c1904
// > CCTextInputNode::updateCursorPosition @ 0x6c19d8
// > CCTextInputNode::updateCursorPosition @ 0x6c1b4c
// > ??> @ 0x7fc78
//
// 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:51:19 +0000
//
__int64 __fastcall CCTextInputNode::displayToRawIndex(CCTextInputNode *this, int a2)
{
unsigned int v4; // w23
const char *v5; // x0
size_t v6; // x0
__int64 v7; // x1
__int64 v8; // x19
unsigned __int64 v9; // x21
__int64 v10; // x24
__int64 v11; // x3
char *v12; // x4
__int64 v13; // x0
int v14; // w1
char v15; // w2
char *v17; // [xsp+68h] [xbp+68h]
__int64 v18; // [xsp+70h] [xbp+70h] BYREF
__int64 v19; // [xsp+78h] [xbp+78h]
void *v20; // [xsp+80h] [xbp+80h]
v4 = a2;
v5 = (const char *)(*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 72) + 1248LL))(*((_QWORD *)this + 72));
v18 = 0;
v17 = (char *)v5;
v19 = 0;
v20 = nullptr;
v6 = strlen(v5);
std::string::__init(&v18, v17, v6);
v7 = *((_QWORD *)this + 64);
if ( 0xAAAAAAAAAAAAAAABLL * ((*((_QWORD *)this + 65) - v7) >> 3) )
{
v8 = 0;
v9 = 0;
while ( 1 )
{
v10 = v7 + v8;
v11 = *(_QWORD *)(v7 + v8);
if ( (v18 & 1) != 0 )
{
v12 = (char *)v20;
if ( (int)v19 <= (int)v11 )
LODWORD(v11) = v19;
if ( (int)v11 > 0 )
goto LABEL_7;
}
else
{
v12 = (char *)&v18 + 1;
if ( (unsigned __int8)v18 >> 1 <= (int)v11 )
LODWORD(v11) = (unsigned __int8)v18 >> 1;
if ( (int)v11 > 0 )
{
LABEL_7:
v13 = 0;
v14 = 0;
do
{
v15 = v12[v13++];
if ( (v15 & 0xC0) != 0x80 )
++v14;
}
while ( (int)v11 > (int)v13 );
goto LABEL_11;
}
}
v14 = 0;
LABEL_11:
if ( a2 > (int)CCTextInputNode::rawToDisplayIndex(this, v14) )
{
v7 = *((_QWORD *)this + 64);
++v9;
v8 += 24;
v4 += *(_QWORD *)(v10 + 8) - 1;
if ( v9 < 0xAAAAAAAAAAAAAAABLL * ((*((_QWORD *)this + 65) - v7) >> 3) )
continue;
}
break;
}
}
if ( (v18 & 1) != 0 )
operator delete(v20);
return v4;
}