// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/Overlaps.cpp
// Function: debug_contig_end(ma_ug_t*, asg_t*, kvec_asg_arc_t_warp*)
void debug_contig_end(ma_ug_t *ug, asg_t* read_g, kvec_asg_arc_t_warp* edge)
{
    asg_t* nsg = ug->g;
    uint32_t n_vtx = nsg->n_seq<<1, v, w, nv, v_occ, rv, rw, i;
    asg_arc_t *av = NULL;
    ma_utg_t* u = NULL;

    for (v = 0; v < n_vtx; v++)
    {
        if(ug->g->seq[v>>1].del) continue;
        u = &(ug->u.a[v>>1]);
        if(u->n == 0) continue;
        av = asg_arc_a(ug->g, v);
        nv = asg_arc_n(ug->g, v);
        if(nv == 0) continue;

        if(v&1) rv = ug->u.a[v>>1].start^1;
        else rv = ug->u.a[v>>1].end^1;

        for (i = v_occ = 0; i < nv; i++)
        {
            if(av[i].del) continue;
            v_occ++;
        }
        if(v_occ == 0) continue;

        for (i = 0; i < nv; i++)
        {
            if(av[i].del) continue;
            w = av[i].v;
            if(w&1) rw = ug->u.a[w>>1].end;
            else rw = ug->u.a[w>>1].start;

            fprintf(stderr, "utg: (v>>1: %u)[v&1: %u]->(w>>1: %u)[w&1: %u]\n", v>>1, v&1, w>>1, w&1);
            fprintf(stderr, "rtg: (r_v>>1: %u)[r_v&1: %u]->(r_w>>1: %u)[r_w&1: %u]\n\n", 
                                    rv>>1, rv&1, rw>>1, rw&1);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq 0x18(%rdi), %rax
movl 0x14(%rax), %eax
addl %eax, %eax
je 0xbaf03
movq %rdi, %r10
movl %eax, %r8d
xorl %r12d, %r12d
movq %rdi, 0x20(%rsp)
movq %r8, 0x18(%rsp)
movq 0x18(%r10), %rax
movq 0x20(%rax), %rcx
movl %r12d, %ebp
shrl %ebp
cmpl $0x0, (%rcx,%rbp,8)
js 0xbaef7
movq 0x10(%r10), %rdx
leaq (,%rbp,4), %rsi
addq %rbp, %rsi
cmpl $0x0, 0x10(%rdx,%rsi,8)
je 0xbaef7
movq 0x28(%rax), %rcx
movq (%rcx,%r12,8), %rcx
testl %ecx, %ecx
je 0xbaef7
leaq (%rdx,%rsi,8), %rdx
movq 0x8(%rax), %rax
movq %rcx, %rsi
shrq $0x20, %rsi
xorl %edi, %edi
movl %r12d, %r9d
andl $0x1, %r9d
movl %r9d, 0x14(%rsp)
sete %dil
movl 0x4(%rdx,%rdi,4), %edi
movl %ecx, %ecx
leaq (%rsi,%rsi,2), %rdx
leaq (%rax,%rdx,8), %r14
addq $0xc, %r14
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %r13
xorl %eax, %eax
xorl %ecx, %ecx
movl (%r14,%rax), %edx
notl %edx
shrl $0x1f, %edx
addl %edx, %ecx
addq $0x18, %rax
cmpq %rax, %r13
jne 0xbae3c
testl %ecx, %ecx
je 0xbaef7
movl %edi, %eax
shrl %eax
movl %eax, 0xc(%rsp)
notl %edi
andl $0x1, %edi
movl %edi, 0x10(%rsp)
xorl %ebx, %ebx
cmpl $0x0, (%r14,%rbx)
jns 0xbae7d
addq $0x18, %rbx
cmpq %rbx, %r13
jne 0xbae6b
jmp 0xbaef7
movl -0x4(%r14,%rbx), %r8d
movl %r8d, %r9d
andl $0x1, %r9d
shrl %r8d
leaq (%r8,%r8,4), %rax
shlq $0x3, %rax
addq 0x10(%r10), %rax
movl 0x4(%rax,%r9,4), %r15d
movq 0x1da13c(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
leaq 0x17b98e(%rip), %rsi    # 0x23683c
movl %ebp, %edx
movl 0x14(%rsp), %ecx
xorl %eax, %eax
callq 0x22b0
movq 0x1da11e(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
movl %r15d, %r8d
shrl %r8d
andl $0x1, %r15d
leaq 0x17b995(%rip), %rsi    # 0x23686b
movl 0xc(%rsp), %edx
movl 0x10(%rsp), %ecx
movl %r15d, %r9d
xorl %eax, %eax
callq 0x22b0
movq 0x18(%rsp), %r8
movq 0x20(%rsp), %r10
jmp 0xbae72
incq %r12
cmpq %r8, %r12
jne 0xbadbc
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq