// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/ecovlp.cpp
// Function: add_cns_arc_bp(cns_gfa*, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int)
inline uint32_t add_cns_arc_bp(cns_gfa *cns, uint32_t src, uint32_t bp, uint32_t plus0, uint32_t rid, uint32_t av_bp)
{
    uint32_t rr, des;
    rr = get_cns_arc_bp(cns, src, bp, 1, av_bp);
    if(rr != ((uint32_t)-1)) {///find an existing node
        des = (*cns).a[src].arc.a[rr].v;
        (*cns).a[des].sc++;
        (*cns).a[src].arc.a[rr].sc += plus0;

        rr = add_cns_arc(cns, des, src, 0, plus0); 
        // if(rr == 0) {
        //     fprintf(stderr, "[M::%s] src::%u -> des::%u\n", __func__, src, des);
        //     prt_cns_arc(cns, src);
        //     prt_cns_arc(cns, des);
        // }
        assert(rr);

        return des;
    } else {///create a new node
        des = insert_cns_node(cns);
        (*cns).a[des].sc++; (*cns).a[des].c = bp;
        insert_cns_arc(cns, src, des, 1, plus0, rid); 
        insert_cns_arc(cns, des, src, 0, plus0, rid);
    }

    return des;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %r10d
movl %edx, %r13d
movl %esi, %ebx
movq %rdi, %r14
movq 0x10(%rdi), %rdi
movl %esi, %r12d
leaq (%r12,%r12,4), %rbp
movl 0x18(%rdi,%rbp,8), %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %rcx, %rcx
je 0x18d2dd
movq 0x20(%rdi,%rbp,8), %rsi
xorl %edx, %edx
movl (%rsi,%rdx,8), %r11d
andl $0x7fffffff, %r11d      # imm = 0x7FFFFFFF
cmpl $0x2, %r11d
jb 0x18d2d1
testl %r9d, %r9d
je 0x18d2c0
cmpl 0x28(%r14), %r11d
jb 0x18d2c0
cmpl 0x2c(%r14), %r11d
jb 0x18d2d1
leaq (%r11,%r11,4), %r11
movl (%rdi,%r11,8), %r11d
andl $0x3, %r11d
cmpl %r13d, %r11d
je 0x18d2db
incq %rdx
cmpq %rdx, %rcx
jne 0x18d29e
jmp 0x18d2dd
movl %edx, %eax
cmpl $-0x1, %eax
je 0x18d381
shlq $0x3, %r12
leaq (%r12,%r12,4), %rdx
movq 0x20(%rdi,%rdx), %rcx
movl %eax, %eax
movl (%rcx,%rax,8), %r15d
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
leaq (,%r15,8), %rcx
leaq (%rcx,%rcx,4), %rsi
addl $0x8, (%rdi,%rsi)
movq 0x10(%r14), %rcx
movq 0x20(%rcx,%rdx), %rdx
addl %r10d, 0x4(%rdx,%rax,8)
movq 0x8(%rcx,%rsi), %rdi
movq 0x18(%rcx,%rsi), %rax
cmpl %edi, %eax
setb %sil
jae 0x18d595
movl %eax, %eax
leaq (%r15,%r15,4), %rdx
movq 0x20(%rcx,%rdx,8), %rcx
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movl (%rcx,%rax,8), %r8d
andl %edx, %r8d
movb $0x1, %sil
cmpl %ebx, %r8d
je 0x18d377
movl %edi, %esi
incq %rax
cmpq %rax, %rsi
je 0x18d591
movl (%rcx,%rax,8), %edi
andl %edx, %edi
incq %rax
cmpl %ebx, %edi
jne 0x18d358
decq %rax
cmpq %rsi, %rax
setb %sil
addl %r10d, 0x4(%rcx,%rax,8)
jmp 0x18d595
movl %r8d, 0x14(%rsp)
movq 0x8(%r14), %r15
cmpq %r15, (%r14)
movl %r10d, 0x10(%rsp)
jne 0x18d3e6
leaq (%r15,%r15), %rax
testq %r15, %r15
movl $0x2, %ecx
cmovneq %rax, %rcx
movq %rcx, 0x8(%r14)
shlq $0x3, %rcx
leaq (%rcx,%rcx,4), %rsi
callq 0x2370
movl 0x10(%rsp), %r10d
movq %rax, 0x10(%r14)
movq 0x8(%r14), %rcx
movl %r15d, %edx
subq %rdx, %rcx
jbe 0x18d3e6
leaq (%rdx,%rdx,4), %rdx
leaq (%rax,%rdx,8), %rdi
shlq $0x3, %rcx
leaq (%rcx,%rcx,4), %rdx
xorl %esi, %esi
callq 0x20e0
movl 0x10(%rsp), %r10d
movq (%r14), %rax
movq 0x10(%r14), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%r14)
leaq (%rax,%rax,4), %rax
xorl %edx, %edx
movq %rdx, 0x18(%rcx,%rax,8)
movq %rdx, 0x8(%rcx,%rax,8)
movl $0x0, (%rcx,%rax,8)
movl (%r14), %r15d
decl %r15d
movq 0x10(%r14), %rax
leaq (,%r15,8), %rcx
leaq (%rcx,%rcx,4), %r9
addl $0x8, (%rax,%r9)
movq 0x10(%r14), %rax
movl (%rax,%r9), %ecx
andl $0x3, %r13d
andl $-0x4, %ecx
orl %r13d, %ecx
movl %ecx, (%rax,%r9)
movq (%r14), %rax
cmpq %r12, %rax
jbe 0x18d5cb
movq 0x10(%r14), %rax
movq 0x10(%rax,%rbp,8), %rcx
cmpq %rcx, 0x8(%rax,%rbp,8)
jne 0x18d4a6
leaq (%rax,%rbp,8), %rdx
addq $0x8, %rdx
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
movl $0x2, %ecx
cmovneq %rsi, %rcx
leaq (,%r12,8), %rsi
leaq (%rsi,%rsi,4), %r13
movq %rcx, 0x10(%rax,%r13)
movq 0x8(%rdx), %rsi
movq 0x18(%rdx), %rdi
shlq $0x3, %rsi
movq %r9, %rbp
callq 0x2370
movq %rbp, %r9
movl 0x10(%rsp), %r10d
movq 0x10(%r14), %rcx
movq %rax, 0x20(%rcx,%r13)
movq 0x10(%r14), %rsi
shlq $0x3, %r12
leaq (%r12,%r12,4), %rdx
movq 0x8(%rsi,%rdx), %rax
movq 0x20(%rsi,%rdx), %rcx
leaq 0x1(%rax), %rdi
movq %rdi, 0x8(%rsi,%rdx)
movl %r10d, 0x4(%rcx,%rax,8)
movl %r15d, %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
movl %esi, (%rcx,%rax,8)
movq 0x10(%r14), %rdi
movq 0x18(%rdi,%rdx), %rsi
incq %rsi
movq %rsi, 0x18(%rdi,%rdx)
cmpq 0x8(%rdi,%rdx), %rsi
jae 0x18d50b
addq %rdi, %rdx
addq $0x8, %rdx
movq 0x18(%rdx), %rdx
movq -0x8(%rdx,%rsi,8), %rdi
movq (%rcx,%rax,8), %r8
movq %r8, -0x8(%rdx,%rsi,8)
movq %rdi, (%rcx,%rax,8)
movq (%r14), %rax
cmpq %r15, %rax
jbe 0x18d5f2
movq 0x10(%r14), %rax
leaq (%r15,%r15,4), %r12
movq 0x10(%rax,%r12,8), %rcx
cmpq %rcx, 0x8(%rax,%r12,8)
jne 0x18d56a
leaq (%rax,%r12,8), %rdx
addq $0x8, %rdx
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
movl $0x2, %ecx
cmovneq %rsi, %rcx
movq %rcx, 0x10(%rax,%r9)
movq 0x8(%rdx), %rsi
movq 0x18(%rdx), %rdi
shlq $0x3, %rsi
movq %r9, %r13
callq 0x2370
movl 0x10(%rsp), %r10d
movq 0x10(%r14), %rcx
movq %rax, 0x20(%rcx,%r13)
movq 0x10(%r14), %rax
movq 0x8(%rax,%r12,8), %rcx
movq 0x20(%rax,%r12,8), %rdx
leaq 0x1(%rcx), %rsi
movq %rsi, 0x8(%rax,%r12,8)
movl %r10d, 0x4(%rdx,%rcx,8)
andl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
movl %ebx, (%rdx,%rcx,8)
jmp 0x18d59a
seta %sil
testb %sil, %sil
je 0x18d5ac
movl %r15d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x9a85b(%rip), %rdi     # 0x227e0e
leaq 0xa4831(%rip), %rsi     # 0x231deb
leaq 0xa606f(%rip), %rcx     # 0x233630
movl $0x269, %edx            # imm = 0x269
callq 0x2110
movq 0xfca0e(%rip), %rcx     # 0x289fe0
movq (%rcx), %rdi
movl %eax, (%rsp)
leaq 0xa6011(%rip), %rsi     # 0x2335f0
leaq 0xa603b(%rip), %rdx     # 0x233621
movl 0x14(%rsp), %ecx
movl %ebx, %r8d
movl %r15d, %r9d
jmp 0x18d617
movq 0xfc9e7(%rip), %rcx     # 0x289fe0
movq (%rcx), %rdi
movl %eax, (%rsp)
leaq 0xa5fea(%rip), %rsi     # 0x2335f0
leaq 0xa6014(%rip), %rdx     # 0x233621
movl 0x14(%rsp), %ecx
movl %r15d, %r8d
movl %ebx, %r9d
xorl %eax, %eax
callq 0x22b0
movl $0x1, %edi
callq 0x2250