// File: marxn[P]pupp/3rdparty/gmp/mpn/set_str.c
// Function: _gmpn_dc_set_str
mp_size_t
mpn_dc_set_str (mp_ptr rp, const unsigned char *str, size_t str_len,
		const powers_t *powtab, mp_ptr tp)
{
  size_t len_lo, len_hi;
  mp_limb_t cy;
  mp_size_t ln, hn, n, sn;

  len_lo = powtab->digits_in_base;

  if (str_len <= len_lo)
    {
      if (BELOW_THRESHOLD (str_len, SET_STR_DC_THRESHOLD))
	return mpn_bc_set_str (rp, str, str_len, powtab->base);
      else
	return mpn_dc_set_str (rp, str, str_len, powtab + 1, tp);
    }

  len_hi = str_len - len_lo;
  ASSERT (len_lo >= len_hi);

  if (BELOW_THRESHOLD (len_hi, SET_STR_DC_THRESHOLD))
    hn = mpn_bc_set_str (tp, str, len_hi, powtab->base);
  else
    hn = mpn_dc_set_str (tp, str, len_hi, powtab + 1, rp);

  sn = powtab->shift;

  if (hn == 0)
    {
      /* Zero +1 limb here, to avoid reading an allocated but uninitialised
	 limb in mpn_incr_u below.  */
      MPN_ZERO (rp, powtab->n + sn + 1);
    }
  else
    {
      if (powtab->n > hn)
	mpn_mul (rp + sn, powtab->p, powtab->n, tp, hn);
      else
	mpn_mul (rp + sn, tp, hn, powtab->p, powtab->n);
      MPN_ZERO (rp, sn);
    }

  str = str + str_len - len_lo;
  if (BELOW_THRESHOLD (len_lo, SET_STR_DC_THRESHOLD))
    ln = mpn_bc_set_str (tp, str, len_lo, powtab->base);
  else
    ln = mpn_dc_set_str (tp, str, len_lo, powtab + 1, tp + powtab->n + sn + 1);

  if (ln != 0)
    {
      cy = mpn_add_n (rp, rp, tp, ln);
      mpn_incr_u (rp + ln, cy);
    }
  n = hn + powtab->n + sn;
  return n - (rp[n - 1] == 0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x38(%rbp), %rax
ja 0x3ada6
cmpq $0x10c, -0x20(%rbp)     # imm = 0x10C
jae 0x3ad80
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rax
movl 0x20(%rax), %ecx
callq 0x3a6f0
movq %rax, -0x8(%rbp)
jmp 0x3b04b
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
addq $0x28, %rcx
movq -0x30(%rbp), %r8
callq 0x3ad20
movq %rax, -0x8(%rbp)
jmp 0x3b04b
movq -0x20(%rbp), %rax
subq -0x38(%rbp), %rax
movq %rax, -0x40(%rbp)
jmp 0x3adb4
cmpq $0x10c, -0x40(%rbp)     # imm = 0x10C
jae 0x3addc
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x28(%rbp), %rax
movl 0x20(%rax), %ecx
callq 0x3a6f0
movq %rax, -0x58(%rbp)
jmp 0x3adfd
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x28(%rbp), %rcx
addq $0x28, %rcx
movq -0x10(%rbp), %r8
callq 0x3ad20
movq %rax, -0x58(%rbp)
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x58(%rbp)
jne 0x3ae81
jmp 0x3ae12
jmp 0x3ae14
jmp 0x3ae16
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
addq -0x68(%rbp), %rax
addq $0x1, %rax
cmpq $0x0, %rax
je 0x3ae7a
jmp 0x3ae2e
movq -0x10(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
addq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x78(%rbp)
jmp 0x3ae4c
jmp 0x3ae4e
movq -0x70(%rbp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, -0x70(%rbp)
movq $0x0, (%rax)
movq -0x78(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x78(%rbp)
cmpq $0x0, %rax
jne 0x3ae4e
jmp 0x3ae78
jmp 0x3ae7a
jmp 0x3ae7c
jmp 0x3af43
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
cmpq -0x58(%rbp), %rax
jle 0x3aebc
movq -0x10(%rbp), %rdi
movq -0x68(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rsi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x30(%rbp), %rcx
movq -0x58(%rbp), %r8
callq 0x37f00
jmp 0x3aee7
movq -0x10(%rbp), %rdi
movq -0x68(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq -0x30(%rbp), %rsi
movq -0x58(%rbp), %rdx
movq -0x28(%rbp), %rax
movq (%rax), %rcx
movq -0x28(%rbp), %rax
movq 0x8(%rax), %r8
callq 0x37f00
jmp 0x3aee9
jmp 0x3aeeb
jmp 0x3aeed
cmpq $0x0, -0x68(%rbp)
je 0x3af3f
jmp 0x3aef6
movq -0x10(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x88(%rbp)
jmp 0x3af0b
jmp 0x3af0d
movq -0x80(%rbp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, -0x80(%rbp)
movq $0x0, (%rax)
movq -0x88(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x88(%rbp)
cmpq $0x0, %rax
jne 0x3af0d
jmp 0x3af3d
jmp 0x3af3f
jmp 0x3af41
jmp 0x3af43
movq -0x18(%rbp), %rax
addq -0x20(%rbp), %rax
xorl %ecx, %ecx
subq -0x38(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
cmpq $0x10c, -0x38(%rbp)     # imm = 0x10C
jae 0x3af80
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq -0x28(%rbp), %rax
movl 0x20(%rax), %ecx
callq 0x3a6f0
movq %rax, -0x50(%rbp)
jmp 0x3afbf
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq -0x28(%rbp), %rcx
addq $0x28, %rcx
movq -0x30(%rbp), %r8
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
shlq $0x3, %rax
addq %rax, %r8
movq -0x68(%rbp), %rax
shlq $0x3, %rax
addq %rax, %r8
addq $0x8, %r8
callq 0x3ad20
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
je 0x3b00f
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x50(%rbp), %rcx
callq 0x36c80
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq -0x50(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq -0x48(%rbp), %rcx
addq %rcx, (%rax)
jae 0x3b002
addq $0x1, 0x8(%rax)
leaq 0x8(%rax), %rax
jb 0x3aff7
movq %rax, -0x90(%rbp)
jmp 0x3b00b
jmp 0x3b00d
jmp 0x3b00f
movq -0x58(%rbp), %rax
movq -0x28(%rbp), %rcx
addq 0x8(%rcx), %rax
addq -0x68(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq -0x10(%rbp), %rcx
movq -0x60(%rbp), %rdx
subq $0x1, %rdx
cmpq $0x0, (%rcx,%rdx,8)
sete %cl
andb $0x1, %cl
movzbl %cl, %ecx
movslq %ecx, %rcx
subq %rcx, %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax,%rax)