//
// sub_81FC8C from 0x81fc8c to 0x81fdd2 (326 bytes)
//
// 12 xrefs:
// > sub_8247F0 @ 0x8249b2
// > sub_8247F0 @ 0x824ac2
// > sub_84FFB4 @ 0x850048
// > sub_850068 @ 0x8500a8
// > sub_8500C4 @ 0x850104
// > sub_85014C @ 0x850214
// > sub_850354 @ 0x850880
// > sub_850CB8 @ 0x850f50
// > sub_8511D4 @ 0x851256
// > sub_851270 @ 0x851b8e
// > sub_851BF4 @ 0x851c2a
// > sub_855DC4 @ 0x855e7c
//
// 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:01:49 +0000
//
int __fastcall sub_81FC8C(int a1, char *a2, size_t a3, const char **a4, size_t *a5)
{
size_t v5; // r7
char *v7; // r9
const char *v9; // r0
const char *v10; // r8
unsigned int v11; // r4
const char *v12; // r0
int v13; // r12
unsigned int v14; // r3
unsigned int v15; // r5
bool v16; // zf
int v17; // lr
unsigned int v18; // r4
const char *v19; // r5
const char *v20; // [sp+14h] [bp-8h]
v5 = a3;
v7 = a2;
*a4 = nullptr;
*a5 = 0;
if ( !a3 )
v5 = strlen(a2);
if ( v5 >= 0x40000000 )
return 27;
v9 = (const char *)off_D200AC(4 * v5 / 3 + 4);
v20 = v9;
if ( !v9 )
return 27;
if ( v5 )
{
v10 = v9;
while ( 1 )
{
v11 = (unsigned __int8)*v7;
v12 = v10;
v13 = v11 & 3;
v14 = v11 >> 2;
if ( v5 == 1 )
{
sub_8346C0(
v10,
5,
"%c%c==",
(unsigned __int8)aAbcdefghijklmn_5[v11 >> 2],
(unsigned __int8)aAbcdefghijklmn_5[16 * (v11 & 3)]);
goto LABEL_14;
}
v15 = (unsigned __int8)v7[1];
v16 = v5 == 2;
v5 -= 3;
v17 = v15 & 0xF;
if ( v16 )
break;
v18 = (unsigned __int8)v7[2];
v10 += 4;
v7 += 3;
sub_8346C0(
v12,
5,
"%c%c%c%c",
(unsigned __int8)aAbcdefghijklmn_5[v14],
(unsigned __int8)aAbcdefghijklmn_5[(v15 >> 4) | (16 * v13)],
(unsigned __int8)aAbcdefghijklmn_5[(v18 >> 6) | (4 * v17)],
(unsigned __int8)aAbcdefghijklmn_5[v18 & 0x3F]);
if ( !v5 )
goto LABEL_11;
}
sub_8346C0(
v10,
5,
"%c%c%c=",
(unsigned __int8)aAbcdefghijklmn_5[v11 >> 2],
(unsigned __int8)aAbcdefghijklmn_5[(v15 >> 4) | (16 * v13)],
(unsigned __int8)aAbcdefghijklmn_5[4 * v17]);
LABEL_14:
v10 += 4;
LABEL_11:
v19 = v20;
}
else
{
v10 = v9;
v19 = v9;
}
*v10 = 0;
*a4 = v19;
off_D200B0(nullptr);
*a5 = strlen(v19);
return 0;
}