// File: marxn[P]pupp/3rdparty/gmp/./mini-gmp/mini-gmp.c
// Function: mpn_invert_3by2
mp_limb_t
mpn_invert_3by2 (mp_limb_t u1, mp_limb_t u0)
{
  mp_limb_t r, p, m;
  unsigned ul, uh;
  unsigned ql, qh;

  /* First, do a 2/1 inverse. */
  /* The inverse m is defined as floor( (B^2 - 1 - u1)/u1 ), so that 0 <
   * B^2 - (B + m) u1 <= u1 */
  assert (u1 >= GMP_LIMB_HIGHBIT);

  ul = u1 & GMP_LLIMB_MASK;
  uh = u1 >> (GMP_LIMB_BITS / 2);

  qh = ~u1 / uh;
  r = ((~u1 - (mp_limb_t) qh * uh) << (GMP_LIMB_BITS / 2)) | GMP_LLIMB_MASK;

  p = (mp_limb_t) qh * ul;
  /* Adjustment steps taken from udiv_qrnnd_c */
  if (r < p)
    {
      qh--;
      r += u1;
      if (r >= u1) /* i.e. we didn't get carry when adding to r */
	if (r < p)
	  {
	    qh--;
	    r += u1;
	  }
    }
  r -= p;

  /* Do a 3/2 division (with half limb size) */
  p = (r >> (GMP_LIMB_BITS / 2)) * qh + r;
  ql = (p >> (GMP_LIMB_BITS / 2)) + 1;

  /* By the 3/2 method, we don't need the high half limb. */
  r = (r << (GMP_LIMB_BITS / 2)) + GMP_LLIMB_MASK - ql * u1;

  if (r >= (p << (GMP_LIMB_BITS / 2)))
    {
      ql--;
      r += u1;
    }
  m = ((mp_limb_t) qh << (GMP_LIMB_BITS / 2)) + ql;
  if (r >= u1)
    {
      m++;
      r -= u1;
    }

  if (u0 > 0)
    {
      mp_limb_t th, tl;
      r = ~r;
      r += u0;
      if (r < u0)
	{
	  m--;
	  if (r >= u1)
	    {
	      m--;
	      r -= u1;
	    }
	  r -= u1;
	}
      gmp_umul_ppmm (th, tl, u0, m);
      r += th;
      if (r < th)
	{
	  m--;
	  m -= ((r > u1) | ((r == u1) & (tl > u0)));
	}
    }

  return m;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
cmpq %rax, -0x8(%rbp)
jb 0x2605
jmp 0x2624
leaq 0xbda0(%rip), %rdi      # 0xe3ac
leaq 0xbac1(%rip), %rsi      # 0xe0d4
movl $0x2cc, %edx            # imm = 0x2CC
leaq 0xbda4(%rip), %rcx      # 0xe3c3
callq 0x1070
movabsq $0xffffffff, %rax       # imm = 0xFFFFFFFF
andq -0x8(%rbp), %rax
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rax
shrq $0x20, %rax
movl %eax, -0x30(%rbp)
movq -0x8(%rbp), %rax
xorq $-0x1, %rax
movl -0x30(%rbp), %ecx
xorl %edx, %edx
divq %rcx
movl %eax, -0x38(%rbp)
movq -0x8(%rbp), %rax
xorq $-0x1, %rax
movl -0x38(%rbp), %ecx
movl -0x30(%rbp), %edx
imulq %rdx, %rcx
subq %rcx, %rax
shlq $0x20, %rax
movabsq $0xffffffff, %rcx       # imm = 0xFFFFFFFF
orq %rcx, %rax
movq %rax, -0x18(%rbp)
movl -0x38(%rbp), %eax
movl -0x2c(%rbp), %ecx
imulq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x26d7
movl -0x38(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x38(%rbp)
movq -0x8(%rbp), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x8(%rbp), %rax
jb 0x26d5
movq -0x18(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x26d3
movl -0x38(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x38(%rbp)
movq -0x8(%rbp), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x26d5
jmp 0x26d7
movq -0x20(%rbp), %rcx
movq -0x18(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
shrq $0x20, %rax
movl -0x38(%rbp), %ecx
imulq %rcx, %rax
addq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
shrq $0x20, %rax
addq $0x1, %rax
movl %eax, -0x34(%rbp)
movq -0x18(%rbp), %rax
shlq $0x20, %rax
movabsq $0xffffffff, %rcx       # imm = 0xFFFFFFFF
addq %rcx, %rax
movl -0x34(%rbp), %ecx
imulq -0x8(%rbp), %rcx
subq %rcx, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x20(%rbp), %rcx
shlq $0x20, %rcx
cmpq %rcx, %rax
jb 0x2756
movl -0x34(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x34(%rbp)
movq -0x8(%rbp), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
movl -0x38(%rbp), %eax
shlq $0x20, %rax
movl -0x34(%rbp), %ecx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x8(%rbp), %rax
jb 0x278c
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rcx
movq -0x18(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
jbe 0x2954
movq -0x18(%rbp), %rax
xorq $-0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x10(%rbp), %rax
jae 0x27f9
movq -0x28(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x8(%rbp), %rax
jb 0x27ea
movq -0x28(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rcx
movq -0x18(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rcx
movq -0x18(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x18(%rbp)
jmp 0x27fb
movq -0x10(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x88(%rbp)
movabsq $0xffffffff, %rax       # imm = 0xFFFFFFFF
andq -0x80(%rbp), %rax
movl %eax, -0x6c(%rbp)
movq -0x80(%rbp), %rax
shrq $0x20, %rax
movl %eax, -0x74(%rbp)
movabsq $0xffffffff, %rax       # imm = 0xFFFFFFFF
andq -0x88(%rbp), %rax
movl %eax, -0x70(%rbp)
movq -0x88(%rbp), %rax
shrq $0x20, %rax
movl %eax, -0x78(%rbp)
movl -0x6c(%rbp), %eax
movl -0x70(%rbp), %ecx
imulq %rcx, %rax
movq %rax, -0x50(%rbp)
movl -0x6c(%rbp), %eax
movl -0x78(%rbp), %ecx
imulq %rcx, %rax
movq %rax, -0x58(%rbp)
movl -0x74(%rbp), %eax
movl -0x70(%rbp), %ecx
imulq %rcx, %rax
movq %rax, -0x60(%rbp)
movl -0x74(%rbp), %eax
movl -0x78(%rbp), %ecx
imulq %rcx, %rax
movq %rax, -0x68(%rbp)
movq -0x50(%rbp), %rax
shrq $0x20, %rax
addq -0x58(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x60(%rbp), %rax
addq -0x58(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x60(%rbp), %rax
jae 0x28bc
movabsq $0x100000000, %rax      # imm = 0x100000000
addq -0x68(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movq -0x58(%rbp), %rcx
shrq $0x20, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x58(%rbp), %rax
shlq $0x20, %rax
movabsq $0xffffffff, %rcx       # imm = 0xFFFFFFFF
andq -0x50(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x40(%rbp), %rax
jae 0x2952
movq -0x28(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x8(%rbp), %rax
seta %al
andb $0x1, %al
movzbl %al, %eax
movq -0x18(%rbp), %rcx
cmpq -0x8(%rbp), %rcx
sete %cl
andb $0x1, %cl
movzbl %cl, %ecx
movq -0x48(%rbp), %rdx
cmpq -0x10(%rbp), %rdx
seta %dl
andb $0x1, %dl
movzbl %dl, %edx
andl %edx, %ecx
orl %ecx, %eax
movslq %eax, %rcx
movq -0x28(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x28(%rbp)
jmp 0x2954
movq -0x28(%rbp), %rax
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)