// File: /workspace/github_c_makefile_star2_O3/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 0x138(%rsp), %rbp
movq (%rbp), %rax
movq %rax, 0x60(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0xa0(%rsp)
testl %esi, %esi
jle 0xbe79
movl %esi, %ebx
movq 0x140(%rsp), %r10
movq 0x130(%rsp), %r11
movq 0x60(%rsp), %rsi
andl $0x80, %esi
movl %esi, %r15d
shrl $0x7, %r15d
movl %ebx, %r13d
xorl %eax, %eax
xorl %r14d, %r14d
addl (%rdx,%rax,4), %r14d
movl $0x0, (%r8,%rax,4)
movq $0x0, (%r9,%rax,8)
incq %rax
cmpq %rax, %r13
jne 0xaf8b
leal -0x100(%rbx), %eax
cmpl $0xffffff01, %eax       # imm = 0xFFFFFF01
jb 0xbe79
testl %r14d, %r14d
je 0xbe79
movl 0x10(%rbp), %eax
testl %eax, %eax
jle 0xafd1
cmpl %eax, %r14d
jg 0xbe79
movq %rsi, 0xc0(%rsp)
movq %rdi, 0x10(%rsp)
testq %r10, %r10
setne %al
btq $0x22, 0x60(%rsp)
setae %sil
andb %al, %sil
xorl %eax, %eax
cmpb $0x1, %sil
jne 0xb02d
movsbl (%r10), %esi
testl %esi, %esi
je 0xb02d
movb 0x1(%r10), %dil
testb %dil, %dil
je 0xb02b
addq $0x2, %r10
movl %esi, %eax
movl %eax, %esi
shll $0x5, %esi
subl %eax, %esi
movsbl %dil, %eax
addl %esi, %eax
movb (%r10), %dil
incq %r10
testb %dil, %dil
jne 0xb011
jmp 0xb02d
movl %esi, %eax
movq %r15, 0x90(%rsp)
movq %r9, 0x80(%rsp)
movq %r8, 0x88(%rsp)
movl %r14d, %esi
shll $0xf, %esi
notl %esi
movq %r14, 0x20(%rsp)
addl %r14d, %esi
movl %esi, %r8d
shrl $0xa, %r8d
xorl %esi, %r8d
leal (%r8,%r8,8), %esi
movl %esi, %r8d
shrl $0x6, %r8d
xorl %esi, %r8d
movl %r8d, %esi
shll $0xb, %esi
notl %esi
addl %r8d, %esi
movl %esi, %r8d
shrl $0x10, %r8d
xorl %esi, %r8d
movl 0x8(%rbp), %r9d
movl %r9d, %esi
shll $0xf, %esi
notl %esi
addl %r9d, %esi
movl %esi, %r9d
shrl $0xa, %r9d
xorl %esi, %r9d
leal (%r9,%r9,8), %r9d
movl %r9d, %esi
shrl $0x6, %esi
xorl %r9d, %esi
movl %esi, %r9d
shll $0xb, %r9d
notl %r9d
addl %esi, %r9d
movl %r9d, %esi
shrl $0x10, %esi
xorl %r9d, %esi
addl %r8d, %esi
xorl %eax, %esi
movl %esi, %eax
shll $0xf, %eax
notl %eax
addl %esi, %eax
movl %eax, %esi
shrl $0xa, %esi
xorl %eax, %esi
leal (%rsi,%rsi,8), %eax
movl %eax, 0xb8(%rsp)
shrl $0x6, %eax
movl %eax, 0xbc(%rsp)
movq (%r11), %rax
movq %rax, 0x48(%rsp)
movq $0x0, 0x98(%rsp)
movq %rbx, 0x40(%rsp)
testl %ebx, %ebx
movq %rcx, 0x68(%rsp)
movq %rdx, 0x30(%rsp)
movq %r13, 0x78(%rsp)
jle 0xb368
xorl %r9d, %r9d
movq $0x0, 0x8(%rsp)
xorl %ebx, %ebx
movq (%rcx,%r9,8), %rsi
movl (%rdx,%r9,4), %edx
movq 0x10(%rsp), %rax
movl 0x4(%rax), %ecx
movl 0x8(%rax), %r8d
movl 0xc(%rax), %eax
andl $0x1, %eax
movq 0x48(%rsp), %rdi
movq %r9, 0x50(%rsp)
leaq 0x98(%rsp), %r10
pushq %r10
pushq %rax
callq 0x13720
addq $0x10, %rsp
movl %ebx, 0xb0(%rsp)
movslq %ebx, %r15
movq 0x98(%rsp), %r14
movq %r14, %rax
subq %r15, %rax
jbe 0xb1a3
movq 0x8(%rsp), %rcx
addl %ecx, %ecx
movslq %ecx, %rcx
movq 0xa8(%rsp), %rdx
movq %r15, %rsi
shlq $0x4, %rsi
addq %rsi, %rdx
addq $0x8, %rdx
addq %rcx, (%rdx)
addq $0x10, %rdx
decq %rax
jne 0xb197
movl 0xc(%rbp), %r12d
testl %r12d, %r12d
jle 0xb33c
subl %r15d, %r14d
shlq $0x4, %r15
addq 0xa8(%rsp), %r15
movq 0x30(%rsp), %rax
movq 0x50(%rsp), %rcx
movl (%rax,%rcx,4), %ebx
movq 0x68(%rsp), %rax
movq (%rax,%rcx,8), %r13
movq 0x48(%rsp), %rdi
callq 0x14084
movq %r13, %rdi
movl %ebx, %esi
movl %r12d, %edx
movl $0x40, %ecx
leaq 0xd0(%rsp), %r8
movq %rax, 0xc8(%rsp)
movq %rax, %r9
callq 0x142a2
testl %r14d, %r14d
jle 0xb314
movl 0xd0(%rsp), %ecx
movslq %ecx, %rdx
movl %r14d, %r10d
xorl %edi, %edi
xorl %r14d, %r14d
xorl %r8d, %r8d
movq 0x78(%rsp), %r13
movabsq $0x100000000, %rsi      # imm = 0x100000000
movq %r10, 0x18(%rsp)
movq %rdi, %r9
shlq $0x4, %r9
cmpl %ecx, %r8d
jge 0xb2c7
movl 0x8(%r15,%r9), %r11d
shrl %r11d
movzbl (%r15,%r9), %r10d
incl %r11d
movl %r11d, %r12d
subl %r10d, %r12d
movslq %r8d, %r8
movq %r8, %rbx
shlq $0x20, %rbx
cmpl (%rax,%r8,8), %r12d
jl 0xb27c
incq %r8
addq %rsi, %rbx
cmpl %r8d, %ecx
jne 0xb266
movl %ecx, %r8d
jmp 0xb2c2
sarq $0x1d, %rbx
cmpl 0x4(%rax,%rbx), %r11d
jle 0xb2c2
cmpl %r8d, %ecx
jle 0xb2c2
xorl %ebp, %ebp
movq %r8, %rbx
movq (%rax,%rbx,8), %r13
movq %r13, %rsi
shrq $0x20, %rsi
cmpl %esi, %r11d
jle 0xb2f5
cmpl %esi, %r12d
cmovgl %r12d, %esi
cmpl %r13d, %r11d
cmovll %r11d, %r13d
addl %ebp, %r13d
subl %esi, %r13d
incq %rbx
movl %r13d, %ebp
cmpq %rdx, %rbx
jl 0xb291
jmp 0xb2f8
movq 0x18(%rsp), %r10
addq %r15, %r9
movslq %r14d, %rsi
incl %r14d
shlq $0x4, %rsi
movups (%r9), %xmm0
movups %xmm0, (%r15,%rsi)
incq %rdi
cmpq %r10, %rdi
movabsq $0x100000000, %rsi      # imm = 0x100000000
jne 0xb236
jmp 0xb31c
movl %ebp, %r13d
shrl %r10d
cmpl %r10d, %r13d
movq 0x138(%rsp), %rbp
movq 0x78(%rsp), %r13
movq 0x18(%rsp), %r10
jle 0xb2c7
jmp 0xb2dd
xorl %r14d, %r14d
movq 0x78(%rsp), %r13
movq 0xc8(%rsp), %rdi
callq 0x14247
addl 0xb0(%rsp), %r14d
movslq %r14d, %r14
movq %r14, 0x98(%rsp)
movq 0x68(%rsp), %rcx
movq 0x30(%rsp), %rdx
movq 0x50(%rsp), %r9
movq 0x8(%rsp), %rax
addl (%rdx,%r9,4), %eax
movq %rax, 0x8(%rsp)
incq %r9
movl %r14d, %ebx
cmpq %r13, %r9
jne 0xb125
movl 0xbc(%rsp), %ebx
xorl 0xb8(%rsp), %ebx
movss 0xc8(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
movq 0x130(%rsp), %r15
jbe 0xb3a4
movq (%r15), %rdi
movl 0xd4(%rbp), %edx
leaq 0x98(%rsp), %rsi
callq 0x1d5a8
movq %rbp, %rsi
movl %ebx, %r12d
movl %ebx, %ebp
shll $0xb, %ebp
testb $0x40, 0x2(%rsi)
movq (%r15), %rdi
movl 0xd4(%rsi), %edx
movq 0x140(%rsp), %r8
movq 0x20(%rsp), %r14
jne 0xb3ff
subq $0x8, %rsp
leaq 0x78(%rsp), %rax
leaq 0x44(%rsp), %r10
leaq 0xc(%rsp), %r11
leaq 0x30(%rsp), %rbx
leaq 0xa0(%rsp), %r9
movq 0x18(%rsp), %rcx
pushq %rax
pushq %r10
pushq %r11
pushq %rbx
pushq %r14
callq 0xc4f5
jmp 0xb431
subq $0x8, %rsp
leaq 0x78(%rsp), %rax
leaq 0x44(%rsp), %r10
leaq 0xc(%rsp), %r11
leaq 0x30(%rsp), %rbx
leaq 0xa0(%rsp), %r9
movq 0x18(%rsp), %rcx
pushq %rax
pushq %r10
pushq %r11
pushq %rbx
pushq %r14
callq 0xbfd2
addq $0x30, %rsp
movq %rax, %r13
notl %ebp
leaq 0x2b4e7(%rip), %rax     # 0x36928
testb $0x4, (%rax)
movl %r12d, %ebx
jne 0xbf2e
addl %ebp, %ebx
movq 0x138(%rsp), %r12
movl 0x1c(%r12), %edi
movl 0x20(%r12), %r15d
cmpl %edi, %r14d
movq %r14, %rax
movl %edi, %r14d
cmovgl %eax, %r14d
btl $0xc, 0x60(%rsp)
cmovael %edi, %r14d
testl %r15d, %r15d
jg 0xb495
movl 0x24(%r12), %eax
movl %edi, %r15d
testl %eax, %eax
jle 0xb495
subl 0x20(%rsp), %eax
cmpl %edi, %eax
cmovlel %edi, %eax
movl %eax, %r15d
movl %ebx, %ebp
xorps %xmm0, %xmm0
cvtss2sd 0x38(%r12), %xmm0
shrl $0x10, %ebx
movsd 0x222cc(%rip), %xmm1    # 0x2d778
movq 0x10(%rsp), %rax
cvtsi2sdl 0x8(%rax), %xmm2
mulsd %xmm1, %xmm0
mulsd %xmm2, %xmm0
cvtsd2ss %xmm0, %xmm0
cvtss2sd 0x3c(%r12), %xmm3
mulsd %xmm1, %xmm3
mulsd %xmm2, %xmm3
xorps %xmm1, %xmm1
cvtsd2ss %xmm3, %xmm1
testb $-0x80, 0x3(%r12)
movss %xmm0, 0x18(%rsp)
movss %xmm1, 0x48(%rsp)
jne 0xb541
movl 0x14(%r12), %edx
movl 0x28(%r12), %ecx
movl 0x2c(%r12), %r8d
movl 0x30(%r12), %r9d
movl 0x34(%r12), %eax
leaq 0x58(%rsp), %r10
movl %r15d, %edi
movl %r14d, %esi
movq 0x130(%rsp), %r11
pushq (%r11)
pushq %r10
leaq 0x10(%rsp), %r10
pushq %r10
pushq %r13
pushq 0x48(%rsp)
pushq 0x68(%rsp)
pushq 0xc0(%rsp)
pushq %rax
callq 0x14e55
addq $0x40, %rsp
jmp 0xb588
movl 0x44(%r12), %esi
movl 0x14(%r12), %edx
movl 0x28(%r12), %ecx
movl 0x40(%r12), %r8d
movl 0x30(%r12), %r9d
movl 0x34(%r12), %eax
leaq 0x58(%rsp), %r10
movq 0x130(%rsp), %r11
pushq (%r11)
pushq %r10
leaq 0x10(%rsp), %r10
pushq %r10
pushq %r13
pushq 0x48(%rsp)
pushq %rax
callq 0x16631
addq $0x30, %rsp
movq %rax, 0x8(%rsp)
xorl %ebp, %ebx
movl 0x18(%r12), %eax
cmpl 0x14(%r12), %eax
movl %ebx, 0x50(%rsp)
jle 0xb6c4
movzwl (%r12), %eax
testl $0x1480, %eax           # imm = 0x1480
sete %al
cmpl $0x1, 0x40(%rsp)
sete %cl
andb %al, %cl
movl (%rsp), %eax
cmpl $0x2, %eax
setge %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0xb6c4
movq 0x58(%rsp), %rsi
movq (%rsi), %rcx
shlq $0x20, %rcx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
addq %rcx, %rdx
sarq $0x1c, %rdx
movq 0x8(%rsp), %r14
movl 0x8(%r14,%rdx), %ecx
subl 0x8(%r14), %ecx
movq 0x20(%rsp), %rbx
movl %ebx, %edx
subl %ecx, %edx
cmpl 0x48(%r12), %edx
movl %r15d, %ebp
jg 0xb627
cvtsi2ss %ecx, %xmm0
xorps %xmm1, %xmm1
cvtsi2ss %ebx, %xmm1
mulss 0x4c(%r12), %xmm1
ucomiss %xmm1, %xmm0
jbe 0xb838
movl %eax, %eax
movq $0x0, 0x28(%rsp)
xorl %ecx, %ecx
xorl %edx, %edx
movq 0x130(%rsp), %r15
movslq (%rsi,%rcx,8), %rdi
addq %rdi, %rdx
movq %rdx, 0x28(%rsp)
incq %rcx
cmpq %rcx, %rax
jne 0xb63e
movq (%r15), %rdi
callq 0x12587
movq 0x28(%rsp), %rsi
shlq $0x4, %rsi
addq %r14, %rsi
movq %r14, %rdi
callq 0x5a49
movl 0x18(%r12), %edx
movl 0x1c(%r12), %edi
movl 0x44(%r12), %esi
movl 0x28(%r12), %ecx
movl 0x40(%r12), %r8d
movl 0x30(%r12), %r9d
movl 0x34(%r12), %eax
leaq 0x58(%rsp), %r10
movq %rsp, %r11
movss 0x18(%rsp), %xmm0
movss 0x48(%rsp), %xmm1
pushq (%r15)
pushq %r10
pushq %r11
pushq %r14
pushq 0x48(%rsp)
pushq %rax
callq 0x16631
addq $0x30, %rsp
movq %rax, %r14
jmp 0xb840
movl 0xd8(%r12), %eax
cmpl 0xd4(%r12), %eax
movl %r15d, %ebp
jle 0xb82e
cmpl $0x0, 0x4(%rsp)
jle 0xb82e
testb $-0x80, 0x3(%r12)
jne 0xb82e
movslq (%rsp), %rcx
testq %rcx, %rcx
jle 0xb7a1
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
xorl %esi, %esi
movq 0x58(%rsp), %rdx
xorl %r8d, %r8d
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
xorl %r9d, %r9d
movq (%rdx,%rsi,8), %r10
movq %r10, %r11
shrq $0x20, %r11
cmpl %r11d, %r9d
cmovgl %r9d, %r11d
cmovll %esi, %edi
cmovll %r8d, %eax
addl %r8d, %r10d
incq %rsi
movl %r10d, %r8d
movl %r11d, %r9d
cmpq %rsi, %rcx
jne 0xb718
movslq %edi, %rcx
movq (%rdx,%rcx,8), %rcx
movl $0x1, %edx
cmpl $0x2, %ecx
jl 0xb797
cltq
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
shlq $0x4, %rax
movq 0x8(%rsp), %rdx
addq %rdx, %rax
addq $0x18, %rax
decq %rcx
movl $0x1, %edx
movabsq $0xff000000000000, %rsi # imm = 0xFF000000000000
movq -0x10(%rax), %rdi
xorq (%rax), %rdi
andq %rsi, %rdi
cmpq $0x1, %rdi
sbbl $-0x1, %edx
addq $0x10, %rax
decq %rcx
jne 0xb77d
cmpl 0x40(%rsp), %edx
jge 0xb82e
movq 0x130(%rsp), %rax
movq (%rax), %rdi
movq 0x8(%rsp), %rsi
movq %rax, %r15
callq 0x12587
movq (%r15), %rdi
movq 0x58(%rsp), %rsi
callq 0x12587
movq (%r15), %rdi
movq 0x70(%rsp), %rsi
callq 0x12587
testb $0x40, 0x2(%r12)
movq (%r15), %rdi
movl 0xd8(%r12), %edx
jne 0xbe8b
subq $0x8, %rsp
leaq 0x78(%rsp), %rax
leaq 0x44(%rsp), %r10
leaq 0xc(%rsp), %r11
leaq 0x30(%rsp), %rbx
leaq 0xa0(%rsp), %r9
movq %r12, %rsi
movq 0x18(%rsp), %rcx
movq 0x148(%rsp), %r8
pushq %rax
pushq %r10
pushq %r11
pushq %rbx
pushq 0x48(%rsp)
callq 0xc4f5
jmp 0xbeca
movq 0x20(%rsp), %rbx
movq 0x8(%rsp), %r14
movq 0x130(%rsp), %r15
movl %ebp, 0xc(%r15)
movl 0x4(%rsp), %eax
movl %eax, 0x8(%r15)
movq (%r15), %rdi
movl (%rsp), %ecx
movq 0x58(%rsp), %r8
movl 0x4(%r12), %eax
andl $0x1, %eax
subq $0x8, %rsp
movl 0x58(%rsp), %esi
movl %ebx, %edx
movq %r14, %r9
pushq %rax
callq 0x1bb14
addq $0x10, %rsp
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpl $0x0, 0x18(%rdi)
je 0xb8a8
movq %rsp, %r13
movl (%r13), %esi
movq %rbx, %rdx
callq 0x1bec3
movq (%r15), %rdi
movss 0x60(%r12), %xmm0
movq %r13, %rsi
movq %rbx, %rdx
callq 0x1c493
movl %ebp, 0x48(%rsp)
leaq 0x2b075(%rip), %rax     # 0x36928
testb $0x14, (%rax)
setne %al
movl (%rsp), %edx
testl %edx, %edx
setg %cl
andb %al, %cl
cmpb $0x1, %cl
movq %rbx, 0x18(%rsp)
jne 0xb9ba
xorl %ebp, %ebp
leaq (,%rbp,4), %r15
addq %rbp, %r15
shlq $0x4, %r15
cmpl $0x0, 0x4(%rbx,%r15)
jle 0xb9ab
addq %rbx, %r15
movl 0x28(%r15), %eax
movslq %eax, %r13
movq %r13, %r12
shlq $0x4, %r12
addq %r14, %r12
movq (%r12), %r8
movq 0x8(%r12), %r10
xorl %r11d, %r11d
cmpl %eax, %r13d
movq 0x10(%rsp), %rcx
je 0xb92b
movl -0x8(%r12), %eax
addl %r8d, %eax
movl %r10d, %r11d
subl %eax, %r11d
addl -0x10(%r12), %r11d
movq 0x2a6c6(%rip), %rax     # 0x35ff8
movq (%rax), %rdi
movq 0x20(%rcx), %rax
movq %r8, %rcx
shrq $0x20, %rcx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
leaq (%rcx,%rcx,2), %rcx
movq (%rax,%rcx,8), %rcx
movq %r8, %rax
shrq $0x3f, %rax
leaq 0x21e4d(%rip), %rdx     # 0x2d7a9
movsbl (%rax,%rdx), %r9d
movq %r10, %rax
shrq $0x20, %rax
movzbl %al, %ebx
subq $0x8, %rsp
leaq 0x21e36(%rip), %rsi     # 0x2d7ac
movl %ebp, %edx
xorl %eax, %eax
pushq %r11
pushq %rbx
pushq %r10
callq 0x2260
addq $0x20, %rsp
incq %r13
movslq 0x28(%r15), %rax
movslq 0x4(%r15), %rcx
addq %rax, %rcx
addq $0x10, %r12
cmpq %rcx, %r13
jl 0xb902
movl (%rsp), %edx
movq 0x18(%rsp), %rbx
incq %rbp
movslq %edx, %rax
cmpq %rax, %rbp
jl 0xb8d3
movq 0x138(%rsp), %rbp
movq (%rbp), %r9
btl $0x17, %r9d
movq 0x130(%rsp), %r15
jb 0xba7f
movq (%r15), %r13
movss 0x50(%rbp), %xmm0
movl 0x54(%rbp), %esi
movl 0x64(%rbp), %r8d
addl %r8d, %r8d
addl 0x68(%rbp), %r8d
andl $0x20000000, %r9d       # imm = 0x20000000
movss 0x60(%rbp), %xmm1
movq %r13, %rdi
movq %rbx, %rcx
callq 0x1bfdc
movq 0x10(%rsp), %rax
movl 0x8(%rax), %edx
addl %edx, %edx
movss 0x58(%rbp), %xmm0
movl 0x5c(%rbp), %ecx
movq 0x40(%rsp), %r8
cmpl $0x1, %r8d
jne 0xba55
xorps %xmm1, %xmm1
cvtsi2sdl 0x1c(%rbp), %xmm1
mulsd 0x21d4d(%rip), %xmm1    # 0x2d780
cvttsd2si %xmm1, %r8d
subq $0x8, %rsp
leaq 0x8(%rsp), %r9
movq %r13, %rdi
movl %edx, %esi
movl %ecx, %edx
movl $0x1, %ecx
pushq %rbx
callq 0x1c811
jmp 0xba7b
movq %rsp, %rax
movss 0x21d28(%rip), %xmm1    # 0x2d788
movss 0x1f59c(%rip), %xmm2    # 0x2b004
movq %r13, %rdi
movl 0x48(%rsp), %esi
movq 0x30(%rsp), %r9
pushq %rbx
pushq %rax
callq 0x10d7c
addq $0x10, %rsp
btl $0xc, 0x60(%rsp)
movabsq $0x100000000, %rax      # imm = 0x100000000
jb 0xbace
testq %rax, (%rbp)
jne 0xbace
movl (%rsp), %edx
movl 0x3c(%rsp), %r9d
subq $0x8, %rsp
movq 0x18(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq %rbx, %rcx
movq %r14, %r8
pushq 0x78(%rsp)
callq 0x119c8
addq $0x10, %rsp
movl (%rsp), %edi
movq %rbx, %rsi
callq 0x1ca22
movl %eax, (%rsp)
movq (%r15), %rdx
movq 0x40(%rsp), %rbx
cmpl $0x1, %ebx
jne 0xbb7e
movq 0x30(%rsp), %rax
movl (%rax), %ecx
movq 0x68(%rsp), %rax
movq (%rax), %r8
movq %rsp, %rbx
movq %rbp, %rdi
movq 0x10(%rsp), %rsi
movq %rbx, %r9
pushq %r14
pushq 0x20(%rsp)
callq 0xc90a
addq $0x10, %rsp
movslq (%rbx), %rcx
shlq $0x4, %rcx
leaq (%rcx,%rcx,4), %rsi
movq %rax, %rdi
callq 0x2320
movq %rax, %r12
movq (%r15), %rdi
movl (%rbx), %esi
movl 0x34(%rbp), %ecx
movl 0x64(%rbp), %r8d
movl 0x4(%rsp), %r9d
movabsq $0x8000001000, %rax     # imm = 0x8000001000
xorl %r10d, %r10d
testq %rax, 0x60(%rsp)
setne %r10b
movq %r12, %rdx
pushq 0x90(%rsp)
pushq %r10
callq 0x1d0a4
addq $0x10, %rsp
movl (%rbx), %eax
movq 0x88(%rsp), %rcx
movl %eax, (%rcx)
movq 0x80(%rsp), %rax
movq %r12, 0x18(%rsp)
movq %r12, (%rax)
jmp 0xbd4e
movl (%rsp), %r8d
subq $0x8, %rsp
movq %rdx, %rdi
movl 0x58(%rsp), %esi
movl %ebx, %edx
movq 0x38(%rsp), %rcx
movq 0x20(%rsp), %r12
movq %r12, %r9
pushq %r14
pushq 0x90(%rsp)
pushq 0xa0(%rsp)
callq 0x1cca0
addq $0x20, %rsp
movq %rax, %r13
movq %r12, %rdi
callq 0x2040
testl %ebx, %ebx
jle 0xbd3a
movq %r14, 0x8(%rsp)
movabsq $0x8000001000, %rax     # imm = 0x8000001000
xorl %ecx, %ecx
testq %rax, 0x60(%rsp)
setne %cl
movq %rcx, 0x50(%rsp)
movq %r13, 0xb0(%rsp)
movq %r13, %r12
addq $0x10, %r12
shlq $0x2, 0x78(%rsp)
xorl %r13d, %r13d
movq 0x88(%rsp), %rbx
movq 0x80(%rsp), %r14
movq (%r15), %rdi
movss 0x50(%rbp), %xmm0
movl 0x54(%rbp), %esi
leaq (%rbx,%r13), %rbp
movl (%rbx,%r13), %edx
movq 0x138(%rsp), %rax
movl 0x64(%rax), %r8d
addl %r8d, %r8d
addl 0x68(%rax), %r8d
movq (%r14,%r13,2), %rcx
movl (%rax), %r9d
movl $0x20000000, %eax       # imm = 0x20000000
andl %eax, %r9d
movq 0x138(%rsp), %rax
movss 0x60(%rax), %xmm1
callq 0x1bfdc
movq (%r15), %rdx
movq 0x30(%rsp), %rax
movl (%rax,%r13), %ecx
movq 0x68(%rsp), %rax
movq (%rax,%r13,2), %r8
movq 0x138(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq %rbp, %r9
movq 0x138(%rsp), %rbp
pushq (%r12)
pushq (%r14,%r13,2)
callq 0xc90a
addq $0x10, %rsp
movq %rax, (%r14,%r13,2)
movq (%r15), %rdi
movl (%rbx,%r13), %esi
movl 0x34(%rbp), %ecx
movl 0x64(%rbp), %r8d
movl 0x4(%rsp), %r9d
movq %rax, %rdx
pushq 0x90(%rsp)
pushq 0x58(%rsp)
callq 0x1d0a4
addq $0x10, %rsp
addq $0x4, %r13
addq $0x18, %r12
cmpq %r13, 0x78(%rsp)
jne 0xbc0e
movq (%r15), %rdi
movq 0x40(%rsp), %rbx
movl %ebx, %esi
movq 0xb0(%rsp), %rdx
callq 0x1d027
cmpl $0x2, %ebx
jne 0xbd49
cmpl $0x0, 0xb8(%rbp)
movq 0x8(%rsp), %r14
js 0xbd4e
testb $0x4, (%rbp)
je 0xbd4e
movq (%r15), %rdi
movl 0x64(%rbp), %r8d
movl 0xbc(%rbp), %edx
leal (%r8,%r8), %ecx
addl 0x68(%rbp), %ecx
movl 0x48(%rsp), %esi
movq 0x30(%rsp), %r9
pushq 0x80(%rsp)
pushq 0x90(%rsp)
callq 0x1130e
addq $0x10, %rsp
jmp 0xbd4e
movq (%r15), %rdi
movl %ebx, %esi
movq %r13, %rdx
callq 0x1d027
jmp 0xbd4e
movq 0x8(%rsp), %r14
movq (%r15), %rdi
movq 0xa8(%rsp), %rsi
callq 0x12587
movq (%r15), %rdi
movq %r14, %rsi
callq 0x12587
movq (%r15), %rdi
movq 0x58(%rsp), %rsi
callq 0x12587
movq (%r15), %rdi
movq 0x70(%rsp), %rsi
callq 0x12587
cmpl $0x1, 0x40(%rsp)
movq 0x68(%rsp), %r12
movq 0x30(%rsp), %r13
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %r14
jne 0xbded
cmpq $0x0, 0x48(%rax)
je 0xbded
cmpq $0x0, 0xc0(%rsp)
je 0xbded
cmpl $0x0, (%rsp)
jle 0xbded
xorl %ebx, %ebx
movq (%r15), %rdi
movl (%r13), %ecx
movq (%r12), %r8
subq $0x8, %rsp
movq 0x18(%rsp), %rsi
movq %rbp, %rdx
movq %r14, %r9
pushq $0x0
callq 0x1dd50
addq $0x10, %rsp
incq %rbx
movslq (%rsp), %rax
addq $0x50, %r14
cmpq %rax, %rbx
jl 0xbdb8
movq (%r15), %rdi
testq %rdi, %rdi
movq 0x140(%rsp), %rbx
movq 0x20(%rsp), %r14
je 0xbe79
leaq 0xd0(%rsp), %rsi
callq 0x1284e
leaq 0x2ab12(%rip), %rax     # 0x36928
testb $0x2, (%rax)
jne 0xbf4a
movq 0xe0(%rsp), %rax
cmpq 0xe8(%rsp), %rax
jne 0xbfb3
cmpq $0x10000000, 0xf0(%rsp) # imm = 0x10000000
ja 0xbe59
movq 0xf8(%rbp), %rax
testq %rax, %rax
jle 0xbe79
cmpq %rax, 0xd0(%rsp)
jbe 0xbe79
leaq 0x2aac8(%rip), %rax     # 0x36928
testb $0x2, (%rax)
jne 0xbf8c
movq (%r15), %rdi
callq 0x12549
callq 0x1252f
movq %rax, (%r15)
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
subq $0x8, %rsp
leaq 0x78(%rsp), %rax
leaq 0x44(%rsp), %r10
leaq 0xc(%rsp), %r11
leaq 0x30(%rsp), %rbx
leaq 0xa0(%rsp), %r9
movq %r12, %rsi
movq 0x18(%rsp), %rcx
movq 0x148(%rsp), %r8
pushq %rax
pushq %r10
pushq %r11
pushq %rbx
pushq 0x48(%rsp)
callq 0xbfd2
addq $0x30, %rsp
movl 0x14(%r12), %edx
movl 0x28(%r12), %ecx
movl 0x2c(%r12), %r8d
movl 0x30(%r12), %r9d
movl 0x34(%r12), %r10d
leaq 0x58(%rsp), %r11
movq %rsp, %rbx
movl %ebp, %edi
movl %r14d, %esi
movss 0x18(%rsp), %xmm0
movss 0x48(%rsp), %xmm1
pushq (%r15)
pushq %r11
pushq %rbx
pushq %rax
pushq 0x48(%rsp)
pushq 0x68(%rsp)
pushq 0xc0(%rsp)
pushq %r10
callq 0x14e55
addq $0x40, %rsp
movq %rax, %r14
movq 0x20(%rsp), %rbx
jmp 0xb840
leaq 0x4(%rsp), %rdi
leaq 0x28(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r13, %rcx
callq 0x2eb7
jmp 0xb44d
movq 0x2a0a7(%rip), %rax     # 0x35ff8
movq (%rax), %rdi
movq 0xd0(%rsp), %r8
movq 0xe8(%rsp), %r9
subq $0x8, %rsp
leaq 0x21856(%rip), %rsi     # 0x2d7c5
movq %rbx, %rdx
movl %r14d, %ecx
xorl %eax, %eax
pushq 0xf8(%rsp)
callq 0x2260
addq $0x10, %rsp
jmp 0xbe1f
movq 0x2a065(%rip), %rax     # 0x35ff8
movq (%rax), %rdi
leaq 0x21902(%rip), %rsi     # 0x2d89f
leaq 0x2192c(%rip), %rdx     # 0x2d8d0
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2260
jmp 0xbe69
leaq 0x21833(%rip), %rdi     # 0x2d7ed
leaq 0x2184a(%rip), %rsi     # 0x2d80b
leaq 0x21849(%rip), %rcx     # 0x2d811
movl $0x172, %edx            # imm = 0x172
callq 0x21a0