// File: /workspace/github_cpp_makefile_star2_O2/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 %rdi, %r10
movq 0x18(%rdi), %rax
movl 0x14(%rax), %r8d
addl %r8d, %r8d
xorl %ebp, %ebp
movq %rdi, 0x20(%rsp)
movq %r8, 0x18(%rsp)
cmpq %r8, %rbp
je 0x7fbf1
movq 0x18(%r10), %rax
movq 0x20(%rax), %rcx
movl %ebp, %r12d
shrl %r12d
cmpl $0x0, (%rcx,%r12,8)
js 0x7fbe9
movq 0x10(%r10), %rcx
imulq $0x28, %r12, %rsi
cmpl $0x0, 0x10(%rcx,%rsi)
je 0x7fbe9
movq 0x28(%rax), %rdx
movq (%rdx,%rbp,8), %rdx
testl %edx, %edx
je 0x7fbe9
addq %rsi, %rcx
movq 0x8(%rax), %rax
movq %rdx, %rsi
shrq $0x20, %rsi
xorl %edi, %edi
movl %ebp, %r9d
andl $0x1, %r9d
movl %r9d, 0x14(%rsp)
sete %dil
movl 0x4(%rcx,%rdi,4), %edi
movl %edx, %ecx
imulq $0x18, %rcx, %r14
imulq $0x18, %rsi, %rcx
leaq (%rax,%rcx), %r13
addq $0xc, %r13
xorl %eax, %eax
xorl %ecx, %ecx
cmpq %rax, %r14
je 0x7fb43
movl (%r13,%rax), %edx
notl %edx
shrl $0x1f, %edx
addl %edx, %ecx
addq $0x18, %rax
jmp 0x7fb2c
testl %ecx, %ecx
je 0x7fbe9
movl %edi, %eax
shrl %eax
movl %eax, 0xc(%rsp)
notl %edi
andl $0x1, %edi
movl %edi, 0x10(%rsp)
xorl %ebx, %ebx
cmpq %rbx, %r14
je 0x7fbe9
cmpl $0x0, (%r13,%rbx)
jns 0x7fb75
addq $0x18, %rbx
jmp 0x7fb5e
movl -0x4(%r13,%rbx), %r8d
movl %r8d, %r9d
andl $0x1, %r9d
shrl %r8d
imulq $0x28, %r8, %rax
addq 0x10(%r10), %rax
movl 0x4(%rax,%r9,4), %r15d
movq 0x1d3448(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
leaq 0x168b9a(%rip), %rsi    # 0x1e873c
movl %r12d, %edx
movl 0x14(%rsp), %ecx
xorl %eax, %eax
callq 0x22b0
movq 0x1d3429(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
movl %r15d, %r8d
shrl %r8d
andl $0x1, %r15d
leaq 0x168ba0(%rip), %rsi    # 0x1e876b
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 0x7fb6f
incq %rbp
jmp 0x7faad
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq