// File: /workspace/github_cpp_makefile_star2_O3/marxn[P]pupp/3rdparty/gmp/./mini-gmp/mini-gmp.c
// Function: mpz_set_str
int
mpz_set_str (mpz_t r, const char *sp, int base)
{
  unsigned bits;
  mp_size_t rn, alloc;
  mp_ptr rp;
  size_t sn;
  int sign;
  unsigned char *dp;

  assert (base == 0 || (base >= 2 && base <= 36));

  while (isspace( (unsigned char) *sp))
    sp++;

  sign = (*sp == '-');
  sp += sign;

  if (base == 0)
    {
      if (*sp == '0')
	{
	  sp++;
	  if (*sp == 'x' || *sp == 'X')
	    {
	      base = 16;
	      sp++;
	    }
	  else if (*sp == 'b' || *sp == 'B')
	    {
	      base = 2;
	      sp++;
	    }
	  else
	    base = 8;
	}
      else
	base = 10;
    }

  sn = strlen (sp);
  dp = (unsigned char *) gmp_xalloc (sn + (sn == 0));

  for (sn = 0; *sp; sp++)
    {
      unsigned digit;

      if (isspace ((unsigned char) *sp))
	continue;
      if (*sp >= '0' && *sp <= '9')
	digit = *sp - '0';
      else if (*sp >= 'a' && *sp <= 'z')
	digit = *sp - 'a' + 10;
      else if (*sp >= 'A' && *sp <= 'Z')
	digit = *sp - 'A' + 10;
      else
	digit = base; /* fail */

      if (digit >= base)
	{
	  gmp_free (dp);
	  r->_mp_size = 0;
	  return -1;
	}

      dp[sn++] = digit;
    }

  bits = mpn_base_power_of_two_p (base);

  if (bits > 0)
    {
      alloc = (sn * bits + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS;
      rp = MPZ_REALLOC (r, alloc);
      rn = mpn_set_str_bits (rp, dp, sn, bits);
    }
  else
    {
      struct mpn_base_info info;
      mpn_get_base_info (&info, base);
      alloc = (sn + info.exp - 1) / info.exp;
      rp = MPZ_REALLOC (r, alloc);
      rn = mpn_set_str_other (rp, dp, sn, base, &info);
    }
  assert (rn <= alloc);
  gmp_free (dp);

  r->_mp_size = sign ? - rn : rn;

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, -0x38(%rbp)
testl %edx, %edx
setne %al
movq %rdx, -0x30(%rbp)
leal -0x2(%rdx), %ecx
cmpl $0x23, %ecx
setae %cl
testb %cl, %al
jne 0x7f82
movq %rsi, %r14
callq 0x1110
movq %rax, %r12
movq (%rax), %rax
movzbl (%r14), %r13d
incq %r14
testb $0x20, 0x1(%rax,%r13,2)
jne 0x7d00
xorl %eax, %eax
cmpb $0x2d, %r13b
sete %al
leaq (%r14,%rax), %rbx
decq %rbx
cmpl $0x0, -0x30(%rbp)
jne 0x7d81
cmpb $0x30, -0x1(%r14,%rax)
jne 0x7d52
movzbl (%r14,%rax), %ecx
cmpl $0x61, %ecx
jg 0x7d59
cmpl $0x42, %ecx
je 0x7d71
cmpl $0x58, %ecx
je 0x7d63
addq %rax, %r14
movl $0x8, %eax
movq %rax, -0x30(%rbp)
movq %r14, %rbx
jmp 0x7d81
movl $0xa, %eax
jmp 0x7d7d
cmpl $0x62, %ecx
je 0x7d71
cmpl $0x78, %ecx
jne 0x7d41
leaq (%r14,%rax), %rbx
incq %rbx
movl $0x10, %eax
jmp 0x7d7d
leaq (%r14,%rax), %rbx
incq %rbx
movl $0x2, %eax
movq %rax, -0x30(%rbp)
movq %rbx, %rdi
callq 0x1070
cmpq $0x1, %rax
adcq $0x0, %rax
movq %rax, %rdi
callq *0x8306(%rip)           # 0x100a0
movq %rax, %r14
movb (%rbx), %al
testb %al, %al
je 0x7dfc
incq %rbx
xorl %r15d, %r15d
movq -0x30(%rbp), %rdi
movq (%r12), %rdx
movzbl %al, %ecx
testb $0x20, 0x1(%rdx,%rcx,2)
jne 0x7df1
leal -0x30(%rax), %edx
cmpb $0x9, %dl
ja 0x7dc8
movzbl %dl, %ecx
jmp 0x7de2
leal -0x61(%rax), %edx
cmpb $0x19, %dl
ja 0x7dd5
addl $-0x57, %ecx
jmp 0x7de2
addb $-0x41, %al
cmpb $0x19, %al
ja 0x7f05
addl $-0x37, %ecx
cmpl %edi, %ecx
jae 0x7f05
movb %cl, (%r14,%r15)
incq %r15
movb (%rbx), %al
incq %rbx
testb %al, %al
jne 0x7dad
jmp 0x7e03
xorl %r15d, %r15d
movq -0x30(%rbp), %rdi
movq %rdi, %rbx
callq 0x1f9e
testl %eax, %eax
je 0x7e7b
movl %eax, %r12d
imulq %r15, %r12
addq $0x3f, %r12
shrq $0x6, %r12
movq -0x38(%rbp), %rcx
movslq (%rcx), %rdx
cmpq %rdx, %r12
jle 0x7f1b
movl %eax, -0x30(%rbp)
cmpq $0x1, %r12
movq %r12, %rbx
adcq $0x0, %rbx
movq 0x8(%rcx), %rdi
leaq (,%rbx,8), %rdx
xorl %esi, %esi
callq *0x8258(%rip)           # 0x100a8
movq -0x38(%rbp), %rdx
movq %rax, %rdi
movq %rax, 0x8(%rdx)
movl %ebx, (%rdx)
movl 0x4(%rdx), %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
cmpq %rcx, %rbx
jae 0x7e73
movl $0x0, 0x4(%rdx)
movl -0x30(%rbp), %eax
jmp 0x7f1f
movl %ebx, %ebx
movl $0x1, %ecx
movq %rbx, %rsi
movq -0x38(%rbp), %rdi
imulq %rbx, %rsi
incl %ecx
movq %rbx, %rax
mulq %rsi
jno 0x7e89
movl %ecx, -0x48(%rbp)
movq %rsi, -0x40(%rbp)
movl %ecx, %ecx
leaq (%r15,%rcx), %rax
decq %rax
xorl %edx, %edx
divq %rcx
movq %rax, %r12
movslq (%rdi), %rax
cmpq %rax, %r12
jle 0x7f2e
cmpq $0x2, %r12
movl $0x1, %eax
cmovgeq %r12, %rax
movq %rax, -0x30(%rbp)
movq 0x8(%rdi), %rdi
leaq (,%rax,8), %rdx
xorl %esi, %esi
callq *0x81cc(%rip)           # 0x100a8
movq -0x38(%rbp), %rdx
movq %rax, %rdi
movq %rax, 0x8(%rdx)
movq -0x30(%rbp), %rsi
movl %esi, (%rdx)
movl 0x4(%rdx), %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
cmpq %rcx, %rsi
jae 0x7f32
movl $0x0, 0x4(%rdx)
jmp 0x7f32
xorl %r12d, %r12d
movq %r14, %rdi
xorl %esi, %esi
callq *0x819d(%rip)           # 0x100b0
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
jmp 0x7f68
movq 0x8(%rcx), %rdi
movq %r14, %rsi
movq %r15, %rdx
movl %eax, %ecx
callq 0x2240
jmp 0x7f44
movq 0x8(%rdi), %rdi
leaq -0x48(%rbp), %r8
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x22c0
movq %rax, %rbx
cmpq %r12, %rax
jg 0x7fa1
xorl %r15d, %r15d
movq %r14, %rdi
xorl %esi, %esi
callq *0x8156(%rip)           # 0x100b0
movl %ebx, %r12d
negl %r12d
cmpb $0x2d, %r13b
cmovnel %ebx, %r12d
movq -0x38(%rbp), %rax
movl %r12d, 0x4(%rax)
movl %r15d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x28cb(%rip), %rdi      # 0xa854
leaq 0x20d4(%rip), %rsi      # 0xa064
leaq 0x28e4(%rip), %rcx      # 0xa87b
movl $0x100b, %edx           # imm = 0x100B
callq 0x1090
leaq 0x2906(%rip), %rdi      # 0xa8ae
leaq 0x20b5(%rip), %rsi      # 0xa064
leaq 0x28c5(%rip), %rcx      # 0xa87b
movl $0x1055, %edx           # imm = 0x1055
callq 0x1090