//
// sub_99A478 from 0x99a478 to 0x99a51a (162 bytes)
//
// 2 xrefs:
// > sub_99A520 @ 0x99a536
// > sub_99A56C @ 0x99a582
//
// 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:44 +0000
//
int __fastcall sub_99A478(void *a1, int a2, _BYTE *a3)
{
int result; // r0
int v7; // r2
int v8; // r12
int v9; // r2
int v10; // r6
int v11; // r3
char v12; // r1
int v13; // kr00_4
memset(a1, 0, 4 * a2);
if ( *a3 == 48 && ((unsigned __int8)a3[1] | 0x20) == 0x78 )
a3 += 2;
result = 0;
do
v7 = (unsigned __int8)a3[result++];
while ( (*(_BYTE *)(ctype_ + 1 + v7) & 0x44) != 0 );
if ( a2 >= 1 )
{
result -= 2;
v8 = 32 * a2;
v9 = 0;
do
{
if ( result + 1 < 1 )
break;
v10 = (unsigned __int8)a3[result];
v11 = v10 - 48;
if ( (unsigned int)(v10 - 48) >= 0xA )
{
if ( (unsigned int)(v10 - 97) > 5 )
{
v11 = -1;
if ( (unsigned int)(v10 - 65) < 6 )
v11 = v10 - 55;
}
else
{
v11 = v10 - 87;
}
}
v12 = v9 & 0x1C;
v13 = v9;
v9 += 4;
--result;
*((_DWORD *)a1 + v13 / 32) |= v11 << v12;
}
while ( v9 < v8 );
}
return result;
}