// File: /workspace/github_c_makefile_star2_O3/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 $0x48, %rsp
movl %edx, 0x8(%rsp)
xorpd %xmm0, %xmm0
testq %rcx, %rcx
je 0x6227
movq %r9, 0x20(%rsp)
xorl %r14d, %r14d
movss 0x4394(%rip), %xmm1     # 0xa2f0
movq %r8, %r11
movq $0x0, 0x28(%rsp)
movl %esi, 0x4(%rsp)
movq %rdi, 0x10(%rsp)
movq (%r11), %rbp
movq %rbp, %r10
shrq $0x20, %r10
movl (%rdi,%r10,8), %r9d
testl %r9d, %r9d
js 0x6120
movl 0xc(%r11), %eax
leaq (%rdi,%rax,8), %r15
movl (%r15), %edx
testl %edx, %edx
js 0x6120
movl 0x4(%r15), %eax
subl %edx, %eax
testb $-0x80, 0x1b(%r11)
movq %r14, 0x18(%rsp)
jne 0x5fc2
movl 0x10(%r11), %r12d
movl 0x14(%r11), %edx
movl %edx, 0xc(%rsp)
subl %edx, %eax
movl %eax, %edx
movl %r12d, %eax
jmp 0x5fd3
movl 0x10(%r11), %r12d
movl 0x14(%r11), %edx
movl %edx, 0xc(%rsp)
subl %edx, %eax
movl %r12d, %edx
leaq (%rdi,%r10,8), %rdi
leaq 0x4(%rdi), %r10
movq %r10, 0x38(%rsp)
movq %rdi, 0x40(%rsp)
movl 0x4(%rdi), %ebx
subl %r9d, %ebx
leaq 0x4(%r15), %rdi
movq %rdi, 0x30(%rsp)
cmpl %ebp, %eax
movl %ebp, %r13d
cmovll %eax, %r13d
movl 0x8(%r11), %r14d
movl %ebx, %edi
subl %r14d, %edi
cmpl %edx, %edi
movl %edx, %r9d
cmovbl %edi, %r9d
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
cmpl %esi, %r13d
jg 0x6047
cmpl %esi, %r9d
jg 0x6047
movl %r12d, %esi
movl %r14d, %r12d
subl %ebp, %r12d
xorps %xmm2, %xmm2
cvtsi2ss %r12, %xmm2
addl %r13d, %r12d
addl %r9d, %r12d
xorps %xmm3, %xmm3
cvtsi2ss %r12, %xmm3
mulss %xmm1, %xmm3
ucomiss %xmm2, %xmm3
jbe 0x60bb
testl %r10d, %r10d
sets %al
leal 0x3(%r10), %edx
cmpl $0x2, %edx
setae %dl
testb %dl, %al
jne 0x60ab
movq 0x18(%rsp), %rdx
leaq 0x1(%rdx), %r14
shlq $0x5, %rdx
movups (%r11), %xmm2
movups 0x10(%r11), %xmm3
movups %xmm3, 0x10(%r8,%rdx)
movups %xmm2, (%r8,%rdx)
testl %r10d, %r10d
movq 0x10(%rsp), %rdi
movl 0x4(%rsp), %esi
jns 0x6118
cmpl $-0x2, %r10d
movq 0x38(%rsp), %r9
cmovneq 0x30(%rsp), %r9
movq 0x40(%rsp), %rdx
cmovneq %r15, %rdx
movq %rdx, %r15
jmp 0x6106
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %r14
movl 0x4(%rsp), %esi
jmp 0x6120
cmpl %eax, %ebp
jg 0x60cf
cmpl %edx, %edi
ja 0x60cf
movq 0x40(%rsp), %r15
movq 0x38(%rsp), %r9
jmp 0x60dc
cmpl %eax, %ebp
jl 0x612f
cmpl %edx, %edi
jb 0x612f
movq 0x30(%rsp), %r9
movq 0x18(%rsp), %rdx
leaq 0x1(%rdx), %r14
shlq $0x5, %rdx
movups (%r11), %xmm2
movups 0x10(%r11), %xmm3
movups %xmm3, 0x10(%r8,%rdx)
movups %xmm2, (%r8,%rdx)
movq 0x10(%rsp), %rdi
movl 0x4(%rsp), %esi
movl (%r9), %r10d
movl (%r15), %edx
movl $0x7fffffff, %r9d       # imm = 0x7FFFFFFF
andl %r9d, %edx
subl %edx, %r10d
movl %r10d, %edx
addq %rdx, 0x28(%rsp)
addq $0x20, %r11
decq %rcx
jne 0x5f71
jmp 0x616a
movl $0xfffffffc, %r10d      # imm = 0xFFFFFFFC
cmpl 0x8(%rsp), %r12d
jb 0x6047
addl %r14d, %edx
subl %edx, %ebx
subl %eax, %ebp
cmovlel %ebx, %ebp
addl %r13d, %r9d
subl %esi, %r9d
addl 0xc(%rsp), %r9d
cmpl 0x8(%rsp), %r9d
movl $0xfffffffc, %eax       # imm = 0xFFFFFFFC
cmovbl %eax, %ebp
movl %ebp, %r10d
jmp 0x6047
movsd 0x28(%rsp), %xmm2
unpcklps 0x4149(%rip), %xmm2     # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
subpd 0x4151(%rip), %xmm2     # 0xa2d0
movapd %xmm2, %xmm1
unpckhpd %xmm2, %xmm1            # xmm1 = xmm1[1],xmm2[1]
addsd %xmm2, %xmm1
testq %r14, %r14
je 0x6230
leaq 0x1(%r14), %rcx
cmpq $0x3, %rcx
movl $0x2, %eax
cmovaeq %rcx, %rax
movq %r14, %rcx
shlq $0x5, %rcx
addq %r8, %rcx
addq $-0x20, %rcx
addq $0x20, %r8
movl $0x1, %esi
xorl %edx, %edx
movl $0x7fffffff, %r11d      # imm = 0x7FFFFFFF
movq 0x20(%rsp), %r9
cmpq %rsi, %r14
jne 0x61d3
movq (%rcx), %rbx
jmp 0x61e3
movq -0x20(%r8), %rbx
movq (%r8), %r10
xorq %rbx, %r10
shrq $0x20, %r10
je 0x61f8
shrq $0x20, %rbx
movl 0x4(%rdi,%rbx,8), %r10d
movl (%rdi,%rbx,8), %ebx
andl %r11d, %ebx
subl %ebx, %r10d
addq %r10, %rdx
incq %rsi
addq $0x20, %r8
cmpq %rsi, %rax
jne 0x61c9
movq %rdx, %xmm2
punpckldq 0x40af(%rip), %xmm2 # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
subpd 0x40b7(%rip), %xmm2     # 0xa2d0
movapd %xmm2, %xmm0
unpckhpd %xmm2, %xmm0            # xmm0 = xmm0[1],xmm2[1]
addsd %xmm2, %xmm0
jmp 0x6238
xorl %r14d, %r14d
xorpd %xmm1, %xmm1
jmp 0x6238
xorl %r14d, %r14d
movq 0x20(%rsp), %r9
divsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
movss %xmm0, (%r9)
leaq 0x7ee9(%rip), %rax      # 0xe138
cmpl $0x3, (%rax)
jge 0x6266
movq %r14, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r9, %rdi
movq %r14, %rsi
callq 0x1cef
jmp 0x6254