//
// common_xtox
from 0x180138ef8 to 0x180138fcc (212 bytes)
//
// 2 xrefs:
// > common_xtox_s @ 0x180139030
// > ??> @ 0x180203758
//
// 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 common_xtox(
unsigned int a1,
__int16 *a2,
unsigned __int64 a3,
unsigned int a4,
char a5)
{
__int16 *v8; // r10
unsigned __int64 v9; // rbx
__int16 *v10; // r8
_WORD *v11; // rsi
__int16 *v12; // r9
unsigned int v13; // edx
__int16 v14; // ax
__int16 v16; // cx
v8 = a2;
v9 = 0;
if ( a5 )
{
a1 = -a1;
*a2 = 45;
v9 = 1;
v8 = a2 + 1;
}
v10 = v8;
do
{
v11 = v8 + 1;
v12 = v8;
v13 = a1 % a4;
a1 /= a4;
v14 = 87;
if ( v13 <= 9 )
v14 = 48;
++v9;
*v8 = v13 + v14;
if ( !a1 )
break;
++v8;
}
while ( v9 < a3 );
if ( v9 < a3 )
{
*v11 = 0;
do
{
v16 = *v12;
*v12-- = *v10;
*v10++ = v16;
}
while ( v10 < v12 );
return 0;
}
else
{
*a2 = 0;
*errno() = 34;
invalid_parameter_noinfo();
return 34;
}
}