// File: /workspace/github_c_makefile_star2_O3/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 $0xd8, %rsp
movl %r9d, 0x14(%rsp)
movl %r8d, 0xa0(%rsp)
movq %rsi, 0x30(%rsp)
movq 0x138(%rsp), %r15
movslq (%rdx), %rbp
movq $0x0, (%r15)
testq %rbp, %rbp
je 0x18cad
movq %rcx, %rbx
movq %rdx, %r13
movq %rdi, %r12
movss %xmm2, 0x20(%rsp)
movss %xmm0, 0x28(%rsp)
leaq (,%rbp,8), %r14
movq %r14, %rsi
callq 0x30e5
testl %ebp, %ebp
jle 0x18c6c
movq 0x30(%rsp), %rcx
movq 0x10(%rcx), %r10
leaq 0x20(%rbx), %rcx
xorl %edx, %edx
movl $0x80000000, %esi       # imm = 0x80000000
xorl %r11d, %r11d
movl $0xffffffff, (%rcx)     # imm = 0xFFFFFFFF
movl -0x18(%rcx), %edi
movl -0x14(%rcx), %r9d
shrl %edi
shlq $0x6, %rdi
movl (%r10,%rdi), %r8d
subl -0x10(%rcx), %r8d
cmpl %r8d, %r9d
cmovll %r9d, %r8d
cmpl 0x14(%rsp), %r8d
jle 0x18c35
movl -0x8(%rcx), %edi
orl %esi, %edi
jmp 0x18c53
sarl $0x3, %r8d
xorl %edi, %edi
xorl %r9d, %r9d
cmpl -0x4(%rcx), %r8d
setg %dil
setle %r9b
shll $0x1f, %edi
orl -0x8(%rcx), %edi
addl %r9d, %r11d
movl %edi, (%rax,%rdx,8)
movl %edx, 0x4(%rax,%rdx,8)
incq %rdx
addq $0x28, %rcx
cmpq %rdx, %rbp
jne 0x18c05
cmpl $0x1, %r11d
jg 0x18cb4
movq %r12, %rdi
movq %rax, %rsi
callq 0x301f
movq %r12, %rdi
movq %r14, %rsi
callq 0x30e5
testl %ebp, %ebp
jle 0x18ca5
addq $0x1c, %rbx
xorl %ecx, %ecx
movl (%rbx), %edx
shlq $0x20, %rdx
incq %rdx
movq %rdx, (%rax,%rcx,8)
incq %rcx
addq $0x28, %rbx
cmpq %rcx, %rbp
jne 0x18c8c
movq %rax, (%r15)
jmp 0x19a4e
xorl %ebp, %ebp
jmp 0x19a4e
movq %r13, 0xb0(%rsp)
leaq (%rax,%rbp,8), %rsi
movq %rax, %rdi
movq %rax, (%rsp)
movl %r11d, %r15d
callq 0x18b65
movq %rbp, 0xa8(%rsp)
shlq $0x2, %rbp
movq %r12, %rdi
movq %rbp, %rsi
callq 0x30e5
movq %rax, %r14
movl %r15d, 0x6c(%rsp)
movl %r15d, %r15d
leaq (,%r15,4), %rsi
movq %r12, %rdi
callq 0x30e5
movq %rax, %r13
leaq (,%r15,8), %rsi
movq %r12, %rdi
callq 0x30e5
movq %rax, 0x50(%rsp)
movl $0x4, %edx
movq %r12, %rdi
movq %r15, %rsi
callq 0x2f84
movq %rax, 0x78(%rsp)
movl 0x110(%rsp), %eax
movq %rax, %rbp
incl %eax
movslq %eax, %rsi
movq %r12, 0x88(%rsp)
movq %r12, %rdi
movq %r13, %r12
callq 0x30e5
movq (%rsp), %r9
movq %rax, 0xb8(%rsp)
movq 0x130(%rsp), %rax
addq $-0x8, %rax
movq %rax, 0x60(%rsp)
movl 0x14(%rsp), %eax
cmpl %ebp, %eax
movl %ebp, %ecx
cmovgl %eax, %ecx
movl %ecx, 0xa4(%rsp)
negl %eax
movl %eax, 0x98(%rsp)
xorl %ecx, %ecx
movl $0x0, 0x70(%rsp)
xorl %ebp, %ebp
movss 0x20(%rsp), %xmm2
movq %r13, 0x8(%rsp)
movq %r14, 0x58(%rsp)
movq %r15, 0x80(%rsp)
movslq 0x4(%r9,%rcx,8), %rax
movq %rcx, %rsi
leaq (%rax,%rax,4), %rcx
leaq (%rbx,%rcx,8), %r15
movl 0x14(%r15), %eax
addl 0x118(%rsp), %eax
movl 0xa0(%rsp), %edx
cmpl %edx, %eax
cmovgel %edx, %eax
testq %rsi, %rsi
movq %rsi, 0x38(%rsp)
je 0x1919f
movslq (%rbx,%rcx,8), %rcx
shlq $0x4, %rcx
movq 0x130(%rsp), %rdx
movq 0x8(%rdx,%rcx), %rcx
movq %rcx, 0x90(%rsp)
cmpl %eax, -0x8(%r9,%rsi,8)
jae 0x18e0b
leaq -0x1(%rsi), %rcx
jmp 0x18e46
cmpl %eax, (%r9)
jae 0x1919f
xorl %ecx, %ecx
movq 0x38(%rsp), %rdx
movl %edx, %edi
subl %ecx, %edi
movl %edi, %esi
shrl $0x1f, %esi
addl %edi, %esi
sarl %esi
leal (%rsi,%rcx), %edi
movslq %edi, %r8
cmpl %eax, (%r9,%r8,8)
jb 0x18e38
movl %edi, %edx
jmp 0x18e3c
addl %esi, %ecx
incl %ecx
cmpl %ecx, %edx
jg 0x18e1b
jne 0x19a62
testl %ecx, %ecx
js 0x1919f
movl %ecx, %r14d
movl $0x0, 0x40(%rsp)
movl $0x0, 0x10(%rsp)
movslq 0x4(%r9,%r14,8), %rax
leaq (%rax,%rax,4), %rax
movl 0x14(%rbx,%rax,8), %ecx
movl 0x14(%r15), %r13d
cmpl %r13d, %ecx
jge 0x1916b
leaq (%rbx,%rax,8), %r12
movl 0x18(%r12), %eax
movl %eax, %edx
subl %r13d, %edx
jle 0x18ec5
xorps %xmm0, %xmm0
cvtsi2ss %edx, %xmm0
movl %eax, %edx
subl %ecx, %edx
xorps %xmm1, %xmm1
cvtsi2ss %edx, %xmm1
mulss %xmm2, %xmm1
ucomiss %xmm1, %xmm0
ja 0x19166
movl 0x18(%r15), %ecx
subl %r13d, %ecx
xorps %xmm1, %xmm1
cvtsi2ss %ecx, %xmm1
mulss %xmm2, %xmm1
ucomiss %xmm1, %xmm0
ja 0x19166
movl %r13d, %edx
subl %eax, %edx
movslq (%r12), %rcx
movl 0x4(%r12), %esi
shlq $0x21, %rsi
sarq $0x21, %rsi
addq %rcx, %rsi
shlq $0x4, %rsi
movq 0x60(%rsp), %rcx
movq (%rcx,%rsi), %r8
xorq 0x90(%rsp), %r8
movabsq $0xff000000000000, %rcx # imm = 0xFF000000000000
testq %rcx, %r8
je 0x18f10
cmpl 0xa4(%rsp), %edx
jle 0x18f1f
jmp 0x1975c
movl 0x110(%rsp), %ecx
cmpl %ecx, %edx
jg 0x1975c
movl 0x8(%r15), %ecx
movl 0x8(%r12), %r9d
cmpl %r9d, %ecx
jne 0x19007
movl 0xc(%r12), %r10d
movl 0xc(%r15), %r9d
cmpl %r9d, %r10d
jge 0x19162
movl 0x10(%r12), %edi
movl 0x10(%r15), %esi
cmpl %esi, %edi
jge 0x19162
movl %esi, 0x18(%rsp)
movl %r9d, %esi
subl %edi, %esi
movl %esi, %r11d
subl %edx, %r11d
movl %r11d, %edx
negl %edx
cmovsl %r11d, %edx
movabsq $0xff000000000000, %r11 # imm = 0xFF000000000000
testq %r11, %r8
jne 0x18f88
cmpl 0x118(%rsp), %edx
jg 0x19162
cmpl 0x14(%rsp), %esi
setg %dl
cmpl 0x98(%rsp), %esi
setl %sil
orb %dl, %sil
jne 0x19162
movl %edi, %edx
subl %r9d, %edx
jle 0x18fe5
xorps %xmm0, %xmm0
cvtsi2ss %edx, %xmm0
movl %edi, %edx
subl %r10d, %edx
xorps %xmm1, %xmm1
cvtsi2ss %edx, %xmm1
mulss %xmm2, %xmm1
ucomiss %xmm1, %xmm0
ja 0x19162
movl 0x18(%rsp), %edx
subl %r9d, %edx
xorps %xmm1, %xmm1
cvtsi2ss %edx, %xmm1
mulss %xmm2, %xmm1
ucomiss %xmm1, %xmm0
ja 0x19162
movq 0x30(%rsp), %rdx
movq 0x10(%rdx), %rdx
shrl %ecx
shlq $0x6, %rcx
movl (%rdx,%rcx), %ecx
addl %r9d, %eax
addl %edi, %r13d
addl %ecx, %eax
subl %eax, %r13d
addl %ecx, %r13d
jmp 0x1907d
movl 0xc(%r15), %edi
movq 0x30(%rsp), %rsi
movq 0x10(%rsi), %rsi
shrl %r9d
shlq $0x6, %r9
movl (%rsi,%r9), %r10d
movl 0x10(%r12), %r9d
movl %r10d, %r11d
subl %r9d, %r11d
addl %edi, %r11d
cmpl 0x14(%rsp), %r11d
jg 0x19162
movq %rsi, 0x18(%rsp)
movabsq $0xff000000000000, %rsi # imm = 0xFF000000000000
testq %rsi, %r8
jne 0x1905d
subl 0x118(%rsp), %r11d
cmpl %edx, %r11d
jg 0x19162
shrl %ecx
shlq $0x6, %rcx
addl %edi, %eax
addl %r10d, %eax
subl %eax, %r13d
addl %r9d, %r13d
movq 0x18(%rsp), %rax
addl (%rax,%rcx), %r13d
js 0x19162
movl 0x70(%rsp), %eax
cmpl %eax, 0x40(%rsp)
jne 0x190c8
movl %eax, %ecx
sarl %ecx
addl %eax, %ecx
cmpl $0x4, %eax
movl $0x10, %eax
cmovll %eax, %ecx
movl %ecx, 0x18(%rsp)
movslq %ecx, %rax
shlq $0x2, %rax
leaq (%rax,%rax,8), %rdx
movq 0x88(%rsp), %rdi
movq %rbp, %rsi
callq 0x31ed
movss 0x20(%rsp), %xmm2
movq %rax, %rbp
movl 0x18(%rsp), %eax
movl %eax, 0x70(%rsp)
movq (%rsp), %r9
movl 0x40(%rsp), %ecx
movslq %ecx, %rax
incl %ecx
movl %ecx, 0x40(%rsp)
leaq (%rax,%rax,8), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbp,%rax,4)
movups %xmm0, (%rbp,%rax,4)
movl $0x0, 0x20(%rbp,%rax,4)
movl 0x8(%r15), %ecx
xorl %edx, %edx
cmpl 0x8(%r12), %ecx
sete %dl
shll $0x1f, %edx
movl %edx, 0xc(%rbp,%rax,4)
movl 0x8(%r12), %ecx
xorl $0x1, %ecx
movl %ecx, (%rbp,%rax,4)
movl %r14d, %ecx
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
orl %edx, %ecx
movl %ecx, 0xc(%rbp,%rax,4)
movl 0x14(%r15), %edx
subl 0x18(%r12), %edx
movl %edx, 0x10(%rbp,%rax,4)
movl %r13d, 0x4(%rbp,%rax,4)
movl %ecx, 0xc(%rbp,%rax,4)
movq 0x78(%rsp), %rax
movl (%rax,%r14,4), %eax
cmpq %rax, 0x38(%rsp)
jne 0x1917d
movl 0x10(%rsp), %eax
cmpl 0x120(%rsp), %eax
movq 0x8(%rsp), %r12
jge 0x191a7
incl %eax
movl %eax, 0x10(%rsp)
jmp 0x19182
movq (%rsp), %r9
movq 0x8(%rsp), %r12
leaq -0x1(%r14), %rax
testq %r14, %r14
movq %rax, %r14
jg 0x18e61
jmp 0x191a7
movq 0x8(%rsp), %r12
movq 0x50(%rsp), %rax
movq (%rax,%r14,8), %rax
testq %rax, %rax
js 0x1916b
movq 0x78(%rsp), %rcx
movq 0x38(%rsp), %rdx
movl %edx, (%rcx,%rax,4)
jmp 0x1916b
movl $0x0, 0x40(%rsp)
movl 0x8(%r15), %eax
movl %eax, %edx
xorl $0x1, %edx
movq 0x30(%rsp), %rsi
movq 0x10(%rsi), %rcx
shrl %eax
shlq $0x6, %rax
movl (%rcx,%rax), %r9d
addl 0x14(%rsp), %r9d
subl 0xc(%r15), %r9d
movq 0x88(%rsp), %rdi
movl 0x40(%rsp), %r14d
movl %r14d, %ecx
movq %rbp, %r8
pushq $0x0
pushq $0xf
callq 0x10f8f
addq $0x10, %rsp
testl %r14d, %r14d
jle 0x196c1
movl %r14d, %eax
shlq $0x2, %rax
leaq (%rax,%rax,8), %rcx
xorl %edx, %edx
xorl %eax, %eax
movq (%rsp), %r9
movss 0x28(%rsp), %xmm4
movsd 0x1029a(%rip), %xmm5    # 0x294b0
movss 0x10006(%rip), %xmm6    # 0x29224
movss 0x10002(%rip), %xmm7    # 0x29228
movss 0xfffd(%rip), %xmm8     # 0x2922c
movl 0x14(%rbp,%rdx), %esi
testl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
je 0x193be
movslq (%r15), %r8
shlq $0x4, %r8
movl 0xc(%rbp,%rdx), %edi
movl 0x1c(%rbp,%rdx), %r11d
subl 0x4(%rbp,%rdx), %r11d
andl $0x3fffffff, %edi       # imm = 0x3FFFFFFF
movslq 0x4(%r9,%rdi,8), %r9
leaq (%r9,%r9,4), %r9
movslq (%rbx,%r9,8), %r10
movl 0x4(%rbx,%r9,8), %r14d
shlq $0x21, %r14
sarq $0x21, %r14
addq %r10, %r14
shlq $0x4, %r14
movl %r11d, %r10d
negl %r10d
cmovsl %r11d, %r10d
movq 0x60(%rsp), %r11
movq (%r11,%r14), %r11
movq 0x130(%rsp), %r14
xorq 0x8(%r14,%r8), %r11
movabsq $0xff000000000000, %r8  # imm = 0xFF000000000000
testq %r8, %r11
jne 0x192bd
cmpl 0x118(%rsp), %r10d
jle 0x192bd
movq (%rsp), %r9
jmp 0x193be
leaq (%rbx,%r9,8), %r8
movl 0x18(%r8), %r9d
movl 0x14(%r15), %r8d
cmpl %r8d, %r9d
jle 0x1930a
movl 0x18(%r15), %r11d
movl %r11d, %r14d
subl %r9d, %r14d
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
subl %r8d, %r11d
xorps %xmm1, %xmm1
cvtsi2sd %r11d, %xmm1
movl 0x1c(%r15), %r8d
divsd %xmm1, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %r8d, %xmm1
mulsd %xmm0, %xmm1
addsd %xmm5, %xmm1
cvttsd2si %xmm1, %r9d
jmp 0x19311
movl 0x1c(%r15), %r8d
movl %r8d, %r9d
xorps %xmm0, %xmm0
cvtsi2ss %r10d, %xmm0
xorps %xmm1, %xmm1
cmpl $0x2, %r10d
jb 0x19363
movd %xmm0, %r10d
movl %r10d, %r11d
shrl $0x17, %r11d
addl $-0x80, %r11d
cvtsi2ss %r11, %xmm2
andl $0x7fffff, %r10d        # imm = 0x7FFFFF
orl $0x3f800000, %r10d      # imm = 0x3F800000
movd %r10d, %xmm3
movdqa %xmm3, %xmm1
mulss %xmm6, %xmm1
addss %xmm7, %xmm1
mulss %xmm3, %xmm1
addss %xmm8, %xmm1
addss %xmm2, %xmm1
sarl $0x1f, %esi
andl 0x128(%rsp), %esi
addl %esi, %r9d
mulss %xmm4, %xmm0
addss %xmm1, %xmm0
cvttss2si %xmm0, %esi
addl (%r12,%rdi,4), %r9d
subl %esi, %r9d
movl %r9d, %esi
negl %esi
jo 0x192b4
addl %r9d, %r8d
movq (%rsp), %r9
js 0x193be
leaq (%rdx,%rbp), %rsi
movslq %eax, %rdi
incl %eax
leaq (%rdi,%rdi,8), %rdi
movl 0x20(%rsi), %r8d
movl %r8d, 0x20(%rbp,%rdi,4)
movups (%rsi), %xmm0
movups 0x10(%rsi), %xmm1
movups %xmm1, 0x10(%rbp,%rdi,4)
movups %xmm0, (%rbp,%rdi,4)
addq $0x24, %rdx
cmpq %rdx, %rcx
jne 0x1922f
movl 0x1c(%r15), %esi
testl %eax, %eax
jle 0x196db
movl %esi, 0x18(%rsp)
movl %eax, %eax
shlq $0x2, %rax
leaq (%rax,%rax,8), %rax
movq %rax, 0x90(%rsp)
movl $0xffffffff, 0x10(%rsp) # imm = 0xFFFFFFFF
xorl %r14d, %r14d
movl $0x0, 0x74(%rsp)
movss 0x100af(%rip), %xmm9    # 0x294b8
movl 0x14(%rbp,%r14), %ecx
movl %ecx, %r10d
andl $0x7fffffff, %r10d      # imm = 0x7FFFFFFF
je 0x1956d
movslq (%r15), %rax
shlq $0x4, %rax
movl 0x1c(%rbp,%r14), %r12d
movl 0x4(%rbp,%r14), %r11d
movl 0xc(%rbp,%r14), %edx
movl %r12d, %r8d
subl %r11d, %r8d
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
movq (%rsp), %rsi
movslq 0x4(%rsi,%rdx,8), %rsi
leaq (%rsi,%rsi,4), %rdi
movslq (%rbx,%rdi,8), %rsi
movl 0x4(%rbx,%rdi,8), %r9d
shlq $0x21, %r9
sarq $0x21, %r9
addq %rsi, %r9
shlq $0x4, %r9
movl %r8d, %esi
negl %esi
cmovsl %r8d, %esi
movq 0x60(%rsp), %r8
movq (%r8,%r9), %r8
movq 0x130(%rsp), %r9
xorq 0x8(%r9,%rax), %r8
movabsq $0xff000000000000, %rax # imm = 0xFF000000000000
testq %rax, %r8
jne 0x194a0
cmpl 0x118(%rsp), %esi
jg 0x19568
leaq (%rbx,%rdi,8), %rax
movl 0x18(%rax), %r13d
movl 0x14(%r15), %edi
cmpl %edi, %r13d
movq %r13, 0x40(%rsp)
jle 0x194ef
movl 0x18(%r15), %r8d
movl %r8d, %r9d
subl %r13d, %r9d
xorps %xmm0, %xmm0
cvtsi2sd %r9d, %xmm0
subl %edi, %r8d
xorps %xmm1, %xmm1
cvtsi2sd %r8d, %xmm1
divsd %xmm1, %xmm0
xorps %xmm1, %xmm1
cvtsi2sdl 0x1c(%r15), %xmm1
mulsd %xmm0, %xmm1
addsd %xmm5, %xmm1
cvttsd2si %xmm1, %r13d
jmp 0x194f3
movl 0x1c(%r15), %r13d
xorps %xmm0, %xmm0
cvtsi2ss %esi, %xmm0
xorps %xmm1, %xmm1
cmpl $0x2, %esi
jb 0x1953c
movd %xmm0, %esi
movl %esi, %edi
shrl $0x17, %edi
addl $-0x80, %edi
cvtsi2ss %rdi, %xmm2
andl $0x7fffff, %esi         # imm = 0x7FFFFF
orl $0x3f800000, %esi       # imm = 0x3F800000
movd %esi, %xmm3
movdqa %xmm3, %xmm1
mulss %xmm6, %xmm1
addss %xmm7, %xmm1
mulss %xmm3, %xmm1
addss %xmm8, %xmm1
addss %xmm2, %xmm1
sarl $0x1f, %ecx
andl 0x128(%rsp), %ecx
addl %ecx, %r13d
mulss %xmm4, %xmm0
addss %xmm1, %xmm0
cvttss2si %xmm0, %ecx
movq 0x8(%rsp), %rsi
addl (%rsi,%rdx,4), %r13d
subl %ecx, %r13d
movl %r13d, %ecx
negl %ecx
jno 0x19584
movq 0x8(%rsp), %r12
addq $0x24, %r14
cmpq %r14, 0x90(%rsp)
jne 0x19409
jmp 0x196ac
leaq 0x190ed(%rip), %rcx     # 0x32678
testb $0x40, (%rcx)
jne 0x195c1
cmpl 0x18(%rsp), %r13d
movq 0x8(%rsp), %r12
jle 0x1956d
movl 0xc(%rbp,%r14), %ecx
movl %ecx, %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
movl %eax, 0x10(%rsp)
movsd 0x1c(%rbp,%r14), %xmm9
shrl $0x1f, %ecx
movl %ecx, 0x74(%rsp)
movl %r13d, 0x18(%rsp)
jmp 0x1956d
movq 0x18a30(%rip), %rcx     # 0x31ff8
movq (%rcx), %rdi
movl (%rbp,%r14), %r9d
movl %r9d, %ecx
andl $0x1, %ecx
leaq 0xf0cd(%rip), %rsi      # 0x286aa
movsbl (%rcx,%rsi), %ecx
movl %ecx, 0x9c(%rsp)
movq 0x30(%rsp), %rcx
movq 0x10(%rcx), %rcx
movl %r9d, %r8d
shrl %r8d
shlq $0x6, %r8
movq 0x18(%rcx,%r8), %r8
movl 0x8(%r15), %esi
shrl %esi
shlq $0x6, %rsi
movl (%rcx,%rsi), %ecx
subl %ecx, %r11d
subl %ecx, %r12d
movl 0x14(%rax), %ecx
movq %rcx, 0xd0(%rsp)
movl 0xc(%rax), %ecx
movq %rcx, 0xc8(%rsp)
movl 0x10(%rax), %eax
movq %rax, 0xc0(%rsp)
leaq 0xfebf(%rip), %rsi      # 0x294fa
movl 0x9c(%rsp), %ecx
xorl %eax, %eax
pushq 0xc0(%rsp)
pushq 0xd0(%rsp)
pushq 0x50(%rsp)
pushq 0xe8(%rsp)
pushq %r13
pushq %r12
pushq %r11
pushq %r10
movaps %xmm9, 0x80(%rsp)
callq 0x2210
movaps 0x80(%rsp), %xmm9
movss 0xfba7(%rip), %xmm8     # 0x2922c
movss 0xfb9b(%rip), %xmm7     # 0x29228
movss 0xfb8f(%rip), %xmm6     # 0x29224
movsd 0xfe13(%rip), %xmm5     # 0x294b0
movss 0x68(%rsp), %xmm4
addq $0x40, %rsp
jmp 0x19590
movl 0x74(%rsp), %edi
shll $0x1f, %edi
movq (%rsp), %r9
movl 0x18(%rsp), %esi
movl 0x10(%rsp), %eax
jmp 0x196eb
movl 0x1c(%r15), %esi
xorl %edi, %edi
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movss 0xfde3(%rip), %xmm9     # 0x294b8
movq (%rsp), %r9
jmp 0x196eb
xorl %edi, %edi
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movss 0xfdcd(%rip), %xmm9     # 0x294b8
movq 0x38(%rsp), %rdx
movl %esi, (%r12,%rdx,4)
movl %eax, %r10d
cltq
movq 0x50(%rsp), %rcx
movq %rax, (%rcx,%rdx,8)
movlps %xmm9, 0x20(%r15)
movl 0x4(%r15), %ecx
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andl %edx, %ecx
orl %edi, %ecx
movl %ecx, 0x4(%r15)
testl %eax, %eax
movq 0x58(%rsp), %r14
movss 0x20(%rsp), %xmm2
js 0x1972f
movl (%r14,%rax,4), %eax
cmpl %esi, %eax
jg 0x19731
movl %esi, %eax
movq 0x38(%rsp), %rcx
movl %eax, (%r14,%rcx,4)
leaq 0x18f37(%rip), %rax     # 0x32678
testb $0x40, (%rax)
movq 0x80(%rsp), %r15
jne 0x19766
incq %rcx
cmpq %r15, %rcx
jne 0x18dac
jmp 0x1979a
movq 0x8(%rsp), %r12
jmp 0x191a7
movl %esi, %r8d
movq 0x18888(%rip), %rax     # 0x31ff8
movq (%rax), %rdi
movl 0x4(%r9,%rcx,8), %edx
leaq 0xfde1(%rip), %rsi      # 0x29560
movl %r10d, %ecx
xorl %eax, %eax
callq 0x2210
movq 0x38(%rsp), %rcx
movss 0x20(%rsp), %xmm2
movq (%rsp), %r9
jmp 0x1974e
movq 0x88(%rsp), %rdi
movq %rbp, %rsi
movq %rdi, %rbp
callq 0x301f
movq %rbp, %rdi
movq 0xb8(%rsp), %rsi
callq 0x301f
movss 0x28(%rsp), %xmm0
leaq 0x18eae(%rip), %rax     # 0x32678
testb $0x40, (%rax)
movq 0xa8(%rsp), %r14
je 0x19868
xorl %ecx, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
xorl %edx, %edx
movl (%r12,%rcx,4), %esi
cmpl %edx, %esi
cmovgl %esi, %edx
cmovgl %ecx, %eax
incq %rcx
cmpq %rcx, %r15
jne 0x197e4
testl %eax, %eax
js 0x19868
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x60(%rsp)
leaq 0xfd6f(%rip), %r13      # 0x2957c
movq 0x187e4(%rip), %rcx     # 0x31ff8
movq (%rcx), %rdi
movl %eax, %r15d
movq (%rsp), %rax
movslq 0x4(%rax,%r15,8), %rdx
movq 0x30(%rsp), %rax
movq 0x10(%rax), %rax
leaq (%rdx,%rdx,4), %rcx
movl 0x8(%rbx,%rcx,8), %ecx
shrl %ecx
shlq $0x6, %rcx
movq 0x18(%rax,%rcx), %rcx
movl (%r12,%r15,4), %r8d
movq %r13, %rsi
movsd 0x60(%rsp), %xmm0
movb $0x1, %al
callq 0x2210
movq 0x50(%rsp), %rax
movl (%rax,%r15,8), %eax
movq 0x80(%rsp), %r15
testl %eax, %eax
jns 0x1980d
leaq 0x2c(%rsp), %r11
leaq 0x24(%rsp), %rax
movl %r14d, %r10d
subl 0x6c(%rsp), %r10d
movq %r12, %r13
xorl %r12d, %r12d
movq %rbp, %rdi
movq %r15, %rsi
movq %r13, %rdx
movq 0x50(%rsp), %rcx
movq 0x58(%rsp), %r8
movq 0x78(%rsp), %r15
movq %r15, %r9
pushq %r11
pushq %rax
pushq %r10
pushq $0x7fffffff             # imm = 0x7FFFFFFF
pushq %r12
pushq %r12
callq 0x15f50
addq $0x30, %rsp
movq %rax, %r14
movq %rbp, %rdi
movq %r13, %rsi
callq 0x301f
movq %rbp, %rdi
movq 0x50(%rsp), %rsi
callq 0x301f
movq %rbp, %rdi
movq %r15, %rsi
callq 0x301f
movq 0xa8(%rsp), %rcx
leaq 0x2c(%rsp), %rax
movl (%rax), %eax
subl 0x6c(%rsp), %ecx
jle 0x1995e
movslq %eax, %rdx
movl %ecx, %ecx
movslq 0x24(%rsp), %rsi
movq 0x58(%rsp), %rdi
leaq (%rdi,%rdx,4), %rdx
leal 0x1(%rsi), %edi
leaq (%r14,%rsi,8), %r8
movq (%rsp), %rsi
movq 0x80(%rsp), %r15
leaq (%rsi,%r15,8), %r9
addq $0x4, %r9
xorl %esi, %esi
movslq (%r9,%rsi,8), %r10
leaq (%r10,%r10,4), %r10
movl 0x1c(%rbx,%r10,8), %r10d
shlq $0x20, %r10
incq %r10
leal (%rdi,%rsi), %r11d
movl %r11d, 0x24(%rsp)
movq %r10, (%r8,%rsi,8)
leal (%rax,%rsi), %r10d
incl %r10d
movl %r10d, 0x2c(%rsp)
leal (%r15,%rsi), %r10d
movl %r10d, (%rdx,%rsi,4)
incq %rsi
cmpq %rsi, %rcx
jne 0x1991d
addl %eax, %esi
movl %esi, %eax
cltq
shlq $0x3, %rax
leaq (%rax,%rax,4), %rsi
movq %rbp, %rdi
callq 0x30e5
movq %rax, %r15
movslq 0x24(%rsp), %rax
testq %rax, %rax
movq (%rsp), %r10
jle 0x199ef
xorl %ecx, %ecx
xorl %r12d, %r12d
movq 0x58(%rsp), %r11
movq (%r14,%rcx,8), %rdi
testl %edi, %edi
jle 0x199e7
movslq %r12d, %r8
movl %edi, %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
leaq (%r8,%r8,4), %rsi
leaq (%r15,%rsi,8), %rsi
addl %r8d, %edi
decl %edi
movl %edx, %r12d
addl %r8d, %r12d
movslq %edi, %rdi
movslq (%r11,%rdi,4), %r8
movslq 0x4(%r10,%r8,8), %r8
leaq (%r8,%r8,4), %r8
movq 0x20(%rbx,%r8,8), %r9
movq %r9, 0x20(%rsi)
movups (%rbx,%r8,8), %xmm0
movups 0x10(%rbx,%r8,8), %xmm1
movups %xmm1, 0x10(%rsi)
movups %xmm0, (%rsi)
addq $0x28, %rsi
decl %edi
decq %rdx
jne 0x199b1
incq %rcx
cmpq %rax, %rcx
jne 0x1998b
cmpl 0x2c(%rsp), %r12d
jne 0x19a81
movslq %r12d, %rax
shlq $0x3, %rax
leaq (%rax,%rax,4), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2230
movq 0xb0(%rsp), %rax
movl %r12d, (%rax)
movq 0x138(%rsp), %rax
movq %r14, (%rax)
movq %rbp, %rdi
movq (%rsp), %rsi
callq 0x301f
movq %rbp, %rdi
movq %r15, %rsi
callq 0x301f
movq %rbp, %rdi
movq 0x58(%rsp), %rsi
callq 0x301f
movl 0x24(%rsp), %ebp
movl %ebp, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xfd88(%rip), %rdi      # 0x297f1
leaq 0xfa4c(%rip), %rsi      # 0x294bc
leaq 0xfd81(%rip), %rcx      # 0x297f8
movl $0x1b, %edx
callq 0x2160
leaq 0xfb23(%rip), %rdi      # 0x295ab
leaq 0xfa2d(%rip), %rsi      # 0x294bc
leaq 0xfb1e(%rip), %rcx      # 0x295b4
movl $0xe7, %edx
callq 0x2160