// File: /workspace/github_cpp_makefile_star2_O3/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 0x22a888
movq %r9, %r15
movq %rcx, %rbp
movq %rsi, 0xd0(%rsp)
movl (%rsi), %eax
movl (%rcx), %ecx
movq %rcx, 0x20(%rsp)
movq $0x0, (%r9)
movq %rax, 0x28(%rsp)
leaq (%rax,%rax,2), %rax
leaq (%rdi,%rax,8), %rax
movq %rax, 0x30(%rsp)
movl 0xc(%rax), %ebx
testq %rbx, %rbx
movq %rdi, 0x10(%rsp)
je 0x22a4cb
movl $0xc, %r14d
xorl %r12d, %r12d
movl $0x2, %r13d
movq 0x30(%rsp), %rax
movq (%rax), %rax
movq 0x20(%rsp), %rcx
cmpl %ecx, (%rax,%r14)
jne 0x22a4b0
movq (%r15), %rcx
movq 0x10(%r15), %rax
cmpq 0x8(%r15), %rcx
jne 0x22a4a5
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
cmoveq %r13, %rsi
movq %rsi, 0x8(%r15)
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x10(%r15)
movq (%r15), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%r15)
movq %r12, (%rax,%rcx,8)
incq %r12
addq $0x28, %r14
cmpq %r12, %rbx
jne 0x22a463
movq (%r15), %rax
movq %rax, 0x18(%rsp)
movq 0x10(%rsp), %rdi
jmp 0x22a4d4
movq $0x0, 0x18(%rsp)
movq 0x20(%rsp), %rax
leaq (%rax,%rax,2), %rax
movl 0xc(%rdi,%rax,8), %ebx
testq %rbx, %rbx
je 0x22a89a
movq 0x10(%rsp), %rcx
leaq (%rcx,%rax,8), %rax
movq %rax, 0x38(%rsp)
movl $0xc, %r14d
xorl %r12d, %r12d
movl $0x2, %r13d
movq 0x38(%rsp), %rax
movq (%rax), %rax
movq 0x28(%rsp), %rcx
cmpl %ecx, (%rax,%r14)
jne 0x22a554
movq (%r15), %rcx
movq 0x10(%r15), %rax
cmpq 0x8(%r15), %rcx
jne 0x22a549
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
cmoveq %r13, %rsi
movq %rsi, 0x8(%r15)
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x10(%r15)
movq (%r15), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%r15)
movq %r12, (%rax,%rcx,8)
incq %r12
addq $0x28, %r14
cmpq %r12, %rbx
jne 0x22a507
cmpq $0x0, 0x18(%rsp)
je 0x22a89a
movq (%r15), %rsi
cmpq 0x18(%rsp), %rsi
je 0x22a89a
movq %rbp, 0xe0(%rsp)
movq 0x18(%rsp), %rax
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 0x22a856
xorl %r14d, %r14d
cmpq $0x0, 0x48(%rsp)
je 0x22a848
movq 0xd0(%rsp), %rax
movq (%rax,%r14,8), %rbx
movl %ebx, %eax
movq %rbx, %r13
shlq $0x20, %r13
leaq (%rax,%rax,2), %rax
movq 0x10(%rsp), %rcx
leaq (%rcx,%rax,8), %r15
xorl %ebp, %ebp
movq %r13, 0xd8(%rsp)
movq %rbp, %rax
orq %r14, %rax
je 0x22a83a
movl 0x80(%rsp), %eax
orq %r13, %rax
movq 0xe0(%rsp), %rcx
movq (%rcx,%rbp,8), %r12
movq %rax, 0x80(%rsp)
movl %r12d, 0x8c(%rsp)
movq 0x20(%rsp), %rcx
cmpl %ecx, 0x28(%rsp)
jne 0x22a753
movl 0xc(%r15), %r10d
testq %r10, %r10
je 0x22a753
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, 0xe(%rsp)
shlq $0x3, %r10
leaq (%r10,%r10,4), %r11
xorl %r10d, %r10d
cmpq %rax, (%rcx,%r10)
jne 0x22a74a
cmpl %r12d, 0xc(%rcx,%r10)
jne 0x22a74a
cmpl %edx, 0x8(%rcx,%r10)
jne 0x22a74a
cmpl %esi, 0x10(%rcx,%r10)
jne 0x22a74a
cmpl %edi, 0x14(%rcx,%r10)
jne 0x22a74a
cmpq %r8, 0x18(%rcx,%r10)
jne 0x22a74a
cmpb %r9b, 0x20(%rcx,%r10)
jne 0x22a74a
movb 0xe(%rsp), %r13b
cmpb %r13b, 0x21(%rcx,%r10)
movq 0xd8(%rsp), %r13
je 0x22a763
addq $0x28, %r10
cmpq %r10, %r11
jne 0x22a706
movq %r15, %rdi
leaq 0x80(%rsp), %rsi
callq 0xa058c
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 0x20(%rsp), %rdx
cmpl %edx, 0x28(%rsp)
jne 0x22a827
movq 0x10(%rsp), %rdx
movl 0xc(%rdx,%rcx,8), %r11d
testq %r11, %r11
je 0x22a827
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), %r12b
movb %r12b, 0xe(%rsp)
shlq $0x3, %r11
leaq (%r11,%r11,4), %r12
xorl %r11d, %r11d
cmpq %rax, (%rdx,%r11)
jne 0x22a81e
cmpl %ebx, 0xc(%rdx,%r11)
jne 0x22a81e
cmpl %esi, 0x8(%rdx,%r11)
jne 0x22a81e
cmpl %edi, 0x10(%rdx,%r11)
jne 0x22a81e
cmpl %r8d, 0x14(%rdx,%r11)
jne 0x22a81e
cmpq %r9, 0x18(%rdx,%r11)
jne 0x22a81e
cmpb %r10b, 0x20(%rdx,%r11)
jne 0x22a81e
movb %r10b, 0xf(%rsp)
movb 0xe(%rsp), %r10b
cmpb %r10b, 0x21(%rdx,%r11)
movb 0xf(%rsp), %r10b
je 0x22a83a
addq $0x28, %r11
cmpq %r11, %r12
jne 0x22a7d8
movq 0x10(%rsp), %rax
leaq (%rax,%rcx,8), %rdi
leaq 0x50(%rsp), %rsi
callq 0xa058c
incq %rbp
cmpq 0x48(%rsp), %rbp
jne 0x22a678
incq %r14
cmpq 0x40(%rsp), %r14
jne 0x22a640
movq 0xc8(%rsp), %rdx
incq %rdx
movq 0xc0(%rsp), %rsi
cmpq %rsi, %rdx
jne 0x22a5f4
movq 0xb0(%rsp), %rdx
incq %rdx
cmpq 0x18(%rsp), %rdx
jne 0x22a5ac
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1f994(%rip), %rdi     # 0x24a235
leaq 0x1ad61(%rip), %rsi     # 0x245609
leaq 0x1f993(%rip), %rcx     # 0x24a242
movl $0x42c8, %edx           # imm = 0x42C8
callq 0x2110