// File: /workspace/github_c_makefile_star2_O0/lh3[P]minigraph/shortk.c
// Function: mg_shortest_k
mg_pathv_t *mg_shortest_k(void *km0, const gfa_t *g, uint32_t src, int32_t n_dst, mg_path_dst_t *dst, int32_t max_dist, int32_t max_k, int32_t *n_pathv)
{
	sp_node_t *p, *root = 0, **out;
	sp_topk_t *q;
	kh_sp_t *h;
	kh_sp2_t *h2;
	void *km;
	khint_t k;
	int absent;
	int32_t i, j, n_done, n_found;
	uint32_t id, n_out, m_out;
	int8_t *dst_done;
	mg_pathv_t *ret = 0;
	uint64_t *dst_group, *seeds = 0;
	void *h_seeds = 0;
	mg128_v mini = {0,0,0};

	if (n_pathv) *n_pathv = 0;
	if (n_dst <= 0) return 0;
	for (i = 0; i < n_dst; ++i) { // initialize
		mg_path_dst_t *t = &dst[i];
		if (t->inner)
			t->dist = 0, t->n_path = 1, t->path_end = -1;
		else
			t->dist = -1, t->n_path = 0, t->path_end = -1;
	}
	if (max_k > MG_MAX_SHORT_K) max_k = MG_MAX_SHORT_K;
	km = (mg_dbg_flag&MG_DBG_NO_KALLOC) && (mg_dbg_flag&MG_DBG_SHORTK)? 0 : km_init2(km0, 0x4000);

	KCALLOC(km, dst_done, n_dst);
	KMALLOC(km, dst_group, n_dst);
	for (i = 0; i < n_dst; ++i) // multiple dst[] may have the same dst[].v. We need to group them first.
		dst_group[i] = (uint64_t)dst[i].v<<32 | i;
	radix_sort_gfa64(dst_group, dst_group + n_dst);

	h2 = sp2_init2(km); // this hash table keeps all destinations
	sp2_resize(h2, n_dst * 2);
	for (i = 1, j = 0; i <= n_dst; ++i) {
		if (i == n_dst || dst_group[i]>>32 != dst_group[j]>>32) {
			k = sp2_put(h2, dst_group[j]>>32, &absent);
			kh_val(h2, k) = (uint64_t)j << 32 | (i - j);
			assert(absent);
			j = i;
		}
	}

	h = sp_init2(km); // this hash table keeps visited vertices
	sp_resize(h, 16);
	m_out = 16, n_out = 0;
	KMALLOC(km, out, m_out);

	id = 0;
	p = gen_sp_node(km, g, src, 0, id++);
	p->hash = kh_hash_uint32(src);
	kavl_insert(sp, &root, p, 0);
	k = sp_put(h, src, &absent);
	q = &kh_val(h, k);
	q->k = 1, q->p[0] = p, q->qs = q->qe = -1;

	n_done = 0;
	while (kavl_size(head, root) > 0) {
		int32_t i, nv;
		gfa_arc_t *av;
		sp_node_t *r;

		r = kavl_erase_first(sp, &root); // take out the closest vertex in the heap (as a binary tree)
		//fprintf(stderr, "XX\t%d\t%d\t%d\t%c%s[%d]\t%d\n", n_out, kavl_size(head, root), n_finished, "><"[(r->v&1)^1], g->seg[r->v>>1].name, r->v, (int32_t)(r->di>>32));
		if (n_out == m_out) KEXPAND(km, out, m_out);
		r->di = r->di>>32<<32 | n_out; // lower 32 bits now for position in the out[] array
		out[n_out++] = r;

		k = sp2_get(h2, r->v);
		if (k != kh_end(h2)) { // we have reached one dst vertex
			int32_t j, dist = r->di>>32, off = kh_val(h2, k) >> 32, cnt = (int32_t)kh_val(h2, k);
			for (j = 0; j < cnt; ++j) {
				mg_path_dst_t *t = &dst[(int32_t)dst_group[off + j]];
				int32_t done = 0;
				if (t->inner) {
					done = 1;
				} else {
					int32_t copy = 0;
					//if (mg_dbg_flag & MG_DBG_GC1) fprintf(stderr, "  src=%c%s[%d],qlen=%d\tdst=%c%s[%d]\ttarget_distx=%d,target_hash=%x\tdistx=%d,hash=%x\n", "><"[src&1], g->seg[src>>1].name, src, ql, "><"[t->v&1], g->seg[t->v>>1].name, t->v, t->target_dist - g->seg[src>>1].len, t->target_hash, dist - g->seg[src>>1].len, r->hash);
					if (t->n_path == 0) { // keep the shortest path
						copy = 1;
					} else if (t->target_dist >= 0) { // we have a target distance; choose the closest
						if (dist == t->target_dist && t->check_hash && r->hash == t->target_hash) { // we found the target path
							copy = 1, done = 1;
						} else {
							int32_t d0 = t->dist, d1 = dist;
							d0 = d0 > t->target_dist? d0 - t->target_dist : t->target_dist - d0;
							d1 = d1 > t->target_dist? d1 - t->target_dist : t->target_dist - d1;
							if (d1 < d0) copy = 1;
						}
					}
					if (copy) {
						t->path_end = n_out - 1, t->dist = dist, t->hash = r->hash, t->is_0 = r->is_0;
						if (t->target_dist >= 0) {
							if (dist == t->target_dist && t->check_hash && r->hash == t->target_hash) done = 1;
							else if (dist > t->target_dist + MG_SHORT_K_EXT) done = 1;
						}
					}
					++t->n_path;
					if (t->n_path >= max_k) done = 1;
				}
				if (dst_done[off + j] == 0 && done)
					dst_done[off + j] = 1, ++n_done;
			}
			if (n_done == n_dst) break;
		}

		nv = gfa_arc_n(g, r->v);
		av = gfa_arc_a(g, r->v);
		for (i = 0; i < nv; ++i) { // visit all neighbors
			gfa_arc_t *ai = &av[i];
			int32_t d = (r->di>>32) + (uint32_t)ai->v_lv;
			if (d > max_dist) continue; // don't probe vertices too far away
			k = sp_put(h, ai->w, &absent);
			q = &kh_val(h, k);
			if (absent) { // a new vertex visited
				q->k = 0, q->qs = q->qe = -1;
				//if (ql && qs) fprintf(stderr, "ql=%d,src=%d\tv=%c%s[%d]\n", ql, src, "><"[ai->w&1], g->seg[ai->w>>1].name, ai->w);
			}
			if (q->k < max_k) { // enough room: add to the heap
				p = gen_sp_node(km, g, ai->w, d, id++);
				p->pre = n_out - 1;
				p->hash = r->hash + kh_hash_uint32(ai->w);
				p->is_0 = r->is_0;
				if (ai->rank > 0) p->is_0 = 0;
				kavl_insert(sp, &root, p, 0);
				q->p[q->k++] = p;
				ks_heapup_sp(q->k, q->p);
			} else if (q->p[0]->di>>32 > d) { // shorter than the longest path so far: replace the longest
				p = kavl_erase(sp, &root, q->p[0], 0);
				if (p) {
					p->di = (uint64_t)d<<32 | (id++);
					p->pre = n_out - 1;
					p->hash = r->hash + kh_hash_uint32(ai->w);
					p->is_0 = r->is_0;
					if (ai->rank > 0) p->is_0 = 0;
					kavl_insert(sp, &root, p, 0);
					ks_heapdown_sp(0, q->k, q->p);
				} else {
					fprintf(stderr, "Warning: logical bug in gfa_shortest_k(): q->k=%d,q->p[0]->{d,i}={%d,%d},d=%d,src=%u,max_dist=%d,n_dst=%d\n", q->k, (int32_t)(q->p[0]->di>>32), (int32_t)q->p[0]->di, d, src, max_dist, n_dst);
					km_destroy(km);
					return 0;
				}
			} // else: the path is longer than all the existing paths ended at ai->w
		}
	}

	kfree(km, dst_group);
	kfree(km, dst_done);
	sp_destroy(h);
	mg_idx_hfree(h_seeds);
	kfree(km, seeds);
	kfree(km, mini.a);
	// NB: AVL nodes are not deallocated. When km==0, they are memory leaks.

	for (i = 0, n_found = 0; i < n_dst; ++i)
		if (dst[i].n_path > 0) ++n_found;

	if (n_found > 0 && n_pathv) { // then generate the backtrack array
		int32_t n, *trans;
		KCALLOC(km, trans, n_out); // used to squeeze unused elements in out[]
		for (i = 0; i < n_dst; ++i) { // mark dst vertices with a target distance
			mg_path_dst_t *t = &dst[i];
			if (t->n_path > 0 && t->target_dist >= 0 && t->path_end >= 0)
				trans[(int32_t)out[t->path_end]->di] = 1;
		}
		for (i = 0; i < n_out; ++i) { // mark dst vertices without a target distance
			k = sp2_get(h2, out[i]->v);
			if (k != kh_end(h2)) { // TODO: check if this is correct!
				int32_t off = kh_val(h2, k)>>32, cnt = (int32_t)kh_val(h2, k);
				for (j = off; j < off + cnt; ++j)
					if (dst[j].target_dist < 0)
						trans[i] = 1;
			}
		}
		for (i = n_out - 1; i >= 0; --i) // mark all predecessors
			if (trans[i] && out[i]->pre >= 0)
				trans[out[i]->pre] = 1;
		for (i = n = 0; i < n_out; ++i) // generate coordinate translations
			if (trans[i]) trans[i] = n++;
			else trans[i] = -1;

		*n_pathv = n;
		KMALLOC(km0, ret, n);
		for (i = 0; i < n_out; ++i) { // generate the backtrack array
			mg_pathv_t *p;
			if (trans[i] < 0) continue;
			p = &ret[trans[i]];
			p->v = out[i]->v, p->d = out[i]->di >> 32;
			p->pre = out[i]->pre < 0? out[i]->pre : trans[out[i]->pre];
		}
		for (i = 0; i < n_dst; ++i) // translate "path_end"
			if (dst[i].path_end >= 0)
				dst[i].path_end = trans[dst[i].path_end];
	}

	km_destroy(km);
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1a0, %rsp            # imm = 0x1A0
movq 0x18(%rbp), %rax
movl 0x10(%rbp), %eax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0xa0(%rbp)
movq $0x0, -0xb0(%rbp)
movq $0x0, -0xb8(%rbp)
leaq -0xd0(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x2190
cmpq $0x0, 0x18(%rbp)
je 0x19795
movq 0x18(%rbp), %rax
movl $0x0, (%rax)
cmpl $0x0, -0x20(%rbp)
jg 0x197a8
movq $0x0, -0x8(%rbp)
jmp 0x1a8b2
movl $0x0, -0x74(%rbp)
movl -0x74(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x19859
movq -0x28(%rbp), %rax
movslq -0x74(%rbp), %rcx
imulq $0x24, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xd8(%rbp)
movq -0xd8(%rbp), %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x19817
movq -0xd8(%rbp), %rax
movl $0x0, 0x1c(%rax)
movq -0xd8(%rbp), %rax
movl 0x14(%rax), %ecx
andl $0x80000000, %ecx       # imm = 0x80000000
orl $0x1, %ecx
movl %ecx, 0x14(%rax)
movq -0xd8(%rbp), %rax
movl $0xffffffff, 0x18(%rax) # imm = 0xFFFFFFFF
jmp 0x19849
movq -0xd8(%rbp), %rax
movl $0xffffffff, 0x1c(%rax) # imm = 0xFFFFFFFF
movq -0xd8(%rbp), %rax
movl 0x14(%rax), %ecx
andl $0x80000000, %ecx       # imm = 0x80000000
orl $0x0, %ecx
movl %ecx, 0x14(%rax)
movq -0xd8(%rbp), %rax
movl $0xffffffff, 0x18(%rax) # imm = 0xFFFFFFFF
jmp 0x1984b
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x197af
cmpl $0xf, 0x10(%rbp)
jle 0x19866
movl $0xf, 0x10(%rbp)
leaq 0x2be1b(%rip), %rax     # 0x45688
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x19893
leaq 0x2be0a(%rip), %rax     # 0x45688
movl (%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x19893
xorl %eax, %eax
movq %rax, -0x150(%rbp)
jmp 0x198a8
movq -0x10(%rbp), %rdi
movl $0x4000, %esi           # imm = 0x4000
callq 0x24a0
movq %rax, -0x150(%rbp)
movq -0x150(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rdi
movslq -0x20(%rbp), %rsi
movl $0x1, %edx
callq 0x2540
movq %rax, -0x98(%rbp)
movq -0x68(%rbp), %rdi
movslq -0x20(%rbp), %rsi
shlq $0x3, %rsi
callq 0x2890
movq %rax, -0xa8(%rbp)
movl $0x0, -0x74(%rbp)
movl -0x74(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x1992b
movq -0x28(%rbp), %rax
movslq -0x74(%rbp), %rcx
imulq $0x24, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, %edx
shlq $0x20, %rdx
movslq -0x74(%rbp), %rax
orq %rax, %rdx
movq -0xa8(%rbp), %rax
movslq -0x74(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x198eb
movq -0xa8(%rbp), %rdi
movq -0xa8(%rbp), %rsi
movslq -0x20(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
callq 0x5440
movq -0x68(%rbp), %rdi
callq 0x1a8c0
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
movl -0x20(%rbp), %esi
shll %esi
callq 0x1a8e0
movl $0x1, -0x74(%rbp)
movl $0x0, -0x78(%rbp)
movl -0x74(%rbp), %eax
cmpl -0x20(%rbp), %eax
jg 0x19a3c
movl -0x74(%rbp), %eax
cmpl -0x20(%rbp), %eax
je 0x199b1
movq -0xa8(%rbp), %rax
movslq -0x74(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movq -0xa8(%rbp), %rcx
movslq -0x78(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
cmpq %rcx, %rax
je 0x19a2c
movq -0x60(%rbp), %rdi
movq -0xa8(%rbp), %rax
movslq -0x78(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movl %eax, %esi
leaq -0x70(%rbp), %rdx
callq 0x1a910
movl %eax, -0x6c(%rbp)
movslq -0x78(%rbp), %rcx
shlq $0x20, %rcx
movl -0x74(%rbp), %eax
subl -0x78(%rbp), %eax
cltq
orq %rax, %rcx
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x6c(%rbp), %edx
imulq $0xc, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x4(%rax)
cmpl $0x0, -0x70(%rbp)
je 0x19a07
jmp 0x19a26
leaq 0x2317b(%rip), %rdi     # 0x3cb89
leaq 0x2317b(%rip), %rsi     # 0x3cb90
movl $0x52, %edx
leaq 0x23178(%rip), %rcx     # 0x3cb99
callq 0x2170
movl -0x74(%rbp), %eax
movl %eax, -0x78(%rbp)
jmp 0x19a2e
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x19972
movq -0x68(%rbp), %rdi
callq 0x1a940
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
movl $0x10, %esi
callq 0x1a960
movl $0x10, -0x8c(%rbp)
movl $0x0, -0x88(%rbp)
movq -0x68(%rbp), %rdi
movl -0x8c(%rbp), %eax
movl %eax, %esi
shlq $0x3, %rsi
callq 0x2890
movq %rax, -0x48(%rbp)
movl $0x0, -0x84(%rbp)
movq -0x68(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
movl -0x84(%rbp), %r8d
movl %r8d, %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
xorl %ecx, %ecx
callq 0x1a990
movq %rax, -0x38(%rbp)
movl -0x1c(%rbp), %edi
callq 0x1aa00
movl %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
callq 0x18250
movq -0x58(%rbp), %rdi
movl -0x1c(%rbp), %esi
leaq -0x70(%rbp), %rdx
callq 0x1aa60
movl %eax, -0x6c(%rbp)
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x6c(%rbp), %ecx
imulq $0x8c, %rcx, %rcx
addq %rcx, %rax
addq $0x4, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movl $0x1, (%rax)
movq -0x38(%rbp), %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x50(%rbp), %rax
movl $0xffffffff, 0x8(%rax)  # imm = 0xFFFFFFFF
movq -0x50(%rbp), %rax
movl $0xffffffff, 0x4(%rax)  # imm = 0xFFFFFFFF
movl $0x0, -0x7c(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x19b52
movq -0x40(%rbp), %rax
movl 0x2c(%rax), %eax
movl %eax, -0x154(%rbp)
jmp 0x19b5c
xorl %eax, %eax
movl %eax, -0x154(%rbp)
jmp 0x19b5c
movl -0x154(%rbp), %eax
cmpl $0x0, %eax
jbe 0x1a3ee
leaq -0x40(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rsi
callq 0x18920
movq %rax, -0xf0(%rbp)
movl -0x88(%rbp), %eax
cmpl -0x8c(%rbp), %eax
jne 0x19beb
jmp 0x19b92
cmpl $0x4, -0x8c(%rbp)
jb 0x19bb3
movl -0x8c(%rbp), %eax
movl -0x8c(%rbp), %ecx
shrl %ecx
addl %ecx, %eax
movl %eax, -0x158(%rbp)
jmp 0x19bc0
movl $0x10, %eax
movl %eax, -0x158(%rbp)
jmp 0x19bc0
movl -0x158(%rbp), %eax
movl %eax, -0x8c(%rbp)
movq -0x68(%rbp), %rdi
movq -0x48(%rbp), %rsi
movl -0x8c(%rbp), %eax
movl %eax, %edx
shlq $0x3, %rdx
callq 0x2ae0
movq %rax, -0x48(%rbp)
jmp 0x19beb
movq -0xf0(%rbp), %rax
movq (%rax), %rcx
shrq $0x20, %rcx
shlq $0x20, %rcx
movl -0x88(%rbp), %eax
orq %rax, %rcx
movq -0xf0(%rbp), %rax
movq %rcx, (%rax)
movq -0xf0(%rbp), %rdx
movq -0x48(%rbp), %rax
movl -0x88(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x88(%rbp)
movl %ecx, %ecx
movq %rdx, (%rax,%rcx,8)
movq -0x60(%rbp), %rdi
movq -0xf0(%rbp), %rax
movl 0x8(%rax), %esi
callq 0x1aaa0
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
movl %eax, -0x15c(%rbp)
movq -0x60(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x19c71
movq -0x60(%rbp), %rax
movl (%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, -0x160(%rbp)
jmp 0x19c7b
xorl %eax, %eax
movl %eax, -0x160(%rbp)
jmp 0x19c7b
movl -0x15c(%rbp), %eax
movl -0x160(%rbp), %ecx
cmpl %ecx, %eax
je 0x1a05b
movq -0xf0(%rbp), %rax
movq (%rax), %rax
shrq $0x20, %rax
movl %eax, -0xf8(%rbp)
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x6c(%rbp), %ecx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq 0x4(%rax), %rax
shrq $0x20, %rax
movl %eax, -0xfc(%rbp)
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x6c(%rbp), %ecx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq 0x4(%rax), %rax
movl %eax, -0x100(%rbp)
movl $0x0, -0xf4(%rbp)
movl -0xf4(%rbp), %eax
cmpl -0x100(%rbp), %eax
jge 0x1a04c
movq -0x28(%rbp), %rax
movq -0xa8(%rbp), %rcx
movl -0xfc(%rbp), %edx
addl -0xf4(%rbp), %edx
movslq %edx, %rdx
movq (%rcx,%rdx,8), %rcx
movslq %ecx, %rcx
imulq $0x24, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x108(%rbp)
movl $0x0, -0x10c(%rbp)
movq -0x108(%rbp), %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x19d55
movl $0x1, -0x10c(%rbp)
jmp 0x19feb
movl $0x0, -0x110(%rbp)
movq -0x108(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpl $0x0, %eax
jne 0x19d82
movl $0x1, -0x110(%rbp)
jmp 0x19ebb
movq -0x108(%rbp), %rax
cmpl $0x0, 0x4(%rax)
jl 0x19eb9
movl -0xf8(%rbp), %eax
movq -0x108(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jne 0x19de9
movq -0x108(%rbp), %rax
movl 0xc(%rax), %eax
shrl $0x1e, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x19de9
movq -0xf0(%rbp), %rax
movl 0x10(%rax), %eax
movq -0x108(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jne 0x19de9
movl $0x1, -0x110(%rbp)
movl $0x1, -0x10c(%rbp)
jmp 0x19eb7
movq -0x108(%rbp), %rax
movl 0x1c(%rax), %eax
movl %eax, -0x114(%rbp)
movl -0xf8(%rbp), %eax
movl %eax, -0x118(%rbp)
movl -0x114(%rbp), %eax
movq -0x108(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jle 0x19e2f
movl -0x114(%rbp), %eax
movq -0x108(%rbp), %rcx
subl 0x4(%rcx), %eax
movl %eax, -0x164(%rbp)
jmp 0x19e45
movq -0x108(%rbp), %rax
movl 0x4(%rax), %eax
subl -0x114(%rbp), %eax
movl %eax, -0x164(%rbp)
movl -0x164(%rbp), %eax
movl %eax, -0x114(%rbp)
movl -0x118(%rbp), %eax
movq -0x108(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jle 0x19e7b
movl -0x118(%rbp), %eax
movq -0x108(%rbp), %rcx
subl 0x4(%rcx), %eax
movl %eax, -0x168(%rbp)
jmp 0x19e91
movq -0x108(%rbp), %rax
movl 0x4(%rax), %eax
subl -0x118(%rbp), %eax
movl %eax, -0x168(%rbp)
movl -0x168(%rbp), %eax
movl %eax, -0x118(%rbp)
movl -0x118(%rbp), %eax
cmpl -0x114(%rbp), %eax
jge 0x19eb5
movl $0x1, -0x110(%rbp)
jmp 0x19eb7
jmp 0x19eb9
jmp 0x19ebb
cmpl $0x0, -0x110(%rbp)
je 0x19fa4
movl -0x88(%rbp), %ecx
subl $0x1, %ecx
movq -0x108(%rbp), %rax
movl %ecx, 0x18(%rax)
movl -0xf8(%rbp), %ecx
movq -0x108(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0xf0(%rbp), %rax
movl 0x10(%rax), %ecx
movq -0x108(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0xf0(%rbp), %rax
movl 0x14(%rax), %edx
movq -0x108(%rbp), %rax
movl 0x14(%rax), %ecx
andl $0x1, %edx
shll $0x1f, %edx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl %edx, %ecx
movl %ecx, 0x14(%rax)
movq -0x108(%rbp), %rax
cmpl $0x0, 0x4(%rax)
jl 0x19fa2
movl -0xf8(%rbp), %eax
movq -0x108(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jne 0x19f7a
movq -0x108(%rbp), %rax
movl 0xc(%rax), %eax
shrl $0x1e, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x19f7a
movq -0xf0(%rbp), %rax
movl 0x10(%rax), %eax
movq -0x108(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jne 0x19f7a
movl $0x1, -0x10c(%rbp)
jmp 0x19fa0
movl -0xf8(%rbp), %eax
movq -0x108(%rbp), %rcx
movl 0x4(%rcx), %ecx
addl $0x3e8, %ecx            # imm = 0x3E8
cmpl %ecx, %eax
jle 0x19f9e
movl $0x1, -0x10c(%rbp)
jmp 0x19fa0
jmp 0x19fa2
jmp 0x19fa4
movq -0x108(%rbp), %rax
movl 0x14(%rax), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
addl $0x1, %edx
movl 0x14(%rax), %ecx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andl $0x80000000, %ecx       # imm = 0x80000000
orl %edx, %ecx
movl %ecx, 0x14(%rax)
movq -0x108(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpl 0x10(%rbp), %eax
jl 0x19fe9
movl $0x1, -0x10c(%rbp)
jmp 0x19feb
movq -0x98(%rbp), %rax
movl -0xfc(%rbp), %ecx
addl -0xf4(%rbp), %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0x1a036
cmpl $0x0, -0x10c(%rbp)
je 0x1a036
movq -0x98(%rbp), %rax
movl -0xfc(%rbp), %ecx
addl -0xf4(%rbp), %ecx
movslq %ecx, %rcx
movb $0x1, (%rax,%rcx)
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x1a038
movl -0xf4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xf4(%rbp)
jmp 0x19ce9
movl -0x7c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jne 0x1a059
jmp 0x1a3ee
jmp 0x1a05b
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movq -0xf0(%rbp), %rcx
movl 0x8(%rcx), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0xe0(%rbp)
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x58(%rcx), %rcx
movq -0xf0(%rbp), %rdx
movl 0x8(%rdx), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0xe8(%rbp)
movl $0x0, -0xdc(%rbp)
movl -0xdc(%rbp), %eax
cmpl -0xe0(%rbp), %eax
jge 0x1a3e9
movq -0xe8(%rbp), %rax
movslq -0xdc(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x120(%rbp)
movq -0xf0(%rbp), %rax
movq (%rax), %rax
shrq $0x20, %rax
movq -0x120(%rbp), %rcx
movq (%rcx), %rcx
movl %ecx, %ecx
addq %rcx, %rax
movl %eax, -0x124(%rbp)
movl -0x124(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jle 0x1a112
jmp 0x1a3d5
movq -0x58(%rbp), %rdi
movq -0x120(%rbp), %rax
movl 0x8(%rax), %esi
leaq -0x70(%rbp), %rdx
callq 0x1aa60
movl %eax, -0x6c(%rbp)
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x6c(%rbp), %ecx
imulq $0x8c, %rcx, %rcx
addq %rcx, %rax
addq $0x4, %rax
movq %rax, -0x50(%rbp)
cmpl $0x0, -0x70(%rbp)
je 0x1a16f
movq -0x50(%rbp), %rax
movl $0x0, (%rax)
movq -0x50(%rbp), %rax
movl $0xffffffff, 0x8(%rax)  # imm = 0xFFFFFFFF
movq -0x50(%rbp), %rax
movl $0xffffffff, 0x4(%rax)  # imm = 0xFFFFFFFF
movq -0x50(%rbp), %rax
movl (%rax), %eax
cmpl 0x10(%rbp), %eax
jge 0x1a260
movq -0x68(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x120(%rbp), %rax
movl 0x8(%rax), %edx
movl -0x124(%rbp), %ecx
movl -0x84(%rbp), %r8d
movl %r8d, %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
callq 0x1a990
movq %rax, -0x38(%rbp)
movl -0x88(%rbp), %ecx
subl $0x1, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0xf0(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x16c(%rbp)
movq -0x120(%rbp), %rax
movl 0x8(%rax), %edi
callq 0x1aa00
movl -0x16c(%rbp), %ecx
addl %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0xf0(%rbp), %rax
movl 0x14(%rax), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x120(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jle 0x1a219
movq -0x38(%rbp), %rax
movl $0x0, 0x14(%rax)
movq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
callq 0x18250
movq -0x38(%rbp), %rdx
movq -0x50(%rbp), %rax
movq -0x50(%rbp), %rsi
movl (%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, (%rsi)
movslq %ecx, %rcx
movq %rdx, 0x10(%rax,%rcx,8)
movq -0x50(%rbp), %rax
movslq (%rax), %rdi
movq -0x50(%rbp), %rsi
addq $0x10, %rsi
callq 0x19380
jmp 0x1a3d3
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rax
shrq $0x20, %rax
movslq -0x124(%rbp), %rcx
cmpq %rcx, %rax
jbe 0x1a3d1
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rsi
leaq -0x40(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
callq 0x18920
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x1a35d
movslq -0x124(%rbp), %rcx
shlq $0x20, %rcx
movl -0x84(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0x84(%rbp)
movl %eax, %eax
orq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movl -0x88(%rbp), %ecx
subl $0x1, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0xf0(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x170(%rbp)
movq -0x120(%rbp), %rax
movl 0x8(%rax), %edi
callq 0x1aa00
movl -0x170(%rbp), %ecx
addl %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0xf0(%rbp), %rax
movl 0x14(%rax), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x120(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jle 0x1a332
movq -0x38(%rbp), %rax
movl $0x0, 0x14(%rax)
movq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
callq 0x18250
movq -0x50(%rbp), %rax
movslq (%rax), %rsi
movq -0x50(%rbp), %rdx
addq $0x10, %rdx
xorl %eax, %eax
movl %eax, %edi
callq 0x192b0
jmp 0x1a3cf
movq 0x2ac94(%rip), %rax     # 0x44ff8
movq (%rax), %rdi
movq -0x50(%rbp), %rax
movl (%rax), %edx
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rax
shrq $0x20, %rax
movl %eax, %ecx
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rax
movl %eax, %r8d
movl -0x124(%rbp), %r9d
movl -0x1c(%rbp), %r11d
movl -0x2c(%rbp), %r10d
movl -0x20(%rbp), %eax
leaq 0x22866(%rip), %rsi     # 0x3cc0b
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movb $0x0, %al
callq 0x2210
movq -0x68(%rbp), %rdi
callq 0x25f0
movq $0x0, -0x8(%rbp)
jmp 0x1a8b2
jmp 0x1a3d1
jmp 0x1a3d3
jmp 0x1a3d5
movl -0xdc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xdc(%rbp)
jmp 0x1a0b1
jmp 0x19b3c
movq -0x68(%rbp), %rdi
movq -0xa8(%rbp), %rsi
callq 0x2670
movq -0x68(%rbp), %rdi
movq -0x98(%rbp), %rsi
callq 0x2670
movq -0x58(%rbp), %rdi
callq 0x1aad0
movq -0xb8(%rbp), %rdi
callq 0x20930
movq -0x68(%rbp), %rdi
movq -0xb0(%rbp), %rsi
callq 0x2670
movq -0x68(%rbp), %rdi
movq -0xc0(%rbp), %rsi
callq 0x2670
movl $0x0, -0x74(%rbp)
movl $0x0, -0x80(%rbp)
movl -0x74(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x1a48b
movq -0x28(%rbp), %rax
movslq -0x74(%rbp), %rcx
imulq $0x24, %rcx, %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpl $0x0, %eax
jle 0x1a47e
movl -0x80(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x80(%rbp)
jmp 0x1a480
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x1a451
cmpl $0x0, -0x80(%rbp)
jle 0x1a89e
cmpq $0x0, 0x18(%rbp)
je 0x1a89e
movq -0x68(%rbp), %rdi
movl -0x88(%rbp), %eax
movl %eax, %esi
movl $0x4, %edx
callq 0x2540
movq %rax, -0x130(%rbp)
movl $0x0, -0x74(%rbp)
movl -0x74(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x1a544
movq -0x28(%rbp), %rax
movslq -0x74(%rbp), %rcx
imulq $0x24, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x138(%rbp)
movq -0x138(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpl $0x0, %eax
jle 0x1a537
movq -0x138(%rbp), %rax
cmpl $0x0, 0x4(%rax)
jl 0x1a537
movq -0x138(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jl 0x1a537
movq -0x130(%rbp), %rax
movq -0x48(%rbp), %rcx
movq -0x138(%rbp), %rdx
movslq 0x18(%rdx), %rdx
movq (%rcx,%rdx,8), %rcx
movq (%rcx), %rcx
movslq %ecx, %rcx
movl $0x1, (%rax,%rcx,4)
jmp 0x1a539
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x1a4c4
movl $0x0, -0x74(%rbp)
movl -0x74(%rbp), %eax
cmpl -0x88(%rbp), %eax
jae 0x1a65a
movq -0x60(%rbp), %rdi
movq -0x48(%rbp), %rax
movslq -0x74(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x8(%rax), %esi
callq 0x1aaa0
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
movl %eax, -0x174(%rbp)
movq -0x60(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x1a59e
movq -0x60(%rbp), %rax
movl (%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, -0x178(%rbp)
jmp 0x1a5a8
xorl %eax, %eax
movl %eax, -0x178(%rbp)
jmp 0x1a5a8
movl -0x174(%rbp), %eax
movl -0x178(%rbp), %ecx
cmpl %ecx, %eax
je 0x1a64a
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x6c(%rbp), %ecx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq 0x4(%rax), %rax
shrq $0x20, %rax
movl %eax, -0x13c(%rbp)
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x6c(%rbp), %ecx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq 0x4(%rax), %rax
movl %eax, -0x140(%rbp)
movl -0x13c(%rbp), %eax
movl %eax, -0x78(%rbp)
movl -0x78(%rbp), %eax
movl -0x13c(%rbp), %ecx
addl -0x140(%rbp), %ecx
cmpl %ecx, %eax
jge 0x1a648
movq -0x28(%rbp), %rax
movslq -0x78(%rbp), %rcx
imulq $0x24, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x4(%rax)
jge 0x1a63b
movq -0x130(%rbp), %rax
movslq -0x74(%rbp), %rcx
movl $0x1, (%rax,%rcx,4)
jmp 0x1a63d
movl -0x78(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x78(%rbp)
jmp 0x1a601
jmp 0x1a64a
jmp 0x1a64c
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x1a54b
movl -0x88(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x74(%rbp)
cmpl $0x0, -0x74(%rbp)
jl 0x1a6ba
movq -0x130(%rbp), %rax
movslq -0x74(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
je 0x1a6ad
movq -0x48(%rbp), %rax
movslq -0x74(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpl $0x0, 0xc(%rax)
jl 0x1a6ad
movq -0x130(%rbp), %rax
movq -0x48(%rbp), %rcx
movslq -0x74(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movslq 0xc(%rcx), %rcx
movl $0x1, (%rax,%rcx,4)
jmp 0x1a6af
movl -0x74(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x1a666
movl $0x0, -0x128(%rbp)
movl $0x0, -0x74(%rbp)
movl -0x74(%rbp), %eax
cmpl -0x88(%rbp), %eax
jae 0x1a727
movq -0x130(%rbp), %rax
movslq -0x74(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
je 0x1a708
movl -0x128(%rbp), %edx
movl %edx, %eax
addl $0x1, %eax
movl %eax, -0x128(%rbp)
movq -0x130(%rbp), %rax
movslq -0x74(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x1a71a
movq -0x130(%rbp), %rax
movslq -0x74(%rbp), %rcx
movl $0xffffffff, (%rax,%rcx,4) # imm = 0xFFFFFFFF
jmp 0x1a71c
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x1a6cb
movl -0x128(%rbp), %ecx
movq 0x18(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rdi
movslq -0x128(%rbp), %rax
imulq $0xc, %rax, %rsi
callq 0x2890
movq %rax, -0xa0(%rbp)
movl $0x0, -0x74(%rbp)
movl -0x74(%rbp), %eax
cmpl -0x88(%rbp), %eax
jae 0x1a83c
movq -0x130(%rbp), %rax
movslq -0x74(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jge 0x1a77a
jmp 0x1a82e
movq -0xa0(%rbp), %rax
movq -0x130(%rbp), %rcx
movslq -0x74(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x148(%rbp)
movq -0x48(%rbp), %rax
movslq -0x74(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x8(%rax), %ecx
movq -0x148(%rbp), %rax
movl %ecx, (%rax)
movq -0x48(%rbp), %rax
movslq -0x74(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rax
shrq $0x20, %rax
movl %eax, %ecx
movq -0x148(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x48(%rbp), %rax
movslq -0x74(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpl $0x0, 0xc(%rax)
jge 0x1a7fe
movq -0x48(%rbp), %rax
movslq -0x74(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl 0xc(%rax), %eax
movl %eax, -0x17c(%rbp)
jmp 0x1a81e
movq -0x130(%rbp), %rax
movq -0x48(%rbp), %rcx
movslq -0x74(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movslq 0xc(%rcx), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x17c(%rbp)
movl -0x17c(%rbp), %ecx
movq -0x148(%rbp), %rax
movl %ecx, 0x8(%rax)
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x1a755
movl $0x0, -0x74(%rbp)
movl -0x74(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x1a89c
movq -0x28(%rbp), %rax
movslq -0x74(%rbp), %rcx
imulq $0x24, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x18(%rax)
jl 0x1a88f
movq -0x130(%rbp), %rax
movq -0x28(%rbp), %rcx
movslq -0x74(%rbp), %rdx
imulq $0x24, %rdx, %rdx
addq %rdx, %rcx
movslq 0x18(%rcx), %rcx
movl (%rax,%rcx,4), %ecx
movq -0x28(%rbp), %rax
movslq -0x74(%rbp), %rdx
imulq $0x24, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x18(%rax)
jmp 0x1a891
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x1a843
jmp 0x1a89e
movq -0x68(%rbp), %rdi
callq 0x25f0
movq -0xa0(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbp
retq
nop