// File: marxn[P]pupp/3rdparty/gmp/./mini-gmp/mini-gmp.c
// Function: mpz_get_str
char *
mpz_get_str (char *sp, int base, const mpz_t u)
{
  unsigned bits;
  const char *digits;
  mp_size_t un;
  size_t i, sn;

  if (base >= 0)
    {
      digits = "0123456789abcdefghijklmnopqrstuvwxyz";
    }
  else
    {
      base = -base;
      digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    }
  if (base <= 1)
    base = 10;
  if (base > 36)
    return NULL;

  sn = 1 + mpz_sizeinbase (u, base);
  if (!sp)
    sp = (char *) gmp_xalloc (1 + sn);

  un = GMP_ABS (u->_mp_size);

  if (un == 0)
    {
      sp[0] = '0';
      sp[1] = '\0';
      return sp;
    }

  i = 0;

  if (u->_mp_size < 0)
    sp[i++] = '-';

  bits = mpn_base_power_of_two_p (base);

  if (bits)
    /* Not modified in this case. */
    sn = i + mpn_get_str_bits ((unsigned char *) sp + i, bits, u->_mp_d, un);
  else
    {
      struct mpn_base_info info;
      mp_ptr tp;

      mpn_get_base_info (&info, base);
      tp = gmp_xalloc_limbs (un);
      mpn_copyi (tp, u->_mp_d, un);

      sn = i + mpn_get_str_other ((unsigned char *) sp + i, base, &info, tp, un);
      gmp_free (tp);
    }

  for (; i < sn; i++)
    sp[i] = digits[(unsigned char) sp[i]];

  sp[sn] = '\0';
  return sp;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
cmpl $0x0, -0x14(%rbp)
jl 0xa6a9
leaq 0x41e8(%rip), %rax      # 0xe88b
movq %rax, -0x30(%rbp)
jmp 0xa6bc
xorl %eax, %eax
subl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
leaq 0x41f8(%rip), %rax      # 0xe8b0
movq %rax, -0x30(%rbp)
cmpl $0x1, -0x14(%rbp)
jg 0xa6c9
movl $0xa, -0x14(%rbp)
cmpl $0x24, -0x14(%rbp)
jle 0xa6dc
movq $0x0, -0x8(%rbp)
jmp 0xa886
movq -0x20(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x8230
addq $0x1, %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0xa70c
movq 0x898a(%rip), %rax      # 0x13088
movq -0x48(%rbp), %rdi
addq $0x1, %rdi
callq *%rax
movq %rax, -0x10(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, 0x4(%rax)
jl 0xa722
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x64(%rbp)
jmp 0xa72e
movq -0x20(%rbp), %rcx
xorl %eax, %eax
subl 0x4(%rcx), %eax
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %eax
cltq
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0xa75a
movq -0x10(%rbp), %rax
movb $0x30, (%rax)
movq -0x10(%rbp), %rax
movb $0x0, 0x1(%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xa886
movq $0x0, -0x40(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, 0x4(%rax)
jge 0xa783
movq -0x10(%rbp), %rax
movq -0x40(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x40(%rbp)
movb $0x2d, (%rax,%rcx)
movl -0x14(%rbp), %edi
callq 0x2a50
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0xa7c8
movq -0x40(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rdi
addq -0x40(%rbp), %rdi
movl -0x24(%rbp), %esi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x38(%rbp), %rcx
callq 0x2b10
movq %rax, %rcx
movq -0x70(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x48(%rbp)
jmp 0xa83a
movslq -0x14(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0x2c40
movq -0x38(%rbp), %rdi
callq 0x3220
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x38(%rbp), %rdx
callq 0x1390
movq -0x40(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x10(%rbp), %rdi
addq -0x40(%rbp), %rdi
movl -0x14(%rbp), %esi
movq -0x60(%rbp), %rcx
movq -0x38(%rbp), %r8
leaq -0x58(%rbp), %rdx
callq 0x2cb0
movq %rax, %rcx
movq -0x78(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq 0x8868(%rip), %rax      # 0x13098
movq -0x60(%rbp), %rdi
xorl %ecx, %ecx
movl %ecx, %esi
callq *%rax
jmp 0xa83c
movq -0x40(%rbp), %rax
cmpq -0x48(%rbp), %rax
jae 0xa872
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
movq -0x40(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
movb (%rax,%rcx), %dl
movq -0x10(%rbp), %rax
movq -0x40(%rbp), %rcx
movb %dl, (%rax,%rcx)
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0xa83c
movq -0x10(%rbp), %rax
movq -0x48(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)