// File: marxn[P]pupp/3rdparty/gmp/mpz/get_str.c
// Function: _gmpz_get_str
char *
mpz_get_str (char *res_str, int base, mpz_srcptr x)
{
  mp_ptr xp;
  mp_size_t x_size = SIZ (x);
  char *return_str;
  size_t str_size;
  size_t alloc_size = 0;
  const char *num_to_text;
  int i;
  TMP_DECL;

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

  /* allocate string for the user if necessary */
  if (res_str == NULL)
    {
      /* digits, null terminator, possible minus sign */
      MPN_SIZEINBASE (alloc_size, PTR(x), ABS(x_size), base);
      alloc_size += 1 + (x_size<0);
      res_str = (char *) (*__gmp_allocate_func) (alloc_size);
    }
  return_str = res_str;

  if (x_size < 0)
    {
      *res_str++ = '-';
      x_size = -x_size;
    }

  /* mpn_get_str clobbers its input on non power-of-2 bases */
  TMP_MARK;
  xp = PTR (x);
  if (! POW2_P (base))
    {
      xp = TMP_ALLOC_LIMBS (x_size | 1);  /* |1 in case x_size==0 */
      MPN_COPY (xp, PTR (x), x_size);
    }

  str_size = mpn_get_str ((unsigned char *) res_str, base, xp, x_size);
  ASSERT (alloc_size == 0 || str_size <= alloc_size - (SIZ(x) < 0));

  /* Convert result to printable chars.  */
  for (i = 0; i < str_size; i++)
    res_str[i] = num_to_text[(int) res_str[i]];
  res_str[str_size] = 0;

  TMP_FREE;

  /* if allocated then resize down to the actual space required */
  if (alloc_size != 0)
    {
      size_t  actual_size = str_size + 1 + (res_str - return_str);
      ASSERT (actual_size == strlen (return_str) + 1);
      __GMP_REALLOCATE_FUNC_MAYBE_TYPE (return_str, alloc_size, actual_size,
					char);
    }
  return return_str;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x20(%rbp), %rax
movslq 0x4(%rax), %rax
movq %rax, -0x30(%rbp)
movq $0x0, -0x48(%rbp)
cmpl $0x0, -0x14(%rbp)
jl 0x5d314
leaq 0x78cd(%rip), %rax      # 0x64ba4
movq %rax, -0x50(%rbp)
cmpl $0x1, -0x14(%rbp)
jg 0x5d2ea
movl $0xa, -0x14(%rbp)
jmp 0x5d312
cmpl $0x24, -0x14(%rbp)
jle 0x5d310
leaq 0x78fd(%rip), %rax      # 0x64bf4
movq %rax, -0x50(%rbp)
cmpl $0x3e, -0x14(%rbp)
jle 0x5d30e
movq $0x0, -0x8(%rbp)
jmp 0x5d6fd
jmp 0x5d310
jmp 0x5d312
jmp 0x5d34b
xorl %eax, %eax
subl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
cmpl $0x1, -0x14(%rbp)
jg 0x5d32b
movl $0xa, -0x14(%rbp)
jmp 0x5d340
cmpl $0x24, -0x14(%rbp)
jle 0x5d33e
movq $0x0, -0x8(%rbp)
jmp 0x5d6fd
jmp 0x5d340
leaq 0x7882(%rip), %rax      # 0x64bc9
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x5d513
jmp 0x5d358
jmp 0x5d35a
jmp 0x5d35c
jmp 0x5d35e
jmp 0x5d360
jmp 0x5d362
jmp 0x5d364
cmpq $0x0, -0x30(%rbp)
jl 0x5d378
movq -0x30(%rbp), %rax
movq %rax, -0xb0(%rbp)
jmp 0x5d385
xorl %eax, %eax
subq -0x30(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rax
cmpq $0x0, %rax
jne 0x5d39f
movq $0x1, -0x48(%rbp)
jmp 0x5d4e3
jmp 0x5d3a1
jmp 0x5d3a3
jmp 0x5d3a5
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xb8(%rbp)
cmpq $0x0, -0x30(%rbp)
jl 0x5d3c8
movq -0x30(%rbp), %rax
movq %rax, -0xc0(%rbp)
jmp 0x5d3d5
xorl %eax, %eax
subq -0x30(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0xb8(%rbp), %rax
movq -0xc0(%rbp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xa0(%rbp)
bsrq -0xa0(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
xorq $0x3f, %rax
movl %eax, -0x68(%rbp)
cmpq $0x0, -0x30(%rbp)
jl 0x5d41d
movq -0x30(%rbp), %rax
movq %rax, -0xc8(%rbp)
jmp 0x5d42a
xorl %eax, %eax
subq -0x30(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0xc8(%rbp), %rax
shlq $0x6, %rax
movl -0x68(%rbp), %ecx
subl $0x0, %ecx
movslq %ecx, %rcx
subq %rcx, %rax
movq %rax, -0x70(%rbp)
movl -0x14(%rbp), %eax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
andl %ecx, %eax
cmpl $0x0, %eax
jne 0x5d48c
movslq -0x14(%rbp), %rcx
leaq 0x3e00(%rip), %rax      # 0x61260
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
movl %eax, -0x64(%rbp)
movq -0x70(%rbp), %rax
movslq -0x64(%rbp), %rcx
addq %rcx, %rax
subq $0x1, %rax
movslq -0x64(%rbp), %rcx
xorl %edx, %edx
divq %rcx
movq %rax, -0x48(%rbp)
jmp 0x5d4e1
jmp 0x5d48e
movq -0x70(%rbp), %rax
movq %rax, -0x90(%rbp)
movslq -0x14(%rbp), %rcx
leaq 0x3dbc(%rip), %rax      # 0x61260
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
addq $0x1, %rax
movq -0x90(%rbp), %rcx
movq %rcx, -0xa8(%rbp)
mulq -0xa8(%rbp)
movq %rax, -0x88(%rbp)
movq %rdx, -0x80(%rbp)
movq -0x80(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x5d4e1
jmp 0x5d4e3
jmp 0x5d4e5
cmpq $0x0, -0x30(%rbp)
setl %al
andb $0x1, %al
movzbl %al, %eax
addl $0x1, %eax
cltq
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
leaq 0x18e1a(%rip), %rax     # 0x76320
movq (%rax), %rax
movq -0x48(%rbp), %rdi
callq *%rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x30(%rbp)
jge 0x5d53e
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movb $0x2d, (%rax)
xorl %eax, %eax
subq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
movq $0x0, -0x60(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movl -0x14(%rbp), %eax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
andl %ecx, %eax
cmpl $0x0, %eax
je 0x5d607
movq -0x30(%rbp), %rax
orq $0x1, %rax
shlq $0x3, %rax
cmpq $0x7f00, %rax           # imm = 0x7F00
setbe %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x5d5b9
movq -0x30(%rbp), %rcx
shlq $0x3, %rcx
orq $0x8, %rcx
addq $0xf, %rcx
andq $-0x10, %rcx
movq %rsp, %rax
subq %rcx, %rax
movq %rax, %rsp
movq %rax, -0xd0(%rbp)
jmp 0x5d5d5
movq -0x30(%rbp), %rsi
orq $0x1, %rsi
shlq $0x3, %rsi
leaq -0x60(%rbp), %rdi
callq 0x56430
movq %rax, -0xd0(%rbp)
movq -0xd0(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x5d5e2
jmp 0x5d5e4
jmp 0x5d5e6
jmp 0x5d5e8
jmp 0x5d5ea
jmp 0x5d5ec
jmp 0x5d5ee
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x30(%rbp), %rdx
callq 0x554c6
jmp 0x5d605
jmp 0x5d607
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movq -0x28(%rbp), %rdx
movq -0x30(%rbp), %rcx
callq 0x5dba0
movq %rax, -0x40(%rbp)
jmp 0x5d621
movl $0x0, -0x54(%rbp)
movslq -0x54(%rbp), %rax
cmpq -0x40(%rbp), %rax
jae 0x5d65e
movq -0x50(%rbp), %rax
movq -0x10(%rbp), %rcx
movslq -0x54(%rbp), %rdx
movsbl (%rcx,%rdx), %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %dl
movq -0x10(%rbp), %rax
movslq -0x54(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x5d628
movq -0x10(%rbp), %rax
movq -0x40(%rbp), %rcx
movb $0x0, (%rax,%rcx)
cmpq $0x0, -0x60(%rbp)
setne %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x5d693
movq -0x60(%rbp), %rdi
callq 0x564a0
jmp 0x5d695
cmpq $0x0, -0x48(%rbp)
je 0x5d6f5
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq -0x10(%rbp), %rcx
movq -0x38(%rbp), %rdx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, -0x98(%rbp)
jmp 0x5d6bb
jmp 0x5d6bd
movq -0x48(%rbp), %rax
cmpq -0x98(%rbp), %rax
je 0x5d6f1
leaq 0x18c57(%rip), %rax     # 0x76328
movq (%rax), %rax
movq -0x38(%rbp), %rdi
movq -0x48(%rbp), %rsi
shlq $0x0, %rsi
movq -0x98(%rbp), %rdx
shlq $0x0, %rdx
callq *%rax
movq %rax, -0x38(%rbp)
jmp 0x5d6f3
jmp 0x5d6f5
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rbp, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)