// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r13
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x28(%rcx), %r14
movq -0x10(%r14), %r15
movq %r13, %rdx
subq %r15, %rdx
ja 0x1ab10
cmpq $0x10b, %r13            # imm = 0x10B
jbe 0x1ab31
addq $0x28, %r14
jmp 0x1aaf5
cmpq $0x10b, %rdx            # imm = 0x10B
movq %r8, 0x8(%rsp)
jbe 0x1ab50
movq %r8, %rdi
movq %r12, %rsi
movq %r14, %rcx
movq %rbx, %r8
callq 0x1aada
jmp 0x1ab5f
movl 0x20(%rcx), %ecx
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1a78d
movl -0x8(%r14), %ecx
movq %r8, %rdi
movq %r12, %rsi
callq 0x1a78d
movq -0x20(%r14), %r8
movq -0x18(%r14), %rbp
testq %rax, %rax
movq %rax, 0x10(%rsp)
je 0x1ab91
leaq (%rbx,%rbp,8), %rdi
movq -0x28(%r14), %rcx
cmpq %rax, %r8
movq 0x8(%rsp), %r9
jle 0x1ab9b
movq %rcx, %rsi
movq %r8, %rdx
movq %r9, %rcx
movq %rax, %r8
jmp 0x1aba1
addq %rbp, %r8
incq %r8
jne 0x1abae
jmp 0x1abbf
movq %r9, %rsi
movq %rax, %rdx
callq 0x18a58
movq %rbp, %r8
testq %rbp, %rbp
je 0x1abbf
shlq $0x3, %r8
movq %rbx, %rdi
xorl %esi, %esi
movq %r8, %rdx
callq 0x6170
addq %r13, %r12
subq %r15, %r12
cmpq $0x10b, %r15            # imm = 0x10B
jbe 0x1abf3
movq -0x20(%r14), %rax
movq 0x8(%rsp), %rdi
leaq (%rdi,%rax,8), %rax
leaq (%rax,%rbp,8), %r8
addq $0x8, %r8
movq %r12, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x1aada
jmp 0x1ac07
movl -0x8(%r14), %ecx
movq 0x8(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x1a78d
movq %rax, %r15
testq %rax, %rax
je 0x1ac36
movq %rbx, %rdi
movq %rbx, %rsi
movq 0x8(%rsp), %rdx
movq %r15, %rcx
callq 0x17cf0
leaq (%rbx,%r15,8), %rcx
addq %rax, (%rcx)
jae 0x1ac36
addq $0x1, 0x8(%rcx)
leaq 0x8(%rcx), %rcx
jb 0x1ac2b
addq 0x10(%rsp), %rbp
addq -0x20(%r14), %rbp
cmpq $0x1, -0x8(%rbx,%rbp,8)
sbbq $0x0, %rbp
movq %rbp, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop