// File: chhylp123[P]hifiasm/Overlaps.cpp
// Function: asg_arc_del_short_diploid_unclean_exact(asg_t*, float, ma_hit_t_alloc*)
int asg_arc_del_short_diploid_unclean_exact(asg_t *g, float drop_ratio, ma_hit_t_alloc* sources)
{
	uint32_t v, n_vtx = g->n_seq * 2, n_short = 0;
	for (v = 0; v < n_vtx; ++v) 
    {
        if (g->seq[v>>1].del) continue;

		asg_arc_t *av = asg_arc_a(g, v);
		uint32_t i, nv = asg_arc_n(g, v);
		///if there is just one overlap, do nothing
		if (nv < 2) continue;
		///keep the longest one
        for (i = 1; i < nv; i++)
        {
            ///if it is an inexact overlap
            if(av[i].el == 0 && 
              sources[v>>1].is_fully_corrected == 1&& 
              sources[(av[i].v>>1)].is_fully_corrected == 1)
            {
                av[i].del = 1;
                ++n_short;
            }
        }

	}

	if (n_short) 
    {
		asg_cleanup(g);
		asg_symm(g);
	}
	fprintf(stderr, "[M::%s] removed %d inexact overlaps\n", __func__, n_short);
	return n_short;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movss %xmm0, -0xc(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x8(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
shll %eax
movl %eax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jae 0xdd1d9
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x1c(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0xdd0df
jmp 0xdd1cb
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x1c(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x1c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x38(%rbp)
cmpl $0x2, -0x38(%rbp)
jae 0xdd122
jmp 0xdd1cb
movl $0x1, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x38(%rbp), %eax
jae 0xdd1c9
movq -0x30(%rbp), %rax
movl -0x34(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movzbl 0x12(%rax), %eax
cmpl $0x0, %eax
jne 0xdd1b9
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0xdd1b9
movq -0x18(%rbp), %rax
movq -0x30(%rbp), %rcx
movl -0x34(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movzbl 0x10(%rax), %eax
cmpl $0x1, %eax
jne 0xdd1b9
movq -0x30(%rbp), %rax
movl -0x34(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0xc(%rax)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xdd1bb
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xdd129
jmp 0xdd1cb
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xdd0b4
cmpl $0x0, -0x24(%rbp)
je 0xdd1f1
movq -0x8(%rbp), %rdi
callq 0xcdd10
movq -0x8(%rbp), %rdi
callq 0xce020
movq 0x2e6de8(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
movl -0x24(%rbp), %ecx
leaq 0x2a9a30(%rip), %rsi    # 0x386c35
leaq 0x2a9a4e(%rip), %rdx    # 0x386c5a
movb $0x0, %al
callq 0x22a0
movl -0x24(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)