// File: chhylp123[P]hifiasm/inter.cpp
// Function: gen_dup_path(asg_t const*, R_to_U*, kv_ul_ov_t*, unsigned long)
uint32_t gen_dup_path(const asg_t *g, R_to_U *ri, kv_ul_ov_t *res, uint64_t v)
{
    asg_t *rg = (asg_t *)g; res->n = 0;
	if(rg->seq[v>>1].del) return res->n;
	uint64_t nv = asg_arc_n(rg, v); asg_arc_t *av = asg_arc_a(rg, v);
	uint64_t k, kv, w = (uint64_t)-1, kw, l, rn, z; ul_ov_t p; memset(&p, 0, sizeof(p));

	// for (k = 0; k < nv; k++) {
	// 	if(av[k].del) continue;
	// 	asg_arc_t *aw = asg_arc_a(rg, av[k].v);
	// 	uint64_t nw = asg_arc_n(rg, av[k].v);
	// 	for (l = 0; l < nw; l++) {
	// 		if(aw[l].del) continue;
	// 		for (rn = 0; rn < nv; rn++) {
	// 			if(av[rn].del) continue;
	// 			if(av[rn].v == aw[l].v) break;
	// 		}
	// 		if(rn < nv) {
	// 			fprintf(stderr, "[M::%s] v0::%lu, w::%u, v1::%u\n", __func__, v, av[k].v, aw[l].v);
	// 		}
	// 	}
	// }
	



	for (k = kv = 0; k < nv && kv < 2; k++) {
		if(!(av[k].del)) kv++; 
	}
	// if(v == 7723) {
	// 	fprintf(stderr, "[M::%s] v0::%lu, kv::%lu\n", __func__, v, kv);
	// }
	if(kv > 1) {
		for (k = 0; k < nv; k++) {
			if(av[k].del) continue;
			w = av[k].v; kw = get_arcs(rg, w^1, NULL, 0);
			// if(v == 7723) {
			// 	fprintf(stderr, "*[M::%s] v0::%lu, av[%lu].v::%u, kw::%lu,\n", __func__, v, k, av[k].v, kw);
			// }
			if(kw > 1) {///kv > 1 && kw > 1
				if((v>>1) != (w>>1)) {///cannot handle if the prefix and suffix nodes are the same
					l = 0;
					p.qn = 0; p.qs = l; p.qe = l + rg->seq[v>>1].len; 
					p.tn = v>>1; p.ts = 0; p.te = rg->seq[v>>1].len;
					p.el = 1; p.rev = v&1; kv_push(ul_ov_t, *res, p);
					// if(v == 7723) {
					// 	fprintf(stderr, "*[M::%s] v0::%lu, p.tn::%u, p.rev::%u\n", __func__, v, p.tn, p.rev);
					// }

					l += asg_arc_len(av[k]);
					p.qn = 0; p.qs = l; p.qe = l + rg->seq[w>>1].len; 
					p.tn = w>>1; p.ts = 0; p.te = rg->seq[w>>1].len;
					p.el = 1; p.rev = w&1; kv_push(ul_ov_t, *res, p);

					// if(v == 7723) {
					// 	fprintf(stderr, "*[M::%s] v0::%lu, p.tn::%u, p.rev::%u\n", __func__, v, p.tn, p.rev);
					// }

					p.tn = (uint32_t)-1; p.qn = ((uint64_t)(av-g->arc+k));
					kv_push(ul_ov_t, *res, p);
				}
			} else if((kw == 1) && (is_contain_r((*ri), (w>>1)))) {///kv > 1 && kw == 1 && w is contained
				rn = res->n; l = 0;
				p.qn = 0; p.qs = l; p.qe = l + rg->seq[v>>1].len; 
				p.tn = v>>1; p.ts = 0; p.te = rg->seq[v>>1].len;
				p.el = 1; p.rev = v&1; kv_push(ul_ov_t, *res, p);
				l += asg_arc_len(av[k]);
				if(!extract_contain_tig(rg, w, ri, l, 0, res)) {
					res->n = rn;
				} else {
					for (z = rn+1; z < res->n; z++) {
						if(res->a[z].tn == (v>>1)) break;
					}
					if(z >= res->n) {///cannot handle circles
						p.tn = (uint32_t)-1; p.qn = ((uint64_t)(av-g->arc+k));
						kv_push(ul_ov_t, *res, p);
					} else {
						res->n = rn;
					}
				}
			}
		}
	} else if(((kv == 1) || (kv == 0)) && (!get_arcs(rg, v^1, NULL, 0)) && (is_contain_r((*ri), (v>>1)))) {
		///1. kv == 1 && kv^ == 0 && v is contained
		///2. kv == 0 && kv^ == 0 && v is contained; an isolated single contained read
		rn = res->n; l = 0;
		if(!extract_contain_tig(rg, v, ri, l, 1, res)) {
			res->n = rn;
		} else {
			for (z = rn+1; z < res->n; z++) {
				if(res->a[z].tn == (v>>1)) break;
			}
			if(z >= res->n) {///cannot handle circles
				p.tn = (uint32_t)-1; p.qn = (uint32_t)-1;
				if(kv > 0) {
					for (k = 0; k < nv; k++) {
						if(!(av[k].del)) break; 
					}
					assert(k < nv);
					p.qn = ((uint64_t)(av-g->arc+k));
				}

				kv_push(ul_ov_t, *res, p);
			} else {
				res->n = rn;
			}
		}
	} 
	// if(v == 7723) {
	// 	fprintf(stderr, "[M::%s] v0::%lu, res->n::%lu,\n", __func__, v, (uint64_t)res->n);
	// }
    return res->n;///# chains have contained reads
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rcx
shrq %rcx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x2e9169
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movl %eax, -0x4(%rbp)
jmp 0x2e9c72
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x30(%rbp), %rcx
movq 0x28(%rcx), %rcx
movq -0x28(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq $-0x1, -0x58(%rbp)
leaq -0x94(%rbp), %rdi
xorl %esi, %esi
movl $0x1c, %edx
callq 0x2100
movq $0x0, -0x50(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rcx
xorl %eax, %eax
cmpq -0x38(%rbp), %rcx
movb %al, -0x95(%rbp)
jae 0x2e91f1
cmpq $0x2, -0x50(%rbp)
setb %al
movb %al, -0x95(%rbp)
movb -0x95(%rbp), %al
testb $0x1, %al
jne 0x2e91fd
jmp 0x2e9230
movq -0x40(%rbp), %rax
imulq $0x18, -0x48(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
jne 0x2e9220
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x2e9222
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x2e91d1
cmpq $0x1, -0x50(%rbp)
jbe 0x2e99d1
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x2e99cc
movq -0x40(%rbp), %rax
imulq $0x18, -0x48(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x2e926d
jmp 0x2e99bb
movq -0x40(%rbp), %rax
imulq $0x18, -0x48(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq %rax, -0x58(%rbp)
movq -0x30(%rbp), %rdi
movq -0x58(%rbp), %rax
xorq $0x1, %rax
movl %eax, %esi
xorl %eax, %eax
movl %eax, %edx
xorl %ecx, %ecx
callq 0x311ba0
movl %eax, %eax
movq %rax, -0x60(%rbp)
cmpq $0x1, -0x60(%rbp)
jbe 0x2e9664
movq -0x28(%rbp), %rax
shrq %rax
movq -0x58(%rbp), %rcx
shrq %rcx
cmpq %rcx, %rax
je 0x2e965f
movq $0x0, -0x68(%rbp)
movl $0x0, -0x94(%rbp)
movq -0x68(%rbp), %rax
movl %eax, -0x90(%rbp)
movq -0x68(%rbp), %rax
movq -0x30(%rbp), %rcx
movq 0x20(%rcx), %rcx
movq -0x28(%rbp), %rdx
shrq %rdx
movl (%rcx,%rdx,8), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movl %ecx, %ecx
addq %rcx, %rax
movl %eax, -0x8c(%rbp)
movq -0x28(%rbp), %rax
shrq %rax
movl %eax, -0x88(%rbp)
movl $0x0, -0x84(%rbp)
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rcx
shrq %rcx
movl (%rax,%rcx,8), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0x80(%rbp)
movl -0x7c(%rbp), %eax
andl $0xbfffffff, %eax       # imm = 0xBFFFFFFF
orl $0x40000000, %eax       # imm = 0x40000000
movl %eax, -0x7c(%rbp)
movq -0x28(%rbp), %rax
andq $0x1, %rax
movl %eax, %ecx
movl -0x7c(%rbp), %eax
andl $0x1, %ecx
shll $0x1f, %ecx
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
orl %ecx, %eax
movl %eax, -0x7c(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jne 0x2e93cf
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x2e9393
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
shlq %rax
movq %rax, -0xa0(%rbp)
jmp 0x2e93a1
movl $0x2, %eax
movq %rax, -0xa0(%rbp)
jmp 0x2e93a1
movq -0xa0(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rax
imulq $0x1c, 0x10(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq -0x20(%rbp), %rdx
movq 0x8(%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0x8(%rdx)
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq -0x94(%rbp), %rcx
movq %rcx, (%rax)
movq -0x8c(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x84(%rbp), %rcx
movq %rcx, 0x10(%rax)
movl -0x7c(%rbp), %ecx
movl %ecx, 0x18(%rax)
movq -0x40(%rbp), %rax
imulq $0x18, -0x48(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rax
movl %eax, %eax
addq -0x68(%rbp), %rax
movq %rax, -0x68(%rbp)
movl $0x0, -0x94(%rbp)
movq -0x68(%rbp), %rax
movl %eax, -0x90(%rbp)
movq -0x68(%rbp), %rax
movq -0x30(%rbp), %rcx
movq 0x20(%rcx), %rcx
movq -0x58(%rbp), %rdx
shrq %rdx
movl (%rcx,%rdx,8), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movl %ecx, %ecx
addq %rcx, %rax
movl %eax, -0x8c(%rbp)
movq -0x58(%rbp), %rax
shrq %rax
movl %eax, -0x88(%rbp)
movl $0x0, -0x84(%rbp)
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x58(%rbp), %rcx
shrq %rcx
movl (%rax,%rcx,8), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0x80(%rbp)
movl -0x7c(%rbp), %eax
andl $0xbfffffff, %eax       # imm = 0xBFFFFFFF
orl $0x40000000, %eax       # imm = 0x40000000
movl %eax, -0x7c(%rbp)
movq -0x58(%rbp), %rax
andq $0x1, %rax
movl %eax, %ecx
movl -0x7c(%rbp), %eax
andl $0x1, %ecx
shll $0x1f, %ecx
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
orl %ecx, %eax
movl %eax, -0x7c(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jne 0x2e9535
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x2e94f9
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
shlq %rax
movq %rax, -0xa8(%rbp)
jmp 0x2e9507
movl $0x2, %eax
movq %rax, -0xa8(%rbp)
jmp 0x2e9507
movq -0xa8(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rax
imulq $0x1c, 0x10(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq -0x20(%rbp), %rdx
movq 0x8(%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0x8(%rdx)
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq -0x94(%rbp), %rcx
movq %rcx, (%rax)
movq -0x8c(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x84(%rbp), %rcx
movq %rcx, 0x10(%rax)
movl -0x7c(%rbp), %ecx
movl %ecx, 0x18(%rax)
movl $0xffffffff, -0x88(%rbp) # imm = 0xFFFFFFFF
movq -0x40(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rcx
subq %rcx, %rax
movl $0x18, %ecx
cqto
idivq %rcx
addq -0x48(%rbp), %rax
movl %eax, -0x94(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jne 0x2e9616
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x2e95da
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
shlq %rax
movq %rax, -0xb0(%rbp)
jmp 0x2e95e8
movl $0x2, %eax
movq %rax, -0xb0(%rbp)
jmp 0x2e95e8
movq -0xb0(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rax
imulq $0x1c, 0x10(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq -0x20(%rbp), %rdx
movq 0x8(%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0x8(%rdx)
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq -0x94(%rbp), %rcx
movq %rcx, (%rax)
movq -0x8c(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x84(%rbp), %rcx
movq %rcx, 0x10(%rax)
movl -0x7c(%rbp), %ecx
movl %ecx, 0x18(%rax)
jmp 0x2e965f
jmp 0x2e99b9
cmpq $0x1, -0x60(%rbp)
jne 0x2e99b7
movq -0x58(%rbp), %rax
shrq %rax
movq -0x18(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x2e99b7
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x58(%rbp), %rcx
shrq %rcx
cmpl $-0x1, (%rax,%rcx,4)
je 0x2e99b7
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x58(%rbp), %rcx
shrq %rcx
movl (%rax,%rcx,4), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
jne 0x2e99b7
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x70(%rbp)
movq $0x0, -0x68(%rbp)
movl $0x0, -0x94(%rbp)
movq -0x68(%rbp), %rax
movl %eax, -0x90(%rbp)
movq -0x68(%rbp), %rax
movq -0x30(%rbp), %rcx
movq 0x20(%rcx), %rcx
movq -0x28(%rbp), %rdx
shrq %rdx
movl (%rcx,%rdx,8), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movl %ecx, %ecx
addq %rcx, %rax
movl %eax, -0x8c(%rbp)
movq -0x28(%rbp), %rax
shrq %rax
movl %eax, -0x88(%rbp)
movl $0x0, -0x84(%rbp)
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rcx
shrq %rcx
movl (%rax,%rcx,8), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0x80(%rbp)
movl -0x7c(%rbp), %eax
andl $0xbfffffff, %eax       # imm = 0xBFFFFFFF
orl $0x40000000, %eax       # imm = 0x40000000
movl %eax, -0x7c(%rbp)
movq -0x28(%rbp), %rax
andq $0x1, %rax
movl %eax, %ecx
movl -0x7c(%rbp), %eax
andl $0x1, %ecx
shll $0x1f, %ecx
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
orl %ecx, %eax
movl %eax, -0x7c(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jne 0x2e97d4
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x2e9798
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
shlq %rax
movq %rax, -0xb8(%rbp)
jmp 0x2e97a6
movl $0x2, %eax
movq %rax, -0xb8(%rbp)
jmp 0x2e97a6
movq -0xb8(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rax
imulq $0x1c, 0x10(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq -0x20(%rbp), %rdx
movq 0x8(%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0x8(%rdx)
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq -0x94(%rbp), %rcx
movq %rcx, (%rax)
movq -0x8c(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x84(%rbp), %rcx
movq %rcx, 0x10(%rax)
movl -0x7c(%rbp), %ecx
movl %ecx, 0x18(%rax)
movq -0x40(%rbp), %rax
imulq $0x18, -0x48(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rax
movl %eax, %eax
addq -0x68(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x30(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x68(%rbp), %rcx
movq -0x20(%rbp), %r9
xorl %eax, %eax
movl %eax, %r8d
callq 0x2e8d30
cmpl $0x0, %eax
jne 0x2e9868
movq -0x70(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0x2e99b5
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x2e98b2
movq -0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x78(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
movq -0x28(%rbp), %rcx
shrq %rcx
cmpq %rcx, %rax
jne 0x2e98a2
jmp 0x2e98b2
jmp 0x2e98a4
movq -0x78(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x78(%rbp)
jmp 0x2e9874
movq -0x78(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jb 0x2e99a7
movl $0xffffffff, -0x88(%rbp) # imm = 0xFFFFFFFF
movq -0x40(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rcx
subq %rcx, %rax
movl $0x18, %ecx
cqto
idivq %rcx
addq -0x48(%rbp), %rax
movl %eax, -0x94(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jne 0x2e995e
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x2e9922
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
shlq %rax
movq %rax, -0xc0(%rbp)
jmp 0x2e9930
movl $0x2, %eax
movq %rax, -0xc0(%rbp)
jmp 0x2e9930
movq -0xc0(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rax
imulq $0x1c, 0x10(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq -0x20(%rbp), %rdx
movq 0x8(%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0x8(%rdx)
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq -0x94(%rbp), %rcx
movq %rcx, (%rax)
movq -0x8c(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x84(%rbp), %rcx
movq %rcx, 0x10(%rax)
movl -0x7c(%rbp), %ecx
movl %ecx, 0x18(%rax)
jmp 0x2e99b3
movq -0x70(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0x2e99b5
jmp 0x2e99b7
jmp 0x2e99b9
jmp 0x2e99bb
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x2e9243
jmp 0x2e9c67
cmpq $0x1, -0x50(%rbp)
je 0x2e99e3
cmpq $0x0, -0x50(%rbp)
jne 0x2e9c65
movq -0x30(%rbp), %rdi
movq -0x28(%rbp), %rax
xorq $0x1, %rax
movl %eax, %esi
xorl %eax, %eax
movl %eax, %edx
xorl %ecx, %ecx
callq 0x311ba0
cmpl $0x0, %eax
jne 0x2e9c65
movq -0x28(%rbp), %rax
shrq %rax
movq -0x18(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x2e9c65
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x28(%rbp), %rcx
shrq %rcx
cmpl $-0x1, (%rax,%rcx,4)
je 0x2e9c65
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x28(%rbp), %rcx
shrq %rcx
movl (%rax,%rcx,4), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
jne 0x2e9c65
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x70(%rbp)
movq $0x0, -0x68(%rbp)
movq -0x30(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x68(%rbp), %rcx
movq -0x20(%rbp), %r9
movl $0x1, %r8d
callq 0x2e8d30
cmpl $0x0, %eax
jne 0x2e9a99
movq -0x70(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0x2e9c63
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x2e9ae3
movq -0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x78(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
movq -0x28(%rbp), %rcx
shrq %rcx
cmpq %rcx, %rax
jne 0x2e9ad3
jmp 0x2e9ae3
jmp 0x2e9ad5
movq -0x78(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x78(%rbp)
jmp 0x2e9aa5
movq -0x78(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jb 0x2e9c55
movl $0xffffffff, -0x88(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x94(%rbp) # imm = 0xFFFFFFFF
cmpq $0x0, -0x50(%rbp)
jbe 0x2e9b9d
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x2e9b4f
movq -0x40(%rbp), %rax
imulq $0x18, -0x48(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
jne 0x2e9b3f
jmp 0x2e9b4f
jmp 0x2e9b41
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x2e9b1c
movq -0x48(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x2e9b5b
jmp 0x2e9b7a
leaq 0xaa9ff(%rip), %rdi     # 0x394561
leaq 0xa6cc6(%rip), %rsi     # 0x39082f
movl $0x4859, %edx           # imm = 0x4859
leaq 0xaa9f3(%rip), %rcx     # 0x394568
callq 0x2130
movq -0x40(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rcx
subq %rcx, %rax
movl $0x18, %ecx
cqto
idivq %rcx
addq -0x48(%rbp), %rax
movl %eax, -0x94(%rbp)
jmp 0x2e9b9f
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jne 0x2e9c0c
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x2e9bd0
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
shlq %rax
movq %rax, -0xc8(%rbp)
jmp 0x2e9bde
movl $0x2, %eax
movq %rax, -0xc8(%rbp)
jmp 0x2e9bde
movq -0xc8(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rax
imulq $0x1c, 0x10(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq -0x20(%rbp), %rdx
movq 0x8(%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0x8(%rdx)
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq -0x94(%rbp), %rcx
movq %rcx, (%rax)
movq -0x8c(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x84(%rbp), %rcx
movq %rcx, 0x10(%rax)
movl -0x7c(%rbp), %ecx
movl %ecx, 0x18(%rax)
jmp 0x2e9c61
movq -0x70(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0x2e9c63
jmp 0x2e9c65
jmp 0x2e9c67
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xd0, %rsp
popq %rbp
retq
nop