// File: /workspace/github_c_makefile_star2_O2/lh3[P]miniprot/map.c
// Function: mp_map
mp_reg1_t *mp_map(const mp_idx_t *mi, int qlen, const char *seq, int *n_reg, mp_tbuf_t *b, const mp_mapopt_t *opt, const char *qname)
{
	void *km = b->km;
	const mp_idxopt_t *io = &mi->opt;
	mp64_v sd = {0,0,0};
	mp_reg1_t *reg;
	int32_t i, n_u, max_occ, is_splice = !(opt->flag&MP_F_NO_SPLICE);
	int64_t k, n_a = 0, n_kmer;
	uint64_t *a, *u;

	*n_reg = 0;
	n_kmer = mp_n_bucket(&mi->opt);
	mp_sketch_prot(km, seq, qlen, io->kmer, io->mod_bit, &sd);
	radix_sort_mp64(sd.a, sd.a + sd.n);

	if (sd.n >= 8) {
		max_occ = mp_cal_max_occ(km, mi, sd.n, sd.a);
		if (max_occ > opt->max_occ) max_occ = opt->max_occ;
	} else max_occ = opt->max_occ;

	for (i = 0; i < sd.n; ++i) {
		int64_t en = (sd.a[i]>>32) + 1 < n_kmer? mi->ki[(sd.a[i]>>32) + 1] : mi->n_kb;
		int64_t n = en - mi->ki[sd.a[i]>>32];
		if (n <= max_occ) n_a += n;
	}
	a = Kmalloc(km, uint64_t, n_a);
	for (i = 0, k = 0; i < sd.n; ++i) {
		int64_t j, st = mi->ki[sd.a[i]>>32];
		int64_t en = (sd.a[i]>>32) + 1 < n_kmer? mi->ki[(sd.a[i]>>32) + 1] : mi->n_kb;
		if (en - st <= max_occ)
			for (j = st; j < en; ++j)
				a[k++] = (uint64_t)mi->kb[j] << 32 | (uint32_t)sd.a[i];
	}
	kfree(km, sd.a);
	radix_sort_mp64(a, a + n_a);

	if (mp_dbg_flag & MP_DBG_ANCHOR) {
		for (k = 0; k < n_a; ++k) {
			i = mp_idx_block2pos(mi, a[k]>>32);
			fprintf(stderr, "X\t%ld\t%s\t%c\t%ld\t%d\n", (long)(a[k]>>32), mi->nt->ctg[i>>1].name, "+-"[i&1], (long)((a[k]>>32) - mi->bo[i]) << mi->opt.bbit, (uint32_t)a[k]);
		}
	}

	if (!(opt->flag & MP_F_NO_PRE_CHAIN) && is_splice) {
		int32_t w = 1<<mi->opt.bbit;
		a = mp_chain(w, w, w, opt->max_chn_max_skip, opt->max_chn_iter, 2, 0, opt->chn_coef_log, is_splice, mi->opt.kmer, mi->opt.bbit, n_a, a, &n_u, &u, km);
		for (i = 0, n_a = 0; i < n_u; ++i) n_a += (uint32_t)u[i];
		kfree(km, u);
		radix_sort_mp64(a, a + n_a);
	}

	a = mp_chain(opt->max_intron, opt->max_gap, opt->bw, opt->max_chn_max_skip, opt->max_chn_iter, opt->min_chn_cnt, opt->min_chn_sc, opt->chn_coef_log,
				 is_splice, mi->opt.kmer, mi->opt.bbit, n_a, a, &n_u, &u, km);
	reg = mp_reg_gen_from_block(0, mi, n_u, u, a, n_reg);
	kfree(km, u);
	mp_sort_reg(km, n_reg, reg);
	mp_set_parent(km, opt->mask_level, opt->mask_len, *n_reg, reg, mi->opt.kmer, 0);
	mp_select_sub(km, opt->pri_ratio * opt->pri_ratio, mi->opt.kmer * 2, opt->best_n, n_reg, reg);

	if (mp_dbg_flag & MP_DBG_CHAIN)
		mp_dbg_chain(mi, *n_reg, reg, a, mi->opt.bbit, "Y1");

	if (!(mp_dbg_flag & MP_DBG_NO_REFINE)) {
		int32_t nr = 0;
		uint64_t *ext;
		ext = mp_cal_max_ext(km, 0, *n_reg, reg, a, 100, opt->max_ext);
		for (i = 0; i < *n_reg; ++i) {
			mp_refine_reg(km, mi, opt, seq, qlen, &reg[i], ext[i]>>32, (int32_t)ext[i]);
			if (reg[i].cnt > 0)
				reg[nr++] = reg[i];
		}
		*n_reg = nr;
		kfree(km, ext);
		kfree(km, a);
		a = mp_collate_a(km, *n_reg, reg);
		mp_sort_reg(km, n_reg, reg);
		//mp_dbg_chain(mi, *n_reg, reg, a, 0, "Y2");
		mp_set_parent(km, opt->mask_level, opt->mask_len, *n_reg, reg, mi->opt.kmer, 0);
		mp_select_sub(km, opt->pri_ratio * opt->pri_ratio, mi->opt.kmer * 2, opt->best_n, n_reg, reg);
	}
	if (!(opt->flag & MP_F_NO_ALIGN)) {
		int32_t k;
		uint64_t *ext = 0;
		ext = mp_cal_max_ext(km, mi->nt, *n_reg, reg, a, 100, opt->max_intron/2); // opt->max_intron/2 for consistency with mp_align()
		for (i = k = 0; i < *n_reg; ++i) {
			mp_align(km, opt, mi, qlen, seq, &reg[i], ext[i]>>32, (int32_t)ext[i]);
			if (reg[i].p) reg[k++] = reg[i];
		}
		*n_reg = k;
		if (ext) kfree(km, ext);
		mp_sort_reg(km, n_reg, reg);
		mp_select_multi_exon(*n_reg, reg, opt->io);
		mp_set_parent(km, opt->mask_level, opt->mask_len, *n_reg, reg, mi->opt.kmer, 0);
		mp_select_sub(km, opt->pri_ratio, mi->opt.kmer * 2, opt->best_n, n_reg, reg);
	}
	kfree(km, a);
	return reg;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %r9, %r15
movl %esi, %r9d
movq (%r8), %r12
xorpd %xmm0, %xmm0
leaq 0x80(%rsp), %r14
movapd %xmm0, (%r14)
movl (%r15), %eax
movq %rcx, 0x18(%rsp)
andl $0x0, (%rcx)
movq %rdi, %rbp
andl $0x1, %eax
movl %eax, 0x8(%rsp)
movl 0x8(%rdi), %eax
movl 0xc(%rdi), %r8d
leal (,%rax,4), %ecx
subl %r8d, %ecx
pushq $0x1
popq %rsi
movl %esi, %ebx
shll %cl, %ebx
movq %r12, %rdi
movq %rdx, 0xa8(%rsp)
movq %rdx, %rsi
movl %r9d, 0x58(%rsp)
movl %r9d, %edx
movl %eax, %ecx
movq %r14, %r9
callq 0xbb50
movq 0x8(%r14), %rdi
movslq (%r14), %rax
leaq (%rdi,%rax,8), %rsi
callq 0x3a66
movslq (%r14), %r14
cmpq $0x8, %r14
movq %r12, 0x38(%rsp)
movq %r15, 0x10(%rsp)
movq %rbp, (%rsp)
jl 0x4a7a
movq 0x88(%rsp), %r13
leaq (,%r14,8), %rsi
movq %r12, %rdi
callq 0x7460
movq %rax, %r15
movl 0x8(%rbp), %ecx
shll $0x2, %ecx
subl 0xc(%rbp), %ecx
pushq $0x1
popq %rax
shll %cl, %eax
cltq
leaq 0x20(%rbp), %rcx
movq 0x28(%rbp), %rdx
xorl %esi, %esi
cmpq %rsi, %r14
je 0x4a83
movq (%r13,%rsi,8), %rdi
shrq $0x20, %rdi
leaq 0x1(%rdi), %r8
cmpq %rax, %r8
leaq 0x8(%rdx,%rdi,8), %rdi
movq %rcx, %r8
cmovbq %rdi, %r8
movq (%r8), %r8
subq -0x8(%rdi), %r8
movq %r8, (%r15,%rsi,8)
incq %rsi
jmp 0x4a49
movl 0x10(%r15), %ecx
jmp 0x4b4e
leaq (%r15,%r14,8), %rsi
movq %r15, %rdi
callq 0x3a66
cvtsi2sd %r14d, %xmm0
movsd 0xdc6c(%rip), %xmm1     # 0x12708
mulsd %xmm0, %xmm1
movsd 0xc580(%rip), %xmm2     # 0x11028
addsd %xmm2, %xmm1
cvttsd2si %xmm1, %rax
mulsd 0xdc57(%rip), %xmm0     # 0x12710
addsd %xmm2, %xmm0
cvttsd2si %xmm0, %rcx
movq (%r15,%rcx,8), %r14
movq %r14, %r12
subq (%r15,%rax,8), %r12
movq 0x38(%rsp), %rdi
movq %r15, %rsi
callq 0x736b
movq %r14, %xmm0
movq 0xdc49(%rip), %xmm1     # 0x12730
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0xdc4d(%rip), %xmm2     # 0x12740
subpd %xmm2, %xmm0
movq %r12, %xmm3
movq 0x38(%rsp), %r12
punpckldq %xmm1, %xmm3    # xmm3 = xmm3[0],xmm1[0],xmm3[1],xmm1[1]
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
subpd %xmm2, %xmm3
movapd %xmm3, %xmm2
unpckhpd %xmm3, %xmm2            # xmm2 = xmm2[1],xmm3[1]
addsd %xmm3, %xmm2
mulsd 0xdbf3(%rip), %xmm2     # 0x12718
addsd %xmm0, %xmm1
addsd %xmm1, %xmm2
addsd 0xdbeb(%rip), %xmm2     # 0x12720
cvttsd2si %xmm2, %ecx
movq 0x10(%rsp), %rax
movl 0x10(%rax), %eax
cmpl %ecx, %eax
cmovll %eax, %ecx
movl 0x80(%rsp), %r14d
movl 0x8(%rsp), %eax
xorl $0x1, %eax
movq %rax, 0x50(%rsp)
movq 0x88(%rsp), %rax
movq (%rsp), %rdi
leaq 0x20(%rdi), %rbp
movslq %ecx, %r15
xorl %ecx, %ecx
testl %r14d, %r14d
cmovlel %ecx, %r14d
xorl %r13d, %r13d
cmpq %rcx, %r14
je 0x4bb3
movq (%rax,%rcx,8), %rdx
shrq $0x20, %rdx
leaq 0x1(%rdx), %rsi
cmpq %rbx, %rsi
movq 0x28(%rdi), %rsi
leaq 0x8(%rsi,%rdx,8), %rsi
movq %rbp, %rdx
cmovbq %rsi, %rdx
movq (%rdx), %rdx
subq -0x8(%rsi), %rdx
cmpq %r15, %rdx
jle 0x4bab
xorl %edx, %edx
addq %rdx, %r13
incq %rcx
jmp 0x4b79
leaq (,%r13,8), %rsi
movq %r12, %rdi
callq 0x7460
movq (%rsp), %r11
movq %rax, %r14
movl 0x80(%rsp), %eax
movq 0x88(%rsp), %rcx
xorl %edx, %edx
testl %eax, %eax
cmovlel %edx, %eax
xorl %esi, %esi
cmpq %rax, %rdx
je 0x4c40
movq 0x28(%r11), %rdi
movq (%rcx,%rdx,8), %r8
shrq $0x20, %r8
leaq (%rdi,%r8,8), %r9
addq $0x8, %r9
movq -0x8(%r9), %rdi
incq %r8
cmpq %rbx, %r8
cmovaeq %rbp, %r9
movq (%r9), %r8
movq %r8, %r9
subq %rdi, %r9
cmpq %r15, %r9
jle 0x4c1c
incq %rdx
jmp 0x4be2
cmpq %r8, %rdi
jge 0x4c17
movq 0x38(%r11), %r9
movl (%r9,%rdi,4), %r9d
shlq $0x20, %r9
movl (%rcx,%rdx,8), %r10d
orq %r9, %r10
movq %r10, (%r14,%rsi,8)
incq %rsi
incq %rdi
jmp 0x4c1c
movq 0x88(%rsp), %rsi
movq %r12, %rdi
callq 0x736b
leaq (%r14,%r13,8), %rsi
movq %r14, %rdi
callq 0x3a66
movq (%rsp), %r11
leaq 0x13b29(%rip), %rax     # 0x18790
testb $0x10, (%rax)
jne 0x4cf9
movq 0x10(%rsp), %rdx
movl (%rdx), %eax
andl $0x40, %eax
orl 0x8(%rsp), %eax
jne 0x4dbb
movl (%r11), %eax
movl %eax, %ecx
pushq $0x1
popq %rdi
shll %cl, %edi
movl 0x8(%r11), %r10d
movl 0x34(%rdx), %ecx
movl 0x38(%rdx), %r8d
movss 0x40(%rdx), %xmm0
subq $0x8, %rsp
leaq 0x70(%rsp), %rbx
leaq 0x64(%rsp), %r15
pushq $0x2
popq %r9
movl %edi, %esi
movl %edi, %edx
pushq %r12
pushq %rbx
pushq %r15
pushq %r14
pushq %r13
pushq %rax
pushq %r10
pushq 0x90(%rsp)
pushq $0x0
callq 0xc400
addq $0x50, %rsp
movq %rax, %r14
movl (%r15), %eax
movq (%rbx), %rsi
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
xorl %r13d, %r13d
cmpq %rcx, %rax
je 0x4da3
movl (%rsi,%rcx,8), %edx
addq %rdx, %r13
incq %rcx
jmp 0x4ce5
testq %r13, %r13
movl $0x0, %ebx
cmovgq %r13, %rbx
leaq 0xda58(%rip), %rbp      # 0x12764
xorl %r15d, %r15d
cmpq %r15, %rbx
je 0x4c70
movl 0x4(%r14,%r15,8), %esi
movq %r11, %rdi
callq 0x3fca
movq 0x132c4(%rip), %rcx     # 0x17ff0
movq (%rcx), %rdi
movq (%r14,%r15,8), %r11
movq %r11, %rdx
shrq $0x20, %rdx
movq (%rsp), %rcx
movq 0x18(%rcx), %rcx
movq 0x28(%rcx), %rcx
movl %eax, %esi
sarl %esi
movslq %esi, %rsi
imulq $0x18, %rsi, %rsi
movq 0x10(%rcx,%rsi), %r10
movslq %eax, %rcx
andl $0x1, %eax
movsbl (%rax,%rbp), %r8d
movq (%rsp), %rax
movq 0x30(%rax), %rax
movl (%rax,%rcx,4), %eax
movq %rdx, %r9
subq %rax, %r9
movq (%rsp), %rax
movb (%rax), %cl
shlq %cl, %r9
subq $0x8, %rsp
leaq 0xd9ca(%rip), %rsi      # 0x12750
movq %r10, %rcx
xorl %eax, %eax
pushq %r11
callq 0x21e0
movq 0x10(%rsp), %r11
addq $0x10, %rsp
incq %r15
jmp 0x4d0f
movq %r12, %rdi
callq 0x736b
leaq (%r14,%r13,8), %rsi
movq %r14, %rdi
callq 0x3a66
movq (%rsp), %r11
movq 0x10(%rsp), %rbp
movl 0x14(%rbp), %esi
movl 0x18(%rbp), %edi
movl 0x24(%rbp), %edx
movl 0x34(%rbp), %ecx
movl 0x38(%rbp), %r8d
movl 0x30(%rbp), %r9d
movl 0x3c(%rbp), %eax
movq %rax, 0x8(%rsp)
movss 0x40(%rbp), %xmm0
movl (%r11), %r10d
movq %r11, %rbx
movl 0x8(%r11), %r15d
subq $0x8, %rsp
leaq 0x70(%rsp), %rax
leaq 0x64(%rsp), %r11
pushq %r12
pushq %rax
pushq %r11
pushq %r14
pushq %r13
movq %rbp, %r13
pushq %r10
pushq %r15
pushq 0x90(%rsp)
pushq 0x50(%rsp)
callq 0xc400
addq $0x50, %rsp
leaq 0x5c(%rsp), %rcx
movl (%rcx), %edx
leaq 0x68(%rsp), %rcx
movq (%rcx), %rcx
xorl %edi, %edi
movq %rbx, %rsi
movq %rax, 0x48(%rsp)
movq %rax, %r8
movq 0x18(%rsp), %r14
movq %r14, %r9
callq 0xcf43
movq %rax, %rbp
leaq 0x68(%rsp), %rax
movq (%rax), %rsi
movq %r12, %rdi
callq 0x736b
movq %r12, %rdi
movq %r14, %rsi
movq %rbp, %rdx
callq 0xd296
movss 0x44(%r13), %xmm0
movl 0x48(%r13), %esi
movl (%r14), %edx
movl 0x8(%rbx), %r8d
movq %r12, %rdi
movq %rbp, %rcx
xorl %r9d, %r9d
callq 0xd458
movss 0x4c(%r13), %xmm0
mulss %xmm0, %xmm0
movl 0x8(%rbx), %esi
addl %esi, %esi
movl 0x58(%r13), %edx
movq %r12, %rdi
movq %r14, %rcx
movq %rbp, 0x8(%rsp)
movq %rbp, %r8
callq 0xd873
leaq 0x138dd(%rip), %rax     # 0x18790
movl (%rax), %eax
testb $0x20, %al
je 0x4fb4
movq 0x18(%rsp), %rax
movl (%rax), %ebx
movq (%rsp), %rax
movl (%rax), %r14d
testl %ebx, %ebx
movl $0x0, %eax
cmovlel %eax, %ebx
xorl %r13d, %r13d
cmpq %rbx, %r13
je 0x4fa6
imulq $0x68, %r13, %r15
addq 0x8(%rsp), %r15
xorl %ebp, %ebp
cmpl 0x4(%r15), %ebp
jge 0x4f9e
movslq (%r15), %rax
addq %rbp, %rax
movq 0x48(%rsp), %rcx
movq (%rcx,%rax,8), %r10
movq %r10, %r8
shrq $0x20, %r8
testl %r14d, %r14d
jle 0x4f2e
movq (%rsp), %rdx
movq 0x30(%rdx), %rcx
movl 0x30(%r15), %eax
movl (%rcx,%rax,4), %ecx
movq %r8, %r11
subq %rcx, %r11
movl %r14d, %ecx
shlq %cl, %r11
jmp 0x4f3d
movq 0x40(%r15), %r11
addq %r8, %r11
movl 0x30(%r15), %eax
movq (%rsp), %rdx
movq 0x130ac(%rip), %rcx     # 0x17ff0
movq (%rcx), %rdi
movq 0x18(%rdx), %rcx
movq 0x28(%rcx), %rcx
movl %eax, %edx
shrl %edx
imulq $0x18, %rdx, %rdx
movq 0x10(%rcx,%rdx), %r9
andl $0x1, %eax
leaq 0xd7fe(%rip), %rcx      # 0x12764
movsbl (%rax,%rcx), %r12d
subq $0x8, %rsp
leaq 0xd804(%rip), %rsi      # 0x1277a
leaq 0xd7ea(%rip), %rdx      # 0x12767
movl %r13d, %ecx
xorl %eax, %eax
pushq %r10
pushq %r11
pushq %r12
callq 0x21e0
addq $0x20, %rsp
incq %rbp
movq 0x38(%rsp), %r12
jmp 0x4eec
incq %r13
jmp 0x4ed8
leaq 0x137e3(%rip), %rax     # 0x18790
movl (%rax), %eax
movq 0x10(%rsp), %r13
pushq $0x2
popq %rdi
testb $0x4, %al
jne 0x5608
movq 0x18(%rsp), %rax
movl (%rax), %edx
movl 0x28(%r13), %eax
subq $0x8, %rsp
pushq $0x64
popq %r9
movq %r12, %rdi
xorl %esi, %esi
movq 0x10(%rsp), %rcx
movq 0x50(%rsp), %r8
pushq %rax
callq 0xdb67
popq %rcx
popq %rdx
movq %rax, 0x90(%rsp)
xorl %edx, %edx
movl $0x0, 0x44(%rsp)
movq (%rsp), %rbp
movq 0x18(%rsp), %rax
movslq (%rax), %rax
cmpq %rax, %rdx
jge 0x5579
imulq $0x68, %rdx, %rbx
movq 0x8(%rsp), %r15
leaq (%r15,%rbx), %rax
movq %rax, 0x98(%rsp)
movq 0x90(%rsp), %rax
movq %rdx, 0xa0(%rsp)
movq (%rax,%rdx,8), %rax
movl (%r13), %ecx
movq %rcx, 0x60(%rsp)
movl 0x60(%r13), %esi
movq 0x18(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl 0x30(%r15,%rbx), %edx
shrl %edx
imulq $0x18, %rdx, %rdx
movq 0x8(%rcx,%rdx), %r13
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0xb0(%rsp)
movq 0x40(%r15,%rbx), %r14
movslq %eax, %r12
sarq $0x20, %rax
subq %rax, %r14
movl $0x0, %eax
cmovleq %rax, %r14
movq %rsi, 0xd0(%rsp)
movslq %esi, %rax
movq %rax, 0x50(%rsp)
addq 0x48(%r15,%rbx), %r12
cmpq %r13, %r12
cmovgeq %r13, %r12
movq %r12, %rsi
subq %r14, %rsi
movq 0x38(%rsp), %rdi
callq 0x7460
movq 0x18(%rbp), %rdi
movl 0x30(%r15,%rbx), %r8d
movl %r8d, %esi
shrl %esi
movq %r13, %rdx
subq %r12, %rdx
subq %r14, %r13
andl $0x1, %r8d
movq %r14, 0xc8(%rsp)
cmoveq %r14, %rdx
cmoveq %r12, %r13
movq 0x38(%rsp), %r12
movq %r13, %rcx
movq %rax, %r15
movq %rax, %r9
callq 0xade7
movl 0x4(%rbp), %ecx
movl $0x80000000, %r14d      # imm = 0x80000000
subq $0x8, %rsp
movq %r12, %rdi
movq %r15, %rsi
movq %rax, %rdx
movq 0x58(%rsp), %rbx
movl %ebx, %r8d
xorl %r9d, %r9d
leaq 0x28(%rsp), %rax
pushq %rax
pushq $0x0
pushq $0x0
callq 0xbe61
addq $0x20, %rsp
movq %r12, %rdi
movq %r15, %rsi
callq 0x736b
movq %r12, %rdi
movq 0xa8(%rsp), %rsi
movl 0x58(%rsp), %edx
movl %ebx, %ecx
xorl %r8d, %r8d
leaq 0xb0(%rsp), %r9
callq 0xbb50
xorl %r13d, %r13d
pushq $0x2
popq %rbx
movslq 0xb0(%rsp), %rax
cmpq %rax, %r13
jge 0x51bb
movl 0x20(%rsp), %ecx
movq 0x28(%rsp), %rax
cmpl 0x24(%rsp), %ecx
jne 0x5199
leal (%rcx,%rcx), %edx
testl %ecx, %ecx
cmovel %ebx, %edx
movl %edx, 0x24(%rsp)
movslq %edx, %rdx
shlq $0x3, %rdx
movq %r12, %rdi
movq %rax, %rsi
callq 0x7568
movq %rax, 0x28(%rsp)
movl 0x20(%rsp), %ecx
movq 0xb8(%rsp), %rdx
movq (%rdx,%r13,8), %rdx
orq %r14, %rdx
leal 0x1(%rcx), %esi
movl %esi, 0x20(%rsp)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
incq %r13
jmp 0x5156
movq 0xb8(%rsp), %rsi
movq %r12, %rdi
callq 0x736b
movq 0x28(%rsp), %rdi
movslq 0x20(%rsp), %rax
leaq (%rdi,%rax,8), %rsi
callq 0x3a66
movl 0x20(%rsp), %eax
xorl %esi, %esi
testl %eax, %eax
movl $0x0, %ecx
cmovgl %eax, %ecx
movq 0x28(%rsp), %rdx
incl %ecx
pushq $0x1
popq %r14
movq %r14, %rdi
xorl %r8d, %r8d
movq 0x10(%rsp), %rbx
movq 0xd0(%rsp), %r15
cmpq %rcx, %rdi
je 0x5277
movslq %r8d, %r10
cmpq %rax, %rdi
je 0x5227
movq (%rdx,%rdi,8), %r9
xorq (%rdx,%r10,8), %r9
shrq $0x20, %r9
je 0x5272
cmpl %edi, %r8d
movl %edi, %r9d
cmovgl %r8d, %r9d
cmpq %rdi, %r10
jge 0x5246
testb $-0x80, 0x3(%rdx,%r10,8)
jne 0x5243
incq %r10
jmp 0x5231
movl %r10d, %r9d
movl %edi, %r10d
subl %r9d, %r10d
subl %r8d, %r9d
setle %r8b
testl %r10d, %r10d
setle %r11b
orb %r8b, %r11b
jne 0x526f
imull %r10d, %r9d
cmpl 0x2c(%rbx), %r9d
jg 0x526f
movl %r9d, %r8d
addq %r8, %rsi
movl %edi, %r8d
incq %rdi
jmp 0x520c
shlq $0x3, %rsi
movq %r12, %rdi
callq 0x7460
movq %rax, %r13
movl 0x20(%rsp), %eax
xorl %ebp, %ebp
testl %eax, %eax
movl $0x0, %ecx
cmovgl %eax, %ecx
movq 0x28(%rsp), %rsi
incl %ecx
movq %r14, %rdx
xorl %r8d, %r8d
cmpq %rcx, %rdx
je 0x5357
movslq %r8d, %rdi
cmpq %rax, %rdx
je 0x52c2
movq (%rsi,%rdx,8), %r9
xorq (%rsi,%rdi,8), %r9
shrq $0x20, %r9
je 0x5316
movq 0x28(%rsp), %r10
cmpl %edx, %r8d
movl %edx, %r9d
cmovgl %r8d, %r9d
movq %rdi, %r11
cmpq %rdx, %r11
jge 0x52e9
testb $-0x80, 0x3(%r10,%r11,8)
jne 0x52e6
incq %r11
jmp 0x52d4
movl %r11d, %r9d
movl %edx, %r10d
subl %r9d, %r10d
movl %r9d, %r11d
subl %r8d, %r11d
setle %r8b
testl %r10d, %r10d
setle %bl
orb %r8b, %bl
jne 0x5313
imull %r10d, %r11d
movq 0x10(%rsp), %r8
cmpl 0x2c(%r8), %r11d
jle 0x531b
movl %edx, %r8d
incq %rdx
jmp 0x52a3
movslq %r9d, %r8
cmpq %r8, %rdi
jge 0x5313
movq 0x28(%rsp), %r9
movq %r8, %r10
cmpq %rdx, %r10
jge 0x5352
movq (%r9,%rdi,8), %r11
shlq $0x20, %r11
movq (%r9,%r10,8), %rbx
andl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
orq %r11, %rbx
movq %rbx, (%r13,%rbp,8)
incq %rbp
incq %r10
jmp 0x532b
incq %rdi
jmp 0x531e
movq 0x60(%rsp), %rbx
notl %ebx
andl $0x1, %ebx
movq %r12, %rdi
callq 0x736b
leaq (,%rbp,8), %rsi
addq %r13, %rsi
movq %r13, %rdi
callq 0x3a66
movq 0x10(%rsp), %r10
movl 0x14(%r10), %esi
movl 0x18(%r10), %edi
movl 0x24(%r10), %edx
movl 0x34(%r10), %ecx
movl 0x38(%r10), %r8d
movl 0x30(%r10), %r9d
movl 0x3c(%r10), %eax
movss 0x40(%r10), %xmm0
subq $0x8, %rsp
pushq %r12
leaq 0x80(%rsp), %r10
pushq %r10
leaq 0x94(%rsp), %r10
pushq %r10
pushq %r13
pushq %rbp
pushq $0x0
pushq %r15
pushq %rbx
pushq %rax
callq 0xc400
addq $0x50, %rsp
movslq 0x7c(%rsp), %r9
testq %r9, %r9
je 0x5525
movq 0x70(%rsp), %rcx
movl 0x4(%rcx), %esi
xorl %edx, %edx
movq %r14, %rdi
cmpq %r9, %rdi
jge 0x5409
movslq %esi, %rsi
movq (%rcx,%rdi,8), %r8
shrq $0x20, %r8
cmpq %rsi, %r8
cmoval %edi, %edx
cmoval %r8d, %esi
incq %rdi
jmp 0x53ea
movl %edx, %edi
xorl %r8d, %r8d
xorl %esi, %esi
movq 0x98(%rsp), %r14
cmpq %r9, %r8
jge 0x542b
cmpq %r8, %rdi
je 0x542b
addl (%rcx,%r8,8), %esi
incq %r8
jmp 0x5418
movslq %edx, %r12
movq (%rcx,%r12,8), %rcx
movq %rcx, 0x60(%rsp)
movslq %ecx, %rbp
movslq %esi, %rcx
leaq (%rax,%rcx,8), %rsi
leaq (,%rbp,8), %rbx
movq %rax, %rdi
movq %rbx, %rdx
movq %r15, %r13
movq %rax, %r15
callq 0x2270
movq 0x38(%rsp), %rdi
movq %r15, %rsi
movq %r13, %r15
movq %rbx, %rdx
callq 0x760a
movq %rax, 0x50(%r14)
movq 0x70(%rsp), %rcx
movl 0x4(%rcx,%r12,8), %ecx
movl %ecx, 0x24(%r14)
movl %ebp, 0x4(%r14)
andl $0x0, (%r14)
movq (%rax), %rcx
movl %ecx, %edx
subl %r15d, %edx
incl %edx
movl %edx, 0x34(%r14)
movl -0x8(%rax,%rbp,8), %edx
incl %edx
movl %edx, 0x38(%r14)
shrq $0x20, %rcx
movq 0x50(%rsp), %rdx
leaq (%rdx,%rdx,2), %rdx
movq 0xc8(%rsp), %rdi
movq %rdi, %rsi
subq %rdx, %rsi
addq %rsi, %rcx
incq %rcx
movq %rcx, 0x40(%r14)
movl -0x4(%rax,%rbp,8), %ecx
addq %rdi, %rcx
incq %rcx
movq %rcx, 0x48(%r14)
testq %rbp, %rbp
movl $0x0, %ecx
cmovleq %rcx, %rbp
xorl %ecx, %ecx
movq 0x10(%rsp), %r13
cmpq %rcx, %rbp
je 0x54fd
movl 0x4(%rax,%rcx,8), %edx
addl %edi, %edx
subl 0x40(%r14), %edx
movl %edx, 0x4(%rax,%rcx,8)
incq %rcx
jmp 0x54e5
movq 0x60(%rsp), %rdi
movq %rax, %rsi
movl %r15d, %edx
callq 0xcedc
movl %eax, 0x28(%r14)
movq 0x70(%rsp), %rsi
movq 0x38(%rsp), %r12
movq %r12, %rdi
callq 0x736b
jmp 0x553f
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq 0x98(%rsp), %r14
movq %rax, (%r14)
andq $0x0, 0x50(%r14)
movq 0x10(%rsp), %r13
movq (%rsp), %rbp
movq 0xa0(%rsp), %rdx
cmpl $0x0, 0x4(%r14)
jle 0x5571
movl 0x44(%rsp), %ecx
movslq %ecx, %rax
incl %ecx
movl %ecx, 0x44(%rsp)
imulq $0x68, %rax, %rdi
addq 0x8(%rsp), %rdi
pushq $0xd
popq %rcx
movq %r14, %rsi
rep  movsq (%rsi), %es:(%rdi)
incq %rdx
jmp 0x4fff
movq 0x18(%rsp), %rbx
movl 0x44(%rsp), %eax
movl %eax, (%rbx)
movq %r12, %rdi
movq 0x90(%rsp), %rsi
callq 0x736b
movq %r12, %rdi
movq 0x48(%rsp), %rsi
callq 0x736b
movl (%rbx), %esi
movq %r12, %rdi
movq 0x8(%rsp), %r15
movq %r15, %rdx
callq 0xd1f9
movq %rax, 0x48(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0xd296
movss 0x44(%r13), %xmm0
movl 0x48(%r13), %esi
movl (%rbx), %edx
movl 0x8(%rbp), %r8d
movq %r12, %rdi
movq %r15, %rcx
xorl %r9d, %r9d
callq 0xd458
movss 0x4c(%r13), %xmm0
mulss %xmm0, %xmm0
movl 0x8(%rbp), %esi
addl %esi, %esi
movl 0x58(%r13), %edx
movq %r12, %rdi
movq %rbx, %rcx
movq %r15, %r8
callq 0xd873
pushq $0x2
popq %rdi
testb $0x2, (%r13)
jne 0x573f
movq (%rsp), %rax
movq 0x18(%rax), %rsi
movq 0x18(%rsp), %rax
movl (%rax), %ecx
movl 0x18(%r13), %eax
cltd
idivl %edi
subq $0x8, %rsp
pushq $0x64
popq %r9
movq %r12, %rdi
movl %ecx, %edx
movq 0x10(%rsp), %rbp
movq %rbp, %rcx
movq 0x50(%rsp), %r8
pushq %rax
callq 0xdb67
popq %rcx
popq %rdx
movq %rax, %r14
xorl %ebx, %ebx
pushq $0xd
popq %r13
xorl %r15d, %r15d
movq 0x18(%rsp), %rax
movslq (%rax), %rax
cmpq %rax, %rbx
jge 0x56bc
movq (%r14,%rbx,8), %rax
movq %rax, %r10
shrq $0x20, %r10
movq %r12, %rdi
movq 0x10(%rsp), %rsi
movq (%rsp), %rdx
movl 0x58(%rsp), %ecx
movq 0xa8(%rsp), %r8
movq %rbp, %r9
pushq %rax
pushq %r10
callq 0x5c20
popq %rax
popq %rcx
cmpq $0x0, 0x60(%rbp)
je 0x56b3
movslq %r15d, %rax
incl %r15d
imulq $0x68, %rax, %rdi
addq 0x8(%rsp), %rdi
movq %r13, %rcx
movq %rbp, %rsi
rep  movsq (%rsi), %es:(%rdi)
incq %rbx
addq $0x68, %rbp
jmp 0x5657
movq 0x18(%rsp), %rax
movl %r15d, (%rax)
testq %r14, %r14
je 0x56d4
movq %r12, %rdi
movq %r14, %rsi
callq 0x736b
movq %r12, %rdi
movq 0x18(%rsp), %rbx
movq %rbx, %rsi
movq 0x8(%rsp), %r13
movq %r13, %rdx
callq 0xd296
movl (%rbx), %edi
movq 0x10(%rsp), %r14
movl 0x6c(%r14), %edx
movq %r13, %rsi
callq 0xdae5
movss 0x44(%r14), %xmm0
movl 0x48(%r14), %esi
movl (%rbx), %edx
movq (%rsp), %r15
movl 0x8(%r15), %r8d
movq %r12, %rdi
movq %r13, %rcx
xorl %r9d, %r9d
callq 0xd458
movss 0x4c(%r14), %xmm0
movl 0x8(%r15), %esi
addl %esi, %esi
movl 0x58(%r14), %edx
movq %r12, %rdi
movq %rbx, %rcx
movq %r13, %r8
callq 0xd873
movq %r12, %rdi
movq 0x48(%rsp), %rsi
callq 0x736b
movq 0x8(%rsp), %rax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq