// File: chhylp123[P]hifiasm/inter.cpp
// Function: mg_gchain_gen(void*, void*, asg_t const*, int, unsigned long const*, mg_lchain_t const*, mg128_t const*, unsigned int, int, int)
mg_gchains_t *mg_gchain_gen(void *km_dst, void *km, const asg_t *g, int32_t n_u, const uint64_t *u, const mg_lchain_t *lc, const mg128_t *a,
							uint32_t hash, int32_t min_gc_cnt, int32_t min_gc_score)
{
	mg_gchains_t *gc;
	mg_llchain_t *tmp;
	int32_t i, j, k, st, n_g, n_a, s_tmp, n_tmp, m_tmp;
	KCALLOC(km_dst, gc, 1);
	// count the number of gchains and remaining anchors
	// filter out low-quality g_chains
	for (i = 0, st = 0, n_g = n_a = 0; i < n_u; ++i) {
		///nui: how many linear chaisn in i-th g_chain
		int32_t m = 0, nui = (int32_t)u[i];
		for (j = 0; j < nui; ++j) m += lc[st + j].cnt; // m is the number of anchors in this gchain
		if (m >= min_gc_cnt && (int64_t)(u[i]>>32) >= min_gc_score)
			++n_g, n_a += m;
		st += nui;
	}
	if (n_g == 0) return gc;

	// preallocate
	gc->km = km_dst;
	gc->n_gc = n_g, gc->n_a = n_a;
	KCALLOC(km_dst, gc->gc, n_g);///all graph chains
	KMALLOC(km_dst, gc->a, n_a);///all anchors, aka minimizers

	// core loop
	tmp = 0; s_tmp = n_tmp = m_tmp = 0;
	for (i = k = 0, st = 0, n_a = 0; i < n_u; ++i) {
		int32_t n_a0 = n_a, m = 0, nui = (int32_t)u[i]; ///nui: how many linear chaisn in i-th g_chain
		for (j = 0; j < nui; ++j) m += lc[st + j].cnt; ///how many minizers in i-th g_chain
		if (m >= min_gc_cnt && (int64_t)(u[i]>>32) >= min_gc_score) {
			mg_llchain_t *q;
			uint32_t h = hash;

			gc->gc[k].score = u[i]>>32; ///chain score
			gc->gc[k].off = s_tmp; ///all minimizers of k-th chain: gc->a[gc->gc[k].off, )

			for (j = 0; j < nui; ++j) {///how many linear chains
				const mg_lchain_t *p = &lc[st + j];
				h += __ac_Wang_hash(p->qs) + __ac_Wang_hash(p->re) + __ac_Wang_hash(p->v);
			}
			gc->gc[k].hash = __ac_Wang_hash(h);///hash key for the k-th graph chain

			if (n_tmp == m_tmp) KEXPAND(km, tmp, m_tmp);
			// copy the first lchain to gc->a[] and tmp[] (aka, gc->lc[])
			// for the first lchain, it is easy and we just copy all its anchors
			copy_lchain(&tmp[n_tmp++], &lc[st], &n_a, gc->a, a); 
			///0-th lchain has been stored
			///process the remaining chains
			for (j = 1; j < nui; ++j) { 
				const mg_lchain_t *l0 = &lc[st + j - 1], *l1 = &lc[st + j];
				if (!l1->inner_pre) { // bridging two segments; if l0 and l1 are at different reference
					int32_t s, n_pathv;
					mg_path_dst_t dst;
					mg_pathv_t *p;
					memset(&dst, 0, sizeof(mg_path_dst_t));
					dst.v = l0->v ^ 1;
					assert(l1->dist_pre >= 0);
					dst.target_dist = l1->dist_pre;
					dst.target_hash = l1->hash_pre;///hash value of the whole path
					dst.check_hash = 1;
					p = mg_shortest_k(km, g, l1->v^1, 1, &dst, dst.target_dist, MG_MAX_SHORT_K, &n_pathv);
					if (n_pathv == 0 || dst.target_hash != dst.hash)
						fprintf(stderr, "%c[%d] -> %c[%d], dist=%d, target_dist=%d\n", "><"[(l1->v^1)&1], l1->v^1, "><"[(l0->v^1)&1], l0->v^1, dst.dist, dst.target_dist);
					assert(n_pathv > 0);
					assert(dst.target_hash == dst.hash);
					for (s = n_pathv - 2; s >= 1; --s) { // path found in a backward way, so we need to reverse it
						if (n_tmp == m_tmp) KEXPAND(km, tmp, m_tmp);
						q = &tmp[n_tmp++];
						q->off = q->cnt = q->score = 0;
						q->v = p[s].v^1; // when reversing a path, we also need to flip the orientation
					}
					kfree(km, p);
					if (n_tmp == m_tmp) KEXPAND(km, tmp, m_tmp);
					copy_lchain(&tmp[n_tmp++], l1, &n_a, gc->a, a);
				}
				else { // if both of them are at the same linear chain, just merge them
					#if 1
					int32_t k;
					mg_llchain_t *t = &tmp[n_tmp - 1];//the last lchain, have alread done
					assert(l0->v == l1->v);
					// a[].x: ref_id(31)rev(1)r_pos(32)
 					// a[].y: weight(8)query_id(8)flag(8)span(8)q_pos(32)
					for (k = 0; k < l1->cnt; ++k) {
						const mg128_t *ak = &a[l1->off + k];
						if ((int32_t)ak->x > l0->re && (int32_t)ak->y > l0->qe)//find colinear anchors
							break;
					}
					assert(k < l1->cnt);
					t->cnt += l1->cnt - k, t->score += l1->score;
					memcpy(&gc->a[n_a], &a[l1->off + k], (l1->cnt - k) * sizeof(mg128_t));
					n_a += l1->cnt - k;
					#else // don't use this block; for debugging only
					if (n_tmp == m_tmp) KEXPAND(km, tmp, m_tmp);
					copy_lchain(&tmp[n_tmp++], l1, &n_a, gc->a, a);
					#endif
				}
			}
			gc->gc[k].cnt = n_tmp - s_tmp;
			gc->gc[k].n_anchor = n_a - n_a0;
			++k, s_tmp = n_tmp;
		}
		st += nui;//nui: how many linear chains in this gchain
	}
	assert(n_a <= gc->n_a);

	gc->n_a = n_a;
	gc->n_lc = n_tmp;
	KMALLOC(km_dst, gc->lc, n_tmp);
	memcpy(gc->lc, tmp, n_tmp * sizeof(mg_llchain_t));
	kfree(km, tmp);

	mg_gchain_extra(g, gc);
	mg_gchain_sort_by_score(km, gc);
	return gc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movl 0x28(%rbp), %eax
movl 0x20(%rbp), %eax
movl 0x18(%rbp), %eax
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq -0x10(%rbp), %rdi
movl $0x1, %esi
movl $0x40, %edx
callq 0x30e1a0
movq %rax, -0x40(%rbp)
movl $0x0, -0x4c(%rbp)
movl $0x0, -0x58(%rbp)
movl $0x0, -0x60(%rbp)
movl $0x0, -0x5c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x28a529
movl $0x0, -0x70(%rbp)
movq -0x30(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, -0x74(%rbp)
movl $0x0, -0x50(%rbp)
movl -0x50(%rbp), %eax
cmpl -0x74(%rbp), %eax
jge 0x28a4df
movq -0x38(%rbp), %rax
movl -0x58(%rbp), %ecx
addl -0x50(%rbp), %ecx
movslq %ecx, %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
shll %eax
sarl %eax
addl -0x70(%rbp), %eax
movl %eax, -0x70(%rbp)
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x28a4ab
movl -0x70(%rbp), %eax
cmpl 0x20(%rbp), %eax
jl 0x28a512
movq -0x30(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movslq 0x28(%rbp), %rcx
cmpq %rcx, %rax
jl 0x28a512
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
movl -0x70(%rbp), %eax
addl -0x60(%rbp), %eax
movl %eax, -0x60(%rbp)
movl -0x74(%rbp), %eax
addl -0x58(%rbp), %eax
movl %eax, -0x58(%rbp)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x28a482
cmpl $0x0, -0x5c(%rbp)
jne 0x28a53c
movq -0x40(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x28ae6c
movq -0x10(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, (%rax)
movl -0x5c(%rbp), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x8(%rax)
movl -0x60(%rbp), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x10(%rbp), %rdi
movslq -0x5c(%rbp), %rsi
movl $0x48, %edx
callq 0x30e1a0
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rdi
movslq -0x60(%rbp), %rsi
shlq $0x4, %rsi
callq 0x30e4f0
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x28(%rax)
movq $0x0, -0x48(%rbp)
movl $0x0, -0x6c(%rbp)
movl $0x0, -0x68(%rbp)
movl $0x0, -0x64(%rbp)
movl $0x0, -0x54(%rbp)
movl $0x0, -0x4c(%rbp)
movl $0x0, -0x58(%rbp)
movl $0x0, -0x60(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x28adc7
movl -0x60(%rbp), %eax
movl %eax, -0x78(%rbp)
movl $0x0, -0x7c(%rbp)
movq -0x30(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, -0x80(%rbp)
movl $0x0, -0x50(%rbp)
movl -0x50(%rbp), %eax
cmpl -0x80(%rbp), %eax
jge 0x28a630
movq -0x38(%rbp), %rax
movl -0x58(%rbp), %ecx
addl -0x50(%rbp), %ecx
movslq %ecx, %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
shll %eax
sarl %eax
addl -0x7c(%rbp), %eax
movl %eax, -0x7c(%rbp)
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x28a5fc
movl -0x7c(%rbp), %eax
cmpl 0x20(%rbp), %eax
jl 0x28adb0
movq -0x30(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movslq 0x28(%rbp), %rcx
cmpq %rcx, %rax
jl 0x28adb0
movl 0x18(%rbp), %eax
movl %eax, -0x8c(%rbp)
movq -0x30(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movl %eax, %ecx
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x54(%rbp), %rdx
imulq $0x48, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x14(%rax)
movl -0x64(%rbp), %ecx
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x54(%rbp), %rdx
imulq $0x48, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
movl $0x0, -0x50(%rbp)
movl -0x50(%rbp), %eax
cmpl -0x80(%rbp), %eax
jge 0x28a738
movq -0x38(%rbp), %rax
movl -0x58(%rbp), %ecx
addl -0x50(%rbp), %ecx
movslq %ecx, %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
movl 0x14(%rax), %edi
callq 0x286f50
movl %eax, -0x108(%rbp)
movq -0x98(%rbp), %rax
movl 0x10(%rax), %edi
callq 0x286f50
movl %eax, %ecx
movl -0x108(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x104(%rbp)
movq -0x98(%rbp), %rax
movl 0x8(%rax), %edi
callq 0x286f50
movl %eax, %ecx
movl -0x104(%rbp), %eax
addl %ecx, %eax
addl -0x8c(%rbp), %eax
movl %eax, -0x8c(%rbp)
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x28a6aa
movl -0x8c(%rbp), %edi
callq 0x286f50
movl %eax, %ecx
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x54(%rbp), %rdx
imulq $0x48, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x38(%rax)
movl -0x68(%rbp), %eax
cmpl -0x6c(%rbp), %eax
jne 0x28a7ae
jmp 0x28a765
cmpl $0x4, -0x6c(%rbp)
jl 0x28a77d
movl -0x6c(%rbp), %eax
movl -0x6c(%rbp), %ecx
sarl %ecx
addl %ecx, %eax
movl %eax, -0x10c(%rbp)
jmp 0x28a78a
movl $0x10, %eax
movl %eax, -0x10c(%rbp)
jmp 0x28a78a
movl -0x10c(%rbp), %eax
movl %eax, -0x6c(%rbp)
movq -0x18(%rbp), %rdi
movq -0x48(%rbp), %rsi
movslq -0x6c(%rbp), %rdx
shlq $0x4, %rdx
callq 0x30e740
movq %rax, -0x48(%rbp)
jmp 0x28a7ae
movq -0x48(%rbp), %rdi
movl -0x68(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x68(%rbp)
cltq
shlq $0x4, %rax
addq %rax, %rdi
movq -0x38(%rbp), %rsi
movslq -0x58(%rbp), %rax
imulq $0x28, %rax, %rax
addq %rax, %rsi
movq -0x40(%rbp), %rax
movq 0x28(%rax), %rcx
movq 0x10(%rbp), %r8
leaq -0x60(%rbp), %rdx
callq 0x28ae80
movl $0x1, -0x50(%rbp)
movl -0x50(%rbp), %eax
cmpl -0x80(%rbp), %eax
jge 0x28ad69
movq -0x38(%rbp), %rax
movl -0x58(%rbp), %ecx
addl -0x50(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xa0(%rbp)
movq -0x38(%rbp), %rax
movl -0x58(%rbp), %ecx
addl -0x50(%rbp), %ecx
movslq %ecx, %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
movl 0x4(%rax), %eax
sarl $0x1f, %eax
cmpl $0x0, %eax
jne 0x28aba5
leaq -0xe0(%rbp), %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x2100
movq -0xa0(%rbp), %rax
movl 0x8(%rax), %eax
xorl $0x1, %eax
movl %eax, -0xe0(%rbp)
movq -0xa8(%rbp), %rax
cmpl $0x0, 0x20(%rax)
jl 0x28a881
jmp 0x28a8a0
leaq 0x106386(%rip), %rdi    # 0x390c0e
leaq 0x105fa0(%rip), %rsi    # 0x39082f
movl $0x7db, %edx            # imm = 0x7DB
leaq 0x106385(%rip), %rcx    # 0x390c20
callq 0x2130
movq -0xa8(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0xdc(%rbp)
movq -0xa8(%rbp), %rax
movl 0x24(%rax), %eax
movl %eax, -0xd8(%rbp)
movl -0xd4(%rbp), %eax
andl $0xbfffffff, %eax       # imm = 0xBFFFFFFF
orl $0x40000000, %eax       # imm = 0x40000000
movl %eax, -0xd4(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0xa8(%rbp), %rax
movl 0x8(%rax), %edx
xorl $0x1, %edx
movl -0xdc(%rbp), %r9d
movl $0x1, %ecx
leaq -0xe0(%rbp), %r8
leaq -0xb0(%rbp), %rax
movl $0xf, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x284f90
movq %rax, -0xe8(%rbp)
cmpl $0x0, -0xb0(%rbp)
je 0x28a938
movl -0xd8(%rbp), %eax
cmpl -0xbc(%rbp), %eax
je 0x28a9c0
movq 0x1396a1(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
movq -0xa8(%rbp), %rax
movl 0x8(%rax), %eax
xorl $0x1, %eax
andl $0x1, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x106386(%rip), %rax    # 0x390ce3
movsbl (%rax,%rcx), %edx
movq -0xa8(%rbp), %rax
movl 0x8(%rax), %ecx
xorl $0x1, %ecx
movq -0xa0(%rbp), %rax
movl 0x8(%rax), %eax
xorl $0x1, %eax
andl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
leaq 0x10635a(%rip), %rax    # 0x390ce3
movsbl (%rax,%rsi), %r8d
movq -0xa0(%rbp), %rax
movl 0x8(%rax), %r9d
xorl $0x1, %r9d
movl -0xc4(%rbp), %r10d
movl -0xdc(%rbp), %eax
leaq 0x106307(%rip), %rsi    # 0x390cb8
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
movb $0x0, %al
callq 0x22a0
cmpl $0x0, -0xb0(%rbp)
jle 0x28a9cb
jmp 0x28a9ea
leaq 0x106314(%rip), %rdi    # 0x390ce6
leaq 0x105e56(%rip), %rsi    # 0x39082f
movl $0x7e2, %edx            # imm = 0x7E2
leaq 0x10623b(%rip), %rcx    # 0x390c20
callq 0x2130
movl -0xd8(%rbp), %eax
cmpl -0xbc(%rbp), %eax
jne 0x28a9fa
jmp 0x28aa19
leaq 0x1062f1(%rip), %rdi    # 0x390cf2
leaq 0x105e27(%rip), %rsi    # 0x39082f
movl $0x7e3, %edx            # imm = 0x7E3
leaq 0x10620c(%rip), %rcx    # 0x390c20
callq 0x2130
movl -0xb0(%rbp), %eax
subl $0x2, %eax
movl %eax, -0xac(%rbp)
cmpl $0x1, -0xac(%rbp)
jl 0x28ab09
movl -0x68(%rbp), %eax
cmpl -0x6c(%rbp), %eax
jne 0x28aa88
jmp 0x28aa3f
cmpl $0x4, -0x6c(%rbp)
jl 0x28aa57
movl -0x6c(%rbp), %eax
movl -0x6c(%rbp), %ecx
sarl %ecx
addl %ecx, %eax
movl %eax, -0x110(%rbp)
jmp 0x28aa64
movl $0x10, %eax
movl %eax, -0x110(%rbp)
jmp 0x28aa64
movl -0x110(%rbp), %eax
movl %eax, -0x6c(%rbp)
movq -0x18(%rbp), %rdi
movq -0x48(%rbp), %rsi
movslq -0x6c(%rbp), %rdx
shlq $0x4, %rdx
callq 0x30e740
movq %rax, -0x48(%rbp)
jmp 0x28aa88
movq -0x48(%rbp), %rax
movl -0x68(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x68(%rbp)
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
movl $0x0, 0xc(%rax)
movq -0x88(%rbp), %rax
movl $0x0, 0x4(%rax)
movq -0x88(%rbp), %rax
movl $0x0, (%rax)
movq -0xe8(%rbp), %rax
movslq -0xac(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %ecx
xorl $0x1, %ecx
movq -0x88(%rbp), %rax
movl %ecx, 0x8(%rax)
movl -0xac(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xac(%rbp)
jmp 0x28aa28
movq -0x18(%rbp), %rdi
movq -0xe8(%rbp), %rsi
callq 0x30e2d0
movl -0x68(%rbp), %eax
cmpl -0x6c(%rbp), %eax
jne 0x28ab6c
jmp 0x28ab23
cmpl $0x4, -0x6c(%rbp)
jl 0x28ab3b
movl -0x6c(%rbp), %eax
movl -0x6c(%rbp), %ecx
sarl %ecx
addl %ecx, %eax
movl %eax, -0x114(%rbp)
jmp 0x28ab48
movl $0x10, %eax
movl %eax, -0x114(%rbp)
jmp 0x28ab48
movl -0x114(%rbp), %eax
movl %eax, -0x6c(%rbp)
movq -0x18(%rbp), %rdi
movq -0x48(%rbp), %rsi
movslq -0x6c(%rbp), %rdx
shlq $0x4, %rdx
callq 0x30e740
movq %rax, -0x48(%rbp)
jmp 0x28ab6c
movq -0x48(%rbp), %rdi
movl -0x68(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x68(%rbp)
cltq
shlq $0x4, %rax
addq %rax, %rdi
movq -0xa8(%rbp), %rsi
movq -0x40(%rbp), %rax
movq 0x28(%rax), %rcx
movq 0x10(%rbp), %r8
leaq -0x60(%rbp), %rdx
callq 0x28ae80
jmp 0x28ad59
movq -0x48(%rbp), %rax
movl -0x68(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0xf8(%rbp)
movq -0xa0(%rbp), %rax
movl 0x8(%rax), %eax
movq -0xa8(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jne 0x28abd8
jmp 0x28abf7
leaq 0x10612f(%rip), %rdi    # 0x390d0e
leaq 0x105c49(%rip), %rsi    # 0x39082f
movl $0x7f2, %edx            # imm = 0x7F2
leaq 0x10602e(%rip), %rcx    # 0x390c20
callq 0x2130
movl $0x0, -0xec(%rbp)
movl -0xec(%rbp), %eax
movq -0xa8(%rbp), %rcx
movl 0x4(%rcx), %ecx
shll %ecx
sarl %ecx
cmpl %ecx, %eax
jge 0x28ac7f
movq 0x10(%rbp), %rax
movq -0xa8(%rbp), %rcx
movl (%rcx), %ecx
addl -0xec(%rbp), %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x100(%rbp)
movq -0x100(%rbp), %rax
movq (%rax), %rax
movq -0xa0(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jle 0x28ac6c
movq -0x100(%rbp), %rax
movq 0x8(%rax), %rax
movq -0xa0(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jle 0x28ac6c
jmp 0x28ac7f
jmp 0x28ac6e
movl -0xec(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xec(%rbp)
jmp 0x28ac01
movl -0xec(%rbp), %eax
movq -0xa8(%rbp), %rcx
movl 0x4(%rcx), %ecx
shll %ecx
sarl %ecx
cmpl %ecx, %eax
jge 0x28ac99
jmp 0x28acb8
leaq 0x10607d(%rip), %rdi    # 0x390d1d
leaq 0x105b88(%rip), %rsi    # 0x39082f
movl $0x7fa, %edx            # imm = 0x7FA
leaq 0x105f6d(%rip), %rcx    # 0x390c20
callq 0x2130
movq -0xa8(%rbp), %rax
movl 0x4(%rax), %ecx
shll %ecx
sarl %ecx
subl -0xec(%rbp), %ecx
movq -0xf8(%rbp), %rax
addl 0x4(%rax), %ecx
movl %ecx, 0x4(%rax)
movq -0xa8(%rbp), %rax
movl 0x1c(%rax), %ecx
movq -0xf8(%rbp), %rax
addl 0xc(%rax), %ecx
movl %ecx, 0xc(%rax)
movq -0x40(%rbp), %rax
movq 0x28(%rax), %rdi
movslq -0x60(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
movq 0x10(%rbp), %rsi
movq -0xa8(%rbp), %rax
movl (%rax), %eax
addl -0xec(%rbp), %eax
cltq
shlq $0x4, %rax
addq %rax, %rsi
movq -0xa8(%rbp), %rax
movl 0x4(%rax), %eax
shll %eax
sarl %eax
subl -0xec(%rbp), %eax
movslq %eax, %rdx
shlq $0x4, %rdx
callq 0x2180
movq -0xa8(%rbp), %rax
movl 0x4(%rax), %eax
shll %eax
sarl %eax
subl -0xec(%rbp), %eax
addl -0x60(%rbp), %eax
movl %eax, -0x60(%rbp)
jmp 0x28ad5b
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x28a7f1
movl -0x68(%rbp), %ecx
subl -0x64(%rbp), %ecx
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x54(%rbp), %rdx
imulq $0x48, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0xc(%rax)
movl -0x60(%rbp), %ecx
subl -0x78(%rbp), %ecx
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x54(%rbp), %rdx
imulq $0x48, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x10(%rax)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
movl -0x68(%rbp), %eax
movl %eax, -0x64(%rbp)
movl -0x80(%rbp), %eax
addl -0x58(%rbp), %eax
movl %eax, -0x58(%rbp)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x28a5cd
movl -0x60(%rbp), %eax
movq -0x40(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jg 0x28add5
jmp 0x28adf4
leaq 0x105f4d(%rip), %rdi    # 0x390d29
leaq 0x105a4c(%rip), %rsi    # 0x39082f
movl $0x80a, %edx            # imm = 0x80A
leaq 0x105e31(%rip), %rcx    # 0x390c20
callq 0x2130
movl -0x60(%rbp), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x10(%rax)
movl -0x68(%rbp), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x10(%rbp), %rdi
movslq -0x68(%rbp), %rsi
shlq $0x4, %rsi
callq 0x30e4f0
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x48(%rbp), %rsi
movslq -0x68(%rbp), %rdx
shlq $0x4, %rdx
callq 0x2180
movq -0x18(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x30e2d0
movq -0x20(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x289ab0
movq -0x18(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x28a290
movq -0x40(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
nopl (%rax)