// File: /workspace/github_c_makefile_star2_O0/lh3[P]minigraph/map-algo.c
// Function: mg_map_frag
void mg_map_frag(const mg_idx_t *gi, int n_segs, const int *qlens, const char **seqs, mg_gchains_t **gcs, mg_tbuf_t *b, const mg_mapopt_t *opt, const char *qname)
{
	int i, l, rep_len, qlen_sum, n_lc, n_gc, n_mini_pos;
	int max_chain_gap_qry, max_chain_gap_ref, is_splice = !!(opt->flag & MG_M_SPLICE), is_sr = !!(opt->flag & MG_M_SR);
	uint32_t hash;
	int64_t n_a;
	uint64_t *u;
	int32_t *mini_pos;
	mg128_t *a;
	mg128_v mv = {0,0,0};
	mg_lchain_t *lc;
	char *seq_cat;
	km_stat_t kmst;
	float tmp, chn_pen_gap, chn_pen_skip;
	double t = 0.0;

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

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

	hash  = qname? kh_hash_str(qname) : 0;
	hash ^= kh_hash_uint32(qlen_sum) + kh_hash_uint32(opt->seed);
	hash  = kh_hash_uint32(hash);

	collect_minimizers(b->km, opt, gi, n_segs, qlens, seqs, &mv);
	if (opt->flag & MG_M_HEAP_SORT) a = collect_seed_hits_heap(b->km, opt, opt->occ_max1, gi, qname, &mv, qlen_sum, &n_a, &rep_len, &n_mini_pos, &mini_pos);
	else a = collect_seed_hits(b->km, opt, opt->occ_max1, gi, qname, &mv, qlen_sum, &n_a, &rep_len, &n_mini_pos, &mini_pos);

	if (mg_dbg_flag & MG_DBG_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", gi->g->seg[a[i].x>>33].name, (int32_t)a[i].x, "+-"[a[i].x>>32&1], (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 mg_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;

	tmp = expf(-opt->div * gi->k);
	chn_pen_gap = opt->chn_pen_gap * tmp;
	chn_pen_skip = opt->chn_pen_skip * tmp;

	if (mg_dbg_flag & MG_DBG_QNAME) t = realtime();
	if (n_a == 0) {
		if (a) kfree(b->km, a);
		a = 0, n_lc = 0, u = 0;
	} else {
		if (opt->flag & MG_M_RMQ) {
			a = mg_lchain_rmq(opt->max_gap, opt->max_gap_pre, opt->bw, opt->max_lc_skip, opt->rmq_size_cap, opt->min_lc_cnt, opt->min_lc_score,
							  chn_pen_gap, chn_pen_skip, n_a, a, &n_lc, &u, b->km);
		} else {
			a = mg_lchain_dp(max_chain_gap_ref, max_chain_gap_qry, opt->bw, opt->max_lc_skip, opt->max_lc_iter, opt->min_lc_cnt, opt->min_lc_score,
							 chn_pen_gap, chn_pen_skip, is_splice, n_segs, n_a, a, &n_lc, &u, b->km);
		}
	}
	if (mg_dbg_flag & MG_DBG_QNAME) t = print_time(t, 1, qname);

	if (opt->bw_long > opt->bw && (opt->flag & (MG_M_SPLICE|MG_M_SR)) == 0 && n_segs == 1 && n_lc > 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 || qlen_sum - (en - st) > qlen_sum * opt->rmq_rescue_ratio) {
			int32_t i;
			for (i = 0, n_a = 0; i < n_lc; ++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->max_gap_pre, opt->bw_long, opt->max_lc_skip, opt->rmq_size_cap, opt->min_lc_cnt, opt->min_lc_score,
							  chn_pen_gap, chn_pen_skip, n_a, a, &n_lc, &u, b->km);
		}
	}

	b->frag_gap = max_chain_gap_ref;
	kfree(b->km, mv.a);

	if (n_lc) {
		lc = mg_lchain_gen(b->km, hash, qlen_sum, n_lc, u, a);
		if (n_lc > 1) {
			int32_t n_lc_new = 0;
			for (i = 0; i < n_lc; ++i) {
				mg_lchain_t *p = &lc[i];
				int32_t cnt = p->cnt, off = p->off;
				mm_fix_bad_ends(a, opt->lc_max_occ, opt->lc_max_trim, &off, &cnt);
				mm_fix_bad_ends_alt(a, p->score, opt->bw, 100, &off, &cnt);
				mm_filter_bad_seeds(b->km, off, cnt, a, 10, 40, opt->max_gap>>1, 10);
				mm_filter_bad_seeds_alt(b->km, off, cnt, a, 30, opt->max_gap>>1);
				//printf("X\t%d\t%d\t%d\t%d\t%d\t%d\n", p->qs, p->qe, p->off, p->cnt, off, cnt);
				p->off = off, p->cnt = cnt;
				if (cnt >= opt->min_lc_cnt) {
					int32_t q_span = a[p->off].y>>32 & 0xff;
					p->rs = (int32_t)a[p->off].x + 1 - q_span;
					p->qs = (int32_t)a[p->off].y + 1 - q_span;
					p->re = (int32_t)a[p->off + p->cnt - 1].x + 1;
					p->qe = (int32_t)a[p->off + p->cnt - 1].y + 1;
					lc[n_lc_new++] = *p;
				}
			}
			n_lc = n_lc_new;
		}
		for (i = 0; i < n_lc; ++i)
			mg_update_anchors(lc[i].cnt, &a[lc[i].off], n_mini_pos, mini_pos);
	} else lc = 0;
	kfree(b->km, mini_pos);
	kfree(b->km, u);
	if (mg_dbg_flag & MG_DBG_QNAME) t = print_time(t, 2, qname);

	if (mg_dbg_flag & MG_DBG_LCHAIN)
		mg_print_lchain(stdout, gi, n_lc, lc, a, qname);

	KMALLOC(b->km, seq_cat, qlen_sum);
	for (i = l = 0; i < n_segs; ++i) {
		strncpy(&seq_cat[l], seqs[i], qlens[i]);
		l += qlens[i];
	}
	n_gc = mg_gchain1_dp(b->km, gi->g, &n_lc, lc, qlen_sum, opt->bw_long, opt->bw_long, opt->bw_long, opt->max_gc_skip, opt->ref_bonus,
						 chn_pen_gap, chn_pen_skip, opt->mask_level, a, &u);
	if (mg_dbg_flag & MG_DBG_QNAME) t = print_time(t, 3, qname);
	gcs[0] = mg_gchain_gen(0, b->km, gi->g, gi->es, n_gc, u, lc, a, hash, opt->min_gc_cnt, opt->min_gc_score, opt->gdp_max_ed, n_segs, seq_cat);
	if (mg_dbg_flag & MG_DBG_QNAME) t = print_time(t, 4, qname);
	gcs[0]->rep_len = rep_len;
	kfree(b->km, a);
	kfree(b->km, lc);
	kfree(b->km, u);

	mg_gchain_set_parent(b->km, opt->mask_level, gcs[0]->n_gc, gcs[0]->gc, opt->sub_diff, 0);
	mg_gchain_flt_sub(opt->pri_ratio, gi->k * 2, opt->best_n, gcs[0]->n_gc, gcs[0]->gc);
	mg_gchain_drop_flt(b->km, gcs[0]);
	mg_gchain_set_mapq(b->km, gcs[0], qlen_sum, mv.n, opt->min_gc_score);
	if ((opt->flag&MG_M_CIGAR) && n_segs == 1) {
		mg_gchain_cigar(b->km, gi->g, gi->es, seq_cat, gcs[0], qname);
		mg_gchain_gen_ds(b->km, gi->g, gi->es, seq_cat, gcs[0]);
	}
	kfree(b->km, seq_cat);
	if (mg_dbg_flag & MG_DBG_QNAME) t = print_time(t, 5, qname);

	if (b->km) {
		km_stat(b->km, &kmst);
		if (mg_dbg_flag & MG_DBG_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);
		if (kmst.n_blocks != kmst.n_cores) {
			fprintf(stderr, "[E::%s] memory leak at %s\n", __func__, qname);
			abort();
		}
		if (kmst.largest > 1U<<28 || (opt->cap_kalloc > 0 && kmst.capacity > opt->cap_kalloc)) {
			km_destroy(b->km);
			b->km = km_init();
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x30(%rbp)
movl %esi, -0x34(%rbp)
movq %rdx, -0x40(%rbp)
movq %rcx, -0x48(%rbp)
movq %r8, -0x50(%rbp)
movq %r9, -0x58(%rbp)
movq 0x10(%rbp), %rax
movq (%rax), %rax
andq $0x10, %rax
cmpq $0x0, %rax
setne %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x80(%rbp)
movq 0x10(%rbp), %rax
movq (%rax), %rax
andq $0x20, %rax
cmpq $0x0, %rax
setne %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x84(%rbp)
leaq -0xc0(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x2190
xorps %xmm0, %xmm0
movsd %xmm0, -0x110(%rbp)
movl $0x0, -0x5c(%rbp)
movl $0x0, -0x68(%rbp)
movl -0x5c(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x2cb92
movq -0x40(%rbp), %rax
movslq -0x5c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
addl -0x68(%rbp), %eax
movl %eax, -0x68(%rbp)
movq -0x50(%rbp), %rax
movslq -0x5c(%rbp), %rcx
movq $0x0, (%rax,%rcx,8)
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x2cb5e
cmpl $0x0, -0x68(%rbp)
je 0x2cba7
cmpl $0x0, -0x34(%rbp)
jle 0x2cba7
cmpl $0xff, -0x34(%rbp)
jle 0x2cbac
jmp 0x2dc61
movq 0x10(%rbp), %rax
cmpl $0x0, 0x14(%rax)
jle 0x2cbc7
movl -0x68(%rbp), %eax
movq 0x10(%rbp), %rcx
cmpl 0x14(%rcx), %eax
jle 0x2cbc7
jmp 0x2dc61
cmpq $0x0, 0x18(%rbp)
je 0x2cbdf
movq 0x18(%rbp), %rdi
callq 0x2dc80
movl %eax, -0x138(%rbp)
jmp 0x2cbe9
xorl %eax, %eax
movl %eax, -0x138(%rbp)
jmp 0x2cbe9
movl -0x138(%rbp), %eax
movl %eax, -0x88(%rbp)
movl -0x68(%rbp), %edi
callq 0x2dce0
movl %eax, -0x13c(%rbp)
movq 0x10(%rbp), %rax
movl 0x10(%rax), %edi
callq 0x2dce0
movl %eax, %ecx
movl -0x13c(%rbp), %eax
addl %ecx, %eax
xorl -0x88(%rbp), %eax
movl %eax, -0x88(%rbp)
movl -0x88(%rbp), %edi
callq 0x2dce0
movl %eax, -0x88(%rbp)
movq -0x58(%rbp), %rax
movq (%rax), %rdi
movq 0x10(%rbp), %rsi
movq -0x30(%rbp), %rdx
movl -0x34(%rbp), %ecx
movq -0x40(%rbp), %r8
movq -0x48(%rbp), %r9
leaq -0xc0(%rbp), %rax
movq %rax, (%rsp)
callq 0x2dd40
movq 0x10(%rbp), %rax
movq (%rax), %rax
andq $0x400, %rax            # imm = 0x400
cmpq $0x0, %rax
je 0x2ccd4
movq -0x58(%rbp), %rax
movq (%rax), %rdi
movq 0x10(%rbp), %rsi
movq 0x10(%rbp), %rax
movl 0x1c(%rax), %edx
movq -0x30(%rbp), %rcx
movq 0x18(%rbp), %r8
movl -0x68(%rbp), %r14d
leaq -0xc0(%rbp), %r9
leaq -0x90(%rbp), %rbx
leaq -0x64(%rbp), %r11
leaq -0x74(%rbp), %r10
leaq -0xa0(%rbp), %rax
movl %r14d, (%rsp)
movq %rbx, 0x8(%rsp)
movq %r11, 0x10(%rsp)
movq %r10, 0x18(%rsp)
movq %rax, 0x20(%rsp)
callq 0x2de40
movq %rax, -0xa8(%rbp)
jmp 0x2cd33
movq -0x58(%rbp), %rax
movq (%rax), %rdi
movq 0x10(%rbp), %rsi
movq 0x10(%rbp), %rax
movl 0x1c(%rax), %edx
movq -0x30(%rbp), %rcx
movq 0x18(%rbp), %r8
movl -0x68(%rbp), %r14d
leaq -0xc0(%rbp), %r9
leaq -0x90(%rbp), %rbx
leaq -0x64(%rbp), %r11
leaq -0x74(%rbp), %r10
leaq -0xa0(%rbp), %rax
movl %r14d, (%rsp)
movq %rbx, 0x8(%rsp)
movq %r11, 0x10(%rsp)
movq %r10, 0x18(%rsp)
movq %rax, 0x20(%rsp)
callq 0x2e260
movq %rax, -0xa8(%rbp)
leaq 0x1894e(%rip), %rax     # 0x45688
movl (%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x2cf1e
movq 0x182a9(%rip), %rax     # 0x44ff8
movq (%rax), %rdi
movl -0x64(%rbp), %edx
leaq 0x10db8(%rip), %rsi     # 0x3db14
movb $0x0, %al
callq 0x2210
movl $0x0, -0x5c(%rbp)
movslq -0x5c(%rbp), %rax
cmpq -0x90(%rbp), %rax
jge 0x2cf1c
movq 0x18276(%rip), %rax     # 0x44ff8
movq (%rax), %rax
movq %rax, -0x160(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rax
movq -0xa8(%rbp), %rcx
movslq -0x5c(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rcx
shrq $0x21, %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
movq %rax, -0x158(%rbp)
movq -0xa8(%rbp), %rax
movslq -0x5c(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movl %eax, -0x14c(%rbp)
movq -0xa8(%rbp), %rax
movslq -0x5c(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
shrq $0x20, %rcx
andq $0x1, %rcx
leaq 0xf55e(%rip), %rax      # 0x3c35f
movsbl (%rax,%rcx), %eax
movl %eax, -0x148(%rbp)
movq -0xa8(%rbp), %rax
movslq -0x5c(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl %eax, -0x144(%rbp)
movq -0xa8(%rbp), %rax
movslq -0x5c(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
shrq $0x20, %rax
andq $0xff, %rax
movl %eax, -0x140(%rbp)
cmpl $0x0, -0x5c(%rbp)
jne 0x2ce5d
xorl %eax, %eax
movl %eax, -0x164(%rbp)
jmp 0x2cec9
movq -0xa8(%rbp), %rax
movslq -0x5c(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq -0xa8(%rbp), %rcx
movl -0x5c(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq 0x8(%rcx), %rcx
subl %ecx, %eax
movq -0xa8(%rbp), %rcx
movslq -0x5c(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rcx
movq -0xa8(%rbp), %rdx
movl -0x5c(%rbp), %esi
subl $0x1, %esi
movslq %esi, %rsi
shlq $0x4, %rsi
addq %rsi, %rdx
movq (%rdx), %rdx
subl %edx, %ecx
subl %ecx, %eax
movl %eax, -0x164(%rbp)
movl -0x140(%rbp), %r10d
movl -0x144(%rbp), %r9d
movl -0x148(%rbp), %r8d
movl -0x14c(%rbp), %ecx
movq -0x158(%rbp), %rdx
movq -0x160(%rbp), %rdi
movl -0x164(%rbp), %eax
leaq 0x10c1c(%rip), %rsi     # 0x3db1b
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
movb $0x0, %al
callq 0x2210
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x2cd6a
jmp 0x2cf1e
cmpl $0x0, -0x84(%rbp)
je 0x2cf56
movl -0x68(%rbp), %eax
movq 0x10(%rbp), %rcx
cmpl 0x40(%rcx), %eax
jle 0x2cf3e
movl -0x68(%rbp), %eax
movl %eax, -0x168(%rbp)
jmp 0x2cf4b
movq 0x10(%rbp), %rax
movl 0x40(%rax), %eax
movl %eax, -0x168(%rbp)
movl -0x168(%rbp), %eax
movl %eax, -0x78(%rbp)
jmp 0x2cf60
movq 0x10(%rbp), %rax
movl 0x40(%rax), %eax
movl %eax, -0x78(%rbp)
movq 0x10(%rbp), %rax
cmpl $0x0, 0x44(%rax)
jle 0x2cf76
movq 0x10(%rbp), %rax
movl 0x44(%rax), %eax
movl %eax, -0x7c(%rbp)
jmp 0x2cfb1
movq 0x10(%rbp), %rax
cmpl $0x0, 0x48(%rax)
jle 0x2cfa5
movq 0x10(%rbp), %rax
movl 0x48(%rax), %eax
subl -0x68(%rbp), %eax
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
movq 0x10(%rbp), %rcx
cmpl 0x40(%rcx), %eax
jge 0x2cfa3
movq 0x10(%rbp), %rax
movl 0x40(%rax), %eax
movl %eax, -0x7c(%rbp)
jmp 0x2cfaf
movq 0x10(%rbp), %rax
movl 0x40(%rax), %eax
movl %eax, -0x7c(%rbp)
jmp 0x2cfb1
movq 0x10(%rbp), %rax
movss 0x4c(%rax), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
movq -0x30(%rbp), %rax
cvtsi2ssl 0x18(%rax), %xmm1
mulss %xmm1, %xmm0
callq 0x20a0
movss %xmm0, -0xfc(%rbp)
movq 0x10(%rbp), %rax
movss 0x50(%rax), %xmm0
mulss -0xfc(%rbp), %xmm0
movss %xmm0, -0x100(%rbp)
movq 0x10(%rbp), %rax
movss 0x54(%rax), %xmm0
mulss -0xfc(%rbp), %xmm0
movss %xmm0, -0x104(%rbp)
leaq 0x1866e(%rip), %rax     # 0x45688
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x2d031
callq 0x48e0
movsd %xmm0, -0x110(%rbp)
cmpq $0x0, -0x90(%rbp)
jne 0x2d07a
cmpq $0x0, -0xa8(%rbp)
je 0x2d058
movq -0x58(%rbp), %rax
movq (%rax), %rdi
movq -0xa8(%rbp), %rsi
callq 0x2670
movq $0x0, -0xa8(%rbp)
movl $0x0, -0x6c(%rbp)
movq $0x0, -0x98(%rbp)
jmp 0x2d1bc
movq 0x10(%rbp), %rax
movq (%rax), %rax
andq $0x8000, %rax           # imm = 0x8000
cmpq $0x0, %rax
je 0x2d123
movq 0x10(%rbp), %rax
movl 0x40(%rax), %edi
movq 0x10(%rbp), %rax
movl 0x3c(%rax), %esi
movq 0x10(%rbp), %rax
movl 0x28(%rax), %edx
movq 0x10(%rbp), %rax
movl 0x58(%rax), %ecx
movq 0x10(%rbp), %rax
movl 0x30(%rax), %r8d
movq 0x10(%rbp), %rax
movl 0x64(%rax), %r9d
movq 0x10(%rbp), %rax
movl 0x68(%rax), %r15d
movss -0x100(%rbp), %xmm0
movss -0x104(%rbp), %xmm1
movq -0x90(%rbp), %r14
movq -0xa8(%rbp), %rbx
movq -0x58(%rbp), %rax
movq (%rax), %rax
leaq -0x6c(%rbp), %r11
leaq -0x98(%rbp), %r10
movl %r15d, (%rsp)
movq %r14, 0x8(%rsp)
movq %rbx, 0x10(%rsp)
movq %r11, 0x18(%rsp)
movq %r10, 0x20(%rsp)
movq %rax, 0x28(%rsp)
callq 0x24950
movq %rax, -0xa8(%rbp)
jmp 0x2d1ba
movl -0x7c(%rbp), %edi
movl -0x78(%rbp), %esi
movq 0x10(%rbp), %rax
movl 0x28(%rax), %edx
movq 0x10(%rbp), %rax
movl 0x58(%rax), %ecx
movq 0x10(%rbp), %rax
movl 0x5c(%rax), %r8d
movq 0x10(%rbp), %rax
movl 0x64(%rax), %r9d
movq 0x10(%rbp), %rax
movl 0x68(%rax), %r13d
movss -0x100(%rbp), %xmm0
movss -0x104(%rbp), %xmm1
movl -0x80(%rbp), %r12d
movl -0x34(%rbp), %r15d
movq -0x90(%rbp), %r14
movq -0xa8(%rbp), %rbx
movq -0x58(%rbp), %rax
movq (%rax), %rax
leaq -0x6c(%rbp), %r11
leaq -0x98(%rbp), %r10
movl %r13d, (%rsp)
movl %r12d, 0x8(%rsp)
movl %r15d, 0x10(%rsp)
movq %r14, 0x18(%rsp)
movq %rbx, 0x20(%rsp)
movq %r11, 0x28(%rsp)
movq %r10, 0x30(%rsp)
movq %rax, 0x38(%rsp)
callq 0x22190
movq %rax, -0xa8(%rbp)
jmp 0x2d1bc
leaq 0x184c5(%rip), %rax     # 0x45688
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x2d1eb
movsd -0x110(%rbp), %xmm0
movq 0x18(%rbp), %rsi
movl $0x1, %edi
callq 0x2e640
movsd %xmm0, -0x110(%rbp)
movq 0x10(%rbp), %rax
movl 0x2c(%rax), %eax
movq 0x10(%rbp), %rcx
cmpl 0x28(%rcx), %eax
jle 0x2d3bd
movq 0x10(%rbp), %rax
movq (%rax), %rax
andq $0x30, %rax
cmpq $0x0, %rax
jne 0x2d3bd
cmpl $0x1, -0x34(%rbp)
jne 0x2d3bd
cmpl $0x1, -0x6c(%rbp)
jle 0x2d3bd
movq -0xa8(%rbp), %rax
movq 0x8(%rax), %rax
movl %eax, -0x114(%rbp)
movq -0xa8(%rbp), %rax
movq -0x98(%rbp), %rcx
movq (%rcx), %rcx
subl $0x1, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl %eax, -0x118(%rbp)
movl -0x68(%rbp), %eax
movl -0x118(%rbp), %ecx
subl -0x114(%rbp), %ecx
subl %ecx, %eax
movq 0x10(%rbp), %rcx
cmpl 0x34(%rcx), %eax
jg 0x2d2a7
movl -0x68(%rbp), %eax
movl -0x118(%rbp), %ecx
subl -0x114(%rbp), %ecx
subl %ecx, %eax
cvtsi2ss %eax, %xmm0
cvtsi2ssl -0x68(%rbp), %xmm1
movq 0x10(%rbp), %rax
mulss 0x38(%rax), %xmm1
ucomiss %xmm1, %xmm0
jbe 0x2d3bb
movl $0x0, -0x11c(%rbp)
movq $0x0, -0x90(%rbp)
movl -0x11c(%rbp), %eax
cmpl -0x6c(%rbp), %eax
jge 0x2d2fa
movq -0x98(%rbp), %rax
movslq -0x11c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cltq
addq -0x90(%rbp), %rax
movq %rax, -0x90(%rbp)
movl -0x11c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x11c(%rbp)
jmp 0x2d2bc
movq -0x58(%rbp), %rax
movq (%rax), %rdi
movq -0x98(%rbp), %rsi
callq 0x2670
movq -0xa8(%rbp), %rdi
movq -0xa8(%rbp), %rsi
movq -0x90(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rsi
callq 0x15f50
movq 0x10(%rbp), %rax
movl 0x40(%rax), %edi
movq 0x10(%rbp), %rax
movl 0x3c(%rax), %esi
movq 0x10(%rbp), %rax
movl 0x2c(%rax), %edx
movq 0x10(%rbp), %rax
movl 0x58(%rax), %ecx
movq 0x10(%rbp), %rax
movl 0x30(%rax), %r8d
movq 0x10(%rbp), %rax
movl 0x64(%rax), %r9d
movq 0x10(%rbp), %rax
movl 0x68(%rax), %r15d
movss -0x100(%rbp), %xmm0
movss -0x104(%rbp), %xmm1
movq -0x90(%rbp), %r14
movq -0xa8(%rbp), %rbx
movq -0x58(%rbp), %rax
movq (%rax), %rax
leaq -0x6c(%rbp), %r11
leaq -0x98(%rbp), %r10
movl %r15d, (%rsp)
movq %r14, 0x8(%rsp)
movq %rbx, 0x10(%rsp)
movq %r11, 0x18(%rsp)
movq %r10, 0x20(%rsp)
movq %rax, 0x28(%rsp)
callq 0x24950
movq %rax, -0xa8(%rbp)
jmp 0x2d3bd
movl -0x7c(%rbp), %ecx
movq -0x58(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x58(%rbp), %rax
movq (%rax), %rdi
movq -0xb0(%rbp), %rsi
callq 0x2670
cmpl $0x0, -0x6c(%rbp)
je 0x2d73c
movq -0x58(%rbp), %rax
movq (%rax), %rdi
movl -0x88(%rbp), %esi
movl -0x68(%rbp), %edx
movl -0x6c(%rbp), %ecx
movq -0x98(%rbp), %r8
movq -0xa8(%rbp), %r9
callq 0x25990
movq %rax, -0xc8(%rbp)
cmpl $0x1, -0x6c(%rbp)
jle 0x2d6d5
movl $0x0, -0x120(%rbp)
movl $0x0, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
cmpl -0x6c(%rbp), %eax
jge 0x2d6cc
movq -0xc8(%rbp), %rax
movslq -0x5c(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x128(%rbp)
movq -0x128(%rbp), %rax
movl 0x4(%rax), %eax
shll %eax
sarl %eax
movl %eax, -0x12c(%rbp)
movq -0x128(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x130(%rbp)
movq -0xa8(%rbp), %rdi
movq 0x10(%rbp), %rax
movl 0x7c(%rax), %esi
movq 0x10(%rbp), %rax
movl 0x78(%rax), %edx
leaq -0x130(%rbp), %rcx
leaq -0x12c(%rbp), %r8
callq 0x2e6a0
movq -0xa8(%rbp), %rdi
movq -0x128(%rbp), %rax
movl 0x1c(%rax), %esi
movq 0x10(%rbp), %rax
movl 0x28(%rax), %edx
movl $0x64, %ecx
leaq -0x130(%rbp), %r8
leaq -0x12c(%rbp), %r9
callq 0x2e7d0
movq -0x58(%rbp), %rax
movq (%rax), %rdi
movl -0x130(%rbp), %esi
movl -0x12c(%rbp), %edx
movq -0xa8(%rbp), %rcx
movq 0x10(%rbp), %rax
movl 0x40(%rax), %eax
sarl %eax
movl $0xa, %r8d
movl $0x28, %r9d
movl %eax, (%rsp)
movl $0xa, 0x8(%rsp)
callq 0x2eb10
movq -0x58(%rbp), %rax
movq (%rax), %rdi
movl -0x130(%rbp), %esi
movl -0x12c(%rbp), %edx
movq -0xa8(%rbp), %rcx
movq 0x10(%rbp), %rax
movl 0x40(%rax), %r9d
sarl %r9d
movl $0x1e, %r8d
callq 0x2ee80
movl -0x130(%rbp), %ecx
movq -0x128(%rbp), %rax
movl %ecx, (%rax)
movl -0x12c(%rbp), %edx
movq -0x128(%rbp), %rax
movl 0x4(%rax), %ecx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andl $0x80000000, %ecx       # imm = 0x80000000
orl %edx, %ecx
movl %ecx, 0x4(%rax)
movl -0x12c(%rbp), %eax
movq 0x10(%rbp), %rcx
cmpl 0x64(%rcx), %eax
jl 0x2d6bc
movq -0xa8(%rbp), %rax
movq -0x128(%rbp), %rcx
movslq (%rcx), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
shrq $0x20, %rax
andq $0xff, %rax
movl %eax, -0x134(%rbp)
movq -0xa8(%rbp), %rax
movq -0x128(%rbp), %rcx
movslq (%rcx), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movl %eax, %ecx
addl $0x1, %ecx
subl -0x134(%rbp), %ecx
movq -0x128(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0xa8(%rbp), %rax
movq -0x128(%rbp), %rcx
movslq (%rcx), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl %eax, %ecx
addl $0x1, %ecx
subl -0x134(%rbp), %ecx
movq -0x128(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0xa8(%rbp), %rax
movq -0x128(%rbp), %rcx
movl (%rcx), %ecx
movq -0x128(%rbp), %rdx
movl 0x4(%rdx), %edx
shll %edx
sarl %edx
addl %edx, %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movl %eax, %ecx
addl $0x1, %ecx
movq -0x128(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0xa8(%rbp), %rax
movq -0x128(%rbp), %rcx
movl (%rcx), %ecx
movq -0x128(%rbp), %rdx
movl 0x4(%rdx), %edx
shll %edx
sarl %edx
addl %edx, %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl %eax, %ecx
addl $0x1, %ecx
movq -0x128(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0xc8(%rbp), %rdi
movl -0x120(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x120(%rbp)
cltq
imulq $0x28, %rax, %rax
addq %rax, %rdi
movq -0x128(%rbp), %rsi
movl $0x28, %edx
callq 0x2230
jmp 0x2d6be
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x2d42c
movl -0x120(%rbp), %eax
movl %eax, -0x6c(%rbp)
movl $0x0, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
cmpl -0x6c(%rbp), %eax
jge 0x2d73a
movq -0xc8(%rbp), %rax
movslq -0x5c(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %edi
shll %edi
sarl %edi
movq -0xa8(%rbp), %rsi
movq -0xc8(%rbp), %rax
movslq -0x5c(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movslq (%rax), %rax
shlq $0x4, %rax
addq %rax, %rsi
movl -0x74(%rbp), %edx
movq -0xa0(%rbp), %rcx
callq 0x25ca0
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x2d6dc
jmp 0x2d747
movq $0x0, -0xc8(%rbp)
movq -0x58(%rbp), %rax
movq (%rax), %rdi
movq -0xa0(%rbp), %rsi
callq 0x2670
movq -0x58(%rbp), %rax
movq (%rax), %rdi
movq -0x98(%rbp), %rsi
callq 0x2670
leaq 0x17f14(%rip), %rax     # 0x45688
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x2d79c
movsd -0x110(%rbp), %xmm0
movq 0x18(%rbp), %rsi
movl $0x2, %edi
callq 0x2e640
movsd %xmm0, -0x110(%rbp)
leaq 0x17ee5(%rip), %rax     # 0x45688
movl (%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x2d7d5
movq 0x17824(%rip), %rax     # 0x44fd8
movq (%rax), %rdi
movq -0x30(%rbp), %rsi
movl -0x6c(%rbp), %edx
movq -0xc8(%rbp), %rcx
movq -0xa8(%rbp), %r8
movq 0x18(%rbp), %r9
callq 0x30ed0
movq -0x58(%rbp), %rax
movq (%rax), %rdi
movslq -0x68(%rbp), %rsi
shlq $0x0, %rsi
callq 0x2890
movq %rax, -0xd0(%rbp)
movl $0x0, -0x60(%rbp)
movl $0x0, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x2d84d
movq -0xd0(%rbp), %rdi
movslq -0x60(%rbp), %rax
addq %rax, %rdi
movq -0x48(%rbp), %rax
movslq -0x5c(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movq -0x40(%rbp), %rax
movslq -0x5c(%rbp), %rcx
movslq (%rax,%rcx,4), %rdx
callq 0x2060
movq -0x40(%rbp), %rax
movslq -0x5c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
addl -0x60(%rbp), %eax
movl %eax, -0x60(%rbp)
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x2d7fe
movq -0x58(%rbp), %rax
movq (%rax), %rdi
movq -0x30(%rbp), %rax
movq (%rax), %rsi
movq -0xc8(%rbp), %rcx
movl -0x68(%rbp), %r8d
movq 0x10(%rbp), %rax
movl 0x2c(%rax), %r9d
movq 0x10(%rbp), %rax
movl 0x2c(%rax), %r15d
movq 0x10(%rbp), %rax
movl 0x2c(%rax), %r14d
movq 0x10(%rbp), %rax
movl 0x60(%rax), %ebx
movq 0x10(%rbp), %rax
movl 0x90(%rax), %r11d
movss -0x100(%rbp), %xmm0
movss -0x104(%rbp), %xmm1
movq 0x10(%rbp), %rax
movss 0x80(%rax), %xmm2
movq -0xa8(%rbp), %r10
leaq -0x6c(%rbp), %rdx
leaq -0x98(%rbp), %rax
movl %r15d, (%rsp)
movl %r14d, 0x8(%rsp)
movl %ebx, 0x10(%rsp)
movl %r11d, 0x18(%rsp)
movq %r10, 0x20(%rsp)
movq %rax, 0x28(%rsp)
callq 0x26390
movl %eax, -0x70(%rbp)
leaq 0x17d9f(%rip), %rax     # 0x45688
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x2d911
movsd -0x110(%rbp), %xmm0
movq 0x18(%rbp), %rsi
movl $0x3, %edi
callq 0x2e640
movsd %xmm0, -0x110(%rbp)
movq -0x58(%rbp), %rax
movq (%rax), %rsi
movq -0x30(%rbp), %rax
movq (%rax), %rdx
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rcx
movl -0x70(%rbp), %r8d
movq -0x98(%rbp), %r9
movq -0xc8(%rbp), %r13
movq -0xa8(%rbp), %r12
movl -0x88(%rbp), %r15d
movq 0x10(%rbp), %rax
movl 0x6c(%rax), %r14d
movq 0x10(%rbp), %rax
movl 0x70(%rax), %ebx
movq 0x10(%rbp), %rax
movl 0x74(%rax), %r11d
movl -0x34(%rbp), %r10d
movq -0xd0(%rbp), %rax
xorl %edi, %edi
movq %r13, (%rsp)
movq %r12, 0x8(%rsp)
movl %r15d, 0x10(%rsp)
movl %r14d, 0x18(%rsp)
movl %ebx, 0x20(%rsp)
movl %r11d, 0x28(%rsp)
movl %r10d, 0x30(%rsp)
movq %rax, 0x38(%rsp)
callq 0x27f90
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, (%rax)
leaq 0x17ce1(%rip), %rax     # 0x45688
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x2d9cf
movsd -0x110(%rbp), %xmm0
movq 0x18(%rbp), %rsi
movl $0x4, %edi
callq 0x2e640
movsd %xmm0, -0x110(%rbp)
movl -0x64(%rbp), %ecx
movq -0x50(%rbp), %rax
movq (%rax), %rax
movl %ecx, 0x14(%rax)
movq -0x58(%rbp), %rax
movq (%rax), %rdi
movq -0xa8(%rbp), %rsi
callq 0x2670
movq -0x58(%rbp), %rax
movq (%rax), %rdi
movq -0xc8(%rbp), %rsi
callq 0x2670
movq -0x58(%rbp), %rax
movq (%rax), %rdi
movq -0x98(%rbp), %rsi
callq 0x2670
movq -0x58(%rbp), %rax
movq (%rax), %rdi
movq 0x10(%rbp), %rax
movss 0x80(%rax), %xmm0
movq -0x50(%rbp), %rax
movq (%rax), %rax
movl 0x8(%rax), %esi
movq -0x50(%rbp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rdx
movq 0x10(%rbp), %rax
movl 0x84(%rax), %ecx
xorl %r8d, %r8d
callq 0x2b630
movq 0x10(%rbp), %rax
movss 0x8c(%rax), %xmm0
movq -0x30(%rbp), %rax
movl 0x18(%rax), %edi
shll %edi
movq 0x10(%rbp), %rax
movl 0x88(%rax), %esi
movq -0x50(%rbp), %rax
movq (%rax), %rax
movl 0x8(%rax), %edx
movq -0x50(%rbp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rcx
callq 0x2bb40
movq -0x58(%rbp), %rax
movq (%rax), %rdi
movq -0x50(%rbp), %rax
movq (%rax), %rsi
callq 0x2bd80
movq -0x58(%rbp), %rax
movq (%rax), %rdi
movq -0x50(%rbp), %rax
movq (%rax), %rsi
movl -0x68(%rbp), %edx
movq -0xc0(%rbp), %rax
movl %eax, %ecx
movq 0x10(%rbp), %rax
movl 0x70(%rax), %r8d
callq 0x2c0e0
movq 0x10(%rbp), %rax
movq (%rax), %rax
andq $0x4000000, %rax        # imm = 0x4000000
cmpq $0x0, %rax
je 0x2db31
cmpl $0x1, -0x34(%rbp)
jne 0x2db31
movq -0x58(%rbp), %rax
movq (%rax), %rdi
movq -0x30(%rbp), %rax
movq (%rax), %rsi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0xd0(%rbp), %rcx
movq -0x50(%rbp), %rax
movq (%rax), %r8
movq 0x18(%rbp), %r9
callq 0x29520
movq -0x58(%rbp), %rax
movq (%rax), %rdi
movq -0x30(%rbp), %rax
movq (%rax), %rsi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0xd0(%rbp), %rcx
movq -0x50(%rbp), %rax
movq (%rax), %r8
callq 0x2a310
movq -0x58(%rbp), %rax
movq (%rax), %rdi
movq -0xd0(%rbp), %rsi
callq 0x2670
leaq 0x17b3d(%rip), %rax     # 0x45688
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x2db73
movsd -0x110(%rbp), %xmm0
movq 0x18(%rbp), %rsi
movl $0x5, %edi
callq 0x2e640
movsd %xmm0, -0x110(%rbp)
movq -0x58(%rbp), %rax
cmpq $0x0, (%rax)
je 0x2dc61
movq -0x58(%rbp), %rax
movq (%rax), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x2c40
leaq 0x17aed(%rip), %rax     # 0x45688
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x2dbdd
movq 0x1744c(%rip), %rax     # 0x44ff8
movq (%rax), %rdi
movq 0x18(%rbp), %rdx
movl -0x68(%rbp), %ecx
movq -0xf8(%rbp), %r8
movq -0xe0(%rbp), %r9
movq -0xd8(%rbp), %rax
leaq 0xff5f(%rip), %rsi      # 0x3db31
movq %rax, (%rsp)
movb $0x0, %al
callq 0x2210
movq -0xe8(%rbp), %rax
cmpq -0xe0(%rbp), %rax
je 0x2dc15
movq 0x17404(%rip), %rax     # 0x44ff8
movq (%rax), %rdi
movq 0x18(%rbp), %rcx
leaq 0xff57(%rip), %rsi      # 0x3db59
leaq 0xff6b(%rip), %rdx      # 0x3db74
movb $0x0, %al
callq 0x2210
callq 0x2050
cmpq $0x10000000, -0xd8(%rbp) # imm = 0x10000000
ja 0x2dc44
movq 0x10(%rbp), %rax
cmpq $0x0, 0x98(%rax)
jle 0x2dc5f
movq -0xf8(%rbp), %rax
movq 0x10(%rbp), %rcx
cmpq 0x98(%rcx), %rax
jbe 0x2dc5f
movq -0x58(%rbp), %rax
movq (%rax), %rdi
callq 0x25f0
callq 0x25d0
movq %rax, %rcx
movq -0x58(%rbp), %rax
movq %rcx, (%rax)
jmp 0x2dc61
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopw %cs:(%rax,%rax)