// File: chhylp123[P]hifiasm/inter.cpp
// Function: update_existing_anchors(asg_t const*, ul_vec_t*, ma_ug_t*, ma_utg_t*, vec_mg_lchain_t*, long, mg_lchain_t*, kv_ul_ov_t*, kv_ul_ov_t*)
void update_existing_anchors(const asg_t *rg, ul_vec_t *rch, ma_ug_t *ug, ma_utg_t *u, vec_mg_lchain_t *res, int64_t res_n0, 
mg_lchain_t *uo, kv_ul_ov_t *raw_idx, kv_ul_ov_t *raw_chn)
{
	int64_t z = -1, m = res->n-1, midx, mdif, ovlp, novlp, mbeg, left[2], right[2]; 
	uint64_t zv;
	if(uo->off >= 0) z = raw_idx->a[uo->off].qn;///if there are some base-level alignments

	for (; z >= 0;) {
		zv = ((rch->bb.a[raw_chn->a[z].qn].hid<<1)+rch->bb.a[raw_chn->a[z].qn].rev);
		if(!(rg->seq[zv>>1].del)) {
			for (midx = mdif = -1, mbeg = m; m >= res_n0; m--) {
				if(zv==res->a[m].v) {
					if(((int32_t)raw_chn->a[z].ts == res->a[m].rs && (int32_t)raw_chn->a[z].te == res->a[m].re)) {
						midx = m; mdif = 0; 
						break;
					} else {
						ovlp = ((MIN((int32_t)raw_chn->a[z].te, res->a[m].re) > MAX((int32_t)raw_chn->a[z].ts, res->a[m].rs))? 
									(MIN((int32_t)raw_chn->a[z].te, res->a[m].re) - MAX((int32_t)raw_chn->a[z].ts, res->a[m].rs)):0);
						novlp = (raw_chn->a[z].te - raw_chn->a[z].ts - ovlp) + (res->a[m].re - res->a[m].rs - ovlp);
						if(midx==-1 || mdif>novlp) {
							midx = m; mdif = novlp;
						}
					}
				}
			}
			if(mdif != 0) {
				for (m = res->n-1; m > mbeg; m--) {
					if(zv == res->a[m].v) {
						if(((int32_t)raw_chn->a[z].ts == res->a[m].rs && (int32_t)raw_chn->a[z].te == res->a[m].re)) {
							midx = m; mdif = 0; 
							break;
						} else {
							ovlp = ((MIN((int32_t)raw_chn->a[z].te, res->a[m].re) > MAX((int32_t)raw_chn->a[z].ts, res->a[m].rs))? 
										(MIN((int32_t)raw_chn->a[z].te, res->a[m].re) - MAX((int32_t)raw_chn->a[z].ts, res->a[m].rs)):0);
							novlp = (raw_chn->a[z].te - raw_chn->a[z].ts - ovlp) + (res->a[m].re - res->a[m].rs - ovlp);
							if(midx==-1 || mdif>novlp) {
								midx = m; mdif = novlp;
							}
						}
					}
				}
			}
			m = midx; 
			// if(m < 0) fprintf(stderr, ">>>>>>[M::%s::] z->%ld\n", __func__, z);
			assert(m >= res_n0);
			res->a[m].qs = raw_chn->a[z].qs; res->a[m].qe = raw_chn->a[z].qe; 
			res->a[m].dist_pre = raw_chn->a[z].qn;///the idx of this chain at rch 
			// fprintf(stderr, "%c, res_n0->%ld, m->%ld, raw_idx->%u, qs->%d, qe->%d, ts->%d, te->%d, mdif->%ld\n", 
			// "+-"[(uo->v&1)], res_n0, m, raw_chn->a[z].qn, raw_chn->a[z].qs, raw_chn->a[z].qe, raw_chn->a[z].ts, raw_chn->a[z].te, mdif);
			


			left[0] = left[1] = -1; right[0] = right[1] = u->len+1;
			if(m > 0) get_r_offset(ug, &(res->a[m-1]), &left[0], &left[1], NULL, NULL);
			if(m + 1 < (int64_t)res->n) get_r_offset(ug, &(res->a[m+1]), &right[0], &right[1], NULL, NULL);

			// if(!(uo->v&1)) {///forward
			// 	if(m > 0) {
			// 		left[0] = a[m-1].rs; left[1] = a[m-1].re;
			// 	}
			// 	if(m + 1 < (int64_t)a_n) {
			// 		right[0] = a[m+1].rs; right[1] = a[m+1].re;
			// 	}
			// } else {//reverse
			// 	if(m > 0) {
			// 		right[0] = a[m-1].rs; right[1] = a[m-1].re;
			// 	}
			// 	if(m + 1 < (int64_t)a_n) { 
			// 		left[0] = a[m+1].rs; left[1] = a[m+1].re;
			// 	}
			// }
			///otherwise a[m] is not co-linear with a[m-1] and a[m+1]
			if(raw_chn->a[z].ts>=left[0]&&raw_chn->a[z].ts<=right[0]
							&&raw_chn->a[z].te>=left[1]&&raw_chn->a[z].te<=right[1]) {
				res->a[m].rs = raw_chn->a[z].ts; res->a[m].re = raw_chn->a[z].te; 
			}
		}
		if(raw_chn->a[z].tn == (uint32_t)-1) z = -1;
        else z = raw_chn->a[z].tn;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq $-0x1, -0x38(%rbp)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
subq $0x1, %rax
movq %rax, -0x40(%rbp)
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
jl 0x2d83eb
movq 0x18(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rbp), %rcx
movslq (%rcx), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %eax
movq %rax, -0x38(%rbp)
jmp 0x2d83ed
cmpq $0x0, -0x38(%rbp)
jl 0x2d8ca2
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq 0x20(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x1c, -0x38(%rbp), %rdx
addq %rdx, %rcx
movl (%rcx), %ecx
imulq $0x24, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %eax
shll %eax
movq -0x10(%rbp), %rcx
movq 0x30(%rcx), %rcx
movq 0x20(%rbp), %rdx
movq (%rdx), %rdx
imulq $0x1c, -0x38(%rbp), %rsi
addq %rsi, %rdx
movl (%rdx), %edx
imulq $0x24, %rdx, %rdx
addq %rdx, %rcx
movb 0x20(%rcx), %cl
shrb $0x5, %cl
andb $0x1, %cl
movzbl %cl, %ecx
addl %ecx, %eax
movl %eax, %eax
movq %rax, -0x98(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x98(%rbp), %rcx
shrq %rcx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
jne 0x2d8c68
movq $-0x1, -0x50(%rbp)
movq $-0x1, -0x48(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x30(%rbp), %rax
jl 0x2d8769
movq -0x98(%rbp), %rax
movq -0x28(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x28, -0x40(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
cmpq %rcx, %rax
jne 0x2d8756
movq 0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movq -0x28(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x28, -0x40(%rbp), %rdx
addq %rdx, %rcx
cmpl 0xc(%rcx), %eax
jne 0x2d851d
movq 0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movq -0x28(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x28, -0x40(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x10(%rcx), %eax
jne 0x2d851d
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
jmp 0x2d8769
movq 0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movq -0x28(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x28, -0x40(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x10(%rcx), %eax
jg 0x2d855d
movq 0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movl %eax, -0x9c(%rbp)
jmp 0x2d8575
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movl %eax, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
movl %eax, -0xa0(%rbp)
movq 0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movq -0x28(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x28, -0x40(%rbp), %rdx
addq %rdx, %rcx
cmpl 0xc(%rcx), %eax
jl 0x2d85c1
movq 0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movl %eax, -0xa4(%rbp)
jmp 0x2d85d9
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
movl %eax, -0xa4(%rbp)
movl -0xa0(%rbp), %eax
movl -0xa4(%rbp), %ecx
cmpl %ecx, %eax
jle 0x2d86bf
movq 0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movq -0x28(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x28, -0x40(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x10(%rcx), %eax
jg 0x2d862d
movq 0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movl %eax, -0xa8(%rbp)
jmp 0x2d8645
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movl %eax, -0xa8(%rbp)
movl -0xa8(%rbp), %eax
movl %eax, -0xac(%rbp)
movq 0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movq -0x28(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x28, -0x40(%rbp), %rdx
addq %rdx, %rcx
cmpl 0xc(%rcx), %eax
jl 0x2d8691
movq 0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movl %eax, -0xb0(%rbp)
jmp 0x2d86a9
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
movl %eax, -0xb0(%rbp)
movl -0xac(%rbp), %eax
movl -0xb0(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0xb4(%rbp)
jmp 0x2d86c9
xorl %eax, %eax
movl %eax, -0xb4(%rbp)
jmp 0x2d86c9
movl -0xb4(%rbp), %eax
cltq
movq %rax, -0x58(%rbp)
movq 0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movq 0x20(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x1c, -0x38(%rbp), %rdx
addq %rdx, %rcx
subl 0x10(%rcx), %eax
movl %eax, %eax
subq -0x58(%rbp), %rax
movq -0x28(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x28, -0x40(%rbp), %rdx
addq %rdx, %rcx
movl 0x10(%rcx), %ecx
movq -0x28(%rbp), %rdx
movq (%rdx), %rdx
imulq $0x28, -0x40(%rbp), %rsi
addq %rsi, %rdx
subl 0xc(%rdx), %ecx
movslq %ecx, %rcx
subq -0x58(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
cmpq $-0x1, -0x48(%rbp)
je 0x2d8742
movq -0x50(%rbp), %rax
cmpq -0x60(%rbp), %rax
jle 0x2d8752
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x2d8754
jmp 0x2d8756
jmp 0x2d8758
movq -0x40(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x2d848c
cmpq $0x0, -0x50(%rbp)
je 0x2d8a63
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
subq $0x1, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x68(%rbp), %rax
jle 0x2d8a61
movq -0x98(%rbp), %rax
movq -0x28(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x28, -0x40(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
cmpq %rcx, %rax
jne 0x2d8a4e
movq 0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movq -0x28(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x28, -0x40(%rbp), %rdx
addq %rdx, %rcx
cmpl 0xc(%rcx), %eax
jne 0x2d8815
movq 0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movq -0x28(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x28, -0x40(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x10(%rcx), %eax
jne 0x2d8815
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
jmp 0x2d8a61
movq 0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movq -0x28(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x28, -0x40(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x10(%rcx), %eax
jg 0x2d8855
movq 0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movl %eax, -0xb8(%rbp)
jmp 0x2d886d
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movl %eax, -0xb8(%rbp)
movl -0xb8(%rbp), %eax
movl %eax, -0xbc(%rbp)
movq 0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movq -0x28(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x28, -0x40(%rbp), %rdx
addq %rdx, %rcx
cmpl 0xc(%rcx), %eax
jl 0x2d88b9
movq 0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movl %eax, -0xc0(%rbp)
jmp 0x2d88d1
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
movl %eax, -0xc0(%rbp)
movl -0xbc(%rbp), %eax
movl -0xc0(%rbp), %ecx
cmpl %ecx, %eax
jle 0x2d89b7
movq 0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movq -0x28(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x28, -0x40(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x10(%rcx), %eax
jg 0x2d8925
movq 0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movl %eax, -0xc4(%rbp)
jmp 0x2d893d
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movl %eax, -0xc4(%rbp)
movl -0xc4(%rbp), %eax
movl %eax, -0xc8(%rbp)
movq 0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movq -0x28(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x28, -0x40(%rbp), %rdx
addq %rdx, %rcx
cmpl 0xc(%rcx), %eax
jl 0x2d8989
movq 0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movl %eax, -0xcc(%rbp)
jmp 0x2d89a1
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
movl %eax, -0xcc(%rbp)
movl -0xc8(%rbp), %eax
movl -0xcc(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0xd0(%rbp)
jmp 0x2d89c1
xorl %eax, %eax
movl %eax, -0xd0(%rbp)
jmp 0x2d89c1
movl -0xd0(%rbp), %eax
cltq
movq %rax, -0x58(%rbp)
movq 0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movq 0x20(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x1c, -0x38(%rbp), %rdx
addq %rdx, %rcx
subl 0x10(%rcx), %eax
movl %eax, %eax
subq -0x58(%rbp), %rax
movq -0x28(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x28, -0x40(%rbp), %rdx
addq %rdx, %rcx
movl 0x10(%rcx), %ecx
movq -0x28(%rbp), %rdx
movq (%rdx), %rdx
imulq $0x28, -0x40(%rbp), %rsi
addq %rsi, %rdx
subl 0xc(%rdx), %ecx
movslq %ecx, %rcx
subq -0x58(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
cmpq $-0x1, -0x48(%rbp)
je 0x2d8a3a
movq -0x50(%rbp), %rax
cmpq -0x60(%rbp), %rax
jle 0x2d8a4a
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x2d8a4c
jmp 0x2d8a4e
jmp 0x2d8a50
movq -0x40(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x2d8784
jmp 0x2d8a63
movq -0x48(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x30(%rbp), %rax
jl 0x2d8a77
jmp 0x2d8a96
leaq 0xbae08(%rip), %rdi     # 0x393886
leaq 0xb7daa(%rip), %rsi     # 0x39082f
movl $0x3be3, %edx           # imm = 0x3BE3
leaq 0xbae01(%rip), %rcx     # 0x393892
callq 0x2130
movq 0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %ecx
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x14(%rax)
movq 0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %ecx
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x18(%rax)
movq 0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl (%rax), %ecx
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x20(%rax)
movq $-0x1, -0x78(%rbp)
movq $-0x1, -0x80(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
addl $0x1, %eax
cltq
movq %rax, -0x88(%rbp)
movq %rax, -0x90(%rbp)
cmpq $0x0, -0x40(%rbp)
jle 0x2d8b69
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rsi
movq -0x40(%rbp), %rax
subq $0x1, %rax
imulq $0x28, %rax, %rax
addq %rax, %rsi
leaq -0x80(%rbp), %rdx
leaq -0x80(%rbp), %rcx
addq $0x8, %rcx
xorl %eax, %eax
movl %eax, %r9d
movq %r9, %r8
callq 0x2984d0
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq -0x28(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jge 0x2d8bb4
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rsi
movq -0x40(%rbp), %rax
addq $0x1, %rax
imulq $0x28, %rax, %rax
addq %rax, %rsi
leaq -0x90(%rbp), %rdx
leaq -0x90(%rbp), %rcx
addq $0x8, %rcx
xorl %eax, %eax
movl %eax, %r9d
movq %r9, %r8
callq 0x2984d0
movq 0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
cmpq -0x80(%rbp), %rax
jl 0x2d8c66
movq 0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
cmpq -0x90(%rbp), %rax
jg 0x2d8c66
movq 0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
cmpq -0x78(%rbp), %rax
jl 0x2d8c66
movq 0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
cmpq -0x88(%rbp), %rax
jg 0x2d8c66
movq 0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %ecx
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0xc(%rax)
movq 0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0x14(%rax), %ecx
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x10(%rax)
jmp 0x2d8c68
movq 0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
cmpl $-0x1, 0xc(%rax)
jne 0x2d8c87
movq $-0x1, -0x38(%rbp)
jmp 0x2d8c9d
movq 0x20(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
movq %rax, -0x38(%rbp)
jmp 0x2d83ed
addq $0xd0, %rsp
popq %rbp
retq
nopl (%rax,%rax)