// File: /workspace/github_cpp_makefile_star2_O2/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 0x4274
movq %rsi, %r12
cmpl $0x0, 0x4(%r14)
je 0x427c
pushq $0x1
popq %rax
leaq -0x50(%rbp), %r15
movq %rax, (%r15)
pushq $0x8
popq %rdi
callq *0xaf1f(%rip)           # 0xf098
movq %rax, 0x8(%r15)
leaq -0x40(%rbp), %r13
pushq $0x1
popq %rax
movq %rax, (%r13)
pushq $0x8
popq %rdi
callq *0xaf07(%rip)           # 0xf098
movq %rax, 0x8(%r13)
movq %r15, %rdi
movq %r12, %rsi
callq 0x2a2a
movq %r15, %rdi
callq 0x434e
movq %rax, %r12
movq %r13, %rdi
movq %r14, %rsi
callq 0x2a2a
movq %r13, %rdi
callq 0x434e
movq %rax, %r14
cmpq %rax, %r12
cmovbq %r12, %r14
movl 0x4(%r15), %eax
movl 0x4(%r13), %ecx
cmpl %ecx, %eax
jge 0x41f6
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), %rdx
movq %r15, %rdi
movq %r15, %rsi
callq 0x370e
cmpl $0x0, 0x4(%r15)
je 0x4295
leaq -0x40(%rbp), %r12
movq %r15, %rdi
callq 0x434e
movq %r15, %rdi
movq %r12, %rsi
callq 0x2963
testl %eax, %eax
je 0x42bd
movl -0x3c(%rbp), %eax
jns 0x425b
movl -0x50(%rbp), %ecx
movl -0x4c(%rbp), %edx
movl %eax, -0x4c(%rbp)
movl %edx, -0x3c(%rbp)
movl -0x40(%rbp), %eax
movl %eax, -0x50(%rbp)
movl %ecx, -0x40(%rbp)
movq -0x48(%rbp), %rax
movq -0x38(%rbp), %rcx
movq %rcx, -0x48(%rbp)
movq %rax, -0x38(%rbp)
movl %edx, %eax
cmpl $0x1, %eax
je 0x42e5
movq %r15, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x2e4a
jmp 0x4214
movq %rbx, %rdi
movq %r14, %rsi
jmp 0x4282
movq %rbx, %rdi
movq %r12, %rsi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2a2a
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 0x4319
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 0x4319
movq -0x38(%rbp), %rax
movq (%rax), %r15
leaq -0x50(%rbp), %rdi
movq %r15, %rsi
callq 0x3e93
movq %rax, %rdi
movq %r15, %rsi
callq 0x3f94
testq %rax, %rax
je 0x4314
movq 0x8(%rbx), %rcx
movq %rax, (%rcx)
pushq $0x1
popq %rax
jmp 0x4316
xorl %eax, %eax
movl %eax, 0x4(%rbx)
movq -0x48(%rbp), %rdi
xorl %esi, %esi
callq *0xad83(%rip)           # 0xf0a8
movq -0x38(%rbp), %rdi
xorl %esi, %esi
callq *0xad77(%rip)           # 0xf0a8
movq %rbx, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x304c
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq