//
// CCTextInputNode::rawToDisplayIndex from 0x3e1b24 to 0x3e1bb4 (144 bytes)
//
// 2 xrefs:
// > CCTextInputNode::updateBlinkLabelToChar @ 0x3e1c82
// > CCTextInputNode::displayToRawIndex @ 0x3e2036
//
// 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:47:02 +0000
//
int __fastcall CCTextInputNode::rawToDisplayIndex(int **this, int a2, int a3, int a4)
{
int v6; // r4
const char *v7; // r0
const char *v8; // r5
size_t v9; // r0
int *v10; // r5
int v11; // r3
int v12; // r7
int v13; // r10
int v14; // r0
int v15; // r2
CCTextInputNode *v17; // [sp+0h] [bp-10h] BYREF
int v18; // [sp+4h] [bp-Ch]
int v19; // [sp+8h] [bp-8h]
int v20; // [sp+Ch] [bp-4h]
v17 = (CCTextInputNode *)this;
v18 = a2;
v19 = a3;
v20 = a4;
v6 = 0;
v7 = (const char *)(*(int (__fastcall **)(_DWORD))(**(this + 104) + 624))(*(this + 104));
v17 = nullptr;
v18 = 0;
v19 = 0;
v8 = v7;
v9 = strlen(v7);
std::string::__init((int *)&v17, v8, v9);
v10 = *(this + 94);
v11 = (int)*(this + 95);
v12 = a2;
v13 = -1431655765 * ((v11 - (int)v10) >> 2);
while ( v6 != v13 )
{
v14 = sub_3DC19C((unsigned __int8 *)&v17, *v10);
v15 = v10[1];
v10 += 3;
if ( v14 + v15 > a2 )
{
if ( a2 > v14 )
v12 += v14 - a2;
break;
}
++v6;
v12 += 1 - v15;
}
std::string::~string((int)&v17);
return v12;
}