//
// sub_987EE8 from 0x987ee8 to 0x98802c (324 bytes)
//
// 3 xrefs:
// > GJAccountManager::registerAccount @ 0x988d6c
// > GJAccountManager::registerAccount @ 0x988d84
// > GJAccountManager::registerAccount @ 0x988da0
//
// 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 12:57:54 +0000
//
__int64 *__usercall sub_987EE8@(char *a1@, __int64 *a2@)
{
unsigned __int8 v4; // w0
__int64 v5; // x1
unsigned __int8 *v6; // x20
__int64 v7; // x22
unsigned __int8 *i; // x22
int v9; // w19
*a2 = 0;
a2[1] = 0;
a2[2] = 0;
v4 = *a1;
v5 = v4 >> 1;
if ( (v4 & 1) != 0 )
v5 = *((_QWORD *)a1 + 1);
std::string::reserve(a2, 3 * v5);
if ( (*a1 & 1) != 0 )
{
v6 = *((unsigned __int8 **)a1 + 2);
v7 = *((_QWORD *)a1 + 1);
}
else
{
v6 = (unsigned __int8 *)(a1 + 1);
v7 = (unsigned __int8)*a1 >> 1;
}
for ( i = &v6[v7]; i != v6; ++v6 )
{
while ( 1 )
{
v9 = *v6;
if ( (unsigned __int8)((v9 & 0xDF) - 65) > 0x19u
&& (unsigned __int8)(v9 - 48) > 9u
&& (unsigned __int8)(v9 - 45) > 1u
&& v9 != 95
&& v9 != 126 )
{
break;
}
std::string::push_back(a2, v9);
if ( i == ++v6 )
return a2;
}
std::string::push_back(a2, 37);
std::string::push_back(a2, a0123456789abcd_0[(unsigned __int8)v9 >> 4]);
std::string::push_back(a2, a0123456789abcd_0[v9 & 0xF]);
}
return a2;
}