//
// std::__ndk1::__codecvt_utf8::do_in from 0xf72484 to 0xf72608 (388 bytes)
//
// 2 xrefs:
// > ??> @ 0xb2a50
// > ??> @ 0x1534a98
//
// 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 13:13:39 +0000
//
__int64 __fastcall std::__codecvt_utf8::do_in(
__int64 a1,
__int64 a2,
char *a3,
unsigned __int64 a4,
char **a5,
unsigned __int16 *a6,
unsigned __int64 a7,
unsigned __int16 **a8)
{
unsigned __int64 v8; // x8
unsigned __int64 v9; // x10
unsigned int v10; // w9
unsigned __int8 v11; // w10
unsigned __int64 v12; // x10
unsigned __int8 v13; // w11
unsigned __int8 v14; // w10
int v15; // w12
unsigned __int16 v16; // w9
__int64 result; // x0
v8 = *(_QWORD *)(a1 + 16);
if ( (*(_BYTE *)(a1 + 24) & 4) != 0
&& (__int64)(a4 - (_QWORD)a3) >= 3
&& (unsigned __int8)*a3 == 239
&& (unsigned __int8)a3[1] == 187
&& (unsigned __int8)a3[2] == 191 )
{
a3 += 3;
}
while ( 1 )
{
while ( 1 )
{
while ( 1 )
{
if ( (unsigned __int64)a3 >= a4 || (unsigned __int64)a6 >= a7 )
{
result = (unsigned __int64)a3 < a4;
goto LABEL_32;
}
v9 = (unsigned __int8)*a3;
if ( *a3 < 0 )
break;
if ( v9 > v8 )
goto LABEL_33;
*a6++ = v9;
++a3;
}
if ( (unsigned int)v9 < 0xC2 )
{
LABEL_33:
result = 2;
goto LABEL_32;
}
v10 = (unsigned __int8)*a3;
if ( v10 > 0xDF )
break;
if ( (__int64)(a4 - (_QWORD)a3) < 2 )
{
result = 1;
goto LABEL_32;
}
v11 = a3[1];
if ( (v11 & 0xC0) != 0x80 || (v12 = v11 & 0x3F | ((unsigned __int8)(v10 & 0x1F) << 6), v12 > v8) )
{
LABEL_34:
result = 2;
goto LABEL_32;
}
*a6++ = v12;
a3 += 2;
}
if ( (unsigned int)v9 > 0xEF )
goto LABEL_34;
if ( (__int64)(a4 - (_QWORD)a3) < 3 )
{
result = 1;
goto LABEL_32;
}
v13 = a3[1];
v14 = a3[2];
if ( v10 == 237 )
{
v15 = v13 & 0xE0;
goto LABEL_27;
}
if ( v10 != 224 )
break;
if ( (v13 & 0xE0) != 0xA0 )
goto LABEL_35;
LABEL_28:
if ( (v14 & 0xC0) != 0x80 || (v16 = ((_WORD)v10 << 12) | ((v13 & 0x3F) << 6) | v14 & 0x3F, v16 > v8) )
{
LABEL_35:
result = 2;
goto LABEL_32;
}
*a6++ = v16;
a3 += 3;
}
v15 = v13 & 0xC0;
LABEL_27:
if ( v15 == 128 )
goto LABEL_28;
result = 2;
LABEL_32:
*a5 = a3;
*a8 = a6;
return result;
}