// File: /workspace/github_cpp_makefile_star2_O1/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
movl %edx, %r13d
movq %rdi, -0x30(%rbp)
testl %edx, %edx
setne %al
leal -0x2(%r13), %ecx
cmpl $0x23, %ecx
setae %cl
testb %cl, %al
jne 0x80e9
movq %rsi, %r14
callq 0x1110
movq %rax, %r12
movq (%rax), %rax
movzbl (%r14), %r15d
incq %r14
testb $0x20, 0x1(%rax,%r15,2)
jne 0x7e40
xorl %eax, %eax
cmpb $0x2d, %r15b
sete %al
leaq (%r14,%rax), %rbx
decq %rbx
testl %r13d, %r13d
jne 0x7ebc
cmpb $0x30, -0x1(%r14,%rax)
jne 0x7e8e
movzbl (%r14,%rax), %ecx
cmpl $0x61, %ecx
jg 0x7e96
cmpl $0x42, %ecx
je 0x7eaf
cmpl $0x58, %ecx
je 0x7ea0
addq %rax, %r14
movl $0x8, %r13d
movq %r14, %rbx
jmp 0x7ebc
movl $0xa, %r13d
jmp 0x7ebc
cmpl $0x62, %ecx
je 0x7eaf
cmpl $0x78, %ecx
jne 0x7e80
leaq (%r14,%rax), %rbx
incq %rbx
movl $0x10, %r13d
jmp 0x7ebc
leaq (%r14,%rax), %rbx
incq %rbx
movl $0x2, %r13d
movq %rbx, %rdi
callq 0x1070
cmpq $0x1, %rax
adcq $0x0, %rax
movq %rax, %rdi
callq *0x81cb(%rip)           # 0x100a0
movq %rax, -0x38(%rbp)
movb (%rbx), %al
testb %al, %al
je 0x7f70
incq %rbx
xorl %r14d, %r14d
movq (%r12), %rsi
movzbl %al, %ecx
movl $0x6, %edx
testb $0x20, 0x1(%rsi,%rcx,2)
jne 0x7f54
leal -0x30(%rax), %edx
cmpb $0x9, %dl
ja 0x7f09
movzbl %dl, %edx
jmp 0x7f24
leal -0x61(%rax), %edx
cmpb $0x19, %dl
ja 0x7f16
addl $-0x57, %ecx
jmp 0x7f22
addb $-0x41, %al
movl %r13d, %edx
cmpb $0x19, %al
ja 0x7f24
addl $-0x37, %ecx
movl %ecx, %edx
cmpl %r13d, %edx
jae 0x7f38
movq -0x38(%rbp), %rax
movb %dl, (%rax,%r14)
incq %r14
xorl %edx, %edx
jmp 0x7f54
movq -0x38(%rbp), %rdi
xorl %esi, %esi
callq *0x816c(%rip)           # 0x100b0
movq -0x30(%rbp), %rax
movl $0x0, 0x4(%rax)
movl $0x1, %edx
cmpl $0x6, %edx
je 0x7f61
testl %edx, %edx
jne 0x8093
movb (%rbx), %al
incq %rbx
testb %al, %al
jne 0x7ee9
jmp 0x7f73
xorl %r14d, %r14d
movl %r13d, %edi
callq 0x1fb0
testl %eax, %eax
je 0x7ff2
movl %eax, %r12d
movl %eax, %ebx
imulq %r14, %rbx
addq $0x3f, %rbx
shrq $0x6, %rbx
movq -0x30(%rbp), %r13
movslq (%r13), %rax
cmpq %rax, %rbx
jle 0x807e
cmpq $0x2, %rbx
movq %r13, %rax
movl $0x1, %r13d
cmovgeq %rbx, %r13
movq 0x8(%rax), %rdi
leaq (,%r13,8), %rdx
xorl %esi, %esi
callq *0x80e2(%rip)           # 0x100a8
movq -0x30(%rbp), %rdx
movq %rax, %rdi
movq %rax, 0x8(%rdx)
movl %r13d, (%rdx)
movl 0x4(%rdx), %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
cmpq %rcx, %r13
jae 0x7fea
movl $0x0, 0x4(%rdx)
movq %rdx, %r13
jmp 0x8082
movl %r13d, %r12d
movl $0x1, %ecx
movq %r12, %rsi
imulq %r12, %rsi
incl %ecx
movq %r12, %rax
mulq %rsi
jno 0x7ffd
movl %ecx, -0x48(%rbp)
movq %rsi, -0x40(%rbp)
movl %ecx, %ecx
leaq (%r14,%rcx), %rax
decq %rax
xorl %edx, %edx
divq %rcx
movq %rax, %rbx
movq -0x30(%rbp), %r13
movslq (%r13), %rax
cmpq %rax, %rbx
jle 0x809a
cmpq $0x2, %rbx
movq %r13, %rax
movl $0x1, %r13d
cmovgeq %rbx, %r13
movq 0x8(%rax), %rdi
leaq (,%r13,8), %rdx
xorl %esi, %esi
callq *0x8053(%rip)           # 0x100a8
movq -0x30(%rbp), %rdx
movq %rax, %rdi
movq %rax, 0x8(%rdx)
movl %r13d, (%rdx)
movl 0x4(%rdx), %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
cmpq %rcx, %r13
jae 0x8079
movl $0x0, 0x4(%rdx)
movq %rdx, %r13
jmp 0x809e
movq 0x8(%r13), %rdi
movq -0x38(%rbp), %rsi
movq %r14, %rdx
movl %r12d, %ecx
callq 0x2258
jmp 0x80b1
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x80d8
movq 0x8(%r13), %rdi
leaq -0x48(%rbp), %r8
movq -0x38(%rbp), %rsi
movq %r14, %rdx
movq %r12, %rcx
callq 0x22dc
movq %rax, %r14
cmpq %rbx, %rax
jg 0x8108
xorl %ebx, %ebx
movq -0x38(%rbp), %rdi
xorl %esi, %esi
callq *0x7fe9(%rip)           # 0x100b0
movl %r14d, %eax
negl %eax
cmpb $0x2d, %r15b
cmovnel %r14d, %eax
movl %eax, 0x4(%r13)
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2764(%rip), %rdi      # 0xa854
leaq 0x1f6d(%rip), %rsi      # 0xa064
leaq 0x277d(%rip), %rcx      # 0xa87b
movl $0x100b, %edx           # imm = 0x100B
callq 0x1090
leaq 0x279f(%rip), %rdi      # 0xa8ae
leaq 0x1f4e(%rip), %rsi      # 0xa064
leaq 0x275e(%rip), %rcx      # 0xa87b
movl $0x1055, %edx           # imm = 0x1055
callq 0x1090