// File: /workspace/github_c_makefile_star2_O3/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 $0xc8, %rsp
movq %r9, %rbp
movl %esi, %r9d
movq %rdi, %r15
movq (%r8), %r12
xorpd %xmm0, %xmm0
leaq 0x80(%rsp), %r14
movapd %xmm0, (%r14)
movl (%rbp), %eax
movl %eax, 0x28(%rsp)
movq %rcx, 0x60(%rsp)
movl $0x0, (%rcx)
movl 0x8(%rdi), %eax
movl 0xc(%rdi), %r8d
leal (,%rax,4), %ecx
subl %r8d, %ecx
movl $0x1, %ebx
shll %cl, %ebx
movq %r12, %rdi
movq %rdx, 0xa8(%rsp)
movq %rdx, %rsi
movl %r9d, 0x50(%rsp)
movl %r9d, %edx
movl %eax, %ecx
movq %r14, %r9
callq 0xd404
movq 0x8(%r14), %rdi
movslq (%r14), %rax
leaq (%rdi,%rax,8), %rsi
callq 0x4a34
movslq (%r14), %r13
cmpq $0x8, %r13
movq %r12, 0x8(%rsp)
movq %rbp, 0x18(%rsp)
movq %r15, 0x20(%rsp)
jl 0x5a1b
movq %r12, %rdi
movq 0x88(%rsp), %r12
leaq (,%r13,8), %rsi
callq 0x84a5
movq %rax, %r14
movl 0x8(%r15), %ecx
shll $0x2, %ecx
subl 0xc(%r15), %ecx
movl $0x1, %eax
shll %cl, %eax
cltq
leaq 0x20(%r15), %rcx
movq 0x28(%r15), %rdx
xorl %esi, %esi
movq (%r12,%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, (%r14,%rsi,8)
incq %rsi
cmpq %rsi, %r13
jne 0x5922
leaq (%r14,%r13,8), %rsi
movq %r14, %rdi
callq 0x4a34
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
movsd 0xed9c(%rip), %xmm1     # 0x14708
mulsd %xmm0, %xmm1
movsd 0xd6a8(%rip), %xmm2     # 0x13020
addsd %xmm2, %xmm1
cvttsd2si %xmm1, %rax
mulsd 0xed87(%rip), %xmm0     # 0x14710
addsd %xmm2, %xmm0
cvttsd2si %xmm0, %rcx
movq (%r14,%rcx,8), %r15
movq %r15, %r12
subq (%r14,%rax,8), %r12
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x83df
movq %r15, %xmm0
movq 0xed79(%rip), %xmm1     # 0x14730
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0xed7d(%rip), %xmm2     # 0x14740
subpd %xmm2, %xmm0
movq %r12, %xmm3
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 0xed28(%rip), %xmm2     # 0x14718
addsd %xmm0, %xmm1
addsd %xmm1, %xmm2
addsd 0xed20(%rip), %xmm2     # 0x14720
cvttsd2si %xmm2, %eax
movq 0x18(%rsp), %rcx
movl 0x10(%rcx), %ecx
cmpl %eax, %ecx
cmovll %ecx, %eax
movl 0x80(%rsp), %r13d
jmp 0x5a1e
movl 0x10(%rbp), %eax
movslq %eax, %r12
testl %r13d, %r13d
jle 0x5a7a
movq 0x88(%rsp), %rax
movq 0x20(%rsp), %r15
leaq 0x20(%r15), %rcx
movq 0x28(%r15), %rdx
movl %r13d, %esi
xorl %edi, %edi
xorl %r14d, %r14d
movq (%rax,%rdi,8), %r8
shrq $0x20, %r8
leaq 0x1(%r8), %r9
cmpq %rbx, %r9
leaq 0x8(%rdx,%r8,8), %r9
movq %rcx, %r8
cmovbq %r9, %r8
movq (%r8), %r8
subq -0x8(%r9), %r8
cmpq %r12, %r8
jle 0x5a6d
xorl %r8d, %r8d
addq %r8, %r14
incq %rdi
cmpq %rdi, %rsi
jne 0x5a43
jmp 0x5a82
xorl %r14d, %r14d
movq 0x20(%rsp), %r15
leaq (,%r14,8), %rsi
movq 0x8(%rsp), %rdi
callq 0x84a5
movq %rax, %rbp
movslq 0x80(%rsp), %rax
movq 0x88(%rsp), %rsi
testq %rax, %rax
jle 0x5b61
movq 0x28(%r15), %rcx
leaq 0x20(%r15), %rdx
xorl %edi, %edi
xorl %r8d, %r8d
movq %r12, 0x10(%rsp)
movq (%rsi,%rdi,8), %r10
shrq $0x20, %r10
leaq (%rcx,%r10,8), %r11
addq $0x8, %r11
movq -0x8(%r11), %r9
incq %r10
cmpq %rbx, %r10
cmovaeq %rdx, %r11
movq (%r11), %r10
movq %r10, %r11
subq %r9, %r11
cmpq %r12, %r11
jg 0x5b55
cmpq %r9, %r10
jle 0x5b55
movq %rdx, %r12
movq %rcx, %rdx
movq %rax, %rcx
movq %rbx, %rax
addq %r8, %r10
subq %r9, %r10
movq %rbp, %rbx
leaq (,%r8,8), %r8
addq %rbp, %r8
shlq $0x2, %r9
addq 0x38(%r15), %r9
xorl %r15d, %r15d
movl (%r9,%r15,4), %ebp
shlq $0x20, %rbp
movl (%rsi,%rdi,8), %r13d
orq %rbp, %r13
movq %r13, (%r8,%r15,8)
incq %r15
cmpq %r15, %r11
jne 0x5b1e
movq %r10, %r8
movq 0x20(%rsp), %r15
movq %rbx, %rbp
movq %rax, %rbx
movq %rcx, %rax
movq %rdx, %rcx
movq %r12, %rdx
movq 0x10(%rsp), %r12
incq %rdi
cmpq %rax, %rdi
jne 0x5ac2
movl 0x28(%rsp), %ebx
andl $0x1, %ebx
movq 0x8(%rsp), %rdi
callq 0x83df
leaq (,%r14,8), %rsi
addq %rbp, %rsi
movq %rbp, %rdi
callq 0x4a34
leaq 0x13bf4(%rip), %rax     # 0x19780
testb $0x10, (%rax)
je 0x5b9a
testq %r14, %r14
jg 0x6657
movl %ebx, %r11d
xorl $0x1, %r11d
movq 0x18(%rsp), %rdx
movl (%rdx), %eax
andl $0x40, %eax
orl %ebx, %eax
movq %r11, 0x10(%rsp)
jne 0x5c28
movl (%r15), %eax
movl $0x1, %edi
movl %eax, %ecx
shll %cl, %edi
movl 0x8(%r15), %r10d
movl 0x34(%rdx), %ecx
movl 0x38(%rdx), %r8d
movss 0x40(%rdx), %xmm0
subq $0x8, %rsp
leaq 0xb8(%rsp), %rbx
leaq 0x5c(%rsp), %r15
movl %edi, %esi
movl %edi, %edx
movl $0x2, %r9d
pushq 0x10(%rsp)
pushq %rbx
pushq %r15
pushq %rbp
pushq %r14
pushq %rax
pushq %r10
pushq %r11
pushq $0x0
callq 0xdd60
addq $0x50, %rsp
movq %rax, %rbp
movslq (%r15), %rax
movq (%rbx), %rsi
testq %rax, %rax
jle 0x5c2f
xorl %ecx, %ecx
xorl %r14d, %r14d
movl (%rsi,%rcx,8), %edx
addq %rdx, %r14
incq %rcx
cmpq %rcx, %rax
jne 0x5c18
jmp 0x5c32
movq 0x8(%rsp), %r13
jmp 0x5c52
xorl %r14d, %r14d
movq 0x8(%rsp), %r13
movq %r13, %rdi
callq 0x83df
leaq (,%r14,8), %rsi
addq %rbp, %rsi
movq %rbp, %rdi
callq 0x4a34
movq %rbp, %r15
movq 0x18(%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, 0x28(%rsp)
movss 0x40(%rbp), %xmm0
movq 0x20(%rsp), %rbx
movl (%rbx), %r10d
movl 0x8(%rbx), %r11d
subq $0x8, %rsp
leaq 0xb8(%rsp), %r12
leaq 0x5c(%rsp), %rax
pushq %r13
pushq %r12
pushq %rax
pushq %r15
pushq %r14
pushq %r10
pushq %r11
pushq 0x50(%rsp)
movq %rbp, %r12
pushq 0x70(%rsp)
callq 0xdd60
addq $0x50, %rsp
leaq 0x54(%rsp), %rcx
movl (%rcx), %edx
leaq 0xb0(%rsp), %rbp
movq (%rbp), %rcx
xorl %edi, %edi
movq %rbx, %rsi
movq %rax, 0x48(%rsp)
movq %rax, %r8
movq 0x60(%rsp), %r15
movq %r15, %r9
callq 0xe978
movq %rax, %r14
movq (%rbp), %rsi
movq %r13, %rdi
callq 0x83df
movq %r13, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xed66
movss 0x44(%r12), %xmm0
movl 0x48(%r12), %esi
movl (%r15), %edx
movl 0x8(%rbx), %r8d
movq %r13, %rdi
movq %r14, %rcx
xorl %r9d, %r9d
callq 0xef22
movss 0x4c(%r12), %xmm0
mulss %xmm0, %xmm0
movl 0x8(%rbx), %esi
addl %esi, %esi
movl 0x58(%r12), %edx
movq %r13, %rdi
movq %r15, %rcx
movq %r14, 0x10(%rsp)
movq %r14, %r8
callq 0xf3f7
leaq 0x13a2d(%rip), %rax     # 0x19780
movl (%rax), %eax
testb $0x20, %al
movq %r13, %rbx
je 0x5e5f
movslq (%r15), %rbp
testq %rbp, %rbp
jle 0x5e5f
movq 0x20(%rsp), %rax
movl (%rax), %r14d
xorl %r12d, %r12d
imulq $0x68, %r12, %rbx
movq 0x10(%rsp), %rax
cmpl $0x0, 0x4(%rax,%rbx)
jle 0x5e3b
addq 0x10(%rsp), %rbx
xorl %r13d, %r13d
movslq (%rbx), %rax
addq %r13, %rax
movq 0x48(%rsp), %rcx
movq (%rcx,%rax,8), %r10
movq %r10, %r8
shrq $0x20, %r8
testl %r14d, %r14d
jle 0x5dcb
movq 0x20(%rsp), %rdx
movq 0x30(%rdx), %rcx
movl 0x30(%rbx), %eax
movl (%rcx,%rax,4), %ecx
movq %r8, %r11
subq %rcx, %r11
movl %r14d, %ecx
shlq %cl, %r11
jmp 0x5dda
movq 0x40(%rbx), %r11
addq %r8, %r11
movl 0x30(%rbx), %eax
movq 0x20(%rsp), %rdx
movq 0x1320f(%rip), %rcx     # 0x18ff0
movq (%rcx), %rdi
movq 0x18(%rdx), %rcx
movq 0x28(%rcx), %rcx
movl %eax, %edx
shrl %edx
leaq (%rdx,%rdx,2), %rdx
movq 0x10(%rcx,%rdx,8), %r9
andl $0x1, %eax
leaq 0xe961(%rip), %rcx      # 0x14764
movsbl (%rax,%rcx), %r15d
subq $0x8, %rsp
leaq 0xe967(%rip), %rsi      # 0x1477a
leaq 0xe94d(%rip), %rdx      # 0x14767
movl %r12d, %ecx
xorl %eax, %eax
pushq %r10
pushq %r11
pushq %r15
callq 0x21d0
addq $0x20, %rsp
incq %r13
cmpl 0x4(%rbx), %r13d
jl 0x5d93
incq %r12
cmpq %rbp, %r12
jne 0x5d77
leaq 0x13932(%rip), %rax     # 0x19780
movl (%rax), %eax
movq 0x8(%rsp), %rbx
movq 0x60(%rsp), %r15
movq 0x18(%rsp), %r12
testb $0x4, %al
jne 0x64ea
movl (%r15), %edx
movl 0x28(%r12), %eax
subq $0x8, %rsp
movq $0x0, 0x60(%rsp)
movq %rbx, %rdi
xorl %esi, %esi
movq 0x18(%rsp), %rbp
movq %rbp, %rcx
movq 0x50(%rsp), %r8
movl $0x64, %r9d
pushq %rax
callq 0xf6fc
addq $0x10, %rsp
movq %rax, 0xa0(%rsp)
cmpl $0x0, (%r15)
jle 0x6458
xorl %ecx, %ecx
movq $0x0, 0x58(%rsp)
imulq $0x68, %rcx, %r13
movq 0xa0(%rsp), %rax
movq %rcx, 0xc0(%rsp)
movq (%rax,%rcx,8), %rax
movl (%r12), %ecx
movq %rcx, 0x68(%rsp)
movl 0x60(%r12), %ecx
movq %rcx, 0x28(%rsp)
movq 0x20(%rsp), %rbx
movq 0x18(%rbx), %rcx
movq 0x28(%rcx), %rcx
movl 0x30(%rbp,%r13), %edx
shrl %edx
leaq (%rdx,%rdx,2), %rdx
movq 0x8(%rcx,%rdx,8), %r12
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x90(%rsp)
movq 0x40(%rbp,%r13), %r14
movq %rax, %rcx
sarq $0x20, %rcx
subq %rcx, %r14
movl $0x0, %ecx
cmovleq %rcx, %r14
movslq %eax, %r15
addq 0x48(%rbp,%r13), %r15
cmpq %r12, %r15
cmovgeq %r12, %r15
movq %r15, %rsi
subq %r14, %rsi
movq 0x8(%rsp), %rdi
callq 0x84a5
movq %rbp, %rcx
movq %rax, %rbp
movq 0x18(%rbx), %rdi
movl 0x30(%rcx,%r13), %r8d
movl %r8d, %esi
shrl %esi
movq %r12, %rdx
subq %r15, %rdx
subq %r14, %r12
andl $0x1, %r8d
movq %r14, 0xb8(%rsp)
cmoveq %r14, %rdx
cmoveq %r15, %r12
movq %r12, %rcx
movq 0x8(%rsp), %r14
movq %rax, %r9
callq 0xc5f2
movl 0x4(%rbx), %ecx
subq $0x8, %rsp
movq %r14, %rdi
movq %rbp, %rsi
movq %rax, %rdx
movq 0x30(%rsp), %rbx
movl %ebx, %r8d
xorl %r9d, %r9d
leaq 0x38(%rsp), %rax
pushq %rax
pushq $0x0
pushq $0x0
callq 0xd744
addq $0x20, %rsp
movq %r14, %rdi
movq %rbp, %rsi
callq 0x83df
movq %r14, %rdi
movq 0xa8(%rsp), %rsi
movl 0x50(%rsp), %edx
movl %ebx, %ecx
xorl %r8d, %r8d
leaq 0x90(%rsp), %r9
callq 0xd404
movl 0x90(%rsp), %ecx
testl %ecx, %ecx
jle 0x6068
movl 0x30(%rsp), %edx
movq 0x38(%rsp), %rax
xorl %r15d, %r15d
movq 0x18(%rsp), %r12
movl $0x2, %ebx
movl $0x80000000, %ebp       # imm = 0x80000000
cmpl 0x34(%rsp), %edx
jne 0x603f
leal (%rdx,%rdx), %ecx
testl %edx, %edx
cmovel %ebx, %ecx
movl %ecx, 0x34(%rsp)
movslq %ecx, %rdx
shlq $0x3, %rdx
movq %r14, %rdi
movq %rax, %rsi
callq 0x85ad
movq %rax, 0x38(%rsp)
movl 0x30(%rsp), %edx
movl 0x90(%rsp), %ecx
movq 0x98(%rsp), %rsi
movq (%rsi,%r15,8), %rdi
orq %rbp, %rdi
movslq %edx, %r8
incl %edx
movl %edx, 0x30(%rsp)
movq %rdi, (%rax,%r8,8)
incq %r15
movslq %ecx, %rdi
cmpq %rdi, %r15
jl 0x600b
jmp 0x6075
movq 0x98(%rsp), %rsi
movq 0x18(%rsp), %r12
movq %r14, %rdi
callq 0x83df
movq 0x38(%rsp), %rdi
movslq 0x30(%rsp), %rax
leaq (%rdi,%rax,8), %rsi
callq 0x4a34
movslq 0x30(%rsp), %rax
testq %rax, %rax
jle 0x6126
movq 0x38(%rsp), %rcx
leal 0x1(%rax), %edx
xorl %r8d, %r8d
movl $0x1, %edi
xorl %esi, %esi
movq 0x28(%rsp), %rbx
movslq %r8d, %r9
cmpq %rax, %rdi
je 0x60cb
movq (%rcx,%rdi,8), %r10
xorq (%rcx,%r9,8), %r10
shrq $0x20, %r10
je 0x6118
movl %r8d, %r10d
cmpq %r9, %rdi
jle 0x60eb
testb $-0x80, 0x3(%rcx,%r9,8)
jne 0x60e8
incq %r9
cmpq %r9, %rdi
jne 0x60d3
movl %edi, %r10d
jmp 0x60eb
movl %r9d, %r10d
movl %edi, %r9d
subl %r10d, %r9d
subl %r8d, %r10d
setle %r8b
testl %r9d, %r9d
setle %r11b
orb %r8b, %r11b
jne 0x6115
imull %r9d, %r10d
cmpl 0x2c(%r12), %r10d
jg 0x6115
movl %r10d, %r8d
addq %r8, %rsi
movl %edi, %r8d
incq %rdi
cmpq %rdx, %rdi
jne 0x60b5
shlq $0x3, %rsi
jmp 0x612d
xorl %esi, %esi
movq 0x28(%rsp), %rbx
movq %r14, %rdi
callq 0x84a5
movq %rax, %r12
movslq 0x30(%rsp), %rax
movq 0x38(%rsp), %rsi
testq %rax, %rax
jle 0x621b
leal 0x1(%rax), %ecx
xorl %r8d, %r8d
movl $0x1, %edx
xorl %ebp, %ebp
movslq %r8d, %rdi
cmpq %rax, %rdx
je 0x6172
movq (%rsi,%rdx,8), %r9
xorq (%rsi,%rdi,8), %r9
shrq $0x20, %r9
je 0x620d
movl %r8d, %r9d
cmpq %rdi, %rdx
jle 0x6190
movq %rdi, %r9
testb $-0x80, 0x3(%rsi,%r9,8)
jne 0x6190
incq %r9
cmpq %r9, %rdx
jne 0x617d
movl %edx, %r9d
movl %edx, %r10d
subl %r9d, %r10d
movl %r9d, %r11d
subl %r8d, %r11d
setle %r15b
testl %r10d, %r10d
setle %r14b
orb %r15b, %r14b
jne 0x620a
imull %r10d, %r11d
movq 0x18(%rsp), %r10
cmpl 0x2c(%r10), %r11d
setle %r10b
cmpl %r8d, %r9d
setg %r8b
andb %r10b, %r8b
cmpb $0x1, %r8b
jne 0x620a
movslq %r9d, %r8
movq 0x38(%rsp), %r9
cmpq %r8, %rdx
jle 0x6202
movq %r8, %r10
movq (%r9,%rdi,8), %r11
shlq $0x20, %r11
movq (%r9,%r10,8), %r14
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
orq %r11, %r14
movq %r14, (%r12,%rbp,8)
incq %rbp
incq %r10
cmpq %r10, %rdx
jne 0x61dd
incq %rdi
cmpq %r8, %rdi
jne 0x61d5
movl %edx, %r8d
incq %rdx
cmpq %rcx, %rdx
jne 0x6158
jmp 0x621d
xorl %ebp, %ebp
addq 0x10(%rsp), %r13
movq 0x68(%rsp), %r15
notl %r15d
andl $0x1, %r15d
movq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x83df
leaq (%r12,%rbp,8), %rsi
movq %r12, %rdi
callq 0x4a34
movq 0x18(%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 %r14
leaq 0x80(%rsp), %r10
pushq %r10
leaq 0x94(%rsp), %r10
pushq %r10
pushq %r12
pushq %rbp
pushq $0x0
pushq %rbx
pushq %r15
pushq %rax
callq 0xdd60
addq $0x50, %rsp
movl 0x7c(%rsp), %ecx
testq %rcx, %rcx
je 0x63f4
movq %rax, %r12
movq 0x70(%rsp), %rax
cmpl $0x2, %ecx
jl 0x6307
movl 0x4(%rax), %esi
xorl %edx, %edx
movl $0x1, %edi
movslq %esi, %rsi
movq (%rax,%rdi,8), %r8
shrq $0x20, %r8
cmpq %rsi, %r8
cmoval %edi, %edx
cmoval %r8d, %esi
incq %rdi
cmpq %rdi, %rcx
jne 0x62be
testl %edx, %edx
je 0x6307
movl %edx, %esi
xorl %edi, %edi
movl $0x1, %r8d
addl -0x8(%rax,%r8,8), %edi
cmpq %rcx, %r8
jae 0x62ff
leaq 0x1(%r8), %r9
cmpq %r8, %rsi
movq %r9, %r8
jne 0x62e9
movslq %edi, %rcx
movslq %edx, %rbp
jmp 0x630b
xorl %ebp, %ebp
xorl %ecx, %ecx
movslq %ebx, %rdx
movq %rdx, 0x68(%rsp)
movq (%rax,%rbp,8), %rax
movq %rax, 0x28(%rsp)
movslq %eax, %r15
leaq (%r12,%rcx,8), %rsi
leaq (,%r15,8), %r14
movq %r12, %rdi
movq %r14, %rdx
callq 0x2250
movq 0x8(%rsp), %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x864f
movq %rax, 0x50(%r13)
movq 0x70(%rsp), %rcx
movl 0x4(%rcx,%rbp,8), %ecx
movl %ecx, 0x24(%r13)
movl %r15d, 0x4(%r13)
movl $0x0, (%r13)
movq (%rax), %rcx
movl %ecx, %esi
movq %rbx, %rdx
subl %ebx, %esi
incl %esi
movl %esi, 0x34(%r13)
movl -0x8(%rax,%r15,8), %esi
incl %esi
movl %esi, 0x38(%r13)
shrq $0x20, %rcx
movq 0x68(%rsp), %rsi
leaq (%rsi,%rsi,2), %r8
movq 0xb8(%rsp), %rdi
movq %rdi, %rsi
subq %r8, %rsi
addq %rsi, %rcx
incq %rcx
movq %rcx, 0x40(%r13)
movl -0x4(%rax,%r15,8), %ecx
addq %rdi, %rcx
incq %rcx
movq %rcx, 0x48(%r13)
testq %r15, %r15
jle 0x63cf
xorl %ecx, %ecx
movl 0x4(%rax,%rcx,8), %esi
addl %edi, %esi
subl 0x40(%r13), %esi
movl %esi, 0x4(%rax,%rcx,8)
incq %rcx
cmpq %rcx, %r15
jne 0x63b9
movq 0x28(%rsp), %rdi
movq %rax, %rsi
callq 0xe900
movl %eax, 0x28(%r13)
movq 0x70(%rsp), %rsi
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x83df
jmp 0x640a
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, (%r13)
movq $0x0, 0x50(%r13)
movq 0x8(%rsp), %rbx
movq 0x18(%rsp), %r12
movq 0x10(%rsp), %rbp
cmpl $0x0, 0x4(%r13)
jle 0x643c
movq 0x58(%rsp), %rcx
movslq %ecx, %rax
incl %ecx
movq %rcx, 0x58(%rsp)
imulq $0x68, %rax, %rdi
addq %rbp, %rdi
movl $0xd, %ecx
movq %r13, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq 0xc0(%rsp), %rcx
incq %rcx
movq 0x60(%rsp), %r15
movslq (%r15), %rax
cmpq %rax, %rcx
jl 0x5ebb
movq 0x58(%rsp), %rax
movl %eax, (%r15)
movq %rbx, %rdi
movq 0xa0(%rsp), %rsi
callq 0x83df
movq %rbx, %rdi
movq 0x48(%rsp), %rsi
callq 0x83df
movl (%r15), %esi
movq %rbx, %rdi
movq %rbp, %rdx
callq 0xecbb
movq %rax, 0x48(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0xed66
movss 0x44(%r12), %xmm0
movl 0x48(%r12), %esi
movl (%r15), %edx
movq 0x20(%rsp), %r13
movl 0x8(%r13), %r8d
movq %rbx, %rdi
movq %rbp, %rcx
xorl %r9d, %r9d
callq 0xef22
movss 0x4c(%r12), %xmm0
mulss %xmm0, %xmm0
movl 0x8(%r13), %esi
addl %esi, %esi
movl 0x58(%r12), %edx
movq %rbx, %rdi
movq %r15, %rcx
movq %rbp, %r8
callq 0xf3f7
jmp 0x64f4
movq 0x20(%rsp), %r13
movq 0x10(%rsp), %rbp
testb $0x2, (%r12)
jne 0x6635
movq 0x18(%r13), %rsi
movl (%r15), %edx
movl 0x18(%r12), %eax
movl %eax, %r10d
shrl $0x1f, %r10d
addl %eax, %r10d
sarl %r10d
subq $0x8, %rsp
movq %rbx, %rdi
movq %rbp, %rcx
movq 0x50(%rsp), %r8
movl $0x64, %r9d
pushq %r10
callq 0xf6fc
addq $0x10, %rsp
movq %rax, %r14
cmpl $0x0, (%r15)
jle 0x65bf
xorl %ebx, %ebx
movq %rbp, %r12
xorl %ebp, %ebp
movq (%r14,%rbx,8), %rax
movq %rax, %r10
shrq $0x20, %r10
movq 0x8(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq %r13, %rdx
movl 0x50(%rsp), %ecx
movq 0xa8(%rsp), %r8
movq %r12, %r9
pushq %rax
pushq %r10
callq 0x6b40
addq $0x10, %rsp
cmpq $0x0, 0x60(%r12)
je 0x659c
movslq %ebp, %rax
incl %ebp
imulq $0x68, %rax, %rdi
addq 0x10(%rsp), %rdi
movl $0xd, %ecx
movq %r12, %rsi
rep  movsq (%rsi), %es:(%rdi)
incq %rbx
movslq (%r15), %rax
addq $0x68, %r12
cmpq %rax, %rbx
jl 0x6548
movl %ebp, (%r15)
movq 0x8(%rsp), %rbx
movq 0x18(%rsp), %r12
movq 0x10(%rsp), %rbp
jmp 0x65cb
movl $0x0, (%r15)
testq %r14, %r14
je 0x65d6
movq %rbx, %rdi
movq %r14, %rsi
callq 0x83df
movq %rbx, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0xed66
movl (%r15), %edi
movl 0x6c(%r12), %edx
movq %rbp, %rsi
callq 0xf686
movss 0x44(%r12), %xmm0
movl 0x48(%r12), %esi
movl (%r15), %edx
movl 0x8(%r13), %r8d
movq %rbx, %rdi
movq %rbp, %rcx
xorl %r9d, %r9d
callq 0xef22
movss 0x4c(%r12), %xmm0
movl 0x8(%r13), %esi
addl %esi, %esi
movl 0x58(%r12), %edx
movq %rbx, %rdi
movq %r15, %rcx
movq %rbp, %r8
callq 0xf3f7
movq %rbx, %rdi
movq 0x48(%rsp), %rsi
callq 0x83df
movq %rbp, %rax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
movq %rbp, %rsi
movq %r14, %rdx
callq 0x2a8b
jmp 0x5b9a