// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %esi, %eax
negl %eax
cmovsl %esi, %eax
testl %esi, %esi
leaq 0x2b7e(%rip), %rcx      # 0xa80a
leaq 0x2b9c(%rip), %r12      # 0xa82f
cmovnsq %rcx, %r12
cmpl $0x2, %eax
movl $0xa, %r14d
cmovael %eax, %r14d
cmpl $0x24, %r14d
jbe 0x7cb2
xorl %r13d, %r13d
jmp 0x7df1
movq %rdx, %r15
movq %rdi, %r13
movq %rdx, %rdi
movl %r14d, %esi
callq 0x63ed
testq %r13, %r13
jne 0x7cd8
addq $0x2, %rax
movq %rax, %rdi
callq *0x83cb(%rip)           # 0x100a0
movq %rax, %r13
movl 0x4(%r15), %ecx
movl %ecx, %ebx
negl %ebx
movl %ecx, %eax
cmovnsl %ebx, %eax
jae 0x7cfb
movq %r15, -0x40(%rbp)
testl %ecx, %ecx
movq %rax, -0x30(%rbp)
movl %ecx, -0x34(%rbp)
js 0x7d0a
xorl %r15d, %r15d
jmp 0x7d15
movb $0x30, (%r13)
movl $0x1, %eax
jmp 0x7deb
movb $0x2d, (%r13)
movl $0x1, %r15d
movl %r14d, %edi
callq 0x1fb0
testl %eax, %eax
je 0x7d40
leaq (%r15,%r13), %rdi
movq -0x40(%rbp), %rcx
movq 0x8(%rcx), %rdx
movl %eax, %esi
movq -0x30(%rbp), %rcx
callq 0x202b
movq %rax, %r14
jmp 0x7dc8
movq %r13, -0x48(%rbp)
movl %r14d, %ecx
movl $0x1, %esi
movq %rcx, %rdi
imulq %rcx, %rdi
incl %esi
movq %rcx, %rax
mulq %rdi
jno 0x7d4f
movl %esi, -0x58(%rbp)
movq %rdi, -0x50(%rbp)
movq -0x30(%rbp), %rax
leaq (,%rax,8), %rdi
callq *0x832a(%rip)           # 0x100a0
movq %rax, %r13
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x34(%rbp), %ecx
cmpl %ebx, %ecx
cmovgl %ecx, %ebx
xorl %ecx, %ecx
movq (%rax,%rcx,8), %rdx
movq %rdx, (%r13,%rcx,8)
incq %rcx
cmpq %rcx, %rbx
jne 0x7d8b
movq -0x48(%rbp), %rbx
leaq (%rbx,%r15), %rdi
leaq -0x58(%rbp), %rdx
movl %r14d, %esi
movq %r13, %rcx
movq -0x30(%rbp), %r8
callq 0x20d8
movq %rax, %r14
movq %r13, %rdi
movq %rbx, %r13
xorl %esi, %esi
callq *0x82e8(%rip)           # 0x100b0
leaq (%r14,%r15), %rax
cmpq %rax, %r15
jae 0x7deb
addq %r13, %r15
xorl %ecx, %ecx
movzbl (%r15,%rcx), %edx
movb (%r12,%rdx), %dl
movb %dl, (%r15,%rcx)
incq %rcx
cmpq %rcx, %r14
jne 0x7dd6
movb $0x0, (%r13,%rax)
movq %r13, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq