//
// sub_84FFB4 from 0x84ffb4 to 0x85005e (170 bytes)
//
// 2 xrefs:
// > sub_84D8EC @ 0x84dc04
// > sub_84DC64 @ 0x84dda2
//
// 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:02:30 +0000
//
int __fastcall sub_84FFB4(int a1, char *a2, const char *a3, const char **a4, size_t *a5)
{
unsigned int v9; // r4
int v10; // r5
size_t v11; // r0
char *v13; // r0
char *v14; // r7
int v15; // r4
size_t v16; // [sp+8h] [bp-Ch]
size_t v17; // [sp+Ch] [bp-8h]
*a5 = 0;
*a4 = nullptr;
v9 = strlen(a2);
v10 = 2 * v9;
v11 = strlen(a3);
if ( v9 > 2 * v9 )
return 27;
if ( __CFADD__(v10, v11) )
return 27;
if ( v10 + v11 + 2 <= 1 )
return 27;
v17 = v11;
v16 = v10 + v11 + 2;
v13 = (char *)off_D200AC(v16);
v14 = v13;
if ( !v13 )
return 27;
memcpy(v13, a2, v9);
v14[v9] = 0;
memcpy(&v14[v9 + 1], a2, v9);
v14[v10 + 1] = 0;
memcpy(&v14[v10 + 2], a3, v17);
v15 = sub_81FC8C(a1, v14, v16, a4, a5);
off_D200B0(v14);
return v15;
}