//
// sub_18003D400 from 0x18003d400 to 0x18003d4a9 (169 bytes)
//
// 6 xrefs:
// > sub_18003F2C0 @ 0x18003f389
// > sub_18003F830 @ 0x18003f8e6
// > ??> @ 0x180137148
// > ??> @ 0x180137158
// > ??> @ 0x1801b1140
// > ??> @ 0x1801b114c
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
__int64 __fastcall sub_18003D400(_BYTE *a1, unsigned __int64 a2, int a3)
{
__int64 v3; // r8
unsigned __int64 i; // r9
__int64 v6; // rdx
__int64 v7; // rcx
__int64 result; // rax
__int64 v9; // r9
v3 = (unsigned int)(a3 - 1);
for ( i = a2; i >= 0x64; a1[v7] = result )
{
v6 = 2 * (unsigned int)(i % 0x64);
i /= 0x64u;
v7 = (unsigned int)(v3 - 1);
a1[v3] = a00010203040506[(unsigned int)(v6 + 1)];
v3 = (unsigned int)(v3 - 2);
result = (unsigned __int8)a00010203040506[v6];
}
if ( i >= 0xA )
{
v9 = (unsigned int)(2 * i);
a1[1] = a00010203040506[(unsigned int)(v9 + 1)];
result = (unsigned __int8)a00010203040506[v9];
*a1 = result;
}
else
{
*a1 = i + 48;
}
return result;
}