// File: 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
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0xa8c8
cmpl $0x2, -0x1c(%rbp)
jl 0xa8ca
cmpl $0x24, -0x1c(%rbp)
jg 0xa8ca
jmp 0xa8e9
leaq 0x4004(%rip), %rdi      # 0xe8d5
leaq 0x37fc(%rip), %rsi      # 0xe0d4
movl $0x100b, %edx           # imm = 0x100B
leaq 0x4018(%rip), %rcx      # 0xe8fc
callq 0x1070
jmp 0xa8eb
callq 0x10e0
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movzbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
je 0xa919
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0xa8eb
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %ecx
movq -0x18(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0xa9cf
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x30, %eax
jne 0xa9c6
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x78, %eax
je 0xa979
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x58, %eax
jne 0xa98e
movl $0x10, -0x1c(%rbp)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0xa9c4
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x62, %eax
je 0xa9a6
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x42, %eax
jne 0xa9bb
movl $0x2, -0x1c(%rbp)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0xa9c2
movl $0x8, -0x1c(%rbp)
jmp 0xa9c4
jmp 0xa9cd
movl $0xa, -0x1c(%rbp)
jmp 0xa9cf
movq -0x18(%rbp), %rdi
callq 0x1050
movq %rax, -0x40(%rbp)
movq 0x86a5(%rip), %rax      # 0x13088
movq -0x40(%rbp), %rdi
cmpq $0x0, -0x40(%rbp)
sete %cl
andb $0x1, %cl
movzbl %cl, %ecx
movslq %ecx, %rcx
addq %rcx, %rdi
callq *%rax
movq %rax, -0x50(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x18(%rbp), %rax
cmpb $0x0, (%rax)
je 0xab1c
callq 0x10e0
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movzbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
je 0xaa3b
jmp 0xab0b
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x30, %eax
jl 0xaa62
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x39, %eax
jg 0xaa62
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
subl $0x30, %eax
movl %eax, -0x54(%rbp)
jmp 0xaac0
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x61, %eax
jl 0xaa8c
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x7a, %eax
jg 0xaa8c
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
subl $0x61, %eax
addl $0xa, %eax
movl %eax, -0x54(%rbp)
jmp 0xaabe
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x41, %eax
jl 0xaab6
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5a, %eax
jg 0xaab6
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
subl $0x41, %eax
addl $0xa, %eax
movl %eax, -0x54(%rbp)
jmp 0xaabc
movl -0x1c(%rbp), %eax
movl %eax, -0x54(%rbp)
jmp 0xaabe
jmp 0xaac0
movl -0x54(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jb 0xaaf0
movq 0x85c9(%rip), %rax      # 0x13098
movq -0x50(%rbp), %rdi
xorl %ecx, %ecx
movl %ecx, %esi
callq *%rax
movq -0x10(%rbp), %rax
movl $0x0, 0x4(%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xac7e
movl -0x54(%rbp), %eax
movb %al, %dl
movq -0x50(%rbp), %rax
movq -0x40(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x40(%rbp)
movb %dl, (%rax,%rcx)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0xaa09
movl -0x1c(%rbp), %edi
callq 0x2a50
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x20(%rbp)
jbe 0xab99
movq -0x40(%rbp), %rax
movl -0x20(%rbp), %ecx
imulq %rcx, %rax
addq $0x40, %rax
subq $0x1, %rax
shrq $0x6, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
movslq (%rcx), %rcx
cmpq %rcx, %rax
jle 0xab6b
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x3440
movq %rax, -0x70(%rbp)
jmp 0xab77
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq -0x40(%rbp), %rdx
movl -0x20(%rbp), %ecx
callq 0x2ef0
movq %rax, -0x28(%rbp)
jmp 0xac14
movslq -0x1c(%rbp), %rsi
leaq -0x68(%rbp), %rdi
callq 0x2c40
movq -0x40(%rbp), %rax
movl -0x68(%rbp), %ecx
addq %rcx, %rax
subq $0x1, %rax
movl -0x68(%rbp), %ecx
xorl %edx, %edx
divq %rcx
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
movslq (%rcx), %rcx
cmpq %rcx, %rax
jle 0xabe3
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x3440
movq %rax, -0x78(%rbp)
jmp 0xabef
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq -0x40(%rbp), %rdx
movslq -0x1c(%rbp), %rcx
leaq -0x68(%rbp), %r8
callq 0x3020
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
jg 0xac20
jmp 0xac3f
leaq 0x3d08(%rip), %rdi      # 0xe92f
leaq 0x34a6(%rip), %rsi      # 0xe0d4
movl $0x1055, %edx           # imm = 0x1055
leaq 0x3cc2(%rip), %rcx      # 0xe8fc
callq 0x1070
movq 0x8452(%rip), %rax      # 0x13098
movq -0x50(%rbp), %rdi
xorl %ecx, %ecx
movl %ecx, %esi
callq *%rax
cmpl $0x0, -0x44(%rbp)
je 0xac62
xorl %eax, %eax
subq -0x28(%rbp), %rax
movq %rax, -0x80(%rbp)
jmp 0xac6a
movq -0x28(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x4(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopw (%rax,%rax)