// File: /workspace/github_cpp_makefile_star2_O1/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 0x4b50
movq %rsi, %r13
cmpl $0x0, 0x4(%r14)
je 0x4b58
movl $0x1, %eax
leaq -0x50(%rbp), %r15
movq %rax, (%r15)
movl $0x8, %edi
callq *0xb669(%rip)           # 0x100a0
movq %rax, 0x8(%r15)
leaq -0x40(%rbp), %r12
movl $0x1, %eax
movq %rax, (%r12)
movl $0x8, %edi
callq *0xb64d(%rip)           # 0x100a0
movq %rax, 0x8(%r12)
movq %r15, %rdi
movq %r13, %rsi
callq 0x24be
movl 0x4(%r15), %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
movl %ecx, 0x4(%r15)
movq %r15, %rdi
callq 0x4c3e
movq %rax, %r13
movq %r12, %rdi
movq %r14, %rsi
callq 0x24be
movl 0x4(%r12), %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
movl %ecx, 0x4(%r12)
movq %r12, %rdi
callq 0x4c3e
movq %rax, %r14
cmpq %rax, %r13
cmovbq %r13, %r14
movl 0x4(%r15), %eax
movl 0x4(%r12), %ecx
cmpl %ecx, %eax
jge 0x4ada
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 0x3989
cmpl $0x0, 0x4(%r15)
je 0x4b9d
movq %r15, %rdi
callq 0x4c3e
leaq -0x40(%rbp), %rsi
movq %r15, %rdi
callq 0x2d3a
testl %eax, %eax
je 0x4b75
testl %eax, %eax
jns 0x4b28
movaps -0x50(%rbp), %xmm0
movaps -0x40(%rbp), %xmm1
movaps %xmm1, -0x50(%rbp)
movaps %xmm0, -0x40(%rbp)
cmpl $0x1, -0x3c(%rbp)
je 0x4bc5
movq %r15, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x3412
movq %r15, %rdi
callq 0x4c3e
movq %r15, %rdi
movq %r12, %rsi
jmp 0x4b0b
movq %rbx, %rdi
movq %r14, %rsi
jmp 0x4b5e
movq %rbx, %rdi
movq %r13, %rsi
callq 0x24be
movl 0x4(%rbx), %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
movl %ecx, 0x4(%rbx)
jmp 0x4c2f
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 0x4c09
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 0x4c09
movq -0x38(%rbp), %rax
movq (%rax), %r15
leaq -0x50(%rbp), %rdx
xorl %edi, %edi
xorl %esi, %esi
movq %r15, %rcx
movl $0x2, %r8d
callq 0x4419
movq %rax, %rdi
movq %r15, %rsi
callq 0x480a
testq %rax, %rax
je 0x4c02
movl $0x1, 0x4(%rbx)
movq 0x8(%rbx), %rcx
movq %rax, (%rcx)
jmp 0x4c09
movl $0x0, 0x4(%rbx)
movq -0x48(%rbp), %rdi
xorl %esi, %esi
callq *0xb49b(%rip)           # 0x100b0
movq -0x38(%rbp), %rdi
xorl %esi, %esi
callq *0xb48f(%rip)           # 0x100b0
movq %rbx, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x366f
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq