//
// std::__ndk1::codecvt::do_in from 0xf70ac0 to 0xf70df4 (820 bytes)
//
// 3 xrefs:
// > ??> @ 0xdcf78
// > ??> @ 0x1534028
// > ??> @ 0x1534350
//
// 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::do_in(
__int64 a1,
mbstate_t *a2,
const char *a3,
const char *a4,
const char **a5,
wchar_t *a6,
wchar_t *a7,
wchar_t **a8)
{
wchar_t *v8; // x26
const char **v9; // x22
const char *v11; // x28
const char *v12; // x23
const char **v13; // x25
size_t v14; // x22
__int64 v15; // x27
size_t v16; // x28
wchar_t *v17; // x27
__int64 v18; // x26
size_t v19; // x23
bool v20; // zf
__int64 result; // x0
const char **v22; // x27
const char *v23; // x20
__int64 v24; // x24
size_t v25; // x25
const char *v26; // [xsp+0h] [xbp-80h]
wchar_t *v28; // [xsp+10h] [xbp-70h]
mbstate_t v30; // [xsp+20h] [xbp-60h] BYREF
__int64 v31; // [xsp+28h] [xbp-58h]
v8 = a6;
v9 = a5;
v11 = a3;
v31 = *(_QWORD *)(_ReadStatusReg(TPIDR_EL0) + 40);
if ( a3 == a4 )
{
*a8 = a6;
*a5 = a3;
LABEL_26:
v20 = v11 == a4;
goto LABEL_27;
}
v12 = a3;
while ( *v12 )
{
if ( a4 == ++v12 )
{
v12 = a4;
break;
}
}
*a8 = a6;
*a5 = a3;
if ( a6 == a7 || a3 == a4 )
goto LABEL_26;
v28 = a7;
while ( 1 )
{
v13 = v9;
v30 = *a2;
v26 = v11;
v14 = a7 - v8;
v15 = uselocale();
v16 = mbsnrtowcs(v8, v13, v12 - v11, v14, a2);
if ( v15 )
uselocale();
if ( v16 == -1 )
break;
v17 = &(*a8)[v16];
*a8 = v17;
a7 = v28;
if ( v17 == v28 )
{
v11 = *v13;
goto LABEL_26;
}
v9 = v13;
v11 = *v13;
if ( v12 == a4 )
{
v12 = a4;
}
else
{
v18 = uselocale();
v19 = mbrtowc(v17, v11, 1u, a2);
if ( v18 )
uselocale();
if ( v19 )
{
result = 2;
goto LABEL_30;
}
++*a8;
v11 = *v13 + 1;
*v13 = v11;
a7 = v28;
v12 = v11;
if ( v11 == a4 )
{
v11 = a4;
goto LABEL_26;
}
while ( *v12 )
{
if ( a4 == ++v12 )
{
v12 = a4;
break;
}
}
}
v8 = *a8;
if ( *a8 == a7 || v11 == a4 )
goto LABEL_26;
}
*a8 = v8;
v22 = v13;
if ( v26 != *v13 )
{
v23 = v26;
while ( 1 )
{
v24 = uselocale();
v25 = mbrtowc(v8, v23, v12 - v23, &v30);
if ( v24 )
uselocale();
if ( v25 )
{
if ( v25 == -2 )
{
*v22 = v23;
result = 1;
goto LABEL_30;
}
if ( v25 == -1 )
{
*v22 = v23;
result = 2;
goto LABEL_30;
}
v23 += v25;
}
else
{
++v23;
}
v8 = *a8 + 1;
*a8 = v8;
if ( v23 == *v22 )
goto LABEL_46;
}
}
v23 = v26;
LABEL_46:
*v22 = v23;
v20 = v23 == a4;
LABEL_27:
result = !v20;
LABEL_30:
_ReadStatusReg(TPIDR_EL0);
return result;
}