// File: /workspace/github_c_makefile_star2_O3/lh3[P]minigraph/lchain.c
// Function: mg_lchain_rmq
mg128_t *mg_lchain_rmq(int max_dist, int max_dist_inner, int bw, int max_chn_skip, int cap_rmq_size, int min_cnt, int min_sc, float chn_pen_gap, float chn_pen_skip,
					   int64_t n, mg128_t *a, int *n_u_, uint64_t **_u, void *km)
{
	int32_t *f,*t, *v, n_u, n_v, mmax_f = 0, max_rmq_size = 0, max_drop = bw;
	int64_t *p, i, i0, st = 0, st_inner = 0, n_iter = 0;
	uint64_t *u;
	lc_elem_t *root = 0, *root_inner = 0;
	void *mem_mp = 0;
	kmp_rmq_t *mp;

	if (_u) *_u = 0, *n_u_ = 0;
	if (n == 0 || a == 0) {
		kfree(km, a);
		return 0;
	}
	if (max_dist < bw) max_dist = bw;
	if (max_dist_inner <= 0 || max_dist_inner >= max_dist) max_dist_inner = 0;
	KMALLOC(km, p, n);
	KMALLOC(km, f, n);
	KCALLOC(km, t, n);
	KMALLOC(km, v, n);
	mem_mp = km_init2(km, 0x10000);
	mp = kmp_init_rmq(mem_mp);

	// fill the score and backtrack arrays
	for (i = i0 = 0; i < n; ++i) {
		int64_t max_j = -1;
		int32_t q_span = a[i].y>>32&0xff, max_f = q_span;
		lc_elem_t s, *q, *r, lo, hi;
		// add in-range anchors
		if (i0 < i && a[i0].x != a[i].x) {
			int64_t j;
			for (j = i0; j < i; ++j) {
				q = kmp_alloc_rmq(mp);
				q->y = (int32_t)a[j].y, q->i = j, q->pri = -(f[j] + 0.5 * chn_pen_gap * ((int32_t)a[j].x + (int32_t)a[j].y));
				krmq_insert(lc_elem, &root, q, 0);
				if (max_dist_inner > 0) {
					r = kmp_alloc_rmq(mp);
					*r = *q;
					krmq_insert(lc_elem, &root_inner, r, 0);
				}
			}
			i0 = i;
		}
		// get rid of active chains out of range
		while (st < i && (a[i].x>>32 != a[st].x>>32 || a[i].x > a[st].x + max_dist || krmq_size(head, root) > cap_rmq_size)) {
			s.y = (int32_t)a[st].y, s.i = st;
			if ((q = krmq_find(lc_elem, root, &s, 0)) != 0) {
				q = krmq_erase(lc_elem, &root, q, 0);
				kmp_free_rmq(mp, q);
			}
			++st;
		}
		if (max_dist_inner > 0)  { // similar to the block above, but applied to the inner tree
			while (st_inner < i && (a[i].x>>32 != a[st_inner].x>>32 || a[i].x > a[st_inner].x + max_dist_inner || krmq_size(head, root_inner) > cap_rmq_size)) {
				s.y = (int32_t)a[st_inner].y, s.i = st_inner;
				if ((q = krmq_find(lc_elem, root_inner, &s, 0)) != 0) {
					q = krmq_erase(lc_elem, &root_inner, q, 0);
					kmp_free_rmq(mp, q);
				}
				++st_inner;
			}
		}
		// RMQ
		lo.i = INT32_MAX, lo.y = (int32_t)a[i].y - max_dist;
		hi.i = 0, hi.y = (int32_t)a[i].y - 1;
		if ((q = krmq_rmq(lc_elem, root, &lo, &hi)) != 0) {
			int32_t sc, exact, width, n_skip = 0;
			int64_t j = q->i;
			assert(q->y >= lo.y && q->y <= hi.y);
			sc = f[j] + comput_sc_simple(&a[i], &a[j], chn_pen_gap, chn_pen_skip, &exact, &width);
			if (width <= bw && sc > max_f) max_f = sc, max_j = j;
			if (!exact && root_inner && (int32_t)a[i].y > 0) {
				lc_elem_t *lo, *hi;
				s.y = (int32_t)a[i].y - 1, s.i = n;
				krmq_interval(lc_elem, root_inner, &s, &lo, &hi);
				if (lo) {
					const lc_elem_t *q;
					int32_t width, n_rmq_iter = 0;
					krmq_itr_t(lc_elem) itr;
					krmq_itr_find(lc_elem, root_inner, lo, &itr);
					while ((q = krmq_at(&itr)) != 0) {
						if (q->y < (int32_t)a[i].y - max_dist_inner) break;
						++n_rmq_iter;
						j = q->i;
						sc = f[j] + comput_sc_simple(&a[i], &a[j], chn_pen_gap, chn_pen_skip, 0, &width);
						if (width <= bw) {
							if (sc > max_f) {
								max_f = sc, max_j = j;
								if (n_skip > 0) --n_skip;
							} else if (t[j] == (int32_t)i) {
								if (++n_skip > max_chn_skip)
									break;
							}
							if (p[j] >= 0) t[p[j]] = i;
						}
						if (!krmq_itr_prev(lc_elem, &itr)) break;
					}
					n_iter += n_rmq_iter;
				}
			}
		}
		// set max
		assert(max_j < 0 || (a[max_j].x < a[i].x && (int32_t)a[max_j].y < (int32_t)a[i].y));
		f[i] = max_f, p[i] = max_j;
		v[i] = max_j >= 0 && v[max_j] > max_f? v[max_j] : max_f; // v[] keeps the peak score up to i; f[] is the score ending at i, not always the peak
		if (mmax_f < max_f) mmax_f = max_f;
		if (max_rmq_size < krmq_size(head, root)) max_rmq_size = krmq_size(head, root);
	}
	if (mg_dbg_flag & MG_DBG_LC_PROF) fprintf(stderr, "LP\tn_iter=%ld\tmmax_f=%d\trmq_size=%d\tmp_max=%ld\n", (long)n_iter, mmax_f, max_rmq_size, mp->max);
	km_destroy(mem_mp);

	u = mg_chain_backtrack(km, n, f, p, v, t, min_cnt, min_sc, max_drop, 0, &n_u, &n_v);
	*n_u_ = n_u, *_u = u; // NB: note that u[] may not be sorted by score here
	kfree(km, p); kfree(km, f); kfree(km, t);
	if (n_u == 0) {
		kfree(km, a); kfree(km, v);
		return 0;
	}
	return compact_a(km, n_u, u, n_v, v, a);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x388, %rsp            # imm = 0x388
movss %xmm1, 0x38(%rsp)
movss %xmm0, 0x10(%rsp)
movl %r8d, 0x3c(%rsp)
movl %ecx, 0x9c(%rsp)
movq %rdx, 0x50(%rsp)
movq 0x3e0(%rsp), %rcx
movq 0x3d8(%rsp), %rdx
movq 0x3d0(%rsp), %r12
movq 0x3c8(%rsp), %r13
xorl %eax, %eax
movq %rax, 0x60(%rsp)
movq %rax, 0x58(%rsp)
testq %rcx, %rcx
je 0x17bd0
movq $0x0, (%rcx)
movl $0x0, (%rdx)
movq 0x3e8(%rsp), %r14
testq %r13, %r13
setne %al
testq %r12, %r12
setne %cl
testb %cl, %al
jne 0x17bf3
movq %r14, %rdi
movq %r12, %rsi
jmp 0x1864e
movq %r9, 0xa8(%rsp)
movq 0x50(%rsp), %rax
cmpl %eax, %edi
cmovlel %eax, %edi
movl %edi, 0x34(%rsp)
xorl %eax, %eax
testl %esi, %esi
movl $0x0, %ebp
cmovgl %esi, %ebp
cmpl %esi, %edi
cmovlel %eax, %ebp
leaq (,%r13,8), %rsi
movq %r14, %rdi
callq 0x30e5
movq %rax, 0x40(%rsp)
leaq (,%r13,4), %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x30e5
movq %rax, 0x18(%rsp)
movl $0x4, %edx
movq %r14, %rdi
movq %r13, %rsi
callq 0x2f84
movq %rax, 0x70(%rsp)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x30e5
movq %rax, 0x28(%rsp)
movl $0x10000, %esi          # imm = 0x10000
movq %r14, %rdi
callq 0x2f3c
movq %rax, %rbx
movl $0x1, %esi
movl $0x28, %edx
movq %rax, %rdi
callq 0x2f84
movq %rax, %r15
movq %rbx, 0xa0(%rsp)
movq %rbx, 0x20(%rax)
testq %r13, %r13
jle 0x18546
cvtss2sd 0x10(%rsp), %xmm0
mulsd 0x11584(%rip), %xmm0    # 0x29238
movsd %xmm0, 0xc0(%rsp)
movslq 0x34(%rsp), %rax
movq %rax, 0xb8(%rsp)
movl %ebp, %eax
movq %rax, 0xb0(%rsp)
leaq 0x8(%r12), %rax
movq %rax, 0x78(%rsp)
movq $0x0, 0x48(%rsp)
xorl %r8d, %r8d
movq $0x0, 0x68(%rsp)
xorl %ebx, %ebx
xorl %r14d, %r14d
xorl %r13d, %r13d
xorl %ecx, %ecx
movl %ebp, 0x14(%rsp)
movq %r8, 0x90(%rsp)
movq %rcx, %rax
shlq $0x4, %rax
leaq (%r12,%rax), %rdx
movzbl 0xc(%r12,%rax), %eax
movl %eax, (%rsp)
cmpq %rcx, %r13
movq %rcx, %rbp
movq %rcx, 0x8(%rsp)
movq %rdx, 0x20(%rsp)
jge 0x17e55
movq %r12, %rax
movq %r13, %r12
shlq $0x4, %r12
movq (%rax,%r12), %rax
cmpq (%rdx), %rax
je 0x17e55
addq 0x78(%rsp), %r12
incq (%r15)
movq 0x8(%r15), %rax
testq %rax, %rax
je 0x17d6e
movq 0x18(%r15), %rcx
leaq -0x1(%rax), %rdx
movq %rdx, 0x8(%r15)
movq -0x8(%rcx,%rax,8), %rbp
jmp 0x17d84
movq 0x20(%r15), %rdi
movl $0x1, %esi
movl $0x38, %edx
callq 0x2f84
movq %rax, %rbp
movl (%r12), %eax
movl %eax, (%rbp)
movq %r13, 0x8(%rbp)
movq 0x18(%rsp), %rcx
xorps %xmm0, %xmm0
cvtsi2sdl (%rcx,%r13,4), %xmm0
addl -0x8(%r12), %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
mulsd 0xc0(%rsp), %xmm1
addsd %xmm0, %xmm1
xorpd 0x11482(%rip), %xmm1    # 0x29240
movlpd %xmm1, 0x10(%rbp)
leaq 0x60(%rsp), %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0x1718b
cmpl $0x0, 0x14(%rsp)
je 0x17e3d
incq (%r15)
movq 0x8(%r15), %rax
testq %rax, %rax
je 0x17df8
movq 0x18(%r15), %rcx
leaq -0x1(%rax), %rdx
movq %rdx, 0x8(%r15)
movq -0x8(%rcx,%rax,8), %rsi
jmp 0x17e0e
movq 0x20(%r15), %rdi
movl $0x1, %esi
movl $0x38, %edx
callq 0x2f84
movq %rax, %rsi
movq 0x30(%rbp), %rax
movq %rax, 0x30(%rsi)
movupd (%rbp), %xmm0
movupd 0x10(%rbp), %xmm1
movups 0x20(%rbp), %xmm2
movups %xmm2, 0x20(%rsi)
movupd %xmm1, 0x10(%rsi)
movupd %xmm0, (%rsi)
leaq 0x58(%rsp), %rdi
xorl %edx, %edx
callq 0x1718b
incq %r13
addq $0x10, %r12
movq 0x8(%rsp), %rbp
cmpq %rbp, %r13
jl 0x17d4f
movq %rbp, %r13
cmpq %rbp, %r14
jge 0x17f4b
movq %r14, %r12
shlq $0x4, %r12
addq 0x78(%rsp), %r12
movq 0x20(%rsp), %rax
movq (%rax), %rax
movq -0x8(%r12), %rcx
movq %rcx, %rdx
xorq %rax, %rdx
shrq $0x20, %rdx
movq 0x60(%rsp), %rdi
jne 0x17eab
addq 0xb8(%rsp), %rcx
cmpq %rcx, %rax
ja 0x17eab
testq %rdi, %rdi
je 0x17f4b
movl 0x3c(%rsp), %eax
cmpl %eax, 0x34(%rdi)
jbe 0x17f4b
movl (%r12), %eax
movl %eax, 0xd0(%rsp)
movq %r14, 0xd8(%rsp)
leaq 0xd0(%rsp), %rsi
xorl %edx, %edx
callq 0x16e23
testq %rax, %rax
je 0x17f3b
leaq 0x60(%rsp), %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x175a0
decq (%r15)
movq %rax, %rbp
movq 0x8(%r15), %rcx
cmpq 0x10(%r15), %rcx
jne 0x17f26
movq %rcx, %rdx
shrq %rdx
addq %rcx, %rdx
cmpq $0x4, %rcx
movl $0x10, %eax
cmovbq %rax, %rdx
movq %rdx, 0x10(%r15)
movq 0x18(%r15), %rsi
movq 0x20(%r15), %rdi
shlq $0x3, %rdx
callq 0x31ed
movq %rax, 0x18(%r15)
movq 0x8(%r15), %rcx
jmp 0x17f2a
movq 0x18(%r15), %rax
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%r15)
movq %rbp, (%rax,%rcx,8)
movq 0x8(%rsp), %rbp
incq %r14
addq $0x10, %r12
cmpq %rbp, %r14
jl 0x17e6a
cmpl $0x0, 0x14(%rsp)
setne %al
cmpq %rbp, %rbx
setl %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x18051
movq %rbx, %r12
shlq $0x4, %r12
addq 0x78(%rsp), %r12
movq 0x20(%rsp), %rax
movq (%rax), %rax
movq -0x8(%r12), %rcx
movq %rcx, %rdx
xorq %rax, %rdx
shrq $0x20, %rdx
movq 0x58(%rsp), %rdi
jne 0x17fb1
addq 0xb0(%rsp), %rcx
cmpq %rcx, %rax
ja 0x17fb1
testq %rdi, %rdi
je 0x18051
movl 0x3c(%rsp), %eax
cmpl %eax, 0x34(%rdi)
jbe 0x18051
movl (%r12), %eax
movl %eax, 0xd0(%rsp)
movq %rbx, 0xd8(%rsp)
leaq 0xd0(%rsp), %rsi
xorl %edx, %edx
callq 0x16e23
testq %rax, %rax
je 0x18041
leaq 0x58(%rsp), %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x175a0
decq (%r15)
movq %rax, %rbp
movq 0x8(%r15), %rcx
cmpq 0x10(%r15), %rcx
jne 0x1802c
movq %rcx, %rdx
shrq %rdx
addq %rcx, %rdx
cmpq $0x4, %rcx
movl $0x10, %eax
cmovbq %rax, %rdx
movq %rdx, 0x10(%r15)
movq 0x18(%r15), %rsi
movq 0x20(%r15), %rdi
shlq $0x3, %rdx
callq 0x31ed
movq %rax, 0x18(%r15)
movq 0x8(%r15), %rcx
jmp 0x18030
movq 0x18(%r15), %rax
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%r15)
movq %rbp, (%rax,%rcx,8)
movq 0x8(%rsp), %rbp
incq %rbx
addq $0x10, %r12
cmpq %rbp, %rbx
jl 0x17f70
movq $0x7fffffff, 0x150(%rsp) # imm = 0x7FFFFFFF
movq 0x20(%rsp), %rax
movl 0x8(%rax), %ebp
movl %ebp, %r12d
subl 0x34(%rsp), %r12d
movl %r12d, 0x148(%rsp)
movq $0x0, 0x118(%rsp)
leal -0x1(%rbp), %eax
movl %eax, 0x4(%rsp)
movl %eax, 0x110(%rsp)
movq 0x60(%rsp), %rdi
movq %rdi, 0x88(%rsp)
leaq 0x148(%rsp), %rsi
leaq 0x110(%rsp), %rdx
callq 0x16f25
testq %rax, %rax
je 0x18434
movl (%rax), %ecx
cmpl %r12d, %ecx
jl 0x186b1
cmpl %ebp, %ecx
jge 0x186b1
movq 0x8(%rax), %rax
movq %rax, %r10
shlq $0x4, %rax
movq 0x20(%rsp), %r12
movl (%r12), %edi
movq 0x3d0(%rsp), %rcx
movq 0x8(%rcx,%rax), %rdx
movl %ebp, %r8d
subl %edx, %r8d
subl (%rcx,%rax), %edi
movl %r8d, %r9d
subl %edi, %r9d
movl %edi, %esi
cmovll %r8d, %esi
setne %al
movl %r9d, %ecx
negl %ecx
cmovsl %r9d, %ecx
shrq $0x20, %rdx
movzbl %dl, %r9d
cmpl %esi, %r9d
movl %esi, %r11d
cmovll %r9d, %r11d
setl %dl
cmpl %edi, %r8d
jne 0x18132
cmpl %r9d, %r8d
jle 0x181be
xorpd %xmm0, %xmm0
cmpl %edi, %r8d
je 0x1818d
leal 0x1(%rcx), %edi
xorps %xmm0, %xmm0
cvtsi2ss %edi, %xmm0
movd %xmm0, %edi
movl %edi, %r8d
shrl $0x17, %r8d
addl $-0x80, %r8d
cvtsi2ss %r8, %xmm1
andl $0x7fffff, %edi         # imm = 0x7FFFFF
orl $0x3f800000, %edi       # imm = 0x3F800000
movd %edi, %xmm2
movdqa %xmm2, %xmm0
mulss 0x110af(%rip), %xmm0    # 0x29224
addss 0x110ab(%rip), %xmm0    # 0x29228
mulss %xmm2, %xmm0
addss 0x110a3(%rip), %xmm0    # 0x2922c
addss %xmm1, %xmm0
xorps %xmm1, %xmm1
cvtsi2ss %ecx, %xmm1
xorps %xmm2, %xmm2
cvtsi2ss %esi, %xmm2
mulss 0x38(%rsp), %xmm2
mulss 0x10(%rsp), %xmm1
addss %xmm2, %xmm1
mulss 0x1107d(%rip), %xmm0    # 0x29230
addss %xmm1, %xmm0
cvttss2si %xmm0, %esi
subl %esi, %r11d
orb %dl, %al
movq 0x18(%rsp), %rdx
addl (%rdx,%r10,4), %r11d
cmpl 0x50(%rsp), %ecx
setle %cl
movl (%rsp), %esi
cmpl %esi, %r11d
setg %dl
testb %dl, %cl
movq $-0x1, %rcx
cmoveq %rcx, %r10
movq %r10, 0x80(%rsp)
cmovel %esi, %r11d
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
setne %cl
testl %ebp, %ebp
setg %dl
andb %cl, %dl
andb %al, %dl
cmpb $0x1, %dl
jne 0x1846f
movl %r11d, (%rsp)
movl 0x4(%rsp), %eax
movl %eax, 0xd0(%rsp)
movq 0x3c8(%rsp), %rax
movq %rax, 0xd8(%rsp)
movq %rdi, %rbp
leaq 0xd0(%rsp), %rsi
leaq 0xc8(%rsp), %rdx
leaq 0x108(%rsp), %rcx
callq 0x16e99
movq 0xc8(%rsp), %rsi
testq %rsi, %rsi
je 0x18453
movq %rbp, %rdi
leaq 0x180(%rsp), %r12
movq %r12, %rdx
callq 0x17a76
movl $0x0, 0x4(%rsp)
xorl %r11d, %r11d
movl (%rsp), %r10d
movq 0x380(%rsp), %rax
cmpq %r12, %rax
jb 0x1845c
movq (%rax), %rax
testq %rax, %rax
je 0x1845c
movq 0x20(%rsp), %rdx
movl 0x8(%rdx), %esi
movl %esi, %ecx
subl 0x14(%rsp), %ecx
cmpl %ecx, (%rax)
jl 0x1845c
movq 0x8(%rax), %rax
movq %rax, %rcx
shlq $0x4, %rcx
movl (%rdx), %edi
movq 0x3d0(%rsp), %rdx
movq 0x8(%rdx,%rcx), %r8
subl %r8d, %esi
subl (%rdx,%rcx), %edi
movl %esi, %r9d
subl %edi, %r9d
movl %edi, %edx
cmovll %esi, %edx
movl %r9d, %ecx
negl %ecx
cmovsl %r9d, %ecx
shrq $0x20, %r8
movzbl %r8b, %r8d
cmpl %edx, %r8d
movl %edx, %ebp
cmovll %r8d, %ebp
cmpl %edi, %esi
jne 0x18306
cmpl %r8d, %esi
jle 0x1838f
xorps %xmm0, %xmm0
cmpl %edi, %esi
je 0x1835f
leal 0x1(%rcx), %esi
xorps %xmm0, %xmm0
cvtsi2ss %esi, %xmm0
movd %xmm0, %esi
movl %esi, %edi
shrl $0x17, %edi
addl $-0x80, %edi
xorps %xmm1, %xmm1
cvtsi2ss %rdi, %xmm1
andl $0x7fffff, %esi         # imm = 0x7FFFFF
orl $0x3f800000, %esi       # imm = 0x3F800000
movd %esi, %xmm2
movdqa %xmm2, %xmm0
mulss 0x10edd(%rip), %xmm0    # 0x29224
addss 0x10ed9(%rip), %xmm0    # 0x29228
mulss %xmm2, %xmm0
addss 0x10ed1(%rip), %xmm0    # 0x2922c
addss %xmm1, %xmm0
xorps %xmm1, %xmm1
cvtsi2ss %ecx, %xmm1
xorps %xmm2, %xmm2
cvtsi2ss %edx, %xmm2
mulss 0x38(%rsp), %xmm2
mulss 0x10(%rsp), %xmm1
addss %xmm2, %xmm1
mulss 0x10eab(%rip), %xmm0    # 0x29230
addss %xmm1, %xmm0
cvttss2si %xmm0, %edx
subl %edx, %ebp
cmpl 0x50(%rsp), %ecx
movl %r11d, (%rsp)
jle 0x183a6
movl %r10d, %ebp
leaq 0x180(%rsp), %r12
jmp 0x18416
movq 0x18(%rsp), %rcx
addl (%rcx,%rax,4), %ebp
cmpl %r10d, %ebp
jle 0x183ce
xorl %ecx, %ecx
movl 0x4(%rsp), %edx
testl %edx, %edx
setg %cl
subl %ecx, %edx
movl %edx, 0x4(%rsp)
movq %rax, 0x80(%rsp)
jmp 0x183f3
movq 0x70(%rsp), %rcx
movq 0x8(%rsp), %rdx
cmpl %edx, (%rcx,%rax,4)
jne 0x183f0
movl 0x4(%rsp), %ecx
cmpl 0x9c(%rsp), %ecx
jge 0x18459
incl %ecx
movl %ecx, 0x4(%rsp)
movl %r10d, %ebp
movq 0x40(%rsp), %rcx
movq (%rcx,%rax,8), %rax
testq %rax, %rax
leaq 0x180(%rsp), %r12
js 0x18416
movq 0x70(%rsp), %rcx
movq 0x8(%rsp), %rdx
movl %edx, (%rcx,%rax,4)
movq %r12, %rdi
xorl %esi, %esi
callq 0x17ae7
movl (%rsp), %r11d
incl %r11d
movl %ebp, %r10d
testl %eax, %eax
jne 0x18281
jmp 0x1845f
movq $-0x1, %rdi
movl (%rsp), %ecx
movl %ecx, %r11d
movq 0x90(%rsp), %r8
movq 0x8(%rsp), %rsi
jmp 0x184e5
movl (%rsp), %r11d
jmp 0x1846f
incl %r11d
movl %r10d, %ebp
movslq %r11d, %rax
addq %rax, 0x68(%rsp)
movl %ebp, %r11d
movq 0x20(%rsp), %r12
movq 0x90(%rsp), %r8
movq 0x8(%rsp), %rsi
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
js 0x184e2
movq %rdi, %rax
shlq $0x4, %rax
movq 0x3d0(%rsp), %rdx
movq (%rdx,%rax), %rcx
cmpq (%r12), %rcx
jae 0x18692
addq %rdx, %rax
movl 0x8(%rax), %eax
cmpl 0x8(%r12), %eax
jge 0x18692
movq 0x18(%rsp), %rax
movl %r11d, (%rax,%rsi,4)
movq 0x40(%rsp), %rax
movq %rdi, (%rax,%rsi,8)
movq 0x28(%rsp), %rax
movl (%rax,%rdi,4), %ecx
cmpl %r11d, %ecx
cmovlel %r11d, %ecx
movq 0x88(%rsp), %rdx
jmp 0x18503
movl %r11d, %ecx
movq 0x88(%rsp), %rdx
movq 0x18(%rsp), %rax
movl %ecx, (%rax,%rsi,4)
movq 0x40(%rsp), %rax
movq %rdi, (%rax,%rsi,8)
movq 0x28(%rsp), %rax
movl %ecx, (%rax,%rsi,4)
movq 0x48(%rsp), %rax
cmpl %r11d, %eax
cmovlel %r11d, %eax
movq %rax, 0x48(%rsp)
testq %rdx, %rdx
je 0x18526
movl 0x34(%rdx), %eax
cmpl %eax, %r8d
cmovbel %eax, %r8d
movq 0x3d0(%rsp), %r12
movq 0x8(%rsp), %rcx
incq %rcx
cmpq 0x3c8(%rsp), %rcx
jne 0x17d01
jmp 0x1855b
movq $0x0, 0x68(%rsp)
movq $0x0, 0x48(%rsp)
xorl %r8d, %r8d
movl 0x3c0(%rsp), %ebx
leaq 0x1a10f(%rip), %rax     # 0x32678
testb $-0x80, (%rax)
jne 0x18667
movq 0xa0(%rsp), %rdi
callq 0x2fe1
leaq 0xd0(%rsp), %rax
leaq 0x180(%rsp), %rbp
movq 0x3e8(%rsp), %rdi
movq 0x3c8(%rsp), %rsi
movq 0x18(%rsp), %r13
movq %r13, %rdx
movq 0x40(%rsp), %r14
movq %r14, %rcx
movq 0x28(%rsp), %r8
movq 0x70(%rsp), %r15
movq %r15, %r9
pushq %rax
pushq %rbp
pushq $0x0
pushq 0x68(%rsp)
pushq %rbx
pushq 0xd0(%rsp)
callq 0x15f50
addq $0x30, %rsp
movq %rax, %rbx
movl (%rbp), %ebp
movq 0x3d8(%rsp), %rax
movl %ebp, (%rax)
movq 0x3e0(%rsp), %rax
movq %rbx, (%rax)
movq 0x3e8(%rsp), %rdi
movq %r14, %rsi
movq %rdi, %r14
callq 0x301f
movq %r14, %rdi
movq %r13, %rsi
callq 0x301f
movq %r14, %rdi
movq %r15, %rsi
callq 0x301f
testl %ebp, %ebp
je 0x1863b
movl 0xd0(%rsp), %ecx
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rdx
movq 0x28(%rsp), %r8
movq %r12, %r9
callq 0x16c23
jmp 0x18655
movq %r14, %rdi
movq %r12, %rsi
callq 0x301f
movq %r14, %rdi
movq 0x28(%rsp), %rsi
callq 0x301f
xorl %eax, %eax
addq $0x388, %rsp            # imm = 0x388
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1998a(%rip), %rax     # 0x31ff8
movq (%rax), %rdi
movq 0x10(%r15), %r9
leaq 0x10d87(%rip), %rsi     # 0x29403
movq 0x68(%rsp), %rdx
movq 0x48(%rsp), %rcx
xorl %eax, %eax
callq 0x2210
jmp 0x18572
leaq 0x10d1e(%rip), %rdi     # 0x293b7
leaq 0x10bc0(%rip), %rsi     # 0x29260
leaq 0x10c98(%rip), %rcx     # 0x2933f
movl $0x163, %edx            # imm = 0x163
callq 0x2160
leaq 0x10c6a(%rip), %rdi     # 0x29322
leaq 0x10ba1(%rip), %rsi     # 0x29260
leaq 0x10c79(%rip), %rcx     # 0x2933f
movl $0x141, %edx            # imm = 0x141
callq 0x2160