// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Overlaps.cpp
// Function: recall_arcs(asg_t*, asg_t*)
void recall_arcs(asg_t *des, asg_t *src)
{
    uint32_t v, w, n_vtx = src->n_seq*2;
    asg_arc_t *av, *za, *p; uint32_t an, zn, ai, zi, k;
    kvec_t(asg_arc_t) ka; kv_init(ka);

    for (v = 0; v < n_vtx; ++v) {
        if(src->seq[v>>1].del) continue;
        za = asg_arc_a(src, v); zn = asg_arc_n(src, v); 
        av = asg_arc_a(des, v); an = asg_arc_n(des, v); 
        for (zi = 0; zi < zn; zi++) {
            if(za[zi].del) continue;
            w = za[zi].v;
            for (ai = 0; ai < an; ai++) {
                if(av[ai].del) continue;
                if(av[ai].v == w) break;
            }
            if(ai >= an) kv_push(asg_arc_t, ka, za[zi]);
        }
    }

    if(ka.n) {
        for (k = 0; k < ka.n; k++) {
            p = asg_arc_pushp(des); *p = (ka.a[k]); 
        }
        free(des->idx);
        des->idx = 0;
        des->is_srt = 0;
        asg_cleanup(des);
        // asg_symm(des);
    }
    fprintf(stderr, "[M::%s] # transitive arcs::%u\n", __func__, (uint32_t)ka.n);
    fprintf(stderr, "[M::%s] # new arcs::%u, # old arcs::%u\n", __func__, des->n_arc, src->n_arc);
    
    kv_destroy(ka);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r14
movq %rdi, 0x8(%rsp)
movl 0x14(%rsi), %eax
addl %eax, %eax
movq %rax, 0x18(%rsp)
xorl %esi, %esi
xorl %edi, %edi
xorl %eax, %eax
xorl %r8d, %r8d
movq %r14, 0x10(%rsp)
cmpq 0x18(%rsp), %rsi
je 0x95ed7
movq 0x20(%r14), %rcx
movl %esi, %edx
shrl %edx
cmpl $0x0, (%rcx,%rdx,8)
js 0x95ecf
movq 0x28(%r14), %rcx
movq (%rcx,%rsi,8), %rcx
movl %ecx, %ebx
shrq $0x20, %rcx
imulq $0x18, %rcx, %r10
addq 0x8(%r14), %r10
movq 0x8(%rsp), %rdx
movq 0x8(%rdx), %rcx
movq 0x28(%rdx), %rdx
movq %rsi, 0x20(%rsp)
movq (%rdx,%rsi,8), %rdx
movl %edx, %esi
shrq $0x20, %rdx
imulq $0x18, %rsi, %r13
imulq $0x18, %rdx, %rdx
leaq (%rcx,%rdx), %rbp
addq $0xc, %rbp
xorl %r14d, %r14d
movq %r10, 0x28(%rsp)
cmpq %rbx, %r14
je 0x95ec5
imulq $0x18, %r14, %r12
cmpl $0x0, 0xc(%r10,%r12)
js 0x95ebd
addq %r10, %r12
movl 0x8(%r12), %ecx
xorl %edx, %edx
cmpq %rdx, %r13
je 0x95e72
cmpl $0x0, (%rbp,%rdx)
js 0x95e6c
cmpl %ecx, -0x4(%rbp,%rdx)
je 0x95ebd
addq $0x18, %rdx
jmp 0x95e5a
cmpq %rax, %r8
jne 0x95ea3
leaq (%rax,%rax), %r15
testq %rax, %rax
pushq $0x2
popq %rax
cmoveq %rax, %r15
imulq $0x18, %r15, %rsi
movq %r8, 0x30(%rsp)
callq 0x2370
movq 0x28(%rsp), %r10
movq 0x30(%rsp), %r8
movq %rax, %rdi
movq %r15, %rax
imulq $0x18, %r8, %rcx
incq %r8
movq 0x10(%r12), %rdx
movq %rdx, 0x10(%rdi,%rcx)
movups (%r12), %xmm0
movups %xmm0, (%rdi,%rcx)
incq %r14
jmp 0x95e3b
movq 0x10(%rsp), %r14
movq 0x20(%rsp), %rsi
incq %rsi
jmp 0x95dd4
movq %rdi, %r15
testq %r8, %r8
je 0x95f34
xorl %eax, %eax
movl %eax, %ebx
movq %r8, %r12
cmpq %rbx, %r8
jbe 0x95f12
movq 0x8(%rsp), %rdi
callq 0x6c45d
imulq $0x18, %rbx, %rcx
movups (%r15,%rcx), %xmm0
movups %xmm0, (%rax)
movq 0x10(%r15,%rcx), %rcx
movq %rcx, 0x10(%rax)
leal 0x1(%rbx), %eax
movq %r12, %r8
jmp 0x95ee1
movq 0x8(%rsp), %rbx
movq 0x28(%rbx), %rdi
callq 0x2220
andq $0x0, 0x28(%rbx)
andb $0x7f, 0x7(%rbx)
movq %rbx, %rdi
callq 0x694eb
movq %r12, %r8
movq 0x1bd0a5(%rip), %rbx    # 0x252fe0
movq (%rbx), %rdi
leaq 0x153512(%rip), %rsi    # 0x1e9457
leaq 0x15352a(%rip), %r13    # 0x1e9476
movq %r13, %rdx
movl %r8d, %ecx
xorl %eax, %eax
callq 0x22b0
movq (%rbx), %rdi
movl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
movq 0x8(%rsp), %rax
movl 0x4(%rax), %ecx
andl %r8d, %ecx
andl 0x4(%r14), %r8d
leaq 0x15350a(%rip), %rsi    # 0x1e9482
movq %r13, %rdx
xorl %eax, %eax
callq 0x22b0
movq %r15, %rdi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2220