// File: /workspace/github_c_makefile_star2_O1/rikuu[P]kermit/miniasm/hit.c
// Function: ma_hit_flt
size_t ma_hit_flt(const ma_sub_t *sub, int max_hang, int min_ovlp, size_t n, ma_hit_t *a, float *cov)
{
	size_t i, m;
	asg_arc_t t;
	uint64_t tot_dp = 0, tot_len = 0;
	for (i = m = 0; i < n; ++i) {
		ma_hit_t *h = &a[i];
		const ma_sub_t *sq = &sub[h->qns>>32], *st = &sub[h->tn];
		int r;
		if (sq->del || st->del) continue;
		r = ma_hit2arc(h, sq->e - sq->s, st->e - st->s, max_hang, .5, min_ovlp, &t);
		if (r >= 0 || r == MA_HT_QCONT || r == MA_HT_TCONT)
			a[m++] = *h, tot_dp += r >= 0? r : r == MA_HT_QCONT? sq->e - sq->s : st->e - st->s;
	}
	for (i = 1; i <= m; ++i)
		if (i == m || a[i].qns>>32 != a[i-1].qns>>32)
			tot_len += sub[a[i-1].qns>>32].e - sub[a[i-1].qns>>32].s;
	*cov = (double)tot_dp / tot_len;
	if (ma_verbose >= 3)
		fprintf(stderr, "[M::%s::%s] %ld hits remain after filtering; crude coverage after filtering: %.2f\n", __func__, sys_timestamp(), m, *cov);
	return m;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, 0x18(%rsp)
movl %edx, (%rsp)
xorpd %xmm0, %xmm0
testq %rcx, %rcx
je 0x63b5
movl %esi, 0x4(%rsp)
leaq 0x18(%r8), %rax
xorl %ebx, %ebx
movss 0x4117(%rip), %xmm1     # 0xa320
movq $0x0, 0x8(%rsp)
movq -0x18(%rax), %r15
movq %r15, %rdx
shrq $0x20, %rdx
movl (%rdi,%rdx,8), %r10d
testl %r10d, %r10d
js 0x6385
movl -0xc(%rax), %esi
leaq (%rdi,%rsi,8), %r14
movl (%r14), %esi
testl %esi, %esi
js 0x6385
movl 0x4(%r14), %ebp
subl %esi, %ebp
testb $-0x80, 0x3(%rax)
jne 0x6255
movl -0x8(%rax), %esi
subl -0x4(%rax), %ebp
movl %ebp, %r9d
movl %esi, %ebp
jmp 0x625c
subl -0x4(%rax), %ebp
movl -0x8(%rax), %r9d
movq %rbx, 0x10(%rsp)
movl %ebp, %r11d
cmpl %r15d, %ebp
jl 0x626c
movl %r15d, %r11d
leaq (%rdi,%rdx,8), %rdx
movq %rdx, 0x20(%rsp)
movl 0x4(%rdx), %r12d
subl %r10d, %r12d
movl -0x10(%rax), %ebx
movl %r12d, %edx
subl %ebx, %edx
cmpl %r9d, %edx
movl %r9d, %r10d
cmovbl %edx, %r10d
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movl 0x4(%rsp), %esi
cmpl %esi, %r11d
jg 0x6318
cmpl %esi, %r10d
jg 0x6318
movl %ebx, %esi
subl %r15d, %esi
xorps %xmm2, %xmm2
cvtsi2ss %rsi, %xmm2
addl %r10d, %esi
addl %r11d, %esi
xorps %xmm3, %xmm3
cvtsi2ss %rsi, %xmm3
mulss %xmm1, %xmm3
ucomiss %xmm2, %xmm3
ja 0x6318
cmpl %ebp, %r15d
jg 0x62d6
movl $0xfffffffe, %r13d      # imm = 0xFFFFFFFE
cmpl %r9d, %edx
jbe 0x6318
cmpl %ebp, %r15d
jl 0x62e6
movl $0xfffffffd, %r13d      # imm = 0xFFFFFFFD
cmpl %r9d, %edx
jae 0x6318
movl $0xfffffffc, %r13d      # imm = 0xFFFFFFFC
cmpl (%rsp), %esi
jb 0x6318
addl %ebx, %r9d
subl %r9d, %r12d
subl %ebp, %r15d
cmovlel %r12d, %r15d
addl %r11d, %r10d
addl -0x4(%rax), %r10d
subl -0x8(%rax), %r10d
movl $0xfffffffc, %r13d      # imm = 0xFFFFFFFC
cmpl (%rsp), %r10d
jb 0x6318
movl %r15d, %r13d
testl %r13d, %r13d
sets %dl
leal 0x3(%r13), %esi
cmpl $0x2, %esi
setae %sil
testb %sil, %dl
jne 0x6380
leaq -0x18(%rax), %rdx
movq 0x10(%rsp), %rbx
movq %rbx, %rsi
shlq $0x5, %rsi
movups (%rdx), %xmm2
movups 0x10(%rdx), %xmm3
movups %xmm3, 0x10(%r8,%rsi)
movups %xmm2, (%r8,%rsi)
testl %r13d, %r13d
jns 0x6373
cmpl $-0x2, %r13d
movq 0x20(%rsp), %rdx
je 0x6363
movq %r14, %rdx
movl 0x4(%rdx), %r13d
movl (%rdx), %edx
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
andl %esi, %edx
subl %edx, %r13d
incq %rbx
movl %r13d, %edx
addq %rdx, 0x8(%rsp)
jmp 0x6385
movq 0x10(%rsp), %rbx
addq $0x20, %rax
decq %rcx
jne 0x6212
movsd 0x8(%rsp), %xmm2
unpcklps 0x3f51(%rip), %xmm2     # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
subpd 0x3f59(%rip), %xmm2     # 0xa300
movapd %xmm2, %xmm1
unpckhpd %xmm2, %xmm1            # xmm1 = xmm1[1],xmm2[1]
addsd %xmm2, %xmm1
jmp 0x63bb
xorl %ebx, %ebx
xorpd %xmm1, %xmm1
testq %rbx, %rbx
je 0x6432
leaq 0x1(%rbx), %rcx
cmpq $0x3, %rcx
movl $0x2, %eax
cmovaeq %rcx, %rax
movl $0x1, %edx
xorl %ecx, %ecx
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
cmpq %rdx, %rbx
je 0x63ef
movq (%r8), %r9
xorq 0x20(%r8), %r9
shrq $0x20, %r9
je 0x6405
movl 0x4(%r8), %r9d
movl 0x4(%rdi,%r9,8), %r10d
movl (%rdi,%r9,8), %r9d
andl %esi, %r9d
subl %r9d, %r10d
addq %r10, %rcx
incq %rdx
addq $0x20, %r8
cmpq %rdx, %rax
jne 0x63dd
movq %rcx, %xmm2
punpckldq 0x3ed2(%rip), %xmm2 # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
subpd 0x3eda(%rip), %xmm2     # 0xa300
movapd %xmm2, %xmm0
unpckhpd %xmm2, %xmm0            # xmm0 = xmm0[1],xmm2[1]
addsd %xmm2, %xmm0
divsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
movq 0x18(%rsp), %rdi
movss %xmm0, (%rdi)
leaq 0x8ceb(%rip), %rax      # 0xf138
cmpl $0x3, (%rax)
jge 0x6464
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rsi
callq 0x1cd4
jmp 0x6452