// File: 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
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
shll %eax
movl %eax, -0x1c(%rbp)
movq $0x0, -0x60(%rbp)
movq $0x0, -0x68(%rbp)
movq $0x0, -0x58(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jae 0x11abb0
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x14(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x11a9fb
jmp 0x11aba2
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x14(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x14(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x14(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x14(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x3c(%rbp)
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x40(%rbp), %eax
jae 0x11aba0
movq -0x30(%rbp), %rax
movl -0x48(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x11aa9c
jmp 0x11ab92
movq -0x30(%rbp), %rax
movl -0x48(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0x18(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jae 0x11aaff
movq -0x28(%rbp), %rax
movl -0x44(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x11aada
jmp 0x11aaf4
movq -0x28(%rbp), %rax
movl -0x44(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
cmpl -0x18(%rbp), %eax
jne 0x11aaf2
jmp 0x11aaff
jmp 0x11aaf4
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x11aab7
movl -0x44(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jb 0x11ab90
jmp 0x11ab0d
movq -0x68(%rbp), %rax
cmpq -0x60(%rbp), %rax
jne 0x11ab50
cmpq $0x0, -0x60(%rbp)
je 0x11ab2b
movq -0x60(%rbp), %rax
shlq %rax
movq %rax, -0x70(%rbp)
jmp 0x11ab36
movl $0x2, %eax
movq %rax, -0x70(%rbp)
jmp 0x11ab36
movq -0x70(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rdi
imulq $0x18, -0x60(%rbp), %rsi
callq 0x2360
movq %rax, -0x58(%rbp)
movq -0x30(%rbp), %rcx
movl -0x48(%rbp), %eax
imulq $0x18, %rax, %rax
addq %rax, %rcx
movq -0x58(%rbp), %rax
movq -0x68(%rbp), %rdx
movq %rdx, %rsi
addq $0x1, %rsi
movq %rsi, -0x68(%rbp)
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rcx
movq %rcx, 0x10(%rax)
jmp 0x11ab90
jmp 0x11ab92
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x11aa72
jmp 0x11aba2
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x11a9d0
cmpq $0x0, -0x68(%rbp)
je 0x11ac40
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpq -0x68(%rbp), %rax
jae 0x11ac0b
movq -0x8(%rbp), %rdi
callq 0xd4050
movq %rax, -0x38(%rbp)
movq -0x58(%rbp), %rcx
movl -0x4c(%rbp), %eax
imulq $0x18, %rax, %rax
addq %rax, %rcx
movq -0x38(%rbp), %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rcx
movq %rcx, 0x10(%rax)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x11abc2
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x2210
movq -0x8(%rbp), %rax
movq $0x0, 0x28(%rax)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x0, %ecx
movl %ecx, 0x4(%rax)
movq -0x8(%rbp), %rdi
callq 0xcdd10
movq 0x2a9399(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
movq -0x68(%rbp), %rax
movl %eax, %ecx
leaq 0x26d4eb(%rip), %rsi    # 0x388142
leaq 0x26d503(%rip), %rdx    # 0x388161
movb $0x0, %al
callq 0x22a0
movq 0x2a9374(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movl 0x4(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movq -0x10(%rbp), %rax
movl 0x4(%rax), %r8d
andl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
leaq 0x26d4db(%rip), %rsi    # 0x38816d
leaq 0x26d4c8(%rip), %rdx    # 0x388161
movb $0x0, %al
callq 0x22a0
movq -0x58(%rbp), %rdi
callq 0x2210
addq $0x70, %rsp
popq %rbp
retq
nop