//
// sub_180015850 from 0x180015850 to 0x1800158da (138 bytes)
//
// 3 xrefs:
// > sub_18003EF10 @ 0x18003efd9
// > sub_18003F450 @ 0x18003f502
// > ??> @ 0x1801b8584
//
// This function is hookable on this platform (idp: pc, 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 11:21:24 +0000
//
__int64 __fastcall sub_180015850(_BYTE *a1, unsigned int a2, int a3)
{
__int64 v3; // r10
unsigned int i; // r9d
__int64 v6; // rcx
__int64 v7; // r8
__int64 result; // rax
__int64 v9; // r9
v3 = (unsigned int)(a3 - 1);
for ( i = a2; i >= 0x64; a1[v6] = result )
{
v6 = (unsigned int)(v3 - 1);
v7 = 2 * (i % 0x64);
i /= 0x64u;
a1[v3] = a00010203040506[(unsigned int)(v7 + 1)];
v3 = (unsigned int)(v3 - 2);
result = (unsigned __int8)a00010203040506[v7];
}
if ( i >= 0xA )
{
v9 = 2 * i;
a1[1] = a00010203040506[(unsigned int)(v9 + 1)];
result = (unsigned __int8)a00010203040506[v9];
*a1 = result;
}
else
{
*a1 = i + 48;
}
return result;
}