// File: /workspace/github_c_makefile_star2_O2/lh3[P]minigraph/gchain1.c
// Function: mg_gchain1_dp
int32_t mg_gchain1_dp(void *km, const gfa_t *g, int32_t *n_lc_, mg_lchain_t *lc, int32_t qlen, int32_t max_dist_g, int32_t max_dist_q, int32_t bw, int32_t max_skip,
					  int32_t ref_bonus, float chn_pen_gap, float chn_pen_skip, float mask_level, const mg128_t *an, uint64_t **u_)
{
	int32_t i, j, k, m_dst, n_dst, n_ext, n_u, n_v, n_lc = *n_lc_;
	int32_t *f, *v, *t;
	int64_t *p;
	uint64_t *u;
	mg_path_dst_t *dst;
	gc_frag_t *a;
	mg_lchain_t *swap;
	char *qs;

	*u_ = 0;
	if (n_lc == 0) return 0;

	KMALLOC(km, a, n_lc);
	for (i = n_ext = 0; i < n_lc; ++i) { // a[] is a view of frag[]; for sorting
		mg_lchain_t *r = &lc[i];
		gc_frag_t *ai = &a[i];
		int32_t is_isolated = 0, min_end_dist_g;
		r->dist_pre = -1;
		min_end_dist_g = g->seg[r->v>>1].len - r->re;
		if (r->rs < min_end_dist_g) min_end_dist_g = r->rs;
		if (min_end_dist_g > max_dist_g) is_isolated = 1; // if too far from segment ends
		else if (min_end_dist_g>>3 > r->score) is_isolated = 1; // if the lchain too small relative to distance to the segment ends
		ai->srt = (uint32_t)is_isolated<<31 | r->qe;
		ai->i = i;
		if (!is_isolated) ++n_ext;
	}
	if (n_ext < 2) { // no graph chaining needed; early return
		kfree(km, a);
		KMALLOC(km, u, n_lc);
		for (i = 0; i < n_lc; ++i)
			u[i] = (uint64_t)lc[i].score<<32 | 1;
		*u_ = u;
		return n_lc;
	}
	radix_sort_gc(a, a + n_lc);

	KMALLOC(km, v, n_lc);
	KMALLOC(km, f, n_ext);
	KMALLOC(km, p, n_ext);
	KCALLOC(km, t, n_ext);

	KMALLOC(km, qs, max_dist_q + 1);
	m_dst = n_dst = 0, dst = 0;
	for (i = 0; i < n_ext; ++i) { // core loop
		gc_frag_t *ai = &a[i];
		mg_lchain_t *li = &lc[ai->i];
		int32_t segi = (an[li->off].y & MG_SEED_SEG_MASK) >> MG_SEED_SEG_SHIFT;
		{ // collect end points potentially reachable from _i_
			int32_t x = li->qs + bw, n_skip = 0;
			if (x > qlen) x = qlen;
			x = find_max(i, a, x);
			n_dst = 0;
			for (j = x; j >= 0; --j) { // collect potential destination vertices
				gc_frag_t *aj = &a[j];
				mg_lchain_t *lj = &lc[aj->i];
				mg_path_dst_t *q;
				int32_t target_dist, segj, dq;
				if (lj->qs >= li->qs) continue; // lj is contained in li on the query coordinate
				if (lj->qe > li->qs) { // test overlap on the query
					int o = lj->qe - li->qs;
					if (o > (lj->qe - lj->qs) * mask_level || o > (li->qe - li->qs) * mask_level)
						continue;
				}
				dq = li->qs - lj->qe;
				segj = (an[lj->off + lj->cnt - 1].y & MG_SEED_SEG_MASK) >> MG_SEED_SEG_SHIFT;
				if (segi == segj) {
					if (dq > max_dist_q) break; // if query gap too large, stop
				} else {
					if (dq > max_dist_g && dq > max_dist_q) break;
				}
				if (li->v != lj->v) { // the two linear chains are on two different segments
					int32_t min_dist = li->rs + (g->seg[lj->v>>1].len - lj->re); // minimal graph gap
					if (min_dist > max_dist_g) continue; // graph gap too large
					if (segi == segj && min_dist - bw > li->qs - lj->qe) continue; // when li->qs < lj->qe, the condition turns to min_dist + (lj->qe - li->qs) > bw, which is desired
					target_dist = mg_target_dist(g, lj, li);
					if (target_dist < 0) continue; // this may happen if the query overlap is far too large
				} else if (lj->rs >= li->rs || lj->re >= li->re) { // not colinear
					continue;
				} else {
					int32_t dr = li->rs - lj->re, w = dr > dq? dr - dq : dq - dr;
					if (segi == segj && w > bw) continue; // test bandwidth
					if (dr > max_dist_g || dr < -max_dist_g) continue;
					if (lj->re > li->rs) { // test overlap on the graph segment
						int o = lj->re - li->rs;
						if (o > (lj->re - lj->rs) * mask_level || o > (li->re - li->rs) * mask_level)
							continue;
					}
					target_dist = mg_target_dist(g, lj, li);
				}
				if (n_dst == m_dst) KEXPAND(km, dst, m_dst); // TODO: watch out the quadratic behavior!
				q = &dst[n_dst++];
				memset(q, 0, sizeof(mg_path_dst_t));
				q->inner = (li->v == lj->v);
				q->v = lj->v^1;
				q->meta = j;
				q->qlen = li->qs - lj->qe;
				q->target_dist = target_dist;
				q->target_hash = 0;
				q->check_hash = 0;
				if (t[j] == i) {
					if (++n_skip > max_skip)
						break;
				}
				if (p[j] >= 0) t[p[j]] = i;
			}
		}
		{ // confirm reach-ability
			int32_t k;
			// test reach-ability without sequences
			mg_shortest_k(km, g, li->v^1, n_dst, dst, max_dist_g + (g->seg[li->v>>1].len - li->rs), MG_MAX_SHORT_K, 0);
			// remove unreachable destinations
			for (j = k = 0; j < n_dst; ++j) {
				mg_path_dst_t *dj = &dst[j];
				int32_t sc;
				if (dj->n_path == 0) continue; // not reachable
				sc = cal_sc(dj, li, lc, an, a, f, bw, ref_bonus, chn_pen_gap);
				if (sc == INT32_MIN) continue; // out of band
				if (sc + li->score < 0) continue; // negative score and too low
				dst[k++] = dst[j];
			}
			n_dst = k;
		}
		{ // DP
			int32_t max_f = li->score, max_j = -1, max_d = -1, max_inner = 0;
			uint32_t max_hash = 0;
			for (j = 0; j < n_dst; ++j) {
				mg_path_dst_t *dj = &dst[j];
				int32_t sc;
				sc = cal_sc(dj, li, lc, an, a, f, bw, ref_bonus, chn_pen_gap);
				if (sc == INT32_MIN) continue;
				if (mg_dbg_flag & MG_DBG_GC1) {
					mg_lchain_t *lj = &lc[a[dj->meta].i];
					fprintf(stderr, "  [dst:%d] dst=%c%s[%d], n_path=%d, target=%d, opt_dist=%d, score=%d, q_intv=[%d,%d), g_intv=[%d,%d)\n", dj->meta, "><"[dj->v&1], g->seg[dj->v>>1].name, dj->v, dj->n_path, dj->target_dist - g->seg[li->v>>1].len, dj->dist - g->seg[li->v>>1].len, sc, lj->qs, lj->qe, lj->rs, lj->re);
				}
				if (sc > max_f) max_f = sc, max_j = dj->meta, max_d = dj->dist, max_hash = dj->hash, max_inner = dj->inner;
			}
			f[i] = max_f, p[i] = max_j;
			li->dist_pre = max_d;
			li->hash_pre = max_hash;
			li->inner_pre = max_inner;
			v[i] = max_j >= 0 && v[max_j] > max_f? v[max_j] : max_f;
			if (mg_dbg_flag & MG_DBG_GC1) fprintf(stderr, " [opt:%d] opt=%d, max_f=%d\n", ai->i, max_j, max_f);
		}
	}
	kfree(km, dst);
	kfree(km, qs);
	if (mg_dbg_flag & MG_DBG_GC1) {
		int32_t mmax_f = 0, mmax_i = -1;
		for (i = 0; i < n_ext; ++i) if (f[i] > mmax_f) mmax_f = f[i], mmax_i = i;
		i = mmax_i; while (i >= 0) { fprintf(stderr, "[best] i=%d, seg=%s, max_f=%d, chn_pen_gap=%f\n", a[i].i, g->seg[lc[a[i].i].v>>1].name, f[i], chn_pen_gap); i = p[i]; }
	}

	u = mg_chain_backtrack(km, n_ext, f, p, v, t, 0, 0, INT32_MAX, n_lc - n_ext, &n_u, &n_v);
	kfree(km, f); kfree(km, p); kfree(km, t);

	for (i = 0; i < n_lc - n_ext; ++i) {
		u[n_u++] = (uint64_t)lc[a[n_ext + i].i].score << 32 | 1;
		v[n_v++] = n_ext + i;
	}

	KMALLOC(km, swap, n_v);
	for (i = 0, k = 0; i < n_u; ++i) {
		int32_t k0 = k, ni = (int32_t)u[i];
		for (j = 0; j < ni; ++j)
			swap[k++] = lc[a[v[k0 + (ni - j - 1)]].i];
	}
	assert(k == n_v);
	memcpy(lc, swap, n_v * sizeof(mg_lchain_t));
	*n_lc_ = n_v;
	*u_ = u;

	kfree(km, a);
	kfree(km, swap);
	kfree(km, v);
	return n_u;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movss %xmm0, 0x54(%rsp)
movl %r9d, 0x1c(%rsp)
movl %r8d, 0x88(%rsp)
movq 0x158(%rsp), %r15
movslq (%rdx), %rbx
andq $0x0, (%r15)
testq %rbx, %rbx
je 0x15a3a
movq %rsi, %rax
movss %xmm2, 0x64(%rsp)
movq %rdx, 0xa8(%rsp)
leaq (,%rbx,8), %r14
movq %rdi, 0x38(%rsp)
movq %r14, %rsi
movq %rcx, 0x10(%rsp)
movq %rax, 0x20(%rsp)
callq 0x266c
movq 0x20(%rsp), %r9
movq %rax, %rbp
xorl %eax, %eax
testl %ebx, %ebx
movq %rbx, %rcx
movl $0x0, %ebx
movq %rcx, 0x78(%rsp)
cmovgl %ecx, %ebx
movq 0x10(%rsp), %rcx
addq $0x20, %rcx
xorl %r12d, %r12d
cmpq %rax, %rbx
je 0x159ef
orl $-0x1, (%rcx)
movq 0x10(%r9), %rdx
movl -0x18(%rcx), %esi
movl -0x14(%rcx), %r8d
shrl %esi
shlq $0x6, %rsi
movl (%rdx,%rsi), %edi
subl -0x10(%rcx), %edi
cmpl %edi, %r8d
cmovll %r8d, %edi
cmpl 0x1c(%rsp), %edi
jle 0x159c4
movl $0x80000000, %esi       # imm = 0x80000000
xorl %edx, %edx
jmp 0x159d8
sarl $0x3, %edi
xorl %esi, %esi
xorl %edx, %edx
cmpl -0x4(%rcx), %edi
setg %sil
setle %dl
shll $0x1f, %esi
orl -0x8(%rcx), %esi
movl %esi, (%rbp,%rax,8)
movl %eax, 0x4(%rbp,%rax,8)
addl %edx, %r12d
incq %rax
addq $0x28, %rcx
jmp 0x1598f
cmpl $0x1, %r12d
ja 0x15a41
movq 0x38(%rsp), %r12
movq %r12, %rdi
movq %rbp, %rsi
callq 0x2577
movq %r12, %rdi
movq %r14, %rsi
callq 0x266c
movq 0x10(%rsp), %rsi
addq $0x1c, %rsi
xorl %ecx, %ecx
cmpq %rcx, %rbx
je 0x16248
movl (%rsi), %edx
shlq $0x20, %rdx
incq %rdx
movq %rdx, (%rax,%rcx,8)
incq %rcx
addq $0x28, %rsi
jmp 0x15a1b
xorl %eax, %eax
jmp 0x1643d
movq 0x78(%rsp), %rbx
leaq (,%rbx,8), %rsi
addq %rbp, %rsi
movq %rbp, %rdi
callq 0x158dd
movq %rbx, %rsi
shlq $0x2, %rsi
movq 0x38(%rsp), %rbx
movq %rbx, %rdi
callq 0x266c
movl %r12d, %ecx
movq %rax, %r12
movl %ecx, 0x80(%rsp)
movl %ecx, %r13d
leaq (,%r13,4), %rsi
movq %rbx, %rdi
callq 0x266c
movq %rax, 0x48(%rsp)
leaq (,%r13,8), %rsi
movq %rbx, %rdi
callq 0x266c
movq %rax, 0x58(%rsp)
pushq $0x4
popq %rdx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x24f0
movq %rax, 0x68(%rsp)
movl 0x130(%rsp), %eax
movq %rax, %r14
incl %eax
movslq %eax, %rsi
movq %rbx, %rdi
callq 0x266c
movq %rax, 0xa0(%rsp)
movq 0x150(%rsp), %rax
addq $-0x8, %rax
movq %rax, 0xf0(%rsp)
movl 0x1c(%rsp), %eax
cmpl %r14d, %eax
movl %r14d, %ecx
cmovgl %eax, %ecx
movl %ecx, 0x8c(%rsp)
negl %eax
movl %eax, 0x84(%rsp)
xorl %r14d, %r14d
xorl %r15d, %r15d
movl $0x0, 0x60(%rsp)
movq 0x10(%rsp), %r11
movq %rbp, 0x8(%rsp)
movq %r12, 0xb8(%rsp)
movq %r13, 0xb0(%rsp)
cmpq %r13, %r14
je 0x16255
movslq 0x4(%rbp,%r14,8), %rax
imulq $0x28, %rax, %r13
movslq (%r11,%r13), %rax
shlq $0x4, %rax
movq 0x150(%rsp), %rcx
movq 0x8(%rcx,%rax), %r9
movl 0x14(%r11,%r13), %ecx
movl 0x138(%rsp), %eax
addl %eax, %ecx
movl 0x88(%rsp), %eax
cmpl %eax, %ecx
cmovgel %eax, %ecx
pushq $-0x1
popq %rax
movl %eax, %r12d
movq %r14, 0x70(%rsp)
testq %r14, %r14
movq 0x20(%rsp), %r10
je 0x15bdf
movq 0x70(%rsp), %rax
cmpl %ecx, -0x8(%rbp,%rax,8)
jae 0x15b99
leaq -0x1(%rax), %r12
jmp 0x15bdf
pushq $-0x1
popq %rax
movl %eax, %r12d
cmpl %ecx, (%rbp)
jae 0x15bdf
xorl %r12d, %r12d
movq 0x70(%rsp), %rax
movl %eax, %esi
movl %esi, %eax
subl %r12d, %eax
jle 0x15bd9
cltd
pushq $0x2
popq %rdi
idivl %edi
leal (%rax,%r12), %edx
movslq %edx, %rdx
cmpl %ecx, (%rbp,%rdx,8)
leal 0x1(%rax,%r12), %eax
cmovael %r12d, %eax
cmovbl %esi, %edx
movl %eax, %r12d
movl %edx, %esi
jmp 0x15bae
jne 0x164e1
addq %r11, %r13
movl $0x0, 0x90(%rsp)
movq $0x0, 0x40(%rsp)
movq %r9, 0x28(%rsp)
testl %r12d, %r12d
js 0x15edf
movl %r12d, %r14d
movslq 0x4(%rbp,%r14,8), %rax
imulq $0x28, %rax, %rbp
movl 0x14(%r11,%rbp), %edx
movl 0x14(%r13), %eax
cmpl %eax, %edx
jge 0x15e71
addq %r11, %rbp
movl 0x18(%rbp), %ecx
movl %ecx, %esi
subl %eax, %esi
jle 0x15c63
cvtsi2ss %esi, %xmm0
movl %ecx, %esi
subl %edx, %esi
cvtsi2ss %esi, %xmm1
movss 0x64(%rsp), %xmm2
mulss %xmm2, %xmm1
ucomiss %xmm1, %xmm0
ja 0x15e71
movl 0x18(%r13), %edx
subl %eax, %edx
cvtsi2ss %edx, %xmm1
mulss %xmm2, %xmm1
ucomiss %xmm1, %xmm0
ja 0x15e71
subl %ecx, %eax
movslq (%rbp), %rcx
movl 0x4(%rbp), %edx
shlq $0x21, %rdx
sarq $0x21, %rdx
addq %rcx, %rdx
shlq $0x4, %rdx
movq 0xf0(%rsp), %rcx
movq (%rcx,%rdx), %rcx
xorq %r9, %rcx
shrq $0x30, %rcx
testb %cl, %cl
je 0x15ca0
cmpl 0x8c(%rsp), %eax
jle 0x15caf
jmp 0x15edf
movl 0x130(%rsp), %edx
cmpl %edx, %eax
jg 0x15edf
movl 0x8(%rbp), %edx
cmpl %edx, 0x8(%r13)
jne 0x15d2a
movl 0xc(%rbp), %edi
movl 0xc(%r13), %edx
cmpl %edx, %edi
jge 0x15e71
movl 0x10(%rbp), %r8d
movl 0x10(%r13), %esi
cmpl %esi, %r8d
jge 0x15e71
movl %edx, %r9d
subl %r8d, %r9d
movl %r9d, %r10d
subl %eax, %r10d
movl %r10d, %eax
negl %eax
cmovsl %r10d, %eax
testb %cl, %cl
jne 0x15d00
movl 0x138(%rsp), %ecx
cmpl %ecx, %eax
jg 0x15e83
cmpl 0x1c(%rsp), %r9d
setg %al
cmpl 0x84(%rsp), %r9d
setl %cl
orb %al, %cl
movq 0x20(%rsp), %r10
je 0x15e94
movq 0x8(%rsp), %rbp
jmp 0x15e8d
movq 0x10(%r10), %rsi
shrl %edx
shlq $0x6, %rdx
movl (%rsi,%rdx), %edx
subl 0x10(%rbp), %edx
addl 0xc(%r13), %edx
cmpl 0x1c(%rsp), %edx
jg 0x15e71
testb %cl, %cl
jne 0x15d5d
movl 0x138(%rsp), %ecx
subl %ecx, %edx
cmpl %eax, %edx
jg 0x15e71
movq %r10, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x1651d
movl %eax, %ebx
testl %eax, %eax
js 0x15e7e
movq 0x40(%rsp), %rdx
cmpl 0x60(%rsp), %edx
jne 0x15daf
movl %edx, %ecx
sarl %ecx
addl %edx, %ecx
cmpl $0x4, %edx
pushq $0x10
popq %rax
cmovll %eax, %ecx
movl %ecx, 0x60(%rsp)
movslq %ecx, %rax
imulq $0x24, %rax, %rdx
movq 0x38(%rsp), %rdi
movq %r15, %rsi
callq 0x2774
movq 0x40(%rsp), %rdx
movq %rax, %r15
movq 0x20(%rsp), %r10
movl 0x90(%rsp), %esi
movslq %edx, %rax
incl %edx
movq %rdx, 0x40(%rsp)
imulq $0x24, %rax, %rax
andl $0x0, 0x20(%r15,%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r15,%rax)
movups %xmm0, (%r15,%rax)
movl 0x8(%r13), %ecx
xorl %edx, %edx
cmpl 0x8(%rbp), %ecx
sete %dl
shll $0x1f, %edx
movl %edx, 0xc(%r15,%rax)
movl 0x8(%rbp), %ecx
xorl $0x1, %ecx
movl %ecx, (%r15,%rax)
movl %r12d, %ecx
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
orl %edx, %ecx
movl %ecx, 0xc(%r15,%rax)
movl 0x14(%r13), %edx
subl 0x18(%rbp), %edx
movl %edx, 0x10(%r15,%rax)
movl %ebx, 0x4(%r15,%rax)
movl %ecx, 0xc(%r15,%rax)
movq 0x68(%rsp), %rax
movl (%rax,%r14,4), %eax
movq 0x70(%rsp), %rdx
cmpq %rax, %rdx
jne 0x15e51
cmpl 0x140(%rsp), %esi
movq 0x28(%rsp), %r9
jge 0x15edf
incl %esi
movl %esi, 0x90(%rsp)
jmp 0x15e56
movq 0x28(%rsp), %r9
movq 0x58(%rsp), %rax
movq (%rax,%r14,8), %rax
testq %rax, %rax
movq 0x10(%rsp), %r11
js 0x15e71
movq 0x68(%rsp), %rcx
movl %edx, (%rcx,%rax,4)
movq 0x8(%rsp), %rbp
decl %r12d
jmp 0x15bfb
movq 0x10(%rsp), %r11
movq 0x8(%rsp), %rbp
movq 0x20(%rsp), %r10
movq 0x28(%rsp), %r9
jmp 0x15e76
movl %r8d, %eax
subl %edx, %eax
movq 0x28(%rsp), %r9
jle 0x15eca
cvtsi2ss %eax, %xmm0
subl %edi, %r8d
cvtsi2ss %r8d, %xmm1
movss 0x64(%rsp), %xmm2
mulss %xmm2, %xmm1
ucomiss %xmm1, %xmm0
ja 0x15e71
subl %edx, %esi
cvtsi2ss %esi, %xmm1
mulss %xmm2, %xmm1
ucomiss %xmm1, %xmm0
ja 0x15e71
movq %r10, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x1651d
movl %eax, %ebx
jmp 0x15d75
movl 0x8(%r13), %eax
movl %eax, %edx
xorl $0x1, %edx
movq 0x10(%r10), %rcx
shrl %eax
shlq $0x6, %rax
movl (%rcx,%rax), %r9d
addl 0x1c(%rsp), %r9d
subl 0xc(%r13), %r9d
movq 0x38(%rsp), %rdi
movq %r10, %rsi
movq 0x40(%rsp), %r14
movl %r14d, %ecx
movq %r15, %r8
pushq $0x0
pushq $0xf
callq 0xe567
popq %rcx
popq %rdx
xorl %ebx, %ebx
testl %r14d, %r14d
cmovlel %ebx, %r14d
imulq $0x24, %r14, %rbp
xorl %r12d, %r12d
movq 0x10(%rsp), %r11
cmpq %rbx, %rbp
je 0x15fc5
testl $0x7fffffff, 0x14(%r15,%rbx) # imm = 0x7FFFFFFF
je 0x15fbc
leaq (%r15,%rbx), %r14
movq %r14, %rdi
movq %r13, %rsi
movq %r11, %rdx
movq 0x150(%rsp), %rcx
movq 0x8(%rsp), %r8
movq 0x48(%rsp), %r9
movss 0x54(%rsp), %xmm0
movl 0x148(%rsp), %eax
pushq %rax
movl 0x140(%rsp), %eax
pushq %rax
callq 0x1654d
addq $0x10, %rsp
movl %eax, %ecx
negl %ecx
jo 0x15fb7
addl 0x1c(%r13), %eax
js 0x15fb7
movslq %r12d, %rax
incl %r12d
imulq $0x24, %rax, %rax
movl 0x20(%r14), %ecx
movl %ecx, 0x20(%r15,%rax)
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups %xmm1, 0x10(%r15,%rax)
movups %xmm0, (%r15,%rax)
movq 0x10(%rsp), %r11
addq $0x24, %rbx
jmp 0x15f32
movl 0x1c(%r13), %eax
movl %eax, 0x40(%rsp)
xorl %ebp, %ebp
testl %r12d, %r12d
cmovlel %ebp, %r12d
imulq $0x24, %r12, %rbx
pushq $-0x1
popq %rax
movl %eax, 0x28(%rsp)
xorl %r14d, %r14d
movss 0xe4d4(%rip), %xmm0     # 0x244c0
movaps %xmm0, 0x90(%rsp)
cmpq %rbp, %rbx
je 0x1619a
leaq (%r15,%rbp), %rdi
movq %r13, %rsi
movq %r11, %rdx
movq 0x150(%rsp), %rcx
movq 0x8(%rsp), %r8
movq 0x48(%rsp), %r9
movss 0x54(%rsp), %xmm0
movl 0x148(%rsp), %eax
pushq %rax
movl 0x140(%rsp), %eax
pushq %rax
callq 0x1654d
popq %rcx
popq %rdx
movl %eax, %r12d
negl %eax
jno 0x16044
movq 0x10(%rsp), %r11
jmp 0x16085
leaq 0x1862d(%rip), %rax     # 0x2e678
testb $0x40, (%rax)
jne 0x1608e
cmpl 0x40(%rsp), %r12d
movq 0x10(%rsp), %r11
jle 0x16085
movl 0xc(%r15,%rbp), %r14d
movl %r14d, %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
movl %eax, 0x28(%rsp)
movsd 0x1c(%r15,%rbp), %xmm0
movaps %xmm0, 0x90(%rsp)
shrl $0x1f, %r14d
movl %r12d, 0x40(%rsp)
addq $0x24, %rbp
jmp 0x15ff4
movl 0xc(%r15,%rbp), %r9d
andl $0x3fffffff, %r9d       # imm = 0x3FFFFFFF
movq 0x8(%rsp), %rax
movslq 0x4(%rax,%r9,8), %rax
imulq $0x28, %rax, %rdx
movq 0x17f49(%rip), %rcx     # 0x2dff8
movq (%rcx), %rdi
movl (%r15,%rbp), %r8d
movq %r8, 0xd8(%rsp)
movl 0x4(%r15,%rbp), %r11d
movl %r8d, %ecx
andl $0x1, %ecx
leaq 0xd5e3(%rip), %rsi      # 0x236b3
movsbl (%rcx,%rsi), %ecx
movq 0x20(%rsp), %rsi
movq 0x10(%rsi), %rsi
shrl %r8d
shlq $0x6, %r8
movq 0x18(%rsi,%r8), %r8
movl 0x14(%r15,%rbp), %eax
movl $0x7fffffff, %r10d      # imm = 0x7FFFFFFF
andl %r10d, %eax
movq %rax, 0xe8(%rsp)
movl 0x8(%r13), %r10d
shrl %r10d
shlq $0x6, %r10
movl (%rsi,%r10), %esi
subl %esi, %r11d
movq %r11, 0xe0(%rsp)
movl 0x1c(%r15,%rbp), %r10d
subl %esi, %r10d
movq 0x10(%rsp), %rsi
movl 0x14(%rsi,%rdx), %eax
movq %rax, 0xd0(%rsp)
movl 0x18(%rsi,%rdx), %eax
movq %rax, 0xc8(%rsp)
movl 0xc(%rsi,%rdx), %eax
movq %rax, 0xc0(%rsp)
movl 0x10(%rsi,%rdx), %r11d
leaq 0xe3b8(%rip), %rsi      # 0x2450e
movl %r9d, %edx
movq 0xd8(%rsp), %r9
xorl %eax, %eax
pushq %r11
pushq 0xc8(%rsp)
pushq 0xd8(%rsp)
pushq 0xe8(%rsp)
pushq %r12
pushq %r10
pushq 0x110(%rsp)
pushq 0x120(%rsp)
callq 0x2210
addq $0x40, %rsp
jmp 0x16050
movq 0x48(%rsp), %rax
movq 0x70(%rsp), %rsi
movl 0x40(%rsp), %r8d
movl %r8d, (%rax,%rsi,4)
movl 0x28(%rsp), %r9d
movslq %r9d, %rax
movq 0x58(%rsp), %rcx
movq %rax, (%rcx,%rsi,8)
movaps 0x90(%rsp), %xmm0
movlps %xmm0, 0x20(%r13)
shll $0x1f, %r14d
movl 0x4(%r13), %ecx
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andl %edx, %ecx
orl %r14d, %ecx
movl %ecx, 0x4(%r13)
testl %eax, %eax
movq 0xb8(%rsp), %r12
js 0x161f6
movl (%r12,%rax,4), %eax
cmpl %r8d, %eax
jg 0x161f9
movl %r8d, %eax
movl %eax, (%r12,%rsi,4)
leaq 0x18474(%rip), %rax     # 0x2e678
testb $0x40, (%rax)
movq %rsi, %r14
movq 0x8(%rsp), %rbp
movq 0xb0(%rsp), %r13
jne 0x16221
incq %r14
jmp 0x15b32
movq 0x17dd0(%rip), %rax     # 0x2dff8
movq (%rax), %rdi
movl 0x4(%rbp,%r14,8), %edx
leaq 0xe33d(%rip), %rsi      # 0x24574
movl %r9d, %ecx
xorl %eax, %eax
callq 0x2210
movq 0x10(%rsp), %r11
jmp 0x16219
movq %rax, (%r15)
movq 0x78(%rsp), %rax
jmp 0x1643d
movq 0x38(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2577
movq %rbx, %rdi
movq 0xa0(%rsp), %rsi
callq 0x2577
movq 0x10(%rsp), %r8
leaq 0x183f7(%rip), %rax     # 0x2e678
testb $0x40, (%rax)
movq 0x20(%rsp), %r9
jne 0x1644f
movq 0x78(%rsp), %r15
subl 0x80(%rsp), %r15d
leaq 0x30(%rsp), %rax
leaq 0x34(%rsp), %r10
movq 0x38(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
movq 0x48(%rsp), %rdx
movq 0x58(%rsp), %rcx
movq %r12, %r8
movq 0x68(%rsp), %r9
pushq %rax
pushq %r10
pushq %r15
pushq $0x7fffffff             # imm = 0x7FFFFFFF
pushq $0x0
pushq $0x0
callq 0x13168
addq $0x30, %rsp
movq %rax, %r14
movq %rbx, %rdi
movq 0x48(%rsp), %rsi
callq 0x2577
movq %rbx, %rdi
movq 0x58(%rsp), %rsi
callq 0x2577
movq %rbx, %rdi
movq 0x68(%rsp), %rsi
callq 0x2577
movq 0x10(%rsp), %rdi
xorl %eax, %eax
testl %r15d, %r15d
cmovgl %r15d, %eax
subq $0x1, %rax
jb 0x16351
movslq 0x4(%rbp,%r13,8), %rcx
imulq $0x28, %rcx, %rcx
movl 0x1c(%rdi,%rcx), %ecx
shlq $0x20, %rcx
incq %rcx
movslq 0x34(%rsp), %rdx
leal 0x1(%rdx), %esi
movl %esi, 0x34(%rsp)
movq %rcx, (%r14,%rdx,8)
movslq 0x30(%rsp), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0x30(%rsp)
movl %r13d, (%r12,%rcx,4)
incq %r13
jmp 0x16312
movslq 0x30(%rsp), %rax
imulq $0x28, %rax, %rsi
movq 0x38(%rsp), %rdi
callq 0x266c
movq 0x10(%rsp), %rdi
movq %rax, %r15
movl 0x34(%rsp), %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
xorl %ebx, %ebx
movslq %ebx, %r8
cmpq %rax, %rcx
je 0x163e8
movl (%r14,%rcx,8), %esi
testl %esi, %esi
movl $0x0, %edx
cmovgl %esi, %edx
addl %r8d, %esi
decl %esi
negq %rdx
imulq $0x28, %r8, %r11
addq %r15, %r11
xorl %r8d, %r8d
cmpq %r8, %rdx
je 0x163e0
leal (%rsi,%r8), %r9d
movslq %r9d, %r9
movslq (%r12,%r9,4), %r9
movslq 0x4(%rbp,%r9,8), %r9
imulq $0x28, %r9, %r9
movq 0x20(%rdi,%r9), %r10
movq %r10, 0x20(%r11)
movups (%rdi,%r9), %xmm0
movups 0x10(%rdi,%r9), %xmm1
movups %xmm1, 0x10(%r11)
movups %xmm0, (%r11)
decq %r8
addq $0x28, %r11
jmp 0x163a1
subl %r8d, %ebx
incq %rcx
jmp 0x16379
cmpl 0x30(%rsp), %ebx
jne 0x164fe
imulq $0x28, %r8, %rdx
movq %r15, %rsi
callq 0x2230
movq 0xa8(%rsp), %rax
movl %ebx, (%rax)
movq 0x158(%rsp), %rax
movq %r14, (%rax)
movq 0x38(%rsp), %rbx
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x2577
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2577
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2577
movl 0x34(%rsp), %eax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $-0x1
popq %rax
xorl %ecx, %ecx
xorl %edx, %edx
cmpq %rcx, %r13
je 0x16470
movq 0x48(%rsp), %rsi
movl (%rsi,%rcx,4), %esi
cmpl %edx, %esi
cmovgl %esi, %edx
cmovgl %ecx, %eax
incq %rcx
jmp 0x16456
cvtss2sd 0x54(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0xe10d(%rip), %r14      # 0x24590
testl %eax, %eax
js 0x1628f
movq 0x17b66(%rip), %rcx     # 0x2dff8
movq (%rcx), %rdi
movl %eax, %ebx
movslq 0x4(%rbp,%rbx,8), %rdx
movq 0x10(%r9), %rax
imulq $0x28, %rdx, %rcx
movl 0x8(%r8,%rcx), %ecx
shrl %ecx
shlq $0x6, %rcx
movq 0x18(%rax,%rcx), %rcx
movq 0x48(%rsp), %rax
movl (%rax,%rbx,4), %r8d
movq %r14, %rsi
movsd 0x8(%rsp), %xmm0
movb $0x1, %al
callq 0x2210
movq 0x20(%rsp), %r9
movq 0x10(%rsp), %r8
movq 0x58(%rsp), %rax
movl (%rax,%rbx,8), %eax
jmp 0x16483
leaq 0xe31d(%rip), %rdi      # 0x24805
leaq 0xdfe1(%rip), %rsi      # 0x244d0
leaq 0xe316(%rip), %rcx      # 0x2480c
pushq $0x1b
popq %rdx
callq 0x2160
leaq 0xe0ba(%rip), %rdi      # 0x245bf
leaq 0xdfc4(%rip), %rsi      # 0x244d0
leaq 0xe0b5(%rip), %rcx      # 0x245c8
movl $0xe7, %edx
callq 0x2160