//
// std::__ndk1::codecvt::do_unshift from 0xf70df4 to 0xf70f18 (292 bytes)
//
// 3 xrefs:
// > ??> @ 0x9a378
// > ??> @ 0x1534030
// > ??> @ 0x1534358
//
// 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_unshift(
__int64 a1,
mbstate_t *a2,
char *a3,
__int64 a4,
char **a5)
{
__int64 v8; // x22
size_t v9; // x21
__int64 result; // x0
char *v11; // x8
char v12; // w9
size_t v13; // x8
char *v14; // x9
char *v15; // x10
char v16; // t1
char s; // [xsp+4h] [xbp-2Ch] BYREF
_BYTE v18[11]; // [xsp+5h] [xbp-2Bh] BYREF
*(_QWORD *)&v18[3] = *(_QWORD *)(_ReadStatusReg(TPIDR_EL0) + 40);
*a5 = a3;
v8 = uselocale();
v9 = wcrtomb(&s, 0, a2);
if ( v8 )
uselocale();
if ( v9 + 1 >= 2 )
{
v11 = *a5;
if ( v9 - 1 <= a4 - (__int64)*a5 )
{
if ( v9 != 1 )
{
v12 = s;
*a5 = v11 + 1;
*v11 = v12;
if ( v9 != 2 )
{
v13 = 2 - v9;
v14 = v18;
do
{
v15 = *a5;
v16 = *v14++;
++v13;
++*a5;
*v15 = v16;
}
while ( v13 );
}
}
result = 0;
}
else
{
result = 1;
}
}
else
{
result = 2;
}
_ReadStatusReg(TPIDR_EL0);
return result;
}