// File: /workspace/github_c_makefile_star2_O0/ToniWestbrook[P]paladin/bwamem.c
// Function: mem_mark_primary_se_core
static void mem_mark_primary_se_core(const mem_opt_t *opt, int n, mem_alnreg_t *a, int_v *z)
{ // similar to the loop in mem_chain_flt()
	int i, k, tmp;
	tmp = opt->a + opt->b;
	tmp = opt->o_del + opt->e_del > tmp? opt->o_del + opt->e_del : tmp;
	tmp = opt->o_ins + opt->e_ins > tmp? opt->o_ins + opt->e_ins : tmp;
	z->n = 0;
	kv_push(int, *z, 0);
	for (i = 1; i < n; ++i) {
		for (k = 0; k < z->n; ++k) {
			int j = z->a[k];
			int b_max = a[j].qb > a[i].qb? a[j].qb : a[i].qb;
			int e_min = a[j].qe < a[i].qe? a[j].qe : a[i].qe;
			if (e_min > b_max) { // have overlap
				int min_l = a[i].qe - a[i].qb < a[j].qe - a[j].qb? a[i].qe - a[i].qb : a[j].qe - a[j].qb;
				if (e_min - b_max >= min_l * opt->mask_level) { // significant overlap
					if (a[j].sub == 0) a[j].sub = a[i].score;
					if (a[j].score - a[i].score <= tmp && (a[j].is_alt || !a[i].is_alt))
						++a[j].sub_n;
					break;
				}
			}
		}
		if (k == z->n) kv_push(int, *z, i);
		else a[i].secondary = z->a[k];
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
movq -0x8(%rbp), %rcx
addl 0x4(%rcx), %eax
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x8(%rbp), %rcx
addl 0xc(%rcx), %eax
cmpl -0x2c(%rbp), %eax
jle 0x2744d
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x8(%rbp), %rcx
addl 0xc(%rcx), %eax
movl %eax, -0x40(%rbp)
jmp 0x27453
movl -0x2c(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
movq -0x8(%rbp), %rcx
addl 0x14(%rcx), %eax
cmpl -0x2c(%rbp), %eax
jle 0x2747f
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
movq -0x8(%rbp), %rcx
addl 0x14(%rcx), %eax
movl %eax, -0x44(%rbp)
jmp 0x27485
movl -0x2c(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x20(%rbp), %rax
movq $0x0, (%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq -0x20(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x27511
movq -0x20(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x274c3
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x50(%rbp)
jmp 0x274ce
movl $0x2, %eax
movq %rax, -0x50(%rbp)
jmp 0x274ce
movq -0x50(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x2, %rsi
leaq 0x131c3(%rip), %rdx     # 0x3a6b8
movl $0x249, %ecx            # imm = 0x249
leaq 0x13ac4(%rip), %r8      # 0x3afc5
callq 0x31d40
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x20(%rbp), %rdx
movq (%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
movl $0x0, (%rax,%rcx,4)
movl $0x1, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x27892
movl $0x0, -0x28(%rbp)
movslq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x277b2
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x28(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movslq -0x30(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movq -0x18(%rbp), %rcx
movslq -0x24(%rbp), %rdx
imulq $0x60, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x10(%rcx), %eax
jle 0x275ab
movq -0x18(%rbp), %rax
movslq -0x30(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movl %eax, -0x54(%rbp)
jmp 0x275c0
movq -0x18(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
movl %eax, -0x34(%rbp)
movq -0x18(%rbp), %rax
movslq -0x30(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movq -0x18(%rbp), %rcx
movslq -0x24(%rbp), %rdx
imulq $0x60, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x14(%rcx), %eax
jge 0x27603
movq -0x18(%rbp), %rax
movslq -0x30(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movl %eax, -0x58(%rbp)
jmp 0x27618
movq -0x18(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movl %eax, -0x58(%rbp)
movl -0x58(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x34(%rbp), %eax
jle 0x277a2
movq -0x18(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movq -0x18(%rbp), %rcx
movslq -0x24(%rbp), %rdx
imulq $0x60, %rdx, %rdx
addq %rdx, %rcx
subl 0x10(%rcx), %eax
movq -0x18(%rbp), %rcx
movslq -0x30(%rbp), %rdx
imulq $0x60, %rdx, %rdx
addq %rdx, %rcx
movl 0x14(%rcx), %ecx
movq -0x18(%rbp), %rdx
movslq -0x30(%rbp), %rsi
imulq $0x60, %rsi, %rsi
addq %rsi, %rdx
subl 0x10(%rdx), %ecx
cmpl %ecx, %eax
jge 0x2769f
movq -0x18(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movq -0x18(%rbp), %rcx
movslq -0x24(%rbp), %rdx
imulq $0x60, %rdx, %rdx
addq %rdx, %rcx
subl 0x10(%rcx), %eax
movl %eax, -0x5c(%rbp)
jmp 0x276c6
movq -0x18(%rbp), %rax
movslq -0x30(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movq -0x18(%rbp), %rcx
movslq -0x30(%rbp), %rdx
imulq $0x60, %rdx, %rdx
addq %rdx, %rcx
subl 0x10(%rcx), %eax
movl %eax, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x38(%rbp), %eax
subl -0x34(%rbp), %eax
cvtsi2ss %eax, %xmm0
cvtsi2ssl -0x3c(%rbp), %xmm1
movq -0x8(%rbp), %rax
mulss 0x9c(%rax), %xmm1
ucomiss %xmm1, %xmm0
jb 0x277a0
movq -0x18(%rbp), %rax
movslq -0x30(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x24(%rax)
jne 0x27729
movq -0x18(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movl 0x1c(%rax), %ecx
movq -0x18(%rbp), %rax
movslq -0x30(%rbp), %rdx
imulq $0x60, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x24(%rax)
movq -0x18(%rbp), %rax
movslq -0x30(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movl 0x1c(%rax), %eax
movq -0x18(%rbp), %rcx
movslq -0x24(%rbp), %rdx
imulq $0x60, %rdx, %rdx
addq %rdx, %rcx
subl 0x1c(%rcx), %eax
cmpl -0x2c(%rbp), %eax
jg 0x2779e
movq -0x18(%rbp), %rax
movslq -0x30(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movl 0x48(%rax), %eax
sarl $0x1e, %eax
cmpl $0x0, %eax
jne 0x27786
movq -0x18(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movl 0x48(%rax), %eax
sarl $0x1e, %eax
cmpl $0x0, %eax
jne 0x2779e
movq -0x18(%rbp), %rax
movslq -0x30(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movl 0x30(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x30(%rax)
jmp 0x277b2
jmp 0x277a2
jmp 0x277a4
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x2754b
movslq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq (%rcx), %rax
jne 0x27861
jmp 0x277c5
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq -0x20(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x27840
movq -0x20(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x277f2
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x68(%rbp)
jmp 0x277fd
movl $0x2, %eax
movq %rax, -0x68(%rbp)
jmp 0x277fd
movq -0x68(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x2, %rsi
leaq 0x12e94(%rip), %rdx     # 0x3a6b8
movl $0x259, %ecx            # imm = 0x259
leaq 0x13795(%rip), %r8      # 0x3afc5
callq 0x31d40
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movl -0x24(%rbp), %edx
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x20(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movl %edx, (%rax,%rcx,4)
jmp 0x27882
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x28(%rbp), %rcx
movl (%rax,%rcx,4), %ecx
movq -0x18(%rbp), %rax
movslq -0x24(%rbp), %rdx
imulq $0x60, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x3c(%rax)
jmp 0x27884
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x27538
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax,%rax)