// File: /workspace/github_c_makefile_star2_O3/rikuu[P]kermit/miniasm/hit.c
// Function: ma_hit_contained
size_t ma_hit_contained(const ma_opt_t *opt, sdict_t *d, ma_sub_t *sub, size_t n, ma_hit_t *a)
{
	int32_t *map, r;
	size_t i, m, old_n_seq = d->n_seq;
	asg_arc_t t;
	for (i = m = 0; i < n; ++i) {
		ma_hit_t *h = &a[i];
		ma_sub_t *sq = &sub[h->qns>>32], *st = &sub[h->tn];
		r = ma_hit2arc(h, sq->e - sq->s, st->e - st->s, opt->max_hang, opt->int_frac, opt->min_ovlp, &t);
		if (r == MA_HT_QCONT) sq->del = 1;
		else if (r == MA_HT_TCONT) st->del = 1;
	}
	for (i = 0; i < d->n_seq; ++i)
		if (sub[i].del) d->seq[i].del = 1;
	ma_hit_mark_unused(d, n, a);
	map = sd_squeeze(d);
	for (i = 0; i < old_n_seq; ++i)
		if (map[i] >= 0) sub[map[i]] = sub[i];
	for (i = m = 0; i < n; ++i) {
		ma_hit_t *h = &a[i];
		int32_t qn = map[h->qns>>32], tn = map[h->tn];
		if (qn >= 0 && tn >= 0) {
			a[i].qns = (uint64_t)qn<<32 | (uint32_t)a[i].qns;
			a[i].tn = tn;
			a[m++] = a[i];
		}
	}
	free(map);
	if (ma_verbose >= 3)
		fprintf(stderr, "[M::%s::%s] %d sequences and %ld hits remain after containment removal\n", __func__, sys_timestamp(), d->n_seq, m);
	return m;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r8, %r14
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, 0x8(%rsp)
movl (%rsi), %eax
movq %rax, 0x38(%rsp)
testq %rcx, %rcx
movq %rcx, 0x18(%rsp)
je 0x6467
movq %rbx, 0x30(%rsp)
movq %r14, 0x28(%rsp)
leaq 0x18(%r14), %rax
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
movq %rcx, %rdx
movl -0xc(%rax), %ecx
movl (%r12,%rcx,8), %edi
movq %rcx, 0x40(%rsp)
movl 0x4(%r12,%rcx,8), %r11d
movl %edi, 0x14(%rsp)
movl %edi, %ecx
andl %esi, %ecx
subl %ecx, %r11d
testb $-0x80, 0x3(%rax)
jne 0x6335
movl -0x8(%rax), %ecx
movl -0x4(%rax), %edi
movl %edi, (%rsp)
subl %edi, %r11d
movl %r11d, %r14d
movl %ecx, 0x4(%rsp)
movl %ecx, %r11d
jmp 0x6347
movl -0x8(%rax), %r14d
movl -0x4(%rax), %ecx
movl %ecx, (%rsp)
subl %ecx, %r11d
movl %r14d, 0x4(%rsp)
movq -0x18(%rax), %r10
movq %r10, %rbx
shrq $0x20, %rbx
movl (%r12,%rbx,8), %ebp
movl 0x4(%r12,%rbx,8), %r8d
movl %ebp, %ecx
andl %esi, %ecx
subl %ecx, %r8d
movq 0x8(%rsp), %rcx
movl 0x10(%rcx), %r15d
cmpl %r10d, %r11d
movl %r10d, %ecx
cmovll %r11d, %ecx
movl -0x10(%rax), %edi
movl %r8d, %r13d
subl %edi, %r13d
cmpl %r14d, %r13d
movl %r14d, %r9d
cmovbl %r13d, %r9d
cmpl %r15d, %ecx
jg 0x6411
cmpl %r15d, %r9d
jg 0x6411
movl %edi, %r15d
subl %r10d, %r15d
xorps %xmm0, %xmm0
cvtsi2ss %r15, %xmm0
addl %ecx, %r15d
addl %r9d, %r15d
xorps %xmm1, %xmm1
cvtsi2ss %r15, %xmm1
movq 0x8(%rsp), %rsi
mulss 0x18(%rsi), %xmm1
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
ucomiss %xmm0, %xmm1
ja 0x6411
leaq (%r12,%rbx,8), %rsi
movq %rsi, 0x20(%rsp)
movq 0x8(%rsp), %rsi
movl 0x14(%rsi), %ebx
cmpl %r11d, %r10d
jg 0x63ed
cmpl %r14d, %r13d
ja 0x63ed
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
movq 0x20(%rsp), %rcx
jmp 0x6409
cmpl %r11d, %r10d
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
jl 0x6420
cmpl %r14d, %r13d
jb 0x6420
movq 0x40(%rsp), %rcx
leaq (%r12,%rcx,8), %rcx
movl 0x14(%rsp), %ebp
orl $0x80000000, %ebp       # imm = 0x80000000
movl %ebp, (%rcx)
addq $0x20, %rax
decq %rdx
jne 0x62fb
jmp 0x6456
addl %edi, %r14d
subl %r14d, %r8d
subl %r11d, %r10d
cmovlel %r8d, %r10d
cmpl %ebx, %r15d
jb 0x6411
addl %ecx, %r9d
subl 0x4(%rsp), %r9d
addl (%rsp), %r9d
cmpl %ebx, %r9d
jb 0x6411
cmpl $-0x2, %r10d
movq 0x20(%rsp), %rcx
je 0x6409
cmpl $-0x3, %r10d
je 0x63fc
jmp 0x6411
movq 0x30(%rsp), %rbx
movl (%rbx), %eax
movq 0x28(%rsp), %r14
movq 0x18(%rsp), %rcx
testl %eax, %eax
je 0x6494
movl $0xc, %edi
xorl %edx, %edx
cmpl $0x0, (%r12,%rdx,8)
jns 0x6486
movq 0x8(%rbx), %rax
orl $0x80000000, (%rax,%rdi) # imm = 0x80000000
movl (%rbx), %eax
incq %rdx
movl %eax, %esi
addq $0x10, %rdi
cmpq %rsi, %rdx
jb 0x6472
movq %rbx, %rdi
movq %rcx, %rsi
movq %r14, %rdx
callq 0x537f
movq %rbx, %rdi
callq 0x34f5
movq 0x38(%rsp), %rdi
testl %edi, %edi
je 0x64ce
xorl %ecx, %ecx
movslq (%rax,%rcx,4), %rdx
testq %rdx, %rdx
js 0x64c6
movq (%r12,%rcx,8), %rsi
movq %rsi, (%r12,%rdx,8)
incq %rcx
cmpq %rcx, %rdi
jne 0x64b5
movq 0x18(%rsp), %r8
xorl %r12d, %r12d
testq %r8, %r8
je 0x6531
movq %r14, %rcx
movq (%rcx), %rdx
movq %rdx, %rsi
shrq $0x20, %rsi
movslq (%rax,%rsi,4), %rsi
testq %rsi, %rsi
js 0x6528
movl 0xc(%rcx), %edi
movl (%rax,%rdi,4), %edi
testl %edi, %edi
js 0x6528
shlq $0x20, %rsi
movl %edx, %edx
orq %rsi, %rdx
movq %rdx, (%rcx)
movl %edi, 0xc(%rcx)
leaq 0x1(%r12), %rdx
shlq $0x5, %r12
movups 0x10(%rcx), %xmm0
movups %xmm0, 0x10(%r14,%r12)
movups (%rcx), %xmm0
movups %xmm0, (%r14,%r12)
movq %rdx, %r12
addq $0x20, %rcx
decq %r8
jne 0x64de
movq %rax, %rdi
callq 0x1040
leaq 0x7bf8(%rip), %rax      # 0xe138
cmpl $0x3, (%rax)
jge 0x6557
movq %r12, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x7a9a(%rip), %rax      # 0xdff8
movq (%rax), %r14
xorl %eax, %eax
callq 0x2f44
movl (%rbx), %r8d
leaq 0x3f5e(%rip), %rsi      # 0xa4d0
leaq 0x3f9f(%rip), %rdx      # 0xa518
movq %r14, %rdi
movq %rax, %rcx
movq %r12, %r9
xorl %eax, %eax
callq 0x1120
jmp 0x6545
nop