//
// CCTextInputNode::rawToDisplayIndex from 0x6c0d38 to 0x6c0eb8 (384 bytes)
//
// 3 xrefs:
// > CCTextInputNode::updateBlinkLabelToChar @ 0x6c0f2c
// > CCTextInputNode::displayToRawIndex @ 0x6c15c8
// > ??> @ 0xe92c0
//
// 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:18 +0000
//
__int64 __fastcall CCTextInputNode::rawToDisplayIndex(CCTextInputNode *this, int a2)
{
const char *v4; // x0
size_t v5; // x0
__int64 *v6; // x5
unsigned __int64 v7; // x8
char *v8; // x4
unsigned int v9; // w19
int v10; // w10
int v11; // w7
__int64 v12; // x6
__int64 v13; // x3
__int64 v14; // x0
int v15; // w2
char v16; // w1
__int64 v17; // x1
char *v19; // [xsp+38h] [xbp+38h]
__int64 v20; // [xsp+40h] [xbp+40h] BYREF
__int64 v21; // [xsp+48h] [xbp+48h]
void *v22; // [xsp+50h] [xbp+50h]
v4 = (const char *)(*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 72) + 1248LL))(*((_QWORD *)this + 72));
v20 = 0;
v19 = (char *)v4;
v21 = 0;
v22 = nullptr;
v5 = strlen(v4);
std::string::__init(&v20, v19, v5);
v6 = *((__int64 **)this + 64);
v7 = 0xAAAAAAAAAAAAAAABLL * ((__int64)(*((_QWORD *)this + 65) - (_QWORD)v6) >> 3);
if ( !v7 )
{
v9 = a2;
v10 = v20 & 1;
goto LABEL_15;
}
v8 = (char *)&v20 + 1;
v9 = a2;
v10 = v20 & 1;
v11 = (unsigned __int8)v20 >> 1;
if ( v10 )
v8 = (char *)v22;
v12 = 0;
if ( v10 )
v11 = v21;
while ( 1 )
{
v13 = *v6;
if ( (int)*v6 > v11 )
LODWORD(v13) = v11;
if ( (int)v13 > 0 )
break;
v17 = v6[1];
v15 = 0;
if ( a2 < (int)v17 )
goto LABEL_19;
LABEL_14:
++v12;
v9 += 1 - v17;
v6 += 3;
if ( v12 == v7 )
goto LABEL_15;
}
v14 = 0;
v15 = 0;
do
{
v16 = v8[v14++];
if ( (v16 & 0xC0) != 0x80 )
++v15;
}
while ( (int)v13 > (int)v14 );
v17 = v6[1];
if ( a2 >= v15 + (int)v17 )
goto LABEL_14;
LABEL_19:
if ( a2 > v15 )
v9 += v15 - a2;
LABEL_15:
if ( v10 )
operator delete(v22);
return v9;
}