// File: /workspace/github_c_makefile_star2_O0/ToniWestbrook[P]paladin/bwamem_pair.c
// Function: cal_sub
static int cal_sub(const mem_opt_t *opt, mem_alnreg_v *r)
{
	int j;
	for (j = 1; j < r->n; ++j) { // choose unique alignment
		int b_max = r->a[j].qb > r->a[0].qb? r->a[j].qb : r->a[0].qb;
		int e_min = r->a[j].qe < r->a[0].qe? r->a[j].qe : r->a[0].qe;
		if (e_min > b_max) { // have overlap
			int min_l = r->a[j].qe - r->a[j].qb < r->a[0].qe - r->a[0].qb? r->a[j].qe - r->a[j].qb : r->a[0].qe - r->a[0].qb;
			if (e_min - b_max >= min_l * opt->mask_level) break; // significant overlap
		}
	}
	return j < r->n? r->a[j].score : opt->min_seed_len * opt->a;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x1, -0x14(%rbp)
movslq -0x14(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x2df1e
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x14(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movq -0x10(%rbp), %rcx
movq 0x18(%rcx), %rcx
cmpl 0x10(%rcx), %eax
jle 0x2dde2
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x14(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movl %eax, -0x24(%rbp)
jmp 0x2ddf0
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x10(%rax), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x14(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movq -0x10(%rbp), %rcx
movq 0x18(%rcx), %rcx
cmpl 0x14(%rcx), %eax
jge 0x2de34
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x14(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movl %eax, -0x28(%rbp)
jmp 0x2de42
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x14(%rax), %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x18(%rbp), %eax
jle 0x2df0e
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x14(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movq -0x10(%rbp), %rcx
movq 0x18(%rcx), %rcx
movslq -0x14(%rbp), %rdx
imulq $0x60, %rdx, %rdx
addq %rdx, %rcx
subl 0x10(%rcx), %eax
movq -0x10(%rbp), %rcx
movq 0x18(%rcx), %rcx
movl 0x14(%rcx), %ecx
movq -0x10(%rbp), %rdx
movq 0x18(%rdx), %rdx
subl 0x10(%rdx), %ecx
cmpl %ecx, %eax
jge 0x2decb
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x14(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movq -0x10(%rbp), %rcx
movq 0x18(%rcx), %rcx
movslq -0x14(%rbp), %rdx
imulq $0x60, %rdx, %rdx
addq %rdx, %rcx
subl 0x10(%rcx), %eax
movl %eax, -0x2c(%rbp)
jmp 0x2dee4
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x14(%rax), %eax
movq -0x10(%rbp), %rcx
movq 0x18(%rcx), %rcx
subl 0x10(%rcx), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %eax
subl -0x18(%rbp), %eax
cvtsi2ss %eax, %xmm0
cvtsi2ssl -0x20(%rbp), %xmm1
movq -0x8(%rbp), %rax
mulss 0x9c(%rax), %xmm1
ucomiss %xmm1, %xmm0
jb 0x2df0c
jmp 0x2df1e
jmp 0x2df0e
jmp 0x2df10
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x2dd93
movslq -0x14(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x2df46
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x14(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movl 0x1c(%rax), %eax
movl %eax, -0x30(%rbp)
jmp 0x2df57
movq -0x8(%rbp), %rax
movl 0x78(%rax), %eax
movq -0x8(%rbp), %rcx
imull (%rcx), %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
popq %rbp
retq
nopl (%rax)