// File: /workspace/github_c_makefile_star2_O1/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, 0x18(%rsp)
movq %rcx, %r14
movq %rdx, %r12
movq %rdi, 0x20(%rsp)
movq %rsi, 0x8(%rsp)
movl (%rsi), %eax
movq %rax, 0x38(%rsp)
testq %rcx, %rcx
je 0x6655
movq 0x18(%rsp), %rax
addq $0x18, %rax
movq %r14, %rdx
movq %r14, 0x30(%rsp)
movl -0xc(%rax), %ecx
movl (%r12,%rcx,8), %esi
movq %rcx, 0x40(%rsp)
movl 0x4(%r12,%rcx,8), %r10d
movl %esi, 0x2c(%rsp)
movl %esi, %ecx
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
andl %esi, %ecx
subl %ecx, %r10d
testb $-0x80, 0x3(%rax)
jne 0x6529
movl -0x8(%rax), %esi
subl -0x4(%rax), %r10d
movl %r10d, %ecx
movl %esi, %r10d
jmp 0x6530
subl -0x4(%rax), %r10d
movl -0x8(%rax), %ecx
movq -0x18(%rax), %rbp
movl %r10d, %r13d
cmpl %ebp, %r10d
jl 0x653f
movl %ebp, %r13d
movq %rbp, %r11
shrq $0x20, %r11
movl (%r12,%r11,8), %r9d
movl 0x4(%r12,%r11,8), %r15d
movl %r9d, %esi
movl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
andl %edi, %esi
subl %esi, %r15d
movq 0x20(%rsp), %rsi
movl 0x10(%rsi), %esi
movl -0x10(%rax), %r8d
movl %r15d, %ebx
subl %r8d, %ebx
cmpl %ecx, %ebx
movl %ecx, %r14d
cmovbl %ebx, %r14d
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl %r13d, 0x14(%rsp)
cmpl %esi, %r13d
jg 0x6616
cmpl %esi, %r14d
jg 0x6616
movl %r8d, %esi
subl %ebp, %esi
xorps %xmm0, %xmm0
cvtsi2ss %rsi, %xmm0
addl %r14d, %esi
addl 0x14(%rsp), %esi
xorps %xmm1, %xmm1
cvtsi2ss %rsi, %xmm1
movq %r12, %r13
movq 0x20(%rsp), %r12
mulss 0x18(%r12), %xmm1
movq %r13, %r12
ucomiss %xmm0, %xmm1
ja 0x6616
movq 0x20(%rsp), %rdi
movl 0x14(%rdi), %r13d
cmpl %r10d, %ebp
jg 0x65dd
movl $0xfffffffe, %edi       # imm = 0xFFFFFFFE
cmpl %ecx, %ebx
jbe 0x6616
cmpl %r10d, %ebp
jl 0x65eb
movl $0xfffffffd, %edi       # imm = 0xFFFFFFFD
cmpl %ecx, %ebx
jae 0x6616
movl $0xfffffffc, %edi       # imm = 0xFFFFFFFC
cmpl %r13d, %esi
jb 0x6616
addl %r8d, %ecx
subl %ecx, %r15d
subl %r10d, %ebp
cmovlel %r15d, %ebp
addl 0x14(%rsp), %r14d
addl -0x4(%rax), %r14d
subl -0x8(%rax), %r14d
cmpl %r13d, %r14d
jb 0x6616
movl %ebp, %edi
cmpl $-0x2, %edi
je 0x6635
cmpl $-0x3, %edi
movq 0x30(%rsp), %r14
jne 0x6648
movq 0x40(%rsp), %rcx
leaq (%r12,%rcx,8), %rcx
movl 0x2c(%rsp), %r9d
jmp 0x663e
leaq (%r12,%r11,8), %rcx
movq 0x30(%rsp), %r14
orl $0x80000000, %r9d       # imm = 0x80000000
movl %r9d, (%rcx)
addq $0x20, %rax
decq %rdx
jne 0x64f3
movq 0x8(%rsp), %rax
cmpl $0x0, (%rax)
je 0x6690
movl $0xc, %eax
xorl %ecx, %ecx
cmpl $0x0, (%r12,%rcx,8)
jns 0x667d
movq 0x8(%rsp), %rdx
movq 0x8(%rdx), %rdx
orl $0x80000000, (%rdx,%rax) # imm = 0x80000000
incq %rcx
movq 0x8(%rsp), %rdx
movl (%rdx), %edx
addq $0x10, %rax
cmpq %rdx, %rcx
jb 0x6666
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movq 0x18(%rsp), %rdx
callq 0x55f2
movq %rbx, %rdi
callq 0x35b5
cmpq $0x0, 0x38(%rsp)
je 0x66d2
xorl %ecx, %ecx
movslq (%rax,%rcx,4), %rdx
testq %rdx, %rdx
js 0x66c8
movq (%r12,%rcx,8), %rsi
movq %rsi, (%r12,%rdx,8)
incq %rcx
cmpq %rcx, 0x38(%rsp)
jne 0x66b7
xorl %r12d, %r12d
testq %r14, %r14
je 0x6737
movq 0x18(%rsp), %rcx
movq (%rcx), %rdx
movq %rdx, %rsi
shrq $0x20, %rsi
movslq (%rax,%rsi,4), %rsi
testq %rsi, %rsi
js 0x672e
movl 0xc(%rcx), %edi
movl (%rax,%rdi,4), %edi
testl %edi, %edi
js 0x672e
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
movq 0x18(%rsp), %rsi
movups %xmm0, 0x10(%rsi,%r12)
movups (%rcx), %xmm0
movups %xmm0, (%rsi,%r12)
movq %rdx, %r12
addq $0x20, %rcx
decq %r14
jne 0x66df
movq %rax, %rdi
callq 0x1040
leaq 0x89f2(%rip), %rax      # 0xf138
cmpl $0x3, (%rax)
jge 0x675d
movq %r12, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8894(%rip), %rax      # 0xeff8
movq (%rax), %r14
xorl %eax, %eax
callq 0x3024
movq 0x8(%rsp), %rcx
movl (%rcx), %r8d
leaq 0x3d83(%rip), %rsi      # 0xa500
leaq 0x3dc4(%rip), %rdx      # 0xa548
movq %r14, %rdi
movq %rax, %rcx
movq %r12, %r9
xorl %eax, %eax
callq 0x1120
jmp 0x674b
nop