// File: /workspace/github_cpp_makefile_star2_O1/marxn[P]pupp/3rdparty/gmp/./mini-gmp/mini-gmp.c
// Function: mpz_div_q_2exp
static void
mpz_div_q_2exp (mpz_t q, const mpz_t u, mp_bitcnt_t bit_index,
		enum mpz_div_round_mode mode)
{
  mp_size_t un, qn;
  mp_size_t limb_cnt;
  mp_ptr qp;
  int adjust;

  un = u->_mp_size;
  if (un == 0)
    {
      q->_mp_size = 0;
      return;
    }
  limb_cnt = bit_index / GMP_LIMB_BITS;
  qn = GMP_ABS (un) - limb_cnt;
  bit_index %= GMP_LIMB_BITS;

  if (mode == ((un > 0) ? GMP_DIV_CEIL : GMP_DIV_FLOOR)) /* un != 0 here. */
    /* Note: Below, the final indexing at limb_cnt is valid because at
       that point we have qn > 0. */
    adjust = (qn <= 0
	      || !mpn_zero_p (u->_mp_d, limb_cnt)
	      || (u->_mp_d[limb_cnt]
		  & (((mp_limb_t) 1 << bit_index) - 1)));
  else
    adjust = 0;

  if (qn <= 0)
    qn = 0;

  else
    {
      qp = MPZ_REALLOC (q, qn);

      if (bit_index != 0)
	{
	  mpn_rshift (qp, u->_mp_d + limb_cnt, qn, bit_index);
	  qn -= qp[qn - 1] == 0;
	}
      else
	{
	  mpn_copyi (qp, u->_mp_d + limb_cnt, qn);
	}
    }

  q->_mp_size = qn;

  if (adjust)
    mpz_add_ui (q, q, 1);
  if (un < 0)
    mpz_neg (q, q);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl 0x4(%rsi), %r13d
testl %r13d, %r13d
je 0x3f1e
movq %rdx, %r15
shrq $0x6, %r15
movl %r13d, %r14d
negl %r14d
cmovsl %r13d, %r14d
subq %r15, %r14
movl %edx, %r8d
andl $0x3f, %r8d
xorl %eax, %eax
testl %r13d, %r13d
setg %al
movb $0x1, %dil
cmpl %ecx, %eax
jne 0x3f42
testq %r14, %r14
jle 0x3f1a
movq 0x8(%rsi), %rax
movq %r15, %rcx
cmpq $0x40, %rdx
jb 0x3f15
movq %r15, %rcx
cmpq $0x0, -0x8(%rax,%rcx,8)
jne 0x3f15
leaq -0x1(%rcx), %rdx
cmpq $0x1, %rcx
movq %rdx, %rcx
jg 0x3efe
xorl %ecx, %ecx
testq %rcx, %rcx
je 0x3f2a
xorl %edi, %edi
jmp 0x3f42
movl $0x0, 0x4(%rbx)
jmp 0x401f
movq $-0x1, %rdx
movl %r8d, %ecx
shlq %cl, %rdx
notq %rdx
testq %rdx, (%rax,%r15,8)
sete %dil
testq %r14, %r14
jle 0x3fb6
movl %edi, -0x30(%rbp)
movslq (%rbx), %rax
cmpq %rax, %r14
jle 0x3fbb
movq %r8, -0x38(%rbp)
movq %rsi, -0x40(%rbp)
movl %r13d, -0x2c(%rbp)
cmpq $0x2, %r14
movq %rbx, %r13
movl $0x1, %ebx
cmovgeq %r14, %rbx
movq 0x8(%r13), %rdi
leaq (,%rbx,8), %rdx
xorl %esi, %esi
callq *0xc126(%rip)           # 0x100a8
movq %rax, %r12
movq %rax, 0x8(%r13)
movl %ebx, (%r13)
movl 0x4(%r13), %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
cmpq %rcx, %rbx
jae 0x3fa5
movl $0x0, 0x4(%r13)
movq %r13, %rbx
movl -0x2c(%rbp), %r13d
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %r8
jmp 0x3fbf
xorl %r14d, %r14d
jmp 0x3ffe
movq 0x8(%rbx), %r12
shlq $0x3, %r15
addq 0x8(%rsi), %r15
testq %r8, %r8
je 0x3fe9
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
movl %r8d, %ecx
callq 0x1b49
cmpq $0x1, -0x8(%r12,%r14,8)
sbbq $0x0, %r14
jmp 0x3ffb
xorl %eax, %eax
movq (%r15,%rax,8), %rcx
movq %rcx, (%r12,%rax,8)
incq %rax
cmpq %rax, %r14
jne 0x3feb
movl -0x30(%rbp), %edi
movl %r14d, 0x4(%rbx)
testb %dil, %dil
jne 0x4017
movl $0x1, %edx
movq %rbx, %rdi
movq %rbx, %rsi
callq 0x2e9e
testl %r13d, %r13d
jns 0x401f
negl 0x4(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq