// File: /workspace/github_c_makefile_star2_O0/983[P]bigint/bigint.c
// Function: bigint_gcd
bigint* bigint_gcd(bigint *dst, const bigint *src_a, const bigint *src_b){
    int shift, shift_a, shift_b;
    bigint a[1], b[1];

    if (src_a->size == 0) return bigint_set_neg(bigint_cpy(dst, src_b), 0);
    if (src_b->size == 0) return bigint_set_neg(bigint_cpy(dst, src_a), 0);

    if (src_a->size == 1 && src_b->size == 1){
        bigint_word word = bigint_word_gcd(src_a->words[0], src_b->words[0]);
        return bigint_from_word(dst, word);
    }

    bigint_init(a);
    bigint_init(b);

    shift_a = bigint_count_trailing_zeros(src_a);
    shift_b = bigint_count_trailing_zeros(src_b);
    shift = BIGINT_MIN(shift_a, shift_b);

    bigint_shift_right(a, src_a, shift_a);
    bigint_shift_right(b, src_b, shift);
    a->neg = 0;
    b->neg = 0;

    do {
        bigint_shift_right(b, b, bigint_count_trailing_zeros(b));

        if (bigint_cmp_abs(a, b) > 0) BIGINT_SWAP(bigint, *a, *b);

        bigint_sub(b, b, a);
    } while (b->size != 0);

    bigint_shift_left(dst, a, shift);

    bigint_free(a);
    bigint_free(b);
    return dst;
}

// Assembly:
subq $0xa8, %rsp
movq %rdi, 0x98(%rsp)
movq %rsi, 0x90(%rsp)
movq %rdx, 0x88(%rsp)
movq 0x90(%rsp), %rax
cmpl $0x0, 0xc(%rax)
jne 0x4be9
movq 0x98(%rsp), %rdi
movq 0x88(%rsp), %rsi
callq 0x2580
movq %rax, %rdi
xorl %esi, %esi
callq 0x24f0
movq %rax, 0xa0(%rsp)
jmp 0x4e25
movq 0x88(%rsp), %rax
cmpl $0x0, 0xc(%rax)
jne 0x4c23
movq 0x98(%rsp), %rdi
movq 0x90(%rsp), %rsi
callq 0x2580
movq %rax, %rdi
xorl %esi, %esi
callq 0x24f0
movq %rax, 0xa0(%rsp)
jmp 0x4e25
movq 0x90(%rsp), %rax
cmpl $0x1, 0xc(%rax)
jne 0x4c80
movq 0x88(%rsp), %rax
cmpl $0x1, 0xc(%rax)
jne 0x4c80
movq 0x90(%rsp), %rax
movq (%rax), %rax
movl (%rax), %edi
movq 0x88(%rsp), %rax
movq (%rax), %rax
movl (%rax), %esi
callq 0x1f80
movl %eax, 0x3c(%rsp)
movq 0x98(%rsp), %rdi
movl 0x3c(%rsp), %esi
callq 0x3a60
movq %rax, 0xa0(%rsp)
jmp 0x4e25
leaq 0x60(%rsp), %rdi
callq 0x20a0
leaq 0x40(%rsp), %rdi
callq 0x20a0
movq 0x90(%rsp), %rdi
callq 0x4660
movl %eax, 0x80(%rsp)
movq 0x88(%rsp), %rdi
callq 0x4660
movl %eax, 0x7c(%rsp)
movl 0x80(%rsp), %eax
cmpl 0x7c(%rsp), %eax
jge 0x4cd3
movl 0x80(%rsp), %eax
movl %eax, 0x1c(%rsp)
jmp 0x4cdb
movl 0x7c(%rsp), %eax
movl %eax, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
movl %eax, 0x84(%rsp)
leaq 0x60(%rsp), %rdi
movq 0x90(%rsp), %rsi
movl 0x80(%rsp), %edx
callq 0x4570
leaq 0x40(%rsp), %rdi
movq 0x88(%rsp), %rsi
movl 0x84(%rsp), %edx
callq 0x4570
movl $0x0, 0x68(%rsp)
movl $0x0, 0x48(%rsp)
leaq 0x40(%rsp), %rax
movq %rax, 0x8(%rsp)
leaq 0x40(%rsp), %rax
movq %rax, 0x10(%rsp)
leaq 0x40(%rsp), %rdi
callq 0x4660
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
movl %eax, %edx
callq 0x4570
leaq 0x60(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x22c0
cmpl $0x0, %eax
jle 0x4dc9
jmp 0x4d6d
movq 0x60(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x68(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x70(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x60(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x68(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x28(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x50(%rsp)
jmp 0x4dc9
leaq 0x40(%rsp), %rdi
leaq 0x40(%rsp), %rsi
leaq 0x60(%rsp), %rdx
callq 0x3de0
cmpl $0x0, 0x4c(%rsp)
jne 0x4d28
movq 0x98(%rsp), %rdi
leaq 0x60(%rsp), %rsi
movl 0x84(%rsp), %edx
callq 0x44d0
leaq 0x60(%rsp), %rdi
callq 0x21b0
leaq 0x40(%rsp), %rdi
callq 0x21b0
movq 0x98(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq 0xa0(%rsp), %rax
addq $0xa8, %rsp
retq
nopw %cs:(%rax,%rax)