// File: /workspace/github_cpp_makefile_star2_O3/marxn[P]pupp/3rdparty/gmp/./mini-gmp/mini-gmp.c
// Function: mpz_gcd
void
mpz_gcd (mpz_t g, const mpz_t u, const mpz_t v)
{
  mpz_t tu, tv;
  mp_bitcnt_t uz, vz, gz;

  if (u->_mp_size == 0)
    {
      mpz_abs (g, v);
      return;
    }
  if (v->_mp_size == 0)
    {
      mpz_abs (g, u);
      return;
    }

  mpz_init (tu);
  mpz_init (tv);

  mpz_abs (tu, u);
  uz = mpz_make_odd (tu);
  mpz_abs (tv, v);
  vz = mpz_make_odd (tv);
  gz = GMP_MIN (uz, vz);

  if (tu->_mp_size < tv->_mp_size)
    mpz_swap (tu, tv);

  mpz_tdiv_r (tu, tu, tv);
  if (tu->_mp_size == 0)
    {
      mpz_swap (g, tv);
    }
  else
    for (;;)
      {
	int c;

	mpz_make_odd (tu);
	c = mpz_cmp (tu, tv);
	if (c == 0)
	  {
	    mpz_swap (g, tu);
	    break;
	  }
	if (c < 0)
	  mpz_swap (tu, tv);

	if (tv->_mp_size == 1)
	  {
	    mp_limb_t vl = tv->_mp_d[0];
	    mp_limb_t ul = mpz_tdiv_ui (tu, vl);
	    mpz_set_ui (g, mpn_gcd_11 (ul, vl));
	    break;
	  }
	mpz_sub (tu, tu, tv);
      }
  mpz_clear (tu);
  mpz_clear (tv);
  mpz_mul_2exp (g, g, gz);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r14
movq %rdi, %rbx
cmpl $0x0, 0x4(%rsi)
je 0x4ad4
movq %rsi, %r13
cmpl $0x0, 0x4(%r14)
je 0x4adc
movl $0x1, %eax
leaq -0x50(%rbp), %r15
movq %rax, (%r15)
movl $0x8, %edi
callq *0xb6fe(%rip)           # 0x100a0
movq %rax, 0x8(%r15)
leaq -0x40(%rbp), %r12
movl $0x1, %eax
movq %rax, (%r12)
movl $0x8, %edi
callq *0xb6e2(%rip)           # 0x100a0
movq %rax, 0x8(%r12)
movq %r15, %rdi
movq %r13, %rsi
callq 0x24a2
movl 0x4(%r15), %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
movl %ecx, 0x4(%r15)
movq %r15, %rdi
callq 0x4bbf
movq %rax, %r13
movq %r12, %rdi
movq %r14, %rsi
callq 0x24a2
movl 0x4(%r12), %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
movl %ecx, 0x4(%r12)
movq %r12, %rdi
callq 0x4bbf
movq %rax, %r14
cmpq %rax, %r13
cmovbq %r13, %r14
movl 0x4(%r15), %eax
movl 0x4(%r12), %ecx
cmpl %ecx, %eax
jge 0x4a45
movl %ecx, -0x4c(%rbp)
movl %eax, -0x3c(%rbp)
movl -0x50(%rbp), %eax
movl -0x40(%rbp), %ecx
movl %ecx, -0x50(%rbp)
movl %eax, -0x40(%rbp)
movq -0x48(%rbp), %rax
movq -0x38(%rbp), %rcx
movq %rcx, -0x48(%rbp)
movq %rax, -0x38(%rbp)
leaq -0x40(%rbp), %rcx
xorl %edi, %edi
movq %r15, %rsi
movq %r15, %rdx
movl $0x2, %r8d
callq 0x3943
cmpl $0x0, 0x4(%r15)
je 0x4b21
movq %r15, %rdi
callq 0x4bbf
leaq -0x40(%rbp), %rsi
movq %r15, %rdi
callq 0x2cfb
testl %eax, %eax
je 0x4af9
movl -0x3c(%rbp), %ecx
testl %eax, %eax
jns 0x4aad
movl -0x50(%rbp), %eax
movl -0x4c(%rbp), %edx
movl %ecx, -0x4c(%rbp)
movl %edx, -0x3c(%rbp)
movl -0x40(%rbp), %ecx
movl %ecx, -0x50(%rbp)
movl %eax, -0x40(%rbp)
movq -0x48(%rbp), %rax
movq -0x38(%rbp), %rcx
movq %rcx, -0x48(%rbp)
movq %rax, -0x38(%rbp)
movl %edx, %ecx
cmpl $0x1, %ecx
je 0x4b49
movq %r15, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x33cf
movq %r15, %rdi
callq 0x4bbf
movq %r15, %rdi
movq %r12, %rsi
jmp 0x4a76
movq %rbx, %rdi
movq %r14, %rsi
jmp 0x4ae2
movq %rbx, %rdi
movq %r13, %rsi
callq 0x24a2
movl 0x4(%rbx), %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
movl %ecx, 0x4(%rbx)
jmp 0x4bb0
movl 0x4(%rbx), %eax
movl -0x4c(%rbp), %ecx
movl %ecx, 0x4(%rbx)
movl %eax, -0x4c(%rbp)
movl (%rbx), %eax
movl -0x50(%rbp), %ecx
movl %ecx, (%rbx)
movl %eax, -0x50(%rbp)
movq 0x8(%rbx), %rax
movq -0x48(%rbp), %rcx
movq %rcx, 0x8(%rbx)
movq %rax, -0x48(%rbp)
jmp 0x4b8a
movl 0x4(%rbx), %eax
movl -0x3c(%rbp), %ecx
movl %ecx, 0x4(%rbx)
movl %eax, -0x3c(%rbp)
movl (%rbx), %eax
movl -0x40(%rbp), %ecx
movl %ecx, (%rbx)
movl %eax, -0x40(%rbp)
movq 0x8(%rbx), %rax
movq -0x38(%rbp), %rcx
movq %rcx, 0x8(%rbx)
movq %rax, -0x38(%rbp)
jmp 0x4b8a
movq -0x38(%rbp), %rax
movq (%rax), %r15
xorl %r12d, %r12d
leaq -0x50(%rbp), %rdx
xorl %edi, %edi
xorl %esi, %esi
movq %r15, %rcx
movl $0x2, %r8d
callq 0x43a7
movq %rax, %rdi
movq %r15, %rsi
callq 0x4776
testq %rax, %rax
je 0x4b86
movq 0x8(%rbx), %rcx
movq %rax, (%rcx)
movl $0x1, %r12d
movl %r12d, 0x4(%rbx)
movq -0x48(%rbp), %rdi
xorl %esi, %esi
callq *0xb51a(%rip)           # 0x100b0
movq -0x38(%rbp), %rdi
xorl %esi, %esi
callq *0xb50e(%rip)           # 0x100b0
movq %rbx, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x362c
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq