// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/gfa_ut.cpp
// Function: renew_paf0(ma_hit_t_alloc*, unsigned long*, unsigned long, unsigned long*, unsigned long, asg64_v*)
void renew_paf0(ma_hit_t_alloc *paf, uint64_t *a0, uint64_t a0n, uint64_t *a1, uint64_t a1n, asg64_v *buf)
{
    if(a0n <= 1 && a1n <= 1) return;
    uint64_t qn = ((uint32_t)a0[0]), tn = ((uint32_t)a1[0]), i, k, sf = 0;
    ma_hit_t e01, e10; uint64_t qi, ti, *qa, *ta, qlen, tlen; buf->n = 0; ma_hit_t_alloc *qo, *to;
    if(qn == tn) sf = 1;
    qo = &(paf[qn]); qi = qo->length;
    for (i = qlen = 0, qa = NULL; i < qi; i++) {
        if(qo->buffer[i].tn == tn) kv_push(uint64_t, *buf, i);
    }
    qlen = buf->n; 

    to = &(paf[tn]); ti = to->length;
    for (i = tlen = 0, ta = NULL; i < ti; i++) {
        if(to->buffer[i].tn == qn) kv_push(uint64_t, *buf, i);
    }
    tlen = buf->n - qlen;
    assert(qlen && tlen);
    qa = buf->a; ta = buf->a + qlen;

    for (qi = 0; qi < qlen; qi++) {
        e01 = qo->buffer[qa[qi]];
        for (ti = 0; ti < tlen; ti++) {
            e10 = to->buffer[ta[ti]];

            for (i = 0; i < a0n; i++) {
                qn = ((uint32_t)a0[i]);
                for (k = 0; k < a1n; k++) {
                    if(i == 0 && k == 0) continue;
                    tn = ((uint32_t)a1[k]);

                    update_qtn(&e01, qn, tn); 
                    if((!sf) || (dup_paf_check(&(paf[qn]), &e01))) {
                        add_ma_hit_t_alloc(&(paf[qn]), &e01);
                    }

                    update_qtn(&e10, tn, qn); 
                    if((!sf) || (dup_paf_check(&(paf[tn]), &e10))) {
                        add_ma_hit_t_alloc(&(paf[tn]), &e10);
                    }
                }
            }
        }
    }
    
    /**
    idx = get_specific_overlap(&(paf[qn]), qn, tn);
    if(idx < 0) return;
    e01 = paf[qn].buffer[idx];
    idx = get_specific_overlap(&(paf[tn]), tn, qn);
    e10 = paf[tn].buffer[idx];

    for (i = 0; i < a0n; i++) {
        qn = ((uint32_t)a0[i]);
        for (k = 0; k < a1n; k++) {
            if(i == 0 && k == 0) continue;
            tn = ((uint32_t)a1[k]);
            if((qn == 5619628 && tn == 5619629) || (tn == 5619628 && qn == 5619629)) {
                fprintf(stderr, "[M::%s]\tqn::%lu(qg::%u)\ttn::%lu(tg::%u)\n", __func__, 
                qn, ((uint32_t)a0[0]), tn, ((uint32_t)a1[0]));
            }
            update_qtn(&e01, qn, tn); add_ma_hit_t_alloc(&(paf[qn]), &e01);
            update_qtn(&e10, tn, qn); add_ma_hit_t_alloc(&(paf[tn]), &e10);
        }
    }
    **/
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %r8, 0x48(%rsp)
movq %r8, %rax
movq %rdx, 0x40(%rsp)
orq %rdx, %rax
cmpq $0x2, %rax
jb 0x21f076
movq %r9, %r15
movq %rdi, %rbp
movq %rsi, 0xd0(%rsp)
movl (%rsi), %eax
movq %rcx, 0xd8(%rsp)
movl (%rcx), %ecx
movq %rcx, 0x18(%rsp)
movq $0x0, (%r9)
movq %rax, 0x20(%rsp)
leaq (%rax,%rax,2), %rax
leaq (%rdi,%rax,8), %rax
movq %rax, 0x30(%rsp)
movl 0xc(%rax), %ebx
testq %rbx, %rbx
je 0x21ecdf
movl $0xc, %r14d
xorl %r12d, %r12d
movl $0x2, %r13d
movq 0x30(%rsp), %rax
movq (%rax), %rax
movq 0x18(%rsp), %rcx
cmpl %ecx, (%rax,%r14)
jne 0x21ecd3
movq 0x8(%r15), %rax
cmpq %rax, (%r15)
jne 0x21ecc1
leaq (%rax,%rax), %rsi
testq %rax, %rax
cmoveq %r13, %rsi
movq %rsi, 0x8(%r15)
movq 0x10(%r15), %rdi
shlq $0x3, %rsi
callq 0x2370
movq %rax, 0x10(%r15)
movq (%r15), %rax
movq 0x10(%r15), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%r15)
movq %r12, (%rcx,%rax,8)
incq %r12
addq $0x28, %r14
cmpq %r12, %rbx
jne 0x21ec85
movq (%r15), %rax
movq %rax, 0x28(%rsp)
movq 0x18(%rsp), %rax
leaq (%rax,%rax,2), %rax
leaq (,%rax,8), %rax
addq %rbp, %rax
movq %rax, 0x38(%rsp)
movl 0xc(%rax), %ebx
testq %rbx, %rbx
je 0x21ed71
movl $0xc, %r14d
xorl %r12d, %r12d
movl $0x2, %r13d
movq 0x38(%rsp), %rax
movq (%rax), %rax
movq 0x20(%rsp), %rcx
cmpl %ecx, (%rax,%r14)
jne 0x21ed65
movq 0x8(%r15), %rax
cmpq %rax, (%r15)
jne 0x21ed53
leaq (%rax,%rax), %rsi
testq %rax, %rax
cmoveq %r13, %rsi
movq %rsi, 0x8(%r15)
movq 0x10(%r15), %rdi
shlq $0x3, %rsi
callq 0x2370
movq %rax, 0x10(%r15)
movq (%r15), %rax
movq 0x10(%r15), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%r15)
movq %r12, (%rcx,%rax,8)
incq %r12
addq $0x28, %r14
cmpq %r12, %rbx
jne 0x21ed17
movq %rbp, 0x10(%rsp)
movq 0x28(%rsp), %rax
testq %rax, %rax
je 0x21f088
movq (%r15), %rsi
cmpq %rax, %rsi
je 0x21f088
subq %rax, %rsi
movq 0x10(%r15), %rcx
movq %rcx, 0xa8(%rsp)
leaq (%rcx,%rax,8), %rax
movq %rax, 0xb8(%rsp)
xorl %edx, %edx
movq %rsi, 0xc0(%rsp)
movq 0x30(%rsp), %rax
movq (%rax), %rax
movq 0xa8(%rsp), %rcx
movq %rdx, 0xb0(%rsp)
movq (%rcx,%rdx,8), %rcx
leaq (%rcx,%rcx,4), %rcx
movq 0x20(%rax,%rcx,8), %rdx
movq %rdx, 0xa0(%rsp)
movups (%rax,%rcx,8), %xmm0
movups 0x10(%rax,%rcx,8), %xmm1
movaps %xmm1, 0x90(%rsp)
movaps %xmm0, 0x80(%rsp)
xorl %edx, %edx
movq 0x38(%rsp), %rax
movq (%rax), %rax
movq 0xb8(%rsp), %rcx
movq %rdx, 0xc8(%rsp)
movq (%rcx,%rdx,8), %rcx
leaq (%rcx,%rcx,4), %rcx
movq 0x20(%rax,%rcx,8), %rdx
movq %rdx, 0x70(%rsp)
movups (%rax,%rcx,8), %xmm0
movups 0x10(%rax,%rcx,8), %xmm1
movaps %xmm1, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
cmpq $0x0, 0x40(%rsp)
je 0x21f044
xorl %r14d, %r14d
cmpq $0x0, 0x48(%rsp)
je 0x21f036
movq 0xd0(%rsp), %rax
movq (%rax,%r14,8), %rbx
movl %ebx, %eax
movq %rbx, %rcx
shlq $0x20, %rcx
movq %rcx, 0xe0(%rsp)
leaq (%rax,%rax,2), %rax
movq 0x10(%rsp), %rcx
leaq (%rcx,%rax,8), %r15
xorl %ebp, %ebp
movq %rbp, %rax
orq %r14, %rax
je 0x21f028
movl 0x80(%rsp), %eax
orq 0xe0(%rsp), %rax
movq 0xd8(%rsp), %rcx
movq (%rcx,%rbp,8), %r12
movq %rax, 0x80(%rsp)
movl %r12d, 0x8c(%rsp)
movq 0x18(%rsp), %rcx
cmpl %ecx, 0x20(%rsp)
jne 0x21ef59
movl 0xc(%r15), %r10d
testq %r10, %r10
je 0x21ef59
movq (%r15), %rcx
movl 0x88(%rsp), %edx
movl 0x90(%rsp), %esi
movl 0x94(%rsp), %edi
movq 0x98(%rsp), %r8
movb 0xa0(%rsp), %r9b
movb 0xa1(%rsp), %r11b
movb %r11b, 0xf(%rsp)
shlq $0x3, %r10
leaq (%r10,%r10,4), %r11
xorl %r10d, %r10d
cmpq %rax, (%rcx,%r10)
jne 0x21ef50
cmpl %r12d, 0xc(%rcx,%r10)
jne 0x21ef50
cmpl %edx, 0x8(%rcx,%r10)
jne 0x21ef50
cmpl %esi, 0x10(%rcx,%r10)
jne 0x21ef50
cmpl %edi, 0x14(%rcx,%r10)
jne 0x21ef50
cmpq %r8, 0x18(%rcx,%r10)
jne 0x21ef50
cmpb %r9b, 0x20(%rcx,%r10)
jne 0x21ef50
movb 0xf(%rsp), %r13b
cmpb %r13b, 0x21(%rcx,%r10)
je 0x21ef69
addq $0x28, %r10
cmpq %r10, %r11
jne 0x21ef14
movq %r15, %rdi
leaq 0x80(%rsp), %rsi
callq 0x9fdd9
movl %r12d, %eax
movl 0x50(%rsp), %edx
leaq (%rax,%rax,2), %rcx
shlq $0x20, %rax
orq %rdx, %rax
movq %rax, 0x50(%rsp)
movl %ebx, 0x5c(%rsp)
movq 0x18(%rsp), %rdx
cmpl %edx, 0x20(%rsp)
jne 0x21f015
movq 0x10(%rsp), %rdx
movl 0xc(%rdx,%rcx,8), %r11d
testq %r11, %r11
je 0x21f015
movq 0x10(%rsp), %rdx
leaq (%rdx,%rcx,8), %rdx
movq (%rdx), %rdx
movl 0x58(%rsp), %esi
movl 0x60(%rsp), %edi
movl 0x64(%rsp), %r8d
movq 0x68(%rsp), %r9
movb 0x70(%rsp), %r10b
movb 0x71(%rsp), %r13b
shlq $0x3, %r11
leaq (%r11,%r11,4), %r12
xorl %r11d, %r11d
cmpq %rax, (%rdx,%r11)
jne 0x21f00c
cmpl %ebx, 0xc(%rdx,%r11)
jne 0x21f00c
cmpl %esi, 0x8(%rdx,%r11)
jne 0x21f00c
cmpl %edi, 0x10(%rdx,%r11)
jne 0x21f00c
cmpl %r8d, 0x14(%rdx,%r11)
jne 0x21f00c
cmpq %r9, 0x18(%rdx,%r11)
jne 0x21f00c
cmpb %r10b, 0x20(%rdx,%r11)
jne 0x21f00c
cmpb %r13b, 0x21(%rdx,%r11)
je 0x21f028
addq $0x28, %r11
cmpq %r11, %r12
jne 0x21efd5
movq 0x10(%rsp), %rax
leaq (%rax,%rcx,8), %rdi
leaq 0x50(%rsp), %rsi
callq 0x9fdd9
incq %rbp
cmpq 0x48(%rsp), %rbp
jne 0x21ee81
incq %r14
cmpq 0x40(%rsp), %r14
jne 0x21ee49
movq 0xc8(%rsp), %rdx
incq %rdx
movq 0xc0(%rsp), %rsi
cmpq %rsi, %rdx
jne 0x21edfd
movq 0xb0(%rsp), %rdx
incq %rdx
cmpq 0x28(%rsp), %rdx
jne 0x21edb5
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1eec2(%rip), %rdi     # 0x23df51
leaq 0x1a28f(%rip), %rsi     # 0x239325
leaq 0x1eec1(%rip), %rcx     # 0x23df5e
movl $0x42c8, %edx           # imm = 0x42C8
callq 0x2110