// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %rbx
pushq %rax
testq %rdi, %rdi
jns 0x1c76
movq %rdi, %rcx
shrq $0x20, %rcx
movq %rdi, %rax
notq %rax
xorl %edx, %edx
divq %rcx
movq %rax, %rcx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
shlq $0x20, %rdx
orq %r8, %rdx
movl %edi, %eax
imulq %rcx, %rax
cmpq %rax, %rdx
jae 0x1b6d
addq %rdi, %rdx
cmpq %rdi, %rdx
setb %r9b
cmpq %rax, %rdx
setae %r10b
orb %r9b, %r10b
jne 0x1b6a
addq %r8, %rcx
decq %rcx
addq %rdi, %rdx
jmp 0x1b6d
addq %r8, %rcx
subq %rax, %rdx
movq %rdx, %rax
shrq $0x20, %rax
movl %ecx, %r10d
imulq %rax, %r10
addq %rdx, %r10
movq %r10, %rax
shrq $0x20, %rax
leal 0x1(%rax), %r11d
shlq $0x20, %rdx
orq %r8, %rdx
movq %r11, %r9
imulq %rdi, %r9
subq %r9, %rdx
shlq $0x20, %r10
xorl %r9d, %r9d
cmpq %r10, %rdx
cmovbl %r11d, %eax
cmovaeq %rdi, %r9
addq %rdx, %r9
shlq $0x20, %rcx
orq %rcx, %rax
cmpq %rdi, %r9
sbbq $-0x1, %rax
testq %rsi, %rsi
je 0x1c6f
xorl %ecx, %ecx
cmpq %rdi, %r9
cmovaeq %rdi, %rcx
notq %r9
addq %rsi, %r9
addq %rcx, %r9
cmpq %rsi, %r9
jae 0x1bfb
xorl %ecx, %ecx
xorl %edx, %edx
cmpq %rdi, %r9
setb %dl
cmovaeq %rdi, %rcx
orq $-0x2, %rdx
addq %rdx, %rax
addq %rdi, %rcx
subq %rcx, %r9
movq %rsi, %r10
shrq $0x20, %r10
movq %rax, %r11
shrq $0x20, %r11
movl %esi, %ecx
movl %eax, %ebx
movq %rbx, %rdx
imulq %rcx, %rdx
imulq %r11, %rcx
imulq %r10, %rbx
imulq %r10, %r11
movq %rdx, %r10
shrq $0x20, %r10
addq %rbx, %rcx
addq %r10, %rcx
cmpq %rbx, %rcx
leaq 0x1(%r8,%r11), %r10
cmovaeq %r11, %r10
movq %rcx, %r8
shrq $0x20, %r8
addq %r10, %r8
addq %r9, %r8
jae 0x1c6f
shlq $0x20, %rcx
movl %edx, %edx
orq %rcx, %rdx
cmpq %rdi, %r8
seta %cl
sete %dil
cmpq %rsi, %rdx
seta %dl
andb %dil, %dl
orb %cl, %dl
movzbl %dl, %ecx
notq %rcx
addq %rcx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x76bf(%rip), %rdi      # 0x933c
leaq 0x73e0(%rip), %rsi      # 0x9064
leaq 0x76c8(%rip), %rcx      # 0x9353
movl $0x2cc, %edx            # imm = 0x2CC
callq 0x1090