//
// sub_1001FC640 from 0x1001fc640 to 0x1001fc774 (308 bytes)
//
// 3 xrefs:
// > CCTextInputNode::updateCursorPosition @ 0x1001fea2c
// > CCTextInputNode::updateCursorPosition @ 0x1001feb20
// > CCTextInputNode::updateCursorPosition @ 0x1001feb9c
//
// 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 11:00:43 +0000
//
__int64 __fastcall sub_1001FC640(__int64 a1, __int64 a2)
{
char *v4; // x0
__int64 v5; // x8
unsigned __int64 v6; // x23
__int64 v7; // x21
_DWORD *v8; // x26
__int64 v9; // x9
char *p_p; // x8
int v11; // w10
__int64 v12; // x1
char v13; // t1
void *__p; // [xsp+8h] [xbp-58h] BYREF
int v16; // [xsp+10h] [xbp-50h]
unsigned __int8 v17; // [xsp+1Fh] [xbp-41h]
v4 = (char *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 576) + 1248LL))(*(_QWORD *)(a1 + 576));
sub_100009900(&__p, v4);
v5 = *(_QWORD *)(a1 + 512);
if ( *(_QWORD *)(a1 + 520) == v5 )
{
v7 = a2;
}
else
{
v6 = 0;
v7 = a2;
do
{
v8 = (_DWORD *)(v5 + 24 * v6);
LODWORD(v9) = *v8;
p_p = (char *)__p;
if ( (v17 & 0x80u) == 0 )
p_p = (char *)&__p;
v11 = v17;
if ( (v17 & 0x80u) != 0 )
v11 = v16;
if ( v11 >= (int)v9 )
v9 = (unsigned int)v9;
else
v9 = (unsigned int)v11;
if ( (int)v9 < 1 )
{
v12 = 0;
}
else
{
LODWORD(v12) = 0;
do
{
v13 = *p_p++;
if ( (v13 & 0xC0) == 0x80 )
v12 = (unsigned int)v12;
else
v12 = (unsigned int)(v12 + 1);
--v9;
}
while ( v9 );
}
if ( (int)sub_1001FC504(a1, v12) >= (int)a2 )
break;
v7 = (unsigned int)(v7 + v8[2] - 1);
++v6;
v5 = *(_QWORD *)(a1 + 512);
}
while ( v6 < 0xAAAAAAAAAAAAAAABLL * ((*(_QWORD *)(a1 + 520) - v5) >> 3) );
}
if ( (char)v17 < 0 )
operator delete(__p);
return v7;
}