// File: /workspace/github_c_makefile_star2_O0/lh3[P]minimap2/align.c
// Function: mm_fix_bad_ends_splice
static void mm_fix_bad_ends_splice(void *km, const mm_mapopt_t *opt, const mm_idx_t *mi, const mm_reg1_t *r, const int8_t mat[25], int qlen, uint8_t *qseq0[2], const mm128_t *a, int *as1, int *cnt1)
{ // this assumes a very crude k-mer based mode; it is not necessary to use a good model just for filtering bounary exons
	int score;
	double log_gap;
	*as1 = r->as, *cnt1 = r->cnt;
	if (r->cnt < 3) return;
	log_gap = log((int32_t)a[r->as + 1].x - (int32_t)a[r->as].x);
	if ((a[r->as].y>>32&0xff) < log_gap + opt->anchor_ext_shift) {
		score = mm_seed_ext_score(km, opt, mi, mat, qlen, qseq0, &a[r->as]);
		if ((double)score / mat[0] < log_gap + opt->anchor_ext_shift) // a more exact format is "score < log_4(gap) + shift"
			++(*as1), --(*cnt1);
	}
	log_gap = log((int32_t)a[r->as + r->cnt - 1].x - (int32_t)a[r->as + r->cnt - 2].x);
	if ((a[r->as + r->cnt - 1].y>>32&0xff) < log_gap + opt->anchor_ext_shift) {
		score = mm_seed_ext_score(km, opt, mi, mat, qlen, qseq0, &a[r->as + r->cnt - 1]);
		if ((double)score / mat[0] < log_gap + opt->anchor_ext_shift)
			--(*cnt1);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
movq -0x20(%rbp), %rax
movl 0x28(%rax), %ecx
movq 0x20(%rbp), %rax
movl %ecx, (%rax)
movq -0x20(%rbp), %rax
movl 0x4(%rax), %ecx
movq 0x28(%rbp), %rax
movl %ecx, (%rax)
movq -0x20(%rbp), %rax
cmpl $0x3, 0x4(%rax)
jge 0x26449
jmp 0x26626
movq 0x18(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq 0x28(%rcx), %rdx
shlq $0x4, %rdx
movl (%rax,%rdx), %ecx
movl 0x10(%rax,%rdx), %eax
subl %ecx, %eax
cvtsi2sd %eax, %xmm0
callq 0x21e0
movsd %xmm0, -0x38(%rbp)
movq 0x18(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq 0x28(%rcx), %rcx
shlq $0x4, %rcx
movzbl 0xc(%rax,%rcx), %eax
cvtsi2sd %eax, %xmm1
movsd -0x38(%rbp), %xmm0
movq -0x10(%rbp), %rax
cvtsi2sdl 0xa8(%rax), %xmm2
addsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x26522
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x28(%rbp), %rcx
movl -0x2c(%rbp), %r8d
movq 0x10(%rbp), %r9
movq 0x18(%rbp), %rax
movq -0x20(%rbp), %r10
movslq 0x28(%r10), %r10
shlq $0x4, %r10
addq %r10, %rax
movq %rax, (%rsp)
callq 0x28a90
movl %eax, -0x30(%rbp)
cvtsi2sdl -0x30(%rbp), %xmm1
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cvtsi2sd %eax, %xmm0
divsd %xmm0, %xmm1
movsd -0x38(%rbp), %xmm0
movq -0x10(%rbp), %rax
cvtsi2sdl 0xa8(%rax), %xmm2
addsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x26520
movq 0x20(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq 0x28(%rbp), %rax
movl (%rax), %ecx
addl $-0x1, %ecx
movl %ecx, (%rax)
jmp 0x26522
movq 0x18(%rbp), %rcx
movq -0x20(%rbp), %rax
movl 0x4(%rax), %edx
movl 0x28(%rax), %eax
movl %edx, %esi
movl %eax, %edx
leal -0x1(%rdx,%rsi), %eax
cltq
shlq $0x4, %rax
movl (%rcx,%rax), %eax
leal -0x2(%rdx,%rsi), %edx
movslq %edx, %rdx
shlq $0x4, %rdx
movl (%rcx,%rdx), %ecx
subl %ecx, %eax
cvtsi2sd %eax, %xmm0
callq 0x21e0
movsd %xmm0, -0x38(%rbp)
movq 0x18(%rbp), %rax
movq -0x20(%rbp), %rdx
movl 0x4(%rdx), %ecx
movl 0x28(%rdx), %esi
movl %ecx, %edx
movl %esi, %ecx
leal -0x1(%rcx,%rdx), %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
movzbl 0xc(%rax,%rcx), %eax
cvtsi2sd %eax, %xmm1
movsd -0x38(%rbp), %xmm0
movq -0x10(%rbp), %rax
cvtsi2sdl 0xa8(%rax), %xmm2
addsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x26626
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x28(%rbp), %rcx
movl -0x2c(%rbp), %r8d
movq 0x10(%rbp), %r9
movq 0x18(%rbp), %rax
movq -0x20(%rbp), %r10
movl 0x28(%r10), %r10d
movq -0x20(%rbp), %r11
addl 0x4(%r11), %r10d
subl $0x1, %r10d
movslq %r10d, %r10
shlq $0x4, %r10
addq %r10, %rax
movq %rax, (%rsp)
callq 0x28a90
movl %eax, -0x30(%rbp)
cvtsi2sdl -0x30(%rbp), %xmm1
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cvtsi2sd %eax, %xmm0
divsd %xmm0, %xmm1
movsd -0x38(%rbp), %xmm0
movq -0x10(%rbp), %rax
cvtsi2sdl 0xa8(%rax), %xmm2
addsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x26624
movq 0x28(%rbp), %rax
movl (%rax), %ecx
addl $-0x1, %ecx
movl %ecx, (%rax)
jmp 0x26626
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)