// File: marxn[P]pupp/3rdparty/gmp/./mini-gmp/mini-gmp.c
// Function: mpz_div_r_2exp
static void
mpz_div_r_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t bit_index,
		enum mpz_div_round_mode mode)
{
  mp_size_t us, un, rn;
  mp_ptr rp;
  mp_limb_t mask;

  us = u->_mp_size;
  if (us == 0 || bit_index == 0)
    {
      r->_mp_size = 0;
      return;
    }
  rn = (bit_index + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS;
  assert (rn > 0);

  rp = MPZ_REALLOC (r, rn);
  un = GMP_ABS (us);

  mask = GMP_LIMB_MAX >> (rn * GMP_LIMB_BITS - bit_index);

  if (rn > un)
    {
      /* Quotient (with truncation) is zero, and remainder is
	 non-zero */
      if (mode == ((us > 0) ? GMP_DIV_CEIL : GMP_DIV_FLOOR)) /* us != 0 here. */
	{
	  /* Have to negate and sign extend. */
	  mp_size_t i;
	  mp_limb_t cy;

	  for (cy = 1, i = 0; i < un; i++)
	    {
	      mp_limb_t s = ~u->_mp_d[i] + cy;
	      cy = s < cy;
	      rp[i] = s;
	    }
	  assert (cy == 0);
	  for (; i < rn - 1; i++)
	    rp[i] = GMP_LIMB_MAX;

	  rp[rn-1] = mask;
	  us = -us;
	}
      else
	{
	  /* Just copy */
	  if (r != u)
	    mpn_copyi (rp, u->_mp_d, un);

	  rn = un;
	}
    }
  else
    {
      if (r != u)
	mpn_copyi (rp, u->_mp_d, rn - 1);

      rp[rn-1] = u->_mp_d[rn-1] & mask;

      if (mode == ((us > 0) ? GMP_DIV_CEIL : GMP_DIV_FLOOR)) /* us != 0 here. */
	{
	  /* If r != 0, compute 2^{bit_count} - r. */
	  mp_size_t i;

	  for (i = 0; i < rn && rp[i] == 0; i++)
	    ;
	  if (i < rn)
	    {
	      /* r > 0, need to flip sign. */
	      rp[i] = ~rp[i] + 1;
	      while (++i < rn)
		rp[i] = ~rp[i];

	      rp[rn-1] &= mask;

	      /* us is not used for anything else, so we can modify it
		 here to indicate flipped sign. */
	      us = -us;
	    }
	}
    }
  rn = mpn_normalized_size (rp, rn);
  r->_mp_size = us < 0 ? -rn : rn;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movslq 0x4(%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x5c14
cmpq $0x0, -0x18(%rbp)
jne 0x5c24
movq -0x8(%rbp), %rax
movl $0x0, 0x4(%rax)
jmp 0x5f7b
movq -0x18(%rbp), %rax
addq $0x40, %rax
subq $0x1, %rax
shrq $0x6, %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jle 0x5c41
jmp 0x5c60
leaq 0x9a3d(%rip), %rdi      # 0xf685
leaq 0x8485(%rip), %rsi      # 0xe0d4
movl $0x93d, %edx            # imm = 0x93D
leaq 0x9a31(%rip), %rcx      # 0xf68c
callq 0x1070
movq -0x38(%rbp), %rax
movq -0x8(%rbp), %rcx
movslq (%rcx), %rcx
cmpq %rcx, %rax
jle 0x5c83
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x3440
movq %rax, -0x70(%rbp)
jmp 0x5c8f
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x28(%rbp)
jl 0x5ca8
movq -0x28(%rbp), %rax
movq %rax, -0x78(%rbp)
jmp 0x5cb2
xorl %eax, %eax
subq -0x28(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x38(%rbp), %rcx
shlq $0x6, %rcx
subq -0x18(%rbp), %rcx
movq $-0x1, %rax
shrq %cl, %rax
movq %rax, -0x48(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x30(%rbp), %rax
jle 0x5e0e
movl -0x1c(%rbp), %eax
movq -0x28(%rbp), %rsi
xorl %ecx, %ecx
movl $0x1, %edx
cmpq $0x0, %rsi
cmovgl %edx, %ecx
cmpl %ecx, %eax
jne 0x5de2
movq $0x1, -0x58(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x30(%rbp), %rax
jge 0x5d69
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x50(%rbp), %rcx
movq (%rax,%rcx,8), %rax
xorq $-0x1, %rax
addq -0x58(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x58(%rbp), %rax
setb %al
andb $0x1, %al
movzbl %al, %eax
cltq
movq %rax, -0x58(%rbp)
movq -0x60(%rbp), %rdx
movq -0x40(%rbp), %rax
movq -0x50(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x5d0f
cmpq $0x0, -0x58(%rbp)
jne 0x5d72
jmp 0x5d91
leaq 0x872e(%rip), %rdi      # 0xe4a7
leaq 0x8354(%rip), %rsi      # 0xe0d4
movl $0x954, %edx            # imm = 0x954
leaq 0x9900(%rip), %rcx      # 0xf68c
callq 0x1070
jmp 0x5d93
movq -0x50(%rbp), %rax
movq -0x38(%rbp), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jge 0x5dc2
movq -0x40(%rbp), %rax
movq -0x50(%rbp), %rcx
movq $-0x1, (%rax,%rcx,8)
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x5d93
movq -0x48(%rbp), %rdx
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %rcx
subq $0x1, %rcx
movq %rdx, (%rax,%rcx,8)
xorl %eax, %eax
subq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x5e09
movq -0x8(%rbp), %rax
cmpq -0x10(%rbp), %rax
je 0x5e01
movq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x30(%rbp), %rdx
callq 0x1390
movq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x5f39
movq -0x8(%rbp), %rax
cmpq -0x10(%rbp), %rax
je 0x5e31
movq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x38(%rbp), %rdx
subq $0x1, %rdx
callq 0x1390
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x38(%rbp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rdx
andq -0x48(%rbp), %rdx
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %rcx
subq $0x1, %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x1c(%rbp), %eax
movq -0x28(%rbp), %rsi
xorl %ecx, %ecx
movl $0x1, %edx
cmpq $0x0, %rsi
cmovgl %edx, %ecx
cmpl %ecx, %eax
jne 0x5f37
movq $0x0, -0x68(%rbp)
movq -0x68(%rbp), %rcx
xorl %eax, %eax
cmpq -0x38(%rbp), %rcx
movb %al, -0x79(%rbp)
jge 0x5ea0
movq -0x40(%rbp), %rax
movq -0x68(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
sete %al
movb %al, -0x79(%rbp)
movb -0x79(%rbp), %al
testb $0x1, %al
jne 0x5ea9
jmp 0x5eb9
jmp 0x5eab
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
jmp 0x5e7e
movq -0x68(%rbp), %rax
cmpq -0x38(%rbp), %rax
jge 0x5f35
movq -0x40(%rbp), %rax
movq -0x68(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
xorq $-0x1, %rdx
addq $0x1, %rdx
movq -0x40(%rbp), %rax
movq -0x68(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
cmpq -0x38(%rbp), %rax
jge 0x5f13
movq -0x40(%rbp), %rax
movq -0x68(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
xorq $-0x1, %rdx
movq -0x40(%rbp), %rax
movq -0x68(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x5ee3
movq -0x48(%rbp), %rdx
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %rcx
subq $0x1, %rcx
andq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
xorl %eax, %eax
subq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x5f37
jmp 0x5f39
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x14d0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x28(%rbp)
jge 0x5f60
xorl %eax, %eax
subq -0x38(%rbp), %rax
movq %rax, -0x88(%rbp)
jmp 0x5f6b
movq -0x38(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x4(%rax)
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)