//
// sub_993784 from 0x993784 to 0x993864 (224 bytes)
//
// 3 xrefs:
// > std::__ndk1::codecvt::do_encoding @ 0x970aee
// > sub_997FF4 @ 0x9982cc
// > sub_997FF4 @ 0x998450
//
// 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 12:06:37 +0000
//
int __fastcall sub_993784(_DWORD *a1, unsigned __int8 *a2, unsigned int a3)
{
int v3; // r3
int result; // r0
int v5; // lr
unsigned int v6; // r2
int v7; // r2
unsigned int v8; // r3
int v9; // r2
unsigned int v10; // r1
_DWORD *v11; // [sp+0h] [bp-8h] BYREF
v11 = a1;
if ( !a2 )
return 0;
if ( !a3 )
goto LABEL_20;
if ( !a1 )
{
a1 = &v11;
v11 = &v11;
}
v3 = *a2;
if ( (v3 & 0x80u) != 0 )
{
if ( (unsigned int)(v3 - 194) <= 0x32 )
{
v5 = dword_C5130C[v3 - 194];
if ( a3 > 3 || (v5 & (0x80000000 >> (6 * a3 - 6))) == 0 )
{
v6 = a2[1];
if ( (((v6 >> 3) - 16) | ((v6 >> 3) + (v5 >> 26))) <= 7 )
{
v7 = (v6 - 128) | (v5 << 6);
if ( v7 >= 0 )
{
*a1 = v7;
return 2;
}
v8 = a2[2] - 128;
if ( v8 <= 0x3F )
{
v9 = v8 | (v7 << 6);
if ( v9 >= 0 )
{
*a1 = v9;
return 3;
}
v10 = a2[3] - 128;
if ( v10 <= 0x3F )
{
*a1 = v10 | (v9 << 6);
return 4;
}
}
}
}
}
LABEL_20:
*(_DWORD *)_errno() = 84;
return -1;
}
*a1 = v3;
result = (unsigned __int8)v3;
if ( (_BYTE)v3 )
return 1;
return result;
}