// File: chhylp123[P]hifiasm/ecovlp.cpp
// Function: gen_mm_cns_arc(cns_gfa*, unsigned int, unsigned int, unsigned int, unsigned int)
inline void gen_mm_cns_arc(cns_gfa *cns, uint32_t src, uint32_t des, uint32_t sc, uint32_t f)
{
    cns_t *av = &((*cns).a[src]), *aw;
    uint32_t vk, wk;
    for (vk = 0; vk < av->arc.nou; vk++) {///out-edge of src
        if((av->arc.a[vk].v != des) || (del_cns_arc((*av), vk))) continue;
        // av->arc.a[vk].f = 1; ///not sure if we should set these edges as visited
        av->arc.a[vk].f = f;
        av->arc.a[vk].sc += sc;

        aw = &((*cns).a[des]);
        for (wk = aw->arc.nou; wk < aw->arc.n; wk++) {///in-edge of des
            if((aw->arc.a[wk].v != src) || (del_cns_arc((*aw), wk))) continue;
            // aw->arc.a[wk].f = 1; ///not sure if we should set these edges as visited
            aw->arc.a[wk].f = f;
            aw->arc.a[wk].sc += sc; 
            break;
        }

        assert(wk < aw->arc.n);
        return;
    }

    cns_arc *p, t;
    ///src -> des
    kv_pushp(cns_arc, (*cns).a[src].arc, &p);
    p->sc = sc; p->v = des;
    // p->f = 1; ///not sure if we should set these edges as visited
    p->f = f; 
    ///ou-edge
    (*cns).a[src].arc.nou++;
    if((*cns).a[src].arc.nou < (*cns).a[src].arc.n) {
        t = (*cns).a[src].arc.a[(*cns).a[src].arc.nou-1]; 
        (*cns).a[src].arc.a[(*cns).a[src].arc.nou-1] = *p;
        *p = t;
    }

    ///src <- des; in-edge
    kv_pushp(cns_arc, (*cns).a[des].arc, &p);
    p->sc = sc; p->v = src;
    // p->f = 1; ///not sure if we should set these edges as visited
    p->f = f; 
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movl %r8d, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xc(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jae 0x26d151
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x2c(%rbp), %ecx
movl (%rax,%rcx,8), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpl -0x10(%rbp), %eax
jne 0x26d029
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x2c(%rbp), %ecx
movl (%rax,%rcx,8), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
jne 0x26d02e
jmp 0x26d143
movl -0x18(%rbp), %esi
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x2c(%rbp), %ecx
movl (%rax,%rcx,8), %edx
andl $0x1, %esi
shll $0x1f, %esi
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
orl %esi, %edx
movl %edx, (%rax,%rcx,8)
movl -0x14(%rbp), %edx
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x2c(%rbp), %ecx
addl 0x4(%rax,%rcx,8), %edx
movl %edx, 0x4(%rax,%rcx,8)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x10(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
movq -0x28(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x26d110
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x30(%rbp), %ecx
movl (%rax,%rcx,8), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpl -0xc(%rbp), %eax
jne 0x26d0c6
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x30(%rbp), %ecx
movl (%rax,%rcx,8), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
jne 0x26d0c8
jmp 0x26d102
movl -0x18(%rbp), %esi
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x30(%rbp), %ecx
movl (%rax,%rcx,8), %edx
andl $0x1, %esi
shll $0x1f, %esi
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
orl %esi, %edx
movl %edx, (%rax,%rcx,8)
movl -0x14(%rbp), %edx
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x30(%rbp), %ecx
addl 0x4(%rax,%rcx,8), %edx
movl %edx, 0x4(%rax,%rcx,8)
jmp 0x26d110
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x26d087
movl -0x30(%rbp), %eax
movq -0x28(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x26d11f
jmp 0x26d13e
leaq 0x121c58(%rip), %rdi    # 0x38ed7e
leaq 0x121ade(%rip), %rsi    # 0x38ec0b
movl $0x4d7, %edx            # imm = 0x4D7
leaq 0x12337b(%rip), %rcx    # 0x3904b4
callq 0x2130
jmp 0x26d4d5
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x26cfe6
jmp 0x26d153
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xc(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0xc(%rbp), %edx
imulq $0x28, %rdx, %rdx
addq %rdx, %rcx
cmpq 0x10(%rcx), %rax
jne 0x26d230
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xc(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, 0x10(%rax)
je 0x26d1bd
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xc(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
shlq %rax
movq %rax, -0x48(%rbp)
jmp 0x26d1c8
movl $0x2, %eax
movq %rax, -0x48(%rbp)
jmp 0x26d1c8
movq -0x48(%rbp), %rcx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xc(%rbp), %edx
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xc(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x20(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xc(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xc(%rbp), %edx
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xc(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x20(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x10(%rcx), %rdx
movl -0xc(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rdx
movq 0x8(%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0x8(%rdx)
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movl -0x14(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x4(%rax)
movl -0x10(%rbp), %edx
movq -0x38(%rbp), %rax
movl (%rax), %ecx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andl $0x80000000, %ecx       # imm = 0x80000000
orl %edx, %ecx
movl %ecx, (%rax)
movl -0x18(%rbp), %edx
movq -0x38(%rbp), %rax
movl (%rax), %ecx
andl $0x1, %edx
shll $0x1f, %edx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl %edx, %ecx
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xc(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x18(%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xc(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0xc(%rbp), %edx
imulq $0x28, %rdx, %rdx
addq %rdx, %rcx
cmpq 0x8(%rcx), %rax
jae 0x26d378
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xc(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x20(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0xc(%rbp), %edx
imulq $0x28, %rdx, %rdx
addq %rdx, %rcx
movq 0x18(%rcx), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rdx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xc(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x20(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0xc(%rbp), %esi
imulq $0x28, %rsi, %rsi
addq %rsi, %rcx
movq 0x18(%rcx), %rcx
subq $0x1, %rcx
movq (%rdx), %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x38(%rbp), %rax
movq -0x40(%rbp), %rcx
movq %rcx, (%rax)
jmp 0x26d37a
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x10(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x10(%rbp), %edx
imulq $0x28, %rdx, %rdx
addq %rdx, %rcx
cmpq 0x10(%rcx), %rax
jne 0x26d457
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x10(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, 0x10(%rax)
je 0x26d3e4
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x10(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
shlq %rax
movq %rax, -0x50(%rbp)
jmp 0x26d3ef
movl $0x2, %eax
movq %rax, -0x50(%rbp)
jmp 0x26d3ef
movq -0x50(%rbp), %rcx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x10(%rbp), %edx
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x10(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x20(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x10(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x10(%rbp), %edx
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x10(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x20(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x10(%rcx), %rdx
movl -0x10(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rdx
movq 0x8(%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0x8(%rdx)
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movl -0x14(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x4(%rax)
movl -0xc(%rbp), %edx
movq -0x38(%rbp), %rax
movl (%rax), %ecx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andl $0x80000000, %ecx       # imm = 0x80000000
orl %edx, %ecx
movl %ecx, (%rax)
movl -0x18(%rbp), %edx
movq -0x38(%rbp), %rax
movl (%rax), %ecx
andl $0x1, %edx
shll $0x1f, %edx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl %edx, %ecx
movl %ecx, (%rax)
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)