// File: /workspace/github_c_makefile_star2_O1/983[P]bigint/bigint.c
// Function: bigint_raw_mul_karatsuba
int bigint_raw_mul_karatsuba(
    bigint_word *dst,
    const bigint_word *a, int na,
    const bigint_word *b, int nb,
    bigint_word *tmp
){
    /* so many */
    int n, k, m, m2;
    const bigint_word *lo1, *hi1, *lo2, *hi2;
    int nlo1, nhi1, nlo2, nhi2;
    bigint_word *lo1hi1, *lo2hi2, *z0, *z1, *z2;
    int nlo1hi1, nlo2hi2, nz0, nz1, nz2;

    if (
        na < BIGINT_KARATSUBA_WORD_THRESHOLD &&
        nb < BIGINT_KARATSUBA_WORD_THRESHOLD
    ){
        bigint_raw_zero(dst, 0, na + nb);
        return bigint_raw_mul_add(dst, a, na, b, nb);
    }

    m = BIGINT_MAX(na, nb);
    m2 = m / 2;
    k = m2 + 2;

    lo1 = a;
    lo2 = b;
    hi1 = a + m2;
    hi2 = b + m2;

    nlo1 = bigint_raw_truncate(lo1, BIGINT_MIN(m2, na));
    nlo2 = bigint_raw_truncate(lo2, BIGINT_MIN(m2, nb));
    nhi1 = bigint_raw_truncate(hi1, BIGINT_MAX(na - m2, 0));
    nhi2 = bigint_raw_truncate(hi2, BIGINT_MAX(nb - m2, 0));

    lo1hi1 = tmp; tmp += k;
    lo2hi2 = tmp; tmp += k;
    z0 = tmp; tmp += k*2;
    z1 = tmp; tmp += k*2;
    z2 = tmp; tmp += k*2;

    nlo1hi1 = bigint_raw_add(lo1hi1, lo1, nlo1, hi1, nhi1);
    nlo2hi2 = bigint_raw_add(lo2hi2, lo2, nlo2, hi2, nhi2);

    nz0 = bigint_raw_mul_karatsuba(z0, lo1   , nlo1   , lo2   , nlo2   , tmp);
    nz1 = bigint_raw_mul_karatsuba(z1, lo1hi1, nlo1hi1, lo2hi2, nlo2hi2, tmp);
    nz2 = bigint_raw_mul_karatsuba(z2,    hi1, nhi1   ,    hi2,    nhi2, tmp);

    nz1 = bigint_raw_sub(z1, z1, nz1, z0, nz0);
    nz1 = bigint_raw_sub(z1, z1, nz1, z2, nz2);

    n = nz0;

    bigint_raw_cpy(dst, z0, n);
    bigint_raw_zero(dst, n, na + nb);

    n = bigint_raw_add(dst + m2*1, dst + m2*1, BIGINT_MAX(n - m2, 0), z1, nz1);
    n = bigint_raw_add(dst + m2*2, dst + m2*2, BIGINT_MAX(n - m2, 0), z2, nz2);

    return bigint_raw_truncate(dst, n + m2*2);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %r12
cmpl $0x14, %edx
setge %al
cmpl $0x14, %r8d
setge %dl
orb %al, %dl
jne 0x2389
movl %r8d, %eax
addl %ebp, %eax
jle 0x236e
movl %eax, %edx
shlq $0x2, %rdx
movq %r12, %rdi
xorl %esi, %esi
movl %r8d, %ebx
movq %rcx, %r14
callq 0x1070
movq %r14, %rcx
movl %ebx, %r8d
movq %r12, %rdi
movq %r15, %rsi
movl %ebp, %edx
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1f5f
cmpl %r8d, %ebp
movl %r8d, %eax
cmovgl %ebp, %eax
movl %eax, %edx
shrl $0x1f, %edx
addl %eax, %edx
sarl %edx
cmpl %ebp, %edx
movl %ebp, %r13d
cmovll %edx, %r13d
testl %r13d, %r13d
jle 0x23c4
movl %r13d, %eax
cmpl $0x0, -0x4(%r15,%rax,4)
jne 0x23c4
leal -0x1(%r13), %eax
cmpl $0x1, %r13d
movl %eax, %r13d
jg 0x23a9
xorl %r13d, %r13d
movslq %edx, %rsi
cmpl %r8d, %edx
movl %r8d, %r14d
cmovll %edx, %r14d
testl %r14d, %r14d
jle 0x23f0
movl %r14d, %eax
cmpl $0x0, -0x4(%rcx,%rax,4)
jne 0x23f0
leal -0x1(%r14), %eax
cmpl $0x1, %r14d
movl %eax, %r14d
jg 0x23d6
xorl %r14d, %r14d
movq %r15, %r10
leaq (%r15,%rsi,4), %rbx
movl %ebp, 0x20(%rsp)
subl %edx, %ebp
xorl %r15d, %r15d
testl %ebp, %ebp
cmovlel %r15d, %ebp
movq %r12, 0x60(%rsp)
jle 0x2422
movl %ebp, %eax
cmpl $0x0, -0x4(%rbx,%rax,4)
jne 0x2422
leal -0x1(%rbp), %eax
cmpl $0x1, %ebp
movl %eax, %ebp
jg 0x240d
xorl %ebp, %ebp
leal 0x2(%rsi), %eax
leaq (%rcx,%rsi,4), %r12
movl %r8d, %edi
subl %edx, %edi
testl %edi, %edi
cmovgl %edi, %r15d
movl %r8d, 0x24(%rsp)
movq %rdx, 0x58(%rsp)
movq %rsi, 0x50(%rsp)
movq %rcx, (%rsp)
jle 0x2464
movl %r15d, %edi
cmpl $0x0, -0x4(%r12,%rdi,4)
jne 0x2464
leal -0x1(%r15), %edi
cmpl $0x1, %r15d
movl %edi, %r15d
jg 0x2449
xorl %r15d, %r15d
cltq
leaq (%r9,%rax,4), %rcx
movq %rcx, 0x28(%rsp)
leaq (%rcx,%rax,4), %rcx
movq %rcx, 0x30(%rsp)
addl %eax, %eax
cltq
leaq (%rcx,%rax,4), %rcx
movq %rcx, 0x8(%rsp)
leaq (%rcx,%rax,4), %rcx
movq %rcx, 0x10(%rsp)
leaq (%rcx,%rax,4), %rax
movq %rax, 0x40(%rsp)
movq %r9, %rdi
movq %r10, %rsi
movq %r10, 0x38(%rsp)
movl %r13d, %edx
movq %rbx, %rcx
movl %ebp, %r8d
movq %r9, 0x48(%rsp)
callq 0x2150
movl %eax, 0x1c(%rsp)
movq 0x28(%rsp), %rdi
movq (%rsp), %rsi
movl %r14d, %edx
movq %r12, %rcx
movl %r15d, %r8d
callq 0x2150
movl %eax, 0x18(%rsp)
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rsi
movl %r13d, %edx
movq (%rsp), %rcx
movl %r14d, %r8d
movq 0x40(%rsp), %r13
movq %r13, %r9
callq 0x2324
movl %eax, %r14d
movq 0x8(%rsp), %rdi
movq 0x48(%rsp), %rsi
movl 0x1c(%rsp), %edx
movq 0x28(%rsp), %rcx
movl 0x18(%rsp), %r8d
movq %r13, %r9
callq 0x2324
movl %eax, (%rsp)
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
movl %ebp, %edx
movq %r12, %rcx
movl %r15d, %r8d
movq %r13, %r9
callq 0x2324
movl %eax, %ebx
movq 0x8(%rsp), %r15
movq %r15, %rdi
movq %r15, %rsi
movl (%rsp), %edx
movq 0x30(%rsp), %r13
movq %r13, %rcx
movl %r14d, %r8d
callq 0x2210
movq %r15, %rdi
movq %r15, %rsi
movl %eax, %edx
movq 0x10(%rsp), %rcx
movl %ebx, %r8d
callq 0x2210
movl %eax, %ebp
movslq %r14d, %r15
leaq (,%r15,4), %rdx
movq 0x60(%rsp), %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x10a0
movl 0x24(%rsp), %eax
addl 0x20(%rsp), %eax
cmpl %eax, %r15d
jge 0x25a7
leaq (%r12,%r15,4), %rdi
subl %r14d, %eax
movslq %eax, %rdx
shlq $0x2, %rdx
xorl %esi, %esi
callq 0x1070
movq 0x50(%rsp), %rax
leaq (%r12,%rax,4), %rdi
movq 0x58(%rsp), %r13
subl %r13d, %r14d
xorl %r15d, %r15d
testl %r14d, %r14d
cmovlel %r15d, %r14d
movq %rdi, %rsi
movl %r14d, %edx
movq 0x8(%rsp), %rcx
movl %ebp, %r8d
callq 0x2150
leal (,%r13,2), %ecx
movslq %ecx, %r14
leaq (%r12,%r14,4), %rdi
subl %r13d, %eax
testl %eax, %eax
cmovgl %eax, %r15d
movq %rdi, %rsi
movl %r15d, %edx
movq 0x10(%rsp), %rcx
movl %ebx, %r8d
callq 0x2150
addl %eax, %r14d
jle 0x2620
movl %r14d, %eax
cmpl $0x0, -0x4(%r12,%rax,4)
jne 0x2620
leal -0x1(%r14), %eax
cmpl $0x1, %r14d
movl %eax, %r14d
jg 0x2605
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq