// File: chhylp123[P]hifiasm/Hash_Table.cpp
// Function: filter_non_ovlp_xchains(overlap_region*, long, long*)
int64_t filter_non_ovlp_xchains(overlap_region *a, int64_t a_n, int64_t *n_v)
{
    int64_t k, i, n_mchain, omx, opx, ovx, os, oe; overlap_region *m, *p, t;
    for (k = n_mchain = (*n_v) = 0; k < a_n; k++) {
		m = &(a[k]); 
        omx = m->x_pos_e + 1 - m->x_pos_s;
		for (i = 0; i < n_mchain; i++) {
			p = &(a[i]);
            opx = p->x_pos_e + 1 - p->x_pos_s;

            os = ((m->x_pos_s>=p->x_pos_s)? m->x_pos_s:p->x_pos_s);
            oe = ((m->x_pos_e<=p->x_pos_e)? m->x_pos_e:p->x_pos_e) + 1;
			ovx = oe>os?oe-os:0;
            if((ovx > omx*0.1) || (ovx > opx*0.1)) break;
		}
		if(i < n_mchain) continue;

        if (n_mchain != k) {
            t = a[k]; a[k] = a[n_mchain]; a[n_mchain] = t;
        }
        (*n_v) += a[n_mchain].align_length;
		n_mchain++;
	}
	return n_mchain;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq $0x0, (%rax)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x10(%rbp), %rax
jge 0x2553b
movq -0x8(%rbp), %rax
imulq $0xa8, -0x20(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movl 0x8(%rax), %eax
addl $0x1, %eax
movq -0x60(%rbp), %rcx
subl 0x4(%rcx), %eax
movl %eax, %eax
movq %rax, -0x38(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
jge 0x2547f
movq -0x8(%rbp), %rax
imulq $0xa8, -0x28(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movl 0x8(%rax), %eax
addl $0x1, %eax
movq -0x68(%rbp), %rcx
subl 0x4(%rcx), %eax
movl %eax, %eax
movq %rax, -0x40(%rbp)
movq -0x60(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x68(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jb 0x253a9
movq -0x60(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x114(%rbp)
jmp 0x253b6
movq -0x68(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x114(%rbp)
movl -0x114(%rbp), %eax
movl %eax, %eax
movq %rax, -0x50(%rbp)
movq -0x60(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x68(%rbp), %rcx
cmpl 0x8(%rcx), %eax
ja 0x253e1
movq -0x60(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x118(%rbp)
jmp 0x253ee
movq -0x68(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x118(%rbp)
movl -0x118(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x50(%rbp), %rax
jle 0x25418
movq -0x58(%rbp), %rax
subq -0x50(%rbp), %rax
movq %rax, -0x120(%rbp)
jmp 0x25423
xorl %eax, %eax
movq %rax, -0x120(%rbp)
jmp 0x25423
movq -0x120(%rbp), %rax
movq %rax, -0x48(%rbp)
cvtsi2sdq -0x48(%rbp), %xmm0
cvtsi2sdq -0x38(%rbp), %xmm1
movsd 0x359bd6(%rip), %xmm2   # 0x37f018
mulsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
ja 0x2546a
cvtsi2sdq -0x48(%rbp), %xmm0
cvtsi2sdq -0x40(%rbp), %xmm1
movsd 0x359bb8(%rip), %xmm2   # 0x37f018
mulsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x2546c
jmp 0x2547f
jmp 0x2546e
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x25352
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
jge 0x2548e
jmp 0x2552a
movq -0x30(%rbp), %rax
cmpq -0x20(%rbp), %rax
je 0x25500
movq -0x8(%rbp), %rsi
imulq $0xa8, -0x20(%rbp), %rax
addq %rax, %rsi
leaq -0x110(%rbp), %rdi
movl $0xa8, %edx
callq 0x2180
movq -0x8(%rbp), %rsi
imulq $0xa8, -0x30(%rbp), %rax
addq %rax, %rsi
movq -0x8(%rbp), %rdi
imulq $0xa8, -0x20(%rbp), %rax
addq %rax, %rdi
movl $0xa8, %edx
callq 0x2180
movq -0x8(%rbp), %rdi
imulq $0xa8, -0x30(%rbp), %rax
addq %rax, %rdi
leaq -0x110(%rbp), %rsi
movl $0xa8, %edx
callq 0x2180
movq -0x8(%rbp), %rax
imulq $0xa8, -0x30(%rbp), %rcx
addq %rcx, %rax
movl 0x28(%rax), %eax
movl %eax, %ecx
movq -0x18(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x25312
movq -0x30(%rbp), %rax
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
nopl (%rax,%rax)