// File: /workspace/github_cpp_makefile_star2_O2/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 0x701b
movq %rsi, %r14
callq 0x1100
movq %rax, %r15
movq (%rax), %rax
movzbl (%r14), %r12d
incq %r14
testb $0x20, 0x1(%rax,%r12,2)
jne 0x6e48
xorl %eax, %eax
cmpb $0x2d, %r12b
sete %al
leaq (%r14,%rax), %rbx
decq %rbx
cmpl $0x0, -0x30(%rbp)
jne 0x6eaf
cmpb $0x30, -0x1(%r14,%rax)
jne 0x6e9d
movzbl (%r14,%rax), %ecx
cmpl $0x42, %ecx
je 0x6ea1
cmpl $0x58, %ecx
je 0x6e92
cmpl $0x62, %ecx
je 0x6ea1
cmpl $0x78, %ecx
jne 0x7009
leaq (%r14,%rax), %rbx
incq %rbx
pushq $0x10
jmp 0x6eaa
pushq $0xa
jmp 0x6eaa
leaq (%r14,%rax), %rbx
incq %rbx
pushq $0x2
popq %rax
movq %rax, -0x30(%rbp)
movq %rbx, %rdi
callq 0x1070
cmpq $0x1, %rax
adcq $0x0, %rax
movq %rax, %rdi
callq *0x81d0(%rip)           # 0xf098
movq %rax, %r14
xorl %r13d, %r13d
movq -0x30(%rbp), %rdi
movzbl (%rbx), %eax
testq %rax, %rax
je 0x6f1b
movq (%r15), %rcx
testb $0x20, 0x1(%rcx,%rax,2)
jne 0x6f16
leal -0x30(%rax), %ecx
cmpb $0x9, %cl
ja 0x6ef1
movzbl %cl, %eax
jmp 0x6f0b
leal -0x61(%rax), %ecx
cmpb $0x19, %cl
ja 0x6efe
addl $-0x57, %eax
jmp 0x6f0b
movl %eax, %ecx
addb $-0x41, %cl
cmpb $0x19, %cl
ja 0x6f51
addl $-0x37, %eax
cmpl %edi, %eax
jae 0x6f51
movb %al, (%r14,%r13)
incq %r13
incq %rbx
jmp 0x6ed2
movq %rdi, %rbx
callq 0x1d5c
testl %eax, %eax
je 0x6f67
movl %eax, %r15d
movl %eax, %ebx
imulq %r13, %rbx
addq $0x3f, %rbx
shrq $0x6, %rbx
movq -0x38(%rbp), %rdi
movslq (%rdi), %rax
cmpq %rax, %rbx
jle 0x6fa3
movq %rbx, %rsi
callq 0x228f
movq %rax, %rdi
jmp 0x6fa7
xorl %r13d, %r13d
movq %r14, %rdi
xorl %esi, %esi
callq *0x8149(%rip)           # 0xf0a8
pushq $-0x1
popq %rbx
jmp 0x6ff0
movl %ebx, %r15d
leaq -0x48(%rbp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1e6c
movl (%rbx), %ecx
leaq (%rcx,%r13), %rax
decq %rax
xorl %edx, %edx
divq %rcx
movq %rax, %rbx
movq -0x38(%rbp), %rdi
movslq (%rdi), %rax
cmpq %rax, %rbx
jle 0x6fb7
movq %rbx, %rsi
callq 0x228f
movq %rax, %rdi
jmp 0x6fbb
movq 0x8(%rdi), %rdi
movq %r14, %rsi
movq %r13, %rdx
movl %r15d, %ecx
callq 0x1ffe
jmp 0x6fcd
movq 0x8(%rdi), %rdi
leaq -0x48(%rbp), %r8
movq %r14, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0x206d
movq %rax, %r15
cmpq %rbx, %rax
jg 0x703a
xorl %ebx, %ebx
movq %r14, %rdi
xorl %esi, %esi
callq *0x80c6(%rip)           # 0xf0a8
movl %r15d, %r13d
negl %r13d
cmpb $0x2d, %r12b
cmovnel %r15d, %r13d
movq -0x38(%rbp), %rax
movl %r13d, 0x4(%rax)
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq %rax, %r14
pushq $0x8
popq %rax
movq %rax, -0x30(%rbp)
movq %r14, %rbx
jmp 0x6eaf
leaq 0x2832(%rip), %rdi      # 0x9854
leaq 0x203b(%rip), %rsi      # 0x9064
leaq 0x284b(%rip), %rcx      # 0x987b
movl $0x100b, %edx           # imm = 0x100B
callq 0x1090
leaq 0x286d(%rip), %rdi      # 0x98ae
leaq 0x201c(%rip), %rsi      # 0x9064
leaq 0x282c(%rip), %rcx      # 0x987b
movl $0x1055, %edx           # imm = 0x1055
callq 0x1090