// File: /workspace/github_c_makefile_star2_O0/lh3[P]minigraph/gcmisc.c
// Function: mg_gchain_flt_sub
int mg_gchain_flt_sub(float pri_ratio, int min_diff, int best_n, int n, mg_gchain_t *r)
{
	if (pri_ratio > 0.0f && n > 0) {
		int i, k, n_2nd = 0;
		for (i = k = 0; i < n; ++i) {
			int p = r[i].parent;
			if (p == i) { // primary
				r[i].flt = 0, ++k;
			} else if ((r[i].score >= r[p].score * pri_ratio || r[i].score + min_diff >= r[p].score) && n_2nd < best_n) {
				if (!(r[i].qs == r[p].qs && r[i].qe == r[p].qe && r[i].ps == r[p].ps && r[i].pe == r[p].pe)) // not identical hits; TODO: check path as well
					r[i].flt = 0, ++n_2nd, ++k;
				else r[i].flt = 1;
			} else r[i].flt = 1;
		}
		return k;
	}
	return n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movss %xmm0, -0x8(%rbp)
movl %edi, -0xc(%rbp)
movl %esi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movss -0x8(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x2bd6e
cmpl $0x0, -0x14(%rbp)
jle 0x2bd6e
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x28(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x2bd66
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0x68, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x24(%rbp), %eax
jne 0x2bbdb
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0x68, %rcx, %rcx
addq %rcx, %rax
movl 0x44(%rax), %ecx
andl $0xfffffeff, %ecx       # imm = 0xFFFFFEFF
orl $0x0, %ecx
movl %ecx, 0x44(%rax)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x2bd56
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0x68, %rcx, %rcx
addq %rcx, %rax
cvtsi2ssl 0x14(%rax), %xmm0
movq -0x20(%rbp), %rax
movslq -0x30(%rbp), %rcx
imulq $0x68, %rcx, %rcx
addq %rcx, %rax
cvtsi2ssl 0x14(%rax), %xmm1
mulss -0x8(%rbp), %xmm1
ucomiss %xmm1, %xmm0
jae 0x2bc3a
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0x68, %rcx, %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
addl -0xc(%rbp), %eax
movq -0x20(%rbp), %rcx
movslq -0x30(%rbp), %rdx
imulq $0x68, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x14(%rcx), %eax
jl 0x2bd33
movl -0x2c(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x2bd33
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0x68, %rcx, %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
movq -0x20(%rbp), %rcx
movslq -0x30(%rbp), %rdx
imulq $0x68, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x18(%rcx), %eax
jne 0x2bcde
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0x68, %rcx, %rcx
addq %rcx, %rax
movl 0x1c(%rax), %eax
movq -0x20(%rbp), %rcx
movslq -0x30(%rbp), %rdx
imulq $0x68, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x1c(%rcx), %eax
jne 0x2bcde
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0x68, %rcx, %rcx
addq %rcx, %rax
movl 0x24(%rax), %eax
movq -0x20(%rbp), %rcx
movslq -0x30(%rbp), %rdx
imulq $0x68, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x24(%rcx), %eax
jne 0x2bcde
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0x68, %rcx, %rcx
addq %rcx, %rax
movl 0x28(%rax), %eax
movq -0x20(%rbp), %rcx
movslq -0x30(%rbp), %rdx
imulq $0x68, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x28(%rcx), %eax
je 0x2bd10
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0x68, %rcx, %rcx
addq %rcx, %rax
movl 0x44(%rax), %ecx
andl $0xfffffeff, %ecx       # imm = 0xFFFFFEFF
orl $0x0, %ecx
movl %ecx, 0x44(%rax)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x2bd31
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0x68, %rcx, %rcx
addq %rcx, %rax
movl 0x44(%rax), %ecx
andl $0xfffffeff, %ecx       # imm = 0xFFFFFEFF
orl $0x100, %ecx            # imm = 0x100
movl %ecx, 0x44(%rax)
jmp 0x2bd54
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0x68, %rcx, %rcx
addq %rcx, %rax
movl 0x44(%rax), %ecx
andl $0xfffffeff, %ecx       # imm = 0xFFFFFEFF
orl $0x100, %ecx            # imm = 0x100
movl %ecx, 0x44(%rax)
jmp 0x2bd56
jmp 0x2bd58
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x2bb86
movl -0x28(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x2bd74
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopl (%rax)