// File: /workspace/github_c_makefile_star2_O2/lh3[P]minimap2/map.c
// Function: mm_map_frag_core
void mm_map_frag_core(const mm_idx_t *mi, int n_segs, const int *qlens, const char **seqs, int *n_regs, mm_reg1_t **regs, mm_tbuf_t *b, const mm_mapopt_t *opt, const char *qname)
{
	int i, j, rep_len, qlen_sum, n_regs0, n_mini_pos;
	int max_chain_gap_qry, max_chain_gap_ref, is_splice = !!(opt->flag & MM_F_SPLICE), is_sr = !!(opt->flag & MM_F_SR), is_sr_rna = !!(opt->flag & MM_F_SR_RNA);
	uint32_t hash;
	int64_t n_a;
	uint64_t *u, *mini_pos;
	mm128_t *a;
	mm128_v mv = {0,0,0};
	mm_reg1_t *regs0;
	km_stat_t kmst;
	float chn_pen_gap, chn_pen_skip;

	for (i = 0, qlen_sum = 0; i < n_segs; ++i)
		qlen_sum += qlens[i], n_regs[i] = 0, regs[i] = 0;

	if (qlen_sum == 0 || n_segs <= 0 || n_segs > MM_MAX_SEG) return;
	if (opt->max_qlen > 0 && qlen_sum > opt->max_qlen) return;

	hash  = qname && !(opt->flag & MM_F_NO_HASH_NAME)? __ac_X31_hash_string(qname) : 0;
	hash ^= __ac_Wang_hash(qlen_sum) + __ac_Wang_hash(opt->seed);
	hash  = __ac_Wang_hash(hash);

	collect_minimizers(b->km, opt, mi, n_segs, qlens, seqs, &mv);
	if (opt->q_occ_frac > 0.0f) mm_seed_mz_flt(b->km, &mv, opt->mid_occ, opt->q_occ_frac);
	if (opt->flag & MM_F_HEAP_SORT) a = collect_seed_hits_heap(b->km, opt, opt->mid_occ, mi, qname, &mv, qlen_sum, &n_a, &rep_len, &n_mini_pos, &mini_pos);
	else a = collect_seed_hits(b->km, opt, opt->mid_occ, mi, qname, &mv, qlen_sum, &n_a, &rep_len, &n_mini_pos, &mini_pos);

	if (mm_dbg_flag & MM_DBG_PRINT_SEED) {
		fprintf(stderr, "RS\t%d\n", rep_len);
		for (i = 0; i < n_a; ++i)
			fprintf(stderr, "SD\t%s\t%d\t%c\t%d\t%d\t%d\n", mi->seq[a[i].x<<1>>33].name, (int32_t)a[i].x, "+-"[a[i].x>>63], (int32_t)a[i].y, (int32_t)(a[i].y>>32&0xff),
					i == 0? 0 : ((int32_t)a[i].y - (int32_t)a[i-1].y) - ((int32_t)a[i].x - (int32_t)a[i-1].x));
	}

	// set max chaining gap on the query and the reference sequence
	if (is_sr)
		max_chain_gap_qry = qlen_sum > opt->max_gap? qlen_sum : opt->max_gap;
	else max_chain_gap_qry = opt->max_gap;
	if (opt->max_gap_ref > 0) {
		max_chain_gap_ref = opt->max_gap_ref; // always honor mm_mapopt_t::max_gap_ref if set
	} else if (opt->max_frag_len > 0) {
		max_chain_gap_ref = opt->max_frag_len - qlen_sum;
		if (max_chain_gap_ref < opt->max_gap) max_chain_gap_ref = opt->max_gap;
	} else max_chain_gap_ref = opt->max_gap;

	chn_pen_gap  = opt->chain_gap_scale * 0.01 * mi->k;
	chn_pen_skip = opt->chain_skip_scale * 0.01 * mi->k;
	if (opt->flag & MM_F_RMQ) {
		a = mg_lchain_rmq(opt->max_gap, opt->rmq_inner_dist, opt->bw, opt->max_chain_skip, opt->rmq_size_cap, opt->min_cnt, opt->min_chain_score,
						  chn_pen_gap, chn_pen_skip, n_a, a, &n_regs0, &u, b->km);
	} else {
		a = mg_lchain_dp(max_chain_gap_ref, max_chain_gap_qry, opt->bw, opt->max_chain_skip, opt->max_chain_iter, opt->min_cnt, opt->min_chain_score,
						 chn_pen_gap, chn_pen_skip, is_splice, n_segs, n_a, a, &n_regs0, &u, b->km);
	}

	if (opt->bw_long > opt->bw && (opt->flag & (MM_F_SPLICE|MM_F_SR|MM_F_NO_LJOIN)) == 0 && n_segs == 1 && n_regs0 > 1) { // re-chain/long-join for long sequences
		int32_t st = (int32_t)a[0].y, en = (int32_t)a[(int32_t)u[0] - 1].y;
		if (qlen_sum - (en - st) > opt->rmq_rescue_size || en - st > qlen_sum * opt->rmq_rescue_ratio) {
			int32_t i;
			for (i = 0, n_a = 0; i < n_regs0; ++i) n_a += (int32_t)u[i];
			kfree(b->km, u);
			radix_sort_128x(a, a + n_a);
			a = mg_lchain_rmq(opt->max_gap, opt->rmq_inner_dist, opt->bw_long, opt->max_chain_skip, opt->rmq_size_cap, opt->min_cnt, opt->min_chain_score,
							  chn_pen_gap, chn_pen_skip, n_a, a, &n_regs0, &u, b->km);
		}
	} else if (opt->max_occ > opt->mid_occ && rep_len > 0 && !(opt->flag & MM_F_RMQ)) { // re-chain, mostly for short reads
		int rechain = 0;
		if (n_regs0 > 0) { // test if the best chain has all the segments
			int n_chained_segs = 1, max = 0, max_i = -1, max_off = -1, off = 0;
			for (i = 0; i < n_regs0; ++i) { // find the best chain
				if (max < (int)(u[i]>>32)) max = u[i]>>32, max_i = i, max_off = off;
				off += (uint32_t)u[i];
			}
			for (i = 1; i < (int32_t)u[max_i]; ++i) // count the number of segments in the best chain
				if ((a[max_off+i].y&MM_SEED_SEG_MASK) != (a[max_off+i-1].y&MM_SEED_SEG_MASK))
					++n_chained_segs;
			if (n_chained_segs < n_segs)
				rechain = 1;
		} else rechain = 1;
		if (rechain) { // redo chaining with a higher max_occ threshold
			kfree(b->km, a);
			kfree(b->km, u);
			kfree(b->km, mini_pos);
			if (opt->flag & MM_F_HEAP_SORT) a = collect_seed_hits_heap(b->km, opt, opt->max_occ, mi, qname, &mv, qlen_sum, &n_a, &rep_len, &n_mini_pos, &mini_pos);
			else a = collect_seed_hits(b->km, opt, opt->max_occ, mi, qname, &mv, qlen_sum, &n_a, &rep_len, &n_mini_pos, &mini_pos);
			a = mg_lchain_dp(max_chain_gap_ref, max_chain_gap_qry, opt->bw, opt->max_chain_skip, opt->max_chain_iter, opt->min_cnt, opt->min_chain_score,
							 chn_pen_gap, chn_pen_skip, is_splice, n_segs, n_a, a, &n_regs0, &u, b->km);
		}
	}
	b->frag_gap = max_chain_gap_ref;
	b->rep_len = rep_len;

	regs0 = mm_gen_regs(b->km, hash, qlen_sum, n_regs0, u, a, !!(opt->flag&MM_F_QSTRAND));
	if (mi->n_alt) {
		mm_mark_alt(mi, n_regs0, regs0);
		mm_hit_sort(b->km, &n_regs0, regs0, opt->alt_drop); // this step can be merged into mm_gen_regs(); will do if this shows up in profile
	}

	if (mm_dbg_flag & (MM_DBG_PRINT_SEED|MM_DBG_PRINT_CHAIN))
		for (j = 0; j < n_regs0; ++j)
			for (i = regs0[j].as; i < regs0[j].as + regs0[j].cnt; ++i)
				fprintf(stderr, "CN\t%d\t%s\t%d\t%c\t%d\t%d\t%d\n", j, mi->seq[a[i].x<<1>>33].name, (int32_t)a[i].x, "+-"[a[i].x>>63], (int32_t)a[i].y, (int32_t)(a[i].y>>32&0xff),
						i == regs0[j].as? 0 : ((int32_t)a[i].y - (int32_t)a[i-1].y) - ((int32_t)a[i].x - (int32_t)a[i-1].x));

	chain_post(opt, max_chain_gap_ref, mi, b->km, qlen_sum, n_segs, qlens, &n_regs0, regs0, a);
	if (!is_sr && !(opt->flag&MM_F_QSTRAND)) {
		mm_est_err(mi, qlen_sum, n_regs0, regs0, a, n_mini_pos, mini_pos);
		n_regs0 = mm_filter_strand_retained(n_regs0, regs0);
	}

	if (n_segs == 1) { // uni-segment
		regs0 = align_regs(opt, mi, b->km, qlens[0], seqs[0], &n_regs0, regs0, a);
		regs0 = (mm_reg1_t*)realloc(regs0, sizeof(*regs0) * n_regs0);
		mm_set_mapq2(b->km, n_regs0, regs0, opt->min_chain_score, opt->a, rep_len, is_sr || is_sr_rna, is_splice);
		n_regs[0] = n_regs0, regs[0] = regs0;
	} else { // multi-segment
		mm_seg_t *seg;
		seg = mm_seg_gen(b->km, hash, n_segs, qlens, n_regs0, regs0, n_regs, regs, a); // split fragment chain to separate segment chains
		free(regs0);
		for (i = 0; i < n_segs; ++i) {
			mm_set_parent(b->km, opt->mask_level, opt->mask_len, n_regs[i], regs[i], opt->a * 2 + opt->b, opt->flag&MM_F_HARD_MLEVEL, opt->alt_drop); // update mm_reg1_t::parent
			regs[i] = align_regs(opt, mi, b->km, qlens[i], seqs[i], &n_regs[i], regs[i], seg[i].a);
			mm_set_mapq2(b->km, n_regs[i], regs[i], opt->min_chain_score, opt->a, rep_len, is_sr || is_sr_rna, is_splice);
		}
		mm_seg_free(b->km, n_segs, seg);
		if (n_segs == 2 && opt->pe_ori >= 0 && (opt->flag&MM_F_CIGAR))
			mm_pair(b->km, max_chain_gap_ref, opt->pe_bonus, opt->a * 2 + opt->b, opt->a, qlens, n_regs, regs); // pairing
	}

	kfree(b->km, mv.a);
	kfree(b->km, a);
	kfree(b->km, u);
	kfree(b->km, mini_pos);

	if (mi->J && n_segs == 1 && is_splice)
		for (i = 0; i < n_regs0; ++i)
			mm_jump_split(b->km, mi, opt, qlens[0], (const uint8_t*)seqs[0], &regs0[i], 0);

	if (b->km) {
		km_stat(b->km, &kmst);
		if (mm_dbg_flag & MM_DBG_PRINT_QNAME)
			fprintf(stderr, "QM\t%s\t%d\tcap=%ld,nCore=%ld,largest=%ld\n", qname, qlen_sum, kmst.capacity, kmst.n_cores, kmst.largest);
		assert(kmst.n_blocks == kmst.n_cores); // otherwise, there is a memory leak
		if (kmst.largest > 1U<<28 || (opt->cap_kalloc > 0 && kmst.capacity > opt->cap_kalloc)) {
			if (mm_dbg_flag & MM_DBG_PRINT_QNAME)
				fprintf(stderr, "[W::%s] reset thread-local memory after read %s\n", __func__, qname);
			km_destroy(b->km);
			b->km = km_init();
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rcx, 0x60(%rsp)
movq %rdx, %r15
movl %esi, %r12d
movq 0x140(%rsp), %rdx
movq 0x138(%rsp), %r14
movq (%r14), %r11
movl %r11d, %esi
andl $0x80, %esi
movl %esi, %eax
shrl $0x7, %eax
movq %rax, 0x88(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0xb0(%rsp)
xorl %eax, %eax
testl %r12d, %r12d
movl $0x0, %r10d
cmovgl %r12d, %r10d
xorl %ecx, %ecx
cmpq %rax, %r10
je 0x9cf7
addl (%r15,%rax,4), %ecx
andl $0x0, (%r8,%rax,4)
andq $0x0, (%r9,%rax,8)
incq %rax
jmp 0x9cdf
movq %rcx, 0x18(%rsp)
leal -0x100(%r12), %eax
cmpl $0xffffff01, %eax       # imm = 0xFFFFFF01
jb 0xab41
cmpl $0x0, 0x18(%rsp)
je 0xab41
movl 0x10(%r14), %eax
testl %eax, %eax
jle 0x9d2c
cmpl %eax, 0x18(%rsp)
jg 0xab41
movq %rdi, 0x10(%rsp)
testq %rdx, %rdx
setne %al
btq $0x22, %r11
setae %cl
andb %al, %cl
movl $0x0, %ebp
cmpb $0x1, %cl
movq 0x18(%rsp), %rdi
jne 0x9d6e
movsbl (%rdx), %eax
testl %eax, %eax
je 0x9d6e
leaq 0x1(%rdx), %rcx
movsbl (%rcx), %edx
testl %edx, %edx
je 0x9d6c
imull $0x1f, %eax, %eax
addl %edx, %eax
incq %rcx
jmp 0x9d5b
movl %eax, %ebp
movq %r11, 0x70(%rsp)
movq %r10, 0xc8(%rsp)
movq %r9, 0x78(%rsp)
movq %r8, 0x80(%rsp)
movq %rsi, 0x98(%rsp)
callq 0xac83
movl %eax, %ebx
movl 0x8(%r14), %edi
callq 0xac83
addl %ebx, %eax
xorl %ebp, %eax
movl %eax, 0xc4(%rsp)
movq 0x130(%rsp), %rbx
movq (%rbx), %rax
movq %rax, 0x90(%rsp)
leaq 0xa8(%rsp), %rax
andq $0x0, (%rax)
movq %r12, 0x48(%rsp)
movl %r12d, %eax
movq %rax, 0xa0(%rsp)
xorl %r9d, %r9d
movq $0x0, 0x38(%rsp)
movq 0x10(%rsp), %r13
xorl %r12d, %r12d
movq %r15, 0x58(%rsp)
cmpq 0xa0(%rsp), %r9
je 0xa008
movq 0x60(%rsp), %rax
movq (%rax,%r9,8), %rsi
movl (%r15,%r9,4), %edx
movl 0x4(%r13), %ecx
movl 0x8(%r13), %r8d
movl 0xc(%r13), %eax
andl $0x1, %eax
movq 0x90(%rsp), %rdi
movq %r9, 0x8(%rsp)
leaq 0xa8(%rsp), %r10
pushq %r10
pushq %rax
callq 0x119f8
popq %rax
popq %rcx
movslq %r12d, %rcx
movq 0xa8(%rsp), %rbx
movq 0xb8(%rsp), %rbp
movq 0x38(%rsp), %rax
addl %eax, %eax
movslq %eax, %rdx
movq %rcx, %rax
shlq $0x4, %rax
leaq (%rax,%rbp), %rsi
addq $0x8, %rsi
cmpq %rbx, %rcx
jae 0x9e79
addq %rdx, (%rsi)
incq %rcx
addq $0x10, %rsi
jmp 0x9e68
movq %r12, 0x30(%rsp)
movl 0xc(%r14), %r12d
testl %r12d, %r12d
jle 0x9fdd
subl 0x30(%rsp), %ebx
addq %rax, %rbp
movq 0x8(%rsp), %rcx
movl (%r15,%rcx,4), %r13d
movq 0x60(%rsp), %rax
movq (%rax,%rcx,8), %r15
movq 0x90(%rsp), %rdi
callq 0x12324
movq %r15, %rdi
movl %r13d, %esi
movl %r12d, %edx
pushq $0x40
popq %rcx
leaq 0xd0(%rsp), %r8
movq %rax, 0x28(%rsp)
movq %rax, %r9
callq 0x12532
movslq 0xd0(%rsp), %rcx
xorl %edx, %edx
testl %ebx, %ebx
cmovlel %edx, %ebx
xorl %esi, %esi
xorl %r15d, %r15d
movabsq $0x100000000, %r14      # imm = 0x100000000
cmpq %rbx, %rdx
je 0x9fb6
movq %rdx, %r8
shlq $0x4, %r8
leaq (%r8,%rbp), %rdi
movl 0x8(%rbp,%r8), %r9d
shrl %r9d
movzbl (%rbp,%r8), %r8d
incl %r9d
movl %r9d, %r10d
subl %r8d, %r10d
movq %rsi, %r11
shlq $0x20, %r11
movslq %esi, %rsi
cmpq %rsi, %rcx
movq %rsi, %r12
cmovgq %rcx, %r12
cmpq %rsi, %r12
je 0x9f42
cmpl (%rax,%rsi,8), %r10d
jl 0x9f47
incq %rsi
addq %r14, %r11
jmp 0x9f2f
movq %r12, %rsi
jmp 0x9f9b
sarq $0x1d, %r11
cmpl 0x4(%rax,%r11), %r9d
jle 0x9f9b
xorl %r12d, %r12d
movq %rsi, %r11
cmpq %rcx, %r11
jge 0x9f89
movq (%rax,%r11,8), %r14
movq %r14, %r13
shrq $0x20, %r13
cmpl %r13d, %r9d
jle 0x9f89
cmpl %r13d, %r10d
cmovgl %r10d, %r13d
cmpl %r14d, %r9d
cmovll %r9d, %r14d
addl %r12d, %r14d
subl %r13d, %r14d
incq %r11
movl %r14d, %r12d
jmp 0x9f58
shrl %r8d
cmpl %r8d, %r12d
movabsq $0x100000000, %r14      # imm = 0x100000000
jg 0x9fae
movslq %r15d, %r8
incl %r15d
shlq $0x4, %r8
movups (%rdi), %xmm0
movups %xmm0, (%rbp,%r8)
incq %rdx
jmp 0x9ef0
movq 0x28(%rsp), %rdi
callq 0x124d7
addl 0x30(%rsp), %r15d
movslq %r15d, %rbx
movq %rbx, 0xa8(%rsp)
movq 0x138(%rsp), %r14
movq 0x58(%rsp), %r15
movq 0x8(%rsp), %r9
movq 0x38(%rsp), %rax
addl (%r15,%r9,4), %eax
movq %rax, 0x38(%rsp)
incq %r9
movl %ebx, %r12d
movq 0x130(%rsp), %rbx
movq 0x10(%rsp), %r13
jmp 0x9df3
movl 0xc4(%rsp), %edi
callq 0xac83
movl %eax, %r12d
movss 0xc8(%r14), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0xa03f
movq (%rbx), %rdi
movl 0xd4(%r14), %edx
leaq 0xa8(%rsp), %rsi
callq 0x1aa1c
testb $0x40, 0x2(%r14)
movq (%rbx), %rdi
movl 0xd4(%r14), %edx
leaq 0x68(%rsp), %rbx
jne 0xa08f
subq $0x8, %rsp
leaq 0x4c(%rsp), %rax
leaq 0xc(%rsp), %r10
leaq 0x28(%rsp), %r11
leaq 0xb0(%rsp), %r9
movq %r14, %rsi
movq %r13, %rcx
movq 0x148(%rsp), %r8
pushq %rbx
pushq %rax
pushq %r10
pushq %r11
pushq 0x40(%rsp)
callq 0xb058
jmp 0xa0c7
subq $0x8, %rsp
leaq 0x4c(%rsp), %rax
leaq 0xc(%rsp), %r10
leaq 0x28(%rsp), %r11
leaq 0xb0(%rsp), %r9
movq %r14, %rsi
movq %r13, %rcx
movq 0x148(%rsp), %r8
pushq %rbx
pushq %rax
pushq %r10
pushq %r11
pushq 0x40(%rsp)
callq 0xacae
addq $0x30, %rsp
movq %rax, %rbp
leaq 0x28853(%rip), %rax     # 0x32928
testb $0x4, (%rax)
jne 0xab53
movq 0x138(%rsp), %r13
movl 0x1c(%r13), %edi
movl 0x20(%r13), %ecx
movq 0x18(%rsp), %rax
cmpl %edi, %eax
movl %edi, %ebx
cmovgl %eax, %ebx
btl $0xc, 0x70(%rsp)
cmovael %edi, %ebx
movl %ecx, 0x28(%rsp)
testl %ecx, %ecx
jg 0xa124
movl 0x24(%r13), %eax
movl %edi, 0x28(%rsp)
testl %eax, %eax
jle 0xa124
subl 0x18(%rsp), %eax
cmpl %edi, %eax
cmovlel %edi, %eax
movl %eax, 0x28(%rsp)
cvtss2sd 0x38(%r13), %xmm0
movsd 0x1e646(%rip), %xmm1    # 0x28778
movq 0x10(%rsp), %rax
cvtsi2sdl 0x8(%rax), %xmm2
mulsd %xmm1, %xmm0
mulsd %xmm2, %xmm0
cvtsd2ss %xmm0, %xmm0
cvtss2sd 0x3c(%r13), %xmm3
mulsd %xmm1, %xmm3
mulsd %xmm2, %xmm3
cvtsd2ss %xmm3, %xmm1
testb $-0x80, 0x3(%r13)
movss %xmm0, 0x38(%rsp)
movss %xmm1, 0x8(%rsp)
jne 0xa1ba
movl 0x14(%r13), %edx
movl 0x28(%r13), %ecx
movl 0x2c(%r13), %r8d
movl 0x30(%r13), %r9d
movl 0x34(%r13), %eax
leaq 0x50(%rsp), %r10
movq %rsp, %r11
movl 0x28(%rsp), %edi
movl %ebx, %esi
movq 0x130(%rsp), %r14
pushq (%r14)
pushq %r10
pushq %r11
pushq %rbp
pushq 0x40(%rsp)
pushq 0x70(%rsp)
pushq 0xb8(%rsp)
pushq %rax
callq 0x12ff8
addq $0x40, %rsp
jmp 0xa1f8
movl 0x44(%r13), %esi
movl 0x14(%r13), %edx
movl 0x28(%r13), %ecx
movl 0x40(%r13), %r8d
movl 0x30(%r13), %r9d
movl 0x34(%r13), %eax
leaq 0x50(%rsp), %r10
movq %rsp, %r11
movq 0x130(%rsp), %r14
pushq (%r14)
pushq %r10
pushq %r11
pushq %rbp
pushq 0x40(%rsp)
pushq %rax
callq 0x143a9
addq $0x30, %rsp
movl 0x18(%r13), %ecx
cmpl 0x14(%r13), %ecx
movq 0x18(%rsp), %rdi
movq 0x10(%rsp), %rbp
jle 0xa2b0
movzwl (%r13), %ecx
testw $0x1480, %cx            # imm = 0x1480
sete %dl
cmpl $0x1, 0x48(%rsp)
sete %cl
andb %dl, %cl
movl (%rsp), %r8d
cmpl $0x2, %r8d
setge %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0xa2b0
movq 0x50(%rsp), %rsi
movq (%rsi), %rcx
shlq $0x20, %rcx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
addq %rcx, %rdx
sarq $0x1c, %rdx
movq %rax, %rbx
movl 0x8(%rax,%rdx), %ecx
subl 0x8(%rax), %ecx
movl %edi, %edx
subl %ecx, %edx
cmpl 0x48(%r13), %edx
movq 0x130(%rsp), %r15
jg 0xa289
cvtsi2ss %ecx, %xmm0
cvtsi2ss %edi, %xmm1
mulss 0x4c(%r13), %xmm1
ucomiss %xmm1, %xmm0
jbe 0xa4f2
andq $0x0, 0x20(%rsp)
movl %r8d, %eax
xorl %ecx, %ecx
xorl %edx, %edx
cmpq %rcx, %rax
je 0xa331
movslq (%rsi,%rcx,8), %rdi
addq %rdi, %rdx
movq %rdx, 0x20(%rsp)
incq %rcx
jmp 0xa296
movl 0xd8(%r13), %ecx
cmpl 0xd4(%r13), %ecx
movq 0x130(%rsp), %r15
jle 0xa4ef
cmpl $0x0, 0x4(%rsp)
jle 0xa4ef
testb $-0x80, 0x3(%r13)
jne 0xa4ef
movslq (%rsp), %r14
testq %r14, %r14
jle 0xa3e7
pushq $-0x1
popq %rcx
xorl %esi, %esi
movq 0x50(%rsp), %rdx
xorl %r9d, %r9d
movl %ecx, %edi
xorl %r8d, %r8d
cmpq %rsi, %r14
je 0xa398
movq (%rdx,%rsi,8), %r10
movq %r10, %r11
shrq $0x20, %r11
cmpl %r11d, %r9d
cmovgl %r9d, %r11d
cmovll %esi, %ecx
cmovll %r8d, %edi
addl %r8d, %r10d
incq %rsi
movl %r11d, %r9d
movl %r10d, %r8d
jmp 0xa301
movq (%r15), %rdi
callq 0x10a07
movq 0x20(%rsp), %rsi
shlq $0x4, %rsi
addq %rbx, %rsi
movq %rbx, %rdi
callq 0x47dc
movl 0x18(%r13), %edx
movl 0x1c(%r13), %edi
movl 0x44(%r13), %esi
movl 0x28(%r13), %ecx
movl 0x40(%r13), %r8d
movl 0x30(%r13), %r9d
movl 0x34(%r13), %eax
leaq 0x50(%rsp), %r10
movq %rsp, %r11
movss 0x38(%rsp), %xmm0
movss 0x8(%rsp), %xmm1
pushq (%r15)
pushq %r10
pushq %r11
pushq %rbx
pushq 0x40(%rsp)
pushq %rax
callq 0x143a9
addq $0x30, %rsp
jmp 0xa4ef
movslq %ecx, %rcx
movslq (%rdx,%rcx,8), %r9
movslq %edi, %rcx
shlq $0x4, %rcx
leaq (%rax,%rcx), %rdx
addq $0x18, %rdx
pushq $0x1
popq %rcx
pushq $0x1
popq %rsi
movabsq $0xff000000000000, %rdi # imm = 0xFF000000000000
cmpq %r9, %rsi
jge 0xa3dd
movq -0x10(%rdx), %r8
xorq (%rdx), %r8
andq %rdi, %r8
cmpq $0x1, %r8
sbbl $-0x1, %ecx
incq %rsi
addq $0x10, %rdx
jmp 0xa3be
cmpl 0x48(%rsp), %ecx
jge 0xa4ef
movq (%r15), %rdi
movq %rax, %rsi
callq 0x10a07
movq (%r15), %rdi
movq 0x50(%rsp), %rsi
callq 0x10a07
movq (%r15), %rdi
movq 0x68(%rsp), %rsi
callq 0x10a07
testb $0x40, 0x2(%r13)
movq (%r15), %rdi
movl 0xd8(%r13), %edx
jne 0xa45d
subq $0x8, %rsp
leaq 0x4c(%rsp), %rax
leaq 0xc(%rsp), %r10
leaq 0x28(%rsp), %r11
leaq 0xb0(%rsp), %r9
movq %r13, %rsi
movq %rbp, %rcx
movq 0x148(%rsp), %r8
leaq 0x70(%rsp), %r14
pushq %r14
pushq %rax
pushq %r10
pushq %r11
pushq 0x40(%rsp)
callq 0xb058
jmp 0xa49b
subq $0x8, %rsp
leaq 0x4c(%rsp), %rax
leaq 0xc(%rsp), %r10
leaq 0x28(%rsp), %r11
leaq 0xb0(%rsp), %r9
movq %r13, %rsi
movq %rbp, %rcx
movq 0x148(%rsp), %r8
leaq 0x70(%rsp), %r14
pushq %r14
pushq %rax
pushq %r10
pushq %r11
pushq 0x40(%rsp)
callq 0xacae
addq $0x30, %rsp
movl 0x14(%r13), %edx
movl 0x28(%r13), %ecx
movl 0x2c(%r13), %r8d
movl 0x30(%r13), %r9d
movl 0x34(%r13), %r10d
leaq 0x50(%rsp), %r11
movq %rsp, %r14
movl 0x28(%rsp), %edi
movl %ebx, %esi
movss 0x38(%rsp), %xmm0
movss 0x8(%rsp), %xmm1
pushq (%r15)
pushq %r11
pushq %r14
pushq %rax
pushq 0x40(%rsp)
pushq 0x70(%rsp)
pushq 0xb8(%rsp)
pushq %r10
callq 0x12ff8
addq $0x40, %rsp
movq %rax, %rbx
movl 0x28(%rsp), %eax
movl %eax, 0xc(%r15)
movl 0x4(%rsp), %eax
movl %eax, 0x8(%r15)
movq (%r15), %rdi
movl (%rsp), %ecx
movq 0x50(%rsp), %r8
movl 0x4(%r13), %eax
andl $0x1, %eax
subq $0x8, %rsp
movl %r12d, %esi
movq 0x20(%rsp), %rdx
movq %rbx, 0x38(%rsp)
movq %rbx, %r9
pushq %rax
callq 0x19230
popq %rcx
popq %rdx
movq %rax, %r14
cmpl $0x0, 0x18(%rbp)
je 0xa55d
movq %rsp, %rbx
movl (%rbx), %esi
movq %rbp, %rdi
movq %r14, %rdx
callq 0x19581
movq (%r15), %rdi
movss 0x60(%r13), %xmm0
movq %rbx, %rsi
movq %r14, %rdx
callq 0x19a6a
movq %r14, 0x8(%rsp)
leaq 0x283bf(%rip), %rax     # 0x32928
testb $0x14, (%rax)
je 0xa657
xorl %ebp, %ebp
movslq (%rsp), %rax
cmpq %rax, %rbp
jge 0xa657
imulq $0x50, %rbp, %rax
movq 0x8(%rsp), %rcx
leaq (%rcx,%rax), %r13
movl 0x28(%rcx,%rax), %eax
movslq %eax, %rbx
movq %rbx, %r15
shlq $0x4, %r15
addq 0x30(%rsp), %r15
movslq 0x4(%r13), %rcx
movslq %eax, %rdx
addq %rcx, %rdx
cmpq %rdx, %rbx
jge 0xa647
movq (%r15), %r8
movq 0x8(%r15), %r10
xorl %r11d, %r11d
cmpl %eax, %ebx
je 0xa5d3
movl -0x8(%r15), %eax
addl %r8d, %eax
movl %r10d, %r11d
subl %eax, %r11d
addl -0x10(%r15), %r11d
movq 0x27a1e(%rip), %rax     # 0x31ff8
movq (%rax), %rdi
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rax
movq %r8, %rcx
shrq $0x20, %rcx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
imulq $0x18, %rcx, %rcx
movq (%rax,%rcx), %rcx
movq %r8, %rax
shrq $0x3f, %rax
leaq 0x1e1a0(%rip), %rdx     # 0x287a9
movsbl (%rax,%rdx), %r9d
movq %r10, %rax
shrq $0x20, %rax
movzbl %al, %r14d
subq $0x8, %rsp
leaq 0x1e188(%rip), %rsi     # 0x287ac
movl %ebp, %edx
xorl %eax, %eax
pushq %r11
pushq %r14
pushq %r10
callq 0x2260
addq $0x20, %rsp
incq %rbx
movl 0x28(%r13), %eax
addq $0x10, %r15
jmp 0xa5a1
incq %rbp
movq 0x138(%rsp), %r13
jmp 0xa574
movq (%r13), %r9
btl $0x17, %r9d
movq 0x130(%rsp), %rbp
jb 0xa720
movq (%rbp), %rbx
movss 0x50(%r13), %xmm0
movl 0x54(%r13), %esi
movl (%rsp), %edx
movl 0x64(%r13), %r8d
addl %r8d, %r8d
addl 0x68(%r13), %r8d
andl $0x20000000, %r9d       # imm = 0x20000000
movss 0x60(%r13), %xmm1
movq %rbx, %rdi
movq 0x8(%rsp), %r14
movq %r14, %rcx
callq 0x19686
movq 0x10(%rsp), %rax
movl 0x8(%rax), %edx
addl %edx, %edx
movss 0x58(%r13), %xmm0
movl 0x5c(%r13), %ecx
movq 0x48(%rsp), %r8
cmpl $0x1, %r8d
jg 0xa6f7
cvtsi2sdl 0x1c(%r13), %xmm1
mulsd 0x1e0ac(%rip), %xmm1    # 0x28780
cvttsd2si %xmm1, %r8d
subq $0x8, %rsp
pushq $0x1
popq %rax
leaq 0x8(%rsp), %r9
movq %rbx, %rdi
movl %edx, %esi
movl %ecx, %edx
movl %eax, %ecx
pushq %r14
callq 0x19dbc
jmp 0xa71e
movq %rsp, %rax
movss 0x1e086(%rip), %xmm1    # 0x28788
movss 0x1b8fa(%rip), %xmm2    # 0x26004
movq %rbx, %rdi
movl 0x28(%rsp), %esi
movq 0x58(%rsp), %r9
pushq %r14
pushq %rax
callq 0xf2d0
popq %rax
popq %rcx
btl $0xc, 0x70(%rsp)
movq 0x30(%rsp), %rbx
jb 0xa777
movabsq $0x100000000, %rax      # imm = 0x100000000
testq %rax, (%r13)
jne 0xa777
movl (%rsp), %edx
movl 0x44(%rsp), %r9d
subq $0x8, %rsp
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x10(%rsp), %r14
movq %r14, %rcx
movq %rbx, %r8
pushq 0x70(%rsp)
callq 0xfe28
popq %rax
popq %rcx
movl (%rsp), %edi
movq %r14, %rsi
callq 0x19fc2
movl %eax, (%rsp)
movq (%rbp), %r9
movq 0x48(%rsp), %rdx
cmpl $0x1, %edx
jne 0xa835
movq 0x58(%rsp), %rax
movl (%rax), %ecx
movq 0x60(%rsp), %rax
movq (%rax), %r8
movq %rbx, %r12
movq %rsp, %rbx
movq %r13, %rdi
movq 0x10(%rsp), %r15
movq %r15, %rsi
movq %r9, %rdx
movq %rbx, %r9
pushq %r12
pushq 0x10(%rsp)
callq 0xb305
addq $0x10, %rsp
movslq (%rbx), %rcx
imulq $0x50, %rcx, %rsi
movq %rax, %rdi
callq 0x2320
movq %rax, %r14
movq (%rbp), %rdi
movl (%rbx), %esi
movl 0x34(%r13), %ecx
movl 0x64(%r13), %r8d
movl 0x4(%rsp), %r9d
movabsq $0x8000001000, %rax     # imm = 0x8000001000
xorl %r10d, %r10d
testq %rax, 0x70(%rsp)
setne %r10b
movq %r14, %rdx
pushq 0x88(%rsp)
pushq %r10
callq 0x1a59c
popq %rax
popq %rcx
movl (%rbx), %eax
movq 0x80(%rsp), %rcx
movl %eax, (%rcx)
movq 0x78(%rsp), %rax
movq %r14, 0x8(%rsp)
movq %r14, (%rax)
movq %rbp, %r14
movq 0x98(%rsp), %rbx
jmp 0xaa23
movl (%rsp), %r8d
subq $0x8, %rsp
movq %r9, %rdi
movl %r12d, %esi
movq 0x60(%rsp), %rcx
movq 0x10(%rsp), %r14
movq %r14, %r9
pushq %rbx
pushq 0x88(%rsp)
pushq 0x98(%rsp)
callq 0x1a209
addq $0x20, %rsp
movq %rax, %rbx
movq %r14, %rdi
callq 0x2040
movabsq $0x8000001000, %rax     # imm = 0x8000001000
xorl %ecx, %ecx
testq %rax, 0x70(%rsp)
setne %cl
movq %rcx, 0x90(%rsp)
movq 0xc8(%rsp), %r15
shlq $0x2, %r15
movq %rbx, 0xa0(%rsp)
addq $0x10, %rbx
movq %rbx, 0x38(%rsp)
xorl %r13d, %r13d
movq %rbp, %r12
movq 0x80(%rsp), %r14
movq (%r12), %rdi
cmpq %r13, %r15
je 0xa990
movq 0x138(%rsp), %rbx
movss 0x50(%rbx), %xmm0
movl 0x54(%rbx), %esi
leaq (%r14,%r13), %rbp
movl (%r14,%r13), %edx
movl 0x64(%rbx), %r8d
addl %r8d, %r8d
addl 0x68(%rbx), %r8d
movq 0x78(%rsp), %r12
movq (%r12,%r13,2), %rcx
movl (%rbx), %r9d
movl $0x20000000, %r10d      # imm = 0x20000000
andl %r10d, %r9d
movss 0x60(%rbx), %xmm1
callq 0x19686
movq 0x130(%rsp), %rax
movq (%rax), %rdx
movq 0x58(%rsp), %rax
movl (%rax,%r13), %ecx
movq 0x60(%rsp), %rax
movq (%rax,%r13,2), %r8
movq %rbx, %rdi
movq 0x10(%rsp), %rsi
movq %rbp, %r9
movq 0x38(%rsp), %rbp
pushq (%rbp)
pushq (%r12,%r13,2)
callq 0xb305
popq %rcx
popq %rdx
movq %rax, (%r12,%r13,2)
movq 0x130(%rsp), %r12
movq (%r12), %rdi
movl (%r14,%r13), %esi
movl 0x34(%rbx), %ecx
movl 0x64(%rbx), %r8d
movl 0x4(%rsp), %r9d
movq %rax, %rdx
pushq 0x88(%rsp)
pushq 0x98(%rsp)
callq 0x1a59c
addq $0x10, %rsp
addq $0x4, %r13
addq $0x18, %rbp
movq %rbp, 0x38(%rsp)
jmp 0xa8ba
movq 0x48(%rsp), %rbx
movl %ebx, %esi
movq 0xa0(%rsp), %rdx
callq 0x1a538
cmpl $0x2, %ebx
jne 0xaa06
movq 0x138(%rsp), %r13
cmpl $0x0, 0xb8(%r13)
movq 0x98(%rsp), %rbx
js 0xa9fc
testb $0x4, (%r13)
je 0xa9fc
movq (%r12), %rdi
movl 0x64(%r13), %r8d
movl 0xbc(%r13), %edx
leal (%r8,%r8), %ecx
addl 0x68(%r13), %ecx
movl 0x28(%rsp), %esi
movq 0x58(%rsp), %r9
pushq 0x78(%rsp)
pushq 0x88(%rsp)
callq 0xf826
popq %rax
popq %rcx
movq %r12, %r14
movq 0x10(%rsp), %r15
jmp 0xaa1e
movq %r12, %r14
movq 0x138(%rsp), %r13
movq 0x10(%rsp), %r15
movq 0x98(%rsp), %rbx
movq 0x30(%rsp), %r12
cmpl $0x1, 0x48(%rsp)
sete %bpl
testq %rbx, %rbx
setne %bl
movq (%r14), %rdi
movq 0xb8(%rsp), %rsi
callq 0x10a07
movq (%r14), %rdi
movq %r12, %rsi
callq 0x10a07
movq (%r14), %rdi
movq 0x50(%rsp), %rsi
callq 0x10a07
movq (%r14), %rdi
movq 0x68(%rsp), %rsi
callq 0x10a07
cmpq $0x0, 0x48(%r15)
setne %al
andb %bpl, %bl
andb %al, %bl
cmpb $0x1, %bl
movq 0x8(%rsp), %r12
jne 0xaaba
xorl %ebx, %ebx
movslq (%rsp), %rax
cmpq %rax, %rbx
jge 0xaaba
movq (%r14), %rdi
movq 0x58(%rsp), %rax
movl (%rax), %ecx
movq 0x60(%rsp), %rax
movq (%rax), %r8
subq $0x8, %rsp
movq %r15, %rsi
movq %r13, %rdx
movq %r12, %r9
pushq $0x0
callq 0x1b0e4
popq %rax
popq %rcx
incq %rbx
addq $0x50, %r12
jmp 0xaa80
movq (%r14), %rdi
testq %rdi, %rdi
movq 0x140(%rsp), %rbx
je 0xab41
leaq 0xd0(%rsp), %rsi
callq 0x10cfd
leaq 0x27e4a(%rip), %rax     # 0x32928
testb $0x2, (%rax)
jne 0xabfb
movq 0xe0(%rsp), %rax
cmpq 0xe8(%rsp), %rax
jne 0xac64
cmpq $0x10000000, 0xf0(%rsp) # imm = 0x10000000
ja 0xab21
movq 0xf8(%r13), %rax
testq %rax, %rax
jle 0xab41
cmpq %rax, 0xd0(%rsp)
jbe 0xab41
leaq 0x27e00(%rip), %rax     # 0x32928
testb $0x2, (%rax)
jne 0xac3d
movq (%r14), %rdi
callq 0x109cc
callq 0x109c3
movq %rax, (%r14)
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2749e(%rip), %r15     # 0x31ff8
movq (%r15), %rdi
movl 0x4(%rsp), %edx
leaq 0x1dc24(%rip), %rsi     # 0x2878c
xorl %eax, %eax
callq 0x2260
leaq 0x1dc33(%rip), %r14     # 0x287a9
movq %rbp, %r13
xorl %ebx, %ebx
cmpq %rbx, 0x20(%rsp)
jle 0xa0de
movq (%r13), %rcx
movq 0x8(%r13), %r9
xorl %r10d, %r10d
testq %rbx, %rbx
je 0xaba6
movl -0x8(%r13), %eax
addl %ecx, %eax
movl %r9d, %r10d
subl %eax, %r10d
addl -0x10(%r13), %r10d
movq (%r15), %rdi
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rax
movq %rcx, %rdx
shrq $0x20, %rdx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
imulq $0x18, %rdx, %rdx
movq (%rax,%rdx), %rdx
movq %rcx, %rax
shrq $0x3f, %rax
movsbl (%rax,%r14), %r8d
movq %r9, %rax
shrq $0x20, %rax
movzbl %al, %r11d
leaq 0x1dbae(%rip), %rsi     # 0x28793
xorl %eax, %eax
pushq %r10
pushq %r11
callq 0x2260
popq %rcx
popq %rdx
incq %rbx
addq $0x10, %r13
jmp 0xab7b
movq 0x273f6(%rip), %rax     # 0x31ff8
movq (%rax), %rdi
movq 0xd0(%rsp), %r8
movq 0xe8(%rsp), %r9
subq $0x8, %rsp
leaq 0x1dba5(%rip), %rsi     # 0x287c5
movq %rbx, %rdx
movq 0x20(%rsp), %rcx
xorl %eax, %eax
pushq 0xf8(%rsp)
callq 0x2260
popq %rcx
popq %rdx
jmp 0xaae7
movq 0x273b4(%rip), %rax     # 0x31ff8
movq (%rax), %rdi
leaq 0x1dc51(%rip), %rsi     # 0x2889f
leaq 0x1dc7b(%rip), %rdx     # 0x288d0
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2260
jmp 0xab31
leaq 0x1db82(%rip), %rdi     # 0x287ed
leaq 0x1db99(%rip), %rsi     # 0x2880b
leaq 0x1db98(%rip), %rcx     # 0x28811
movl $0x172, %edx            # imm = 0x172
callq 0x21a0