// File: marxn[P]pupp/3rdparty/gmp/mpq/get_str.c
// Function: _gmpq_get_str
char *
mpq_get_str (char *str, int base, mpq_srcptr q)
{
  size_t  str_alloc, len;

  if (base > 62 || base < -36)
    return NULL;

  str_alloc = 0;
  if (str == NULL)
    {
      /* This is an overestimate since we don't bother checking how much of
	 the high limbs of num and den are used.  +2 for rounding up the
	 chars per bit of num and den.  +3 for sign, slash and '\0'.  */
      DIGITS_IN_BASE_PER_LIMB (str_alloc, ABSIZ(NUM(q)) + SIZ(DEN(q)), ABS(base));
      str_alloc += 6;

      str = (char *) (*__gmp_allocate_func) (str_alloc);
    }

  mpz_get_str (str, base, mpq_numref(q));
  len = strlen (str);
  if (! MPZ_EQUAL_1_P (mpq_denref (q)))
    {
      str[len++] = '/';
      mpz_get_str (str+len, base, mpq_denref(q));
      len += strlen (str+len);
    }

  ASSERT (len == strlen(str));
  ASSERT (str_alloc == 0 || len+1 <= str_alloc);
  ASSERT (len+1 <=  /* size recommended to applications */
	  mpz_sizeinbase (mpq_numref(q), ABS(base)) +
	  mpz_sizeinbase (mpq_denref(q), ABS(base)) + 3);

  if (str_alloc != 0)
    __GMP_REALLOCATE_FUNC_MAYBE_TYPE (str, str_alloc, len+1, char);

  return str;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
cmpl $0x3e, -0x14(%rbp)
jg 0x5d7bf
cmpl $-0x24, -0x14(%rbp)
jge 0x5d7cc
movq $0x0, -0x8(%rbp)
jmp 0x5d955
movq $0x0, -0x28(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x5d882
jmp 0x5d7e1
cmpl $0x0, -0x14(%rbp)
jl 0x5d7ef
movl -0x14(%rbp), %eax
movl %eax, -0x4c(%rbp)
jmp 0x5d7f7
xorl %eax, %eax
subl -0x14(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movslq %eax, %rcx
leaq 0x3a5c(%rip), %rax      # 0x61260
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, 0x4(%rax)
jl 0x5d829
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x5c(%rbp)
jmp 0x5d835
movq -0x20(%rbp), %rcx
xorl %eax, %eax
subl 0x4(%rcx), %eax
movl %eax, -0x5c(%rbp)
movq -0x58(%rbp), %rax
movl -0x5c(%rbp), %ecx
movq -0x20(%rbp), %rdx
addl 0x14(%rdx), %ecx
movslq %ecx, %rcx
shlq $0x6, %rcx
movq %rcx, -0x48(%rbp)
mulq -0x48(%rbp)
movq %rax, -0x40(%rbp)
movq %rdx, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
addq $0x6, %rax
movq %rax, -0x28(%rbp)
leaq 0x18aab(%rip), %rax     # 0x76320
movq (%rax), %rax
movq -0x28(%rbp), %rdi
callq *%rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movq -0x20(%rbp), %rdx
callq 0x5d2a0
movq -0x10(%rbp), %rdi
callq 0x6170
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x1, 0x14(%rax)
jne 0x5d8b7
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
cmpq $0x1, (%rax)
je 0x5d8fb
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x30(%rbp)
movb $0x2f, (%rax,%rcx)
movq -0x10(%rbp), %rdi
addq -0x30(%rbp), %rdi
movl -0x14(%rbp), %esi
movq -0x20(%rbp), %rdx
addq $0x10, %rdx
callq 0x5d2a0
movq -0x10(%rbp), %rdi
addq -0x30(%rbp), %rdi
callq 0x6170
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0x5d8fd
jmp 0x5d8ff
jmp 0x5d901
jmp 0x5d903
jmp 0x5d905
jmp 0x5d907
cmpq $0x0, -0x28(%rbp)
je 0x5d94d
jmp 0x5d910
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
je 0x5d949
leaq 0x18a00(%rip), %rax     # 0x76328
movq (%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
shlq $0x0, %rsi
movq -0x30(%rbp), %rdx
addq $0x1, %rdx
shlq $0x0, %rdx
callq *%rax
movq %rax, -0x10(%rbp)
jmp 0x5d94b
jmp 0x5d94d
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nop