// File: /workspace/github_cpp_makefile_star2_O2/marxn[P]pupp/3rdparty/gmp/mpn/set_str.c
// Function: _gmpn_set_str_compute_powtab
void
mpn_set_str_compute_powtab (powers_t *powtab, mp_ptr powtab_mem, mp_size_t un, int base)
{
  mp_ptr powtab_mem_ptr;
  long i, pi;
  mp_size_t n;
  mp_ptr p, t;
  mp_limb_t big_base;
  int chars_per_limb;
  size_t digits_in_base;
  mp_size_t shift;

  powtab_mem_ptr = powtab_mem;

  chars_per_limb = mp_bases[base].chars_per_limb;
  big_base = mp_bases[base].big_base;

  p = powtab_mem_ptr;
  powtab_mem_ptr += 1;

  digits_in_base = chars_per_limb;

  p[0] = big_base;
  n = 1;

  count_leading_zeros (i, un - 1);
  i = GMP_LIMB_BITS - 1 - i;

  powtab[i].p = p;
  powtab[i].n = n;
  powtab[i].digits_in_base = digits_in_base;
  powtab[i].base = base;
  powtab[i].shift = 0;

  shift = 0;
  for (pi = i - 1; pi >= 0; pi--)
    {
      t = powtab_mem_ptr;
      powtab_mem_ptr += 2 * n;

      ASSERT_ALWAYS (powtab_mem_ptr < powtab_mem + mpn_dc_set_str_powtab_alloc (un));

      mpn_sqr (t, p, n);
      n = 2 * n - 1; n += t[n] != 0;
      digits_in_base *= 2;
#if 1
      if ((((un - 1) >> pi) & 2) == 0)
	{
	  mpn_divexact_1 (t, t, n, big_base);
	  n -= t[n - 1] == 0;
	  digits_in_base -= chars_per_limb;
	}
#else
      if (CLEVER_CONDITION_1 ())
	{
	  /* perform adjustment operation of previous */
	  cy = mpn_mul_1 (p, p, n, big_base);
	}
      if (CLEVER_CONDITION_2 ())
	{
	  /* perform adjustment operation of new */
	  cy = mpn_mul_1 (t, t, n, big_base);
	}
#endif
      shift *= 2;
      /* Strip low zero limbs, but be careful to keep the result divisible by
	 big_base.  */
      while (t[0] == 0 && (t[1] & ((big_base & -big_base) - 1)) == 0)
	{
	  t++;
	  n--;
	  shift++;
	}
      p = t;
      powtab[pi].p = p;
      powtab[pi].n = n;
      powtab[pi].digits_in_base = digits_in_base;
      powtab[pi].base = base;
      powtab[pi].shift = shift;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %ecx, 0xc(%rsp)
movslq %ecx, %rax
imulq $0x28, %rax, %rcx
leaq 0x167d2(%rip), %r8      # 0x31120
movslq (%r8,%rcx), %r9
movq 0x18(%r8,%rcx), %r15
movq %r15, (%rsi)
leaq -0x1(%rdx), %rcx
movq %rcx, 0x20(%rsp)
movq %rcx, 0x40(%rsp)
bsrq 0x40(%rsp), %rcx
xorq $0x3f, %rcx
pushq $0x3f
popq %r8
subq %rcx, %r8
imulq $0x28, %r8, %r8
movq %rsi, (%rdi,%r8)
movq $0x1, 0x8(%rdi,%r8)
movq %r9, 0x18(%rdi,%r8)
movl %eax, 0x20(%rdi,%r8)
movq %rdi, 0x28(%rsp)
andq $0x0, 0x10(%rdi,%r8)
leaq 0x8(%rsi), %r13
pushq $0x3e
popq %r12
subq %rcx, %r12
leaq (%rsi,%rdx,8), %rax
addq $0x200, %rax            # imm = 0x200
movq %rax, 0x30(%rsp)
leaq -0x1(%r15), %rax
movq %r15, 0x10(%rsp)
notq %r15
andq %rax, %r15
pushq $0x1
popq %rbp
xorl %ebx, %ebx
movq %r9, 0x18(%rsp)
testq %r12, %r12
js 0x1aab3
movq %rbp, %r14
shlq $0x4, %r14
addq %r13, %r14
cmpq 0x30(%rsp), %r14
jae 0x1aac2
movq %r12, 0x38(%rsp)
leaq (,%rbp,2), %r12
movq %r9, (%rsp)
movq %r13, %rdi
movq %rbp, %rdx
callq 0x196c0
movq (%rsp), %r9
leaq -0x1(%r12), %rbp
cmpq $0x1, -0x8(%r13,%r12,8)
movq 0x38(%rsp), %r12
sbbq $-0x1, %rbp
addq %r9, %r9
movq 0x20(%rsp), %rax
movl %r12d, %ecx
sarq %cl, %rax
testb $0x2, %al
jne 0x1aa60
movq %r9, (%rsp)
movq %r13, %rdi
movq %r13, %rsi
movq %rbp, %rdx
movq 0x10(%rsp), %rcx
callq 0x2a200
movq (%rsp), %r9
cmpq $0x1, -0x8(%r13,%rbp,8)
sbbq $0x0, %rbp
subq 0x18(%rsp), %r9
addq %rbx, %rbx
movq (%r13), %rax
testq %rax, %rax
jne 0x1aa81
movq 0x8(%r13), %rax
testq %rax, %r15
jne 0x1aa81
addq $0x8, %r13
decq %rbp
incq %rbx
jmp 0x1aa67
imulq $0x28, %r12, %rax
movq 0x28(%rsp), %rdx
movq %r13, (%rdx,%rax)
movq %rbp, 0x8(%rdx,%rax)
movq %r9, 0x18(%rdx,%rax)
movl 0xc(%rsp), %ecx
movl %ecx, 0x20(%rdx,%rax)
movq %rbx, 0x10(%rdx,%rax)
decq %r12
movq %r13, %rsi
movq %r14, %r13
jmp 0x1a9d2
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x18e7f(%rip), %rdi     # 0x33948
leaq 0x18e82(%rip), %rdx     # 0x33952
movl $0xb2, %esi
callq 0x29ce6