// File: chhylp123[P]hifiasm/inter.cpp
// Function: quick_rechain(overlap_region_alloc*, ul_ov_t*, long, kv_rtrace_t*, ul_idx_t const*, ug_opt_t const*, long, double, long, long, long, long, bit_extz_t*, long, All_reads*, char*, UC_Read*, double, int*, int*, int*, int*, long*, long*)
int64_t quick_rechain(overlap_region_alloc* ol, ul_ov_t *a, int64_t a_n, kv_rtrace_t *trace, const ul_idx_t *uref, const ug_opt_t *uopt, 
int64_t bw, double diff_ec_ul, int64_t qlen, int64_t max_skip, int64_t max_iter, int64_t max_dis, 
bit_extz_t *exz, int64_t trans_sc, All_reads *ridx, char* qstr, UC_Read *tu, double e_rate, 
int32_t *f, int32_t *c_n, int32_t *c_sc, int32_t *rch, int64_t *p, int64_t *t)
{
	int64_t mm_ovlp, x, i, j, sc, csc, mm_sc, mm_idx, mm_n, sn, n_skip, end_j; 
	ul_ov_t *li, *lj; rtrace_iter tc; int64_t st, max_ii, max, max_n; uint32_t li_v;
	memset(t, 0, (a_n*sizeof((*t)))); 

	for (i = st = 0, max_ii = -1; i < a_n; ++i) {
        li = &(a[i]); li_v = (li->tn<<1)|li->rev; rch[i] = INT32_MAX;
		csc = li->qe - li->qs; csc -= (((int64_t)li->sec)*trans_sc);
        mm_sc = INT32_MIN; mm_idx = -1; mm_n = 0; 
        n_skip = 0; end_j = -1; tc.k = INT32_MAX;
		// if((i>=15) && (rch_connect(rch[15], 18))) {
		// 	fprintf(stderr, ">>>[i::%ld] (id::%u)%.*s\t%c\trch[i]::%d\n", i, li->tn,
		// 				(int)Get_NAME_LENGTH(R_INF, a[i].tn), Get_NAME(R_INF, a[i].tn), 
		// 				"+-"[a[i].rev], rch[15]);
		// }
		if(li->el) {
			mm_ovlp = max_ovlp_src_contain(uopt, li_v^1);        
			x = (li->qs + mm_ovlp)*diff_ec_ul; 
			if(x < bw) x = bw; 
			x += li->qs + mm_ovlp;
			if (x > qlen+1) x = qlen+1;
			x = find_ul_ov_max(i, a, x+G_CHAIN_INDEL); 
			if ((x-st) > max_iter) st = x-max_iter;
			for (j = x; j >= st; --j) { // collect potential destination vertices
				lj = &(a[j]); 
				rch[j] = (i<<2); rch[j] += 3;//set it to unaviable
				// if((i>=15) && (rch_connect(rch[15], 18))) {
				// 	fprintf(stderr, "**j::%ld**[i::%ld] (id::%u)%.*s\t%c\trch[i]::%d\n", j, i, li->tn,
				// 				(int)Get_NAME_LENGTH(R_INF, a[i].tn), Get_NAME(R_INF, a[i].tn), 
				// 				"+-"[a[i].rev], rch[15]);
				// }
				if(!(lj->el)) continue;
				if(lj->qe <= li->qs) break;//even this pair has a overlap, its length will be very small; just ignore
				if(lj->qs > li->qs) continue;///no contain
				sc = quick_rechain_sc(a, ol, uref, uopt, bw, diff_ec_ul, ridx, trace, qstr, tu, 
				&tc, e_rate, exz, trans_sc, f, i, j);
				if(sc == INT32_MIN) continue;
				// if(li->tn == 23989) {
				// 	fprintf(stderr, "*[i::%ld] (id::%u)%.*s\t%c\tj::%ld\t%.*s\n", i, li->tn,
				// 		(int)Get_NAME_LENGTH(R_INF, a[i].tn), Get_NAME(R_INF, a[i].tn), 
				// 		"+-"[a[i].rev], j, (int)Get_NAME_LENGTH(R_INF, lj->tn), Get_NAME(R_INF, lj->tn));
				// }
				rch[j] = (i<<2);//set it to aviable
				sn = c_n[j] + 1;
				if((sc > mm_sc) || ((sc == mm_sc) && (sn > mm_n))) {
					mm_sc = sc, mm_idx = j; mm_n = sn; 
					if (n_skip > 0) --n_skip;
				} else if (t[j] == i) {
					if (++n_skip > max_skip)
						break;
				}
				if (p[j] >= 0) t[p[j]] = i;
			}
			// if((i>=15) && (rch_connect(rch[15], 18))) {
			// 	fprintf(stderr, ">>>1[i::%ld] (id::%u)%.*s\t%c\trch[i]::%d\n", i, li->tn,
			// 				(int)Get_NAME_LENGTH(R_INF, a[i].tn), Get_NAME(R_INF, a[i].tn), 
			// 				"+-"[a[i].rev], rch[15]);
			// }

			end_j = j;
			if (max_ii < 0 || (a[i].qe>(a[max_ii].qe+max_dis))) {//too long
				max = INT32_MIN; max_n = INT32_MIN; max_ii = -1;
				for (j = i - 1; (j >= st) && (a[i].qe<=(max_dis+a[j].qe)); --j) {
					if ((max < f[j]) || ((max == f[j]) && (max_n < c_n[j]))) {
						max = f[j]; max_n = c_n[j]; max_ii = j;
					}
				}
			}
			// if((i>=15) && (rch_connect(rch[15], 18))) {
			// 	fprintf(stderr, ">>>2[i::%ld] (id::%u)%.*s\t%c\trch[i]::%d\n", i, li->tn,
			// 				(int)Get_NAME_LENGTH(R_INF, a[i].tn), Get_NAME(R_INF, a[i].tn), 
			// 				"+-"[a[i].rev], rch[15]);
			// }

			if (max_ii >= 0 && max_ii < end_j) {///just have a try with a[i]<->a[max_ii]
				lj = &(a[max_ii]); 
				if((lj->el) && (lj->qe > li->qs) && (lj->qs <= li->qs)) {
					sc = quick_rechain_sc(a, ol, uref, uopt, bw, diff_ec_ul, ridx, trace, qstr, tu, 
					&tc, e_rate, exz, trans_sc, f, i, max_ii);
					///as max_ii < end_j, get_rid_backward_cigar_err still works
					if(sc != INT32_MIN) {
						sn = c_n[max_ii] + 1;
						if((sc > mm_sc) || ((sc == mm_sc) && (sn > mm_n))) {
							mm_sc = sc; mm_idx = max_ii; mm_n = sn; 
						}
					}
				}
			}
			// if((i>=15) && (rch_connect(rch[15], 18))) {
			// 	fprintf(stderr, ">>>3[i::%ld] (id::%u)%.*s\t%c\trch[i]::%d\n", i, li->tn,
			// 				(int)Get_NAME_LENGTH(R_INF, a[i].tn), Get_NAME(R_INF, a[i].tn), 
			// 				"+-"[a[i].rev], rch[15]);
			// }
			sc = csc; sn = 1;///for i itself
			if((sc > mm_sc) || ((sc == mm_sc) && (sn > mm_n))) {
				mm_sc = sc, mm_idx = -1; mm_n = sn; 
			}

			if(mm_sc < 0) {
				mm_sc = csc; mm_idx = -1; mm_n = 1;
			}
			// if(li->tn == 23989) {
			// 	fprintf(stderr, "+[i::%ld] (id::%u)%.*s\t%c\tj::%ld\t%.*s\n", i, li->tn,
			// 		(int)Get_NAME_LENGTH(R_INF, a[i].tn), Get_NAME(R_INF, a[i].tn), 
			// 		"+-"[a[i].rev], mm_idx, mm_idx>=0?((int)Get_NAME_LENGTH(R_INF, a[mm_idx].tn)):(1), 
			// 		mm_idx>=0?(Get_NAME(R_INF, a[mm_idx].tn)):("*"));
			// }
			if(mm_idx >= 0) {
				///mo meed to update mm_sc and is_fc
				quick_rechain_propagate_transitive_reduction(uref, uopt, ridx, bw, diff_ec_ul, a, x+1, i, rch, f, p, c_n, t, &mm_sc, &mm_idx, &mm_n);
			}
			// if(li->tn == 23989) {
			// 	fprintf(stderr, "-[i::%ld] (id::%u)%.*s\t%c\tj::%ld\t%.*s\n", i, li->tn,
			// 		(int)Get_NAME_LENGTH(R_INF, a[i].tn), Get_NAME(R_INF, a[i].tn), 
			// 		"+-"[a[i].rev], mm_idx, mm_idx>=0?((int)Get_NAME_LENGTH(R_INF, a[mm_idx].tn)):(1), 
			// 		mm_idx>=0?(Get_NAME(R_INF, a[mm_idx].tn)):("*"));
			// }
		}
		f[i] = mm_sc; p[i] = mm_idx; c_n[i] = mm_n; 
		if ((max_ii < 0) || ((a[i].qe<=max_dis+a[max_ii].qe) && (f[max_ii]<f[i]))) {
			max_ii = i;
		}
	}

	int64_t cl = 0; i = a_n-1; 
	while (i >= 0) {
		// fprintf(stderr, "i::%ld[M::%s] (id::%u)%.*s\t%c\tq::[%u, %u)\tt::[%u, %u)\tc::%u\n", 
		// i, __func__, a[i].tn, (int)Get_NAME_LENGTH(R_INF, a[i].tn), Get_NAME(R_INF, a[i].tn), 
		// 			"+-"[a[i].rev], a[i].qs, a[i].qe, a[i].ts, a[i].te, !a[i].el);
        t[cl++] = i; i = p[i];
    }
	return cl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1e8, %rsp            # imm = 0x1E8
movq 0x88(%rbp), %rax
movq 0x80(%rbp), %rax
movq 0x78(%rbp), %rax
movq 0x70(%rbp), %rax
movq 0x68(%rbp), %rax
movq 0x60(%rbp), %rax
movq 0x58(%rbp), %rax
movq 0x50(%rbp), %rax
movq 0x48(%rbp), %rax
movq 0x40(%rbp), %rax
movq 0x38(%rbp), %rax
movq 0x30(%rbp), %rax
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x30(%rbp)
movq %rsi, -0x38(%rbp)
movq %rdx, -0x40(%rbp)
movq %rcx, -0x48(%rbp)
movq %r8, -0x50(%rbp)
movq %r9, -0x58(%rbp)
movsd %xmm0, -0x60(%rbp)
movsd %xmm1, -0x68(%rbp)
movq 0x88(%rbp), %rdi
movq -0x40(%rbp), %rdx
shlq $0x3, %rdx
xorl %esi, %esi
callq 0x2100
movq $0x0, -0x178(%rbp)
movq $0x0, -0x80(%rbp)
movq $-0x1, -0x180(%rbp)
movq -0x80(%rbp), %rax
cmpq -0x40(%rbp), %rax
jge 0x2b3a08
movq -0x38(%rbp), %rax
imulq $0x1c, -0x80(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0xd0(%rbp)
movq -0xd0(%rbp), %rax
movl 0xc(%rax), %eax
shll %eax
movq -0xd0(%rbp), %rcx
movl 0x18(%rcx), %ecx
shrl $0x1f, %ecx
orl %ecx, %eax
movl %eax, -0x194(%rbp)
movq 0x78(%rbp), %rax
movq -0x80(%rbp), %rcx
movl $0x7fffffff, (%rax,%rcx,4) # imm = 0x7FFFFFFF
movq -0xd0(%rbp), %rax
movl 0x8(%rax), %eax
movq -0xd0(%rbp), %rcx
subl 0x4(%rcx), %eax
movl %eax, %eax
movq %rax, -0x98(%rbp)
movq -0xd0(%rbp), %rax
movl 0x18(%rax), %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
movl %eax, %eax
movl %eax, %ecx
imulq 0x40(%rbp), %rcx
movq -0x98(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x98(%rbp)
movq $-0x80000000, -0xa0(%rbp) # imm = 0x80000000
movq $-0x1, -0xa8(%rbp)
movq $0x0, -0xb0(%rbp)
movq $0x0, -0xc0(%rbp)
movq $-0x1, -0xc8(%rbp)
movq $0x7fffffff, -0x170(%rbp) # imm = 0x7FFFFFFF
movq -0xd0(%rbp), %rax
movl 0x18(%rax), %eax
shrl $0x1e, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x2b395a
movq -0x58(%rbp), %rdi
movl -0x194(%rbp), %esi
xorl $0x1, %esi
callq 0x2b2850
movq %rax, -0x70(%rbp)
movq -0xd0(%rbp), %rax
movl 0x4(%rax), %eax
addq -0x70(%rbp), %rax
cvtsi2sd %rax, %xmm0
mulsd -0x60(%rbp), %xmm0
cvttsd2si %xmm0, %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
cmpq 0x10(%rbp), %rax
jge 0x2b31fb
movq 0x10(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0xd0(%rbp), %rax
movl 0x4(%rax), %eax
addq -0x70(%rbp), %rax
addq -0x78(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq 0x18(%rbp), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
jle 0x2b322e
movq 0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x78(%rbp)
movq -0x80(%rbp), %rax
movl %eax, %edi
movq -0x38(%rbp), %rsi
movq -0x78(%rbp), %rax
addq $0x80, %rax
movl %eax, %edx
callq 0x28cf00
cltq
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
subq -0x178(%rbp), %rax
cmpq 0x28(%rbp), %rax
jle 0x2b326f
movq -0x78(%rbp), %rax
subq 0x28(%rbp), %rax
movq %rax, -0x178(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
cmpq -0x178(%rbp), %rax
jl 0x2b34f3
movq -0x38(%rbp), %rax
imulq $0x1c, -0x88(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0xd8(%rbp)
movq -0x80(%rbp), %rax
shlq $0x2, %rax
movl %eax, %edx
movq 0x78(%rbp), %rax
movq -0x88(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq 0x78(%rbp), %rax
movq -0x88(%rbp), %rcx
movl (%rax,%rcx,4), %edx
addl $0x3, %edx
movl %edx, (%rax,%rcx,4)
movq -0xd8(%rbp), %rax
movl 0x18(%rax), %eax
shrl $0x1e, %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x2b32ea
jmp 0x2b34dc
movq -0xd8(%rbp), %rax
movl 0x8(%rax), %eax
movq -0xd0(%rbp), %rcx
cmpl 0x4(%rcx), %eax
ja 0x2b3305
jmp 0x2b34f3
movq -0xd8(%rbp), %rax
movl 0x4(%rax), %eax
movq -0xd0(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jbe 0x2b3320
jmp 0x2b34dc
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq -0x58(%rbp), %rcx
movq 0x10(%rbp), %r8
movsd -0x60(%rbp), %xmm0
movq 0x48(%rbp), %r9
movq -0x48(%rbp), %rax
movq 0x50(%rbp), %r13
movq 0x58(%rbp), %r12
movsd -0x68(%rbp), %xmm1
movq 0x38(%rbp), %r14
movq 0x40(%rbp), %rbx
movq 0x60(%rbp), %r11
movq -0x80(%rbp), %r10
movq -0x88(%rbp), %r15
movq %r15, -0x1a8(%rbp)
leaq -0x170(%rbp), %r15
movq %rax, (%rsp)
movq -0x1a8(%rbp), %rax
movq %r13, 0x8(%rsp)
movq %r12, 0x10(%rsp)
movq %r15, 0x18(%rsp)
movq %r14, 0x20(%rsp)
movq %rbx, 0x28(%rsp)
movq %r11, 0x30(%rsp)
movq %r10, 0x38(%rsp)
movq %rax, 0x40(%rsp)
callq 0x2b2a40
movq %rax, -0x90(%rbp)
cmpq $-0x80000000, -0x90(%rbp) # imm = 0x80000000
jne 0x2b33c4
jmp 0x2b34dc
movq -0x80(%rbp), %rax
shlq $0x2, %rax
movl %eax, %edx
movq 0x78(%rbp), %rax
movq -0x88(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq 0x68(%rbp), %rax
movq -0x88(%rbp), %rcx
movl (%rax,%rcx,4), %eax
addl $0x1, %eax
cltq
movq %rax, -0xb8(%rbp)
movq -0x90(%rbp), %rax
cmpq -0xa0(%rbp), %rax
jg 0x2b3426
movq -0x90(%rbp), %rax
cmpq -0xa0(%rbp), %rax
jne 0x2b346e
movq -0xb8(%rbp), %rax
cmpq -0xb0(%rbp), %rax
jle 0x2b346e
movq -0x90(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xb8(%rbp), %rax
movq %rax, -0xb0(%rbp)
cmpq $0x0, -0xc0(%rbp)
jle 0x2b346c
movq -0xc0(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0xc0(%rbp)
jmp 0x2b34a4
movq 0x88(%rbp), %rax
movq -0x88(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpq -0x80(%rbp), %rax
jne 0x2b34a2
movq -0xc0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xc0(%rbp)
cmpq 0x20(%rbp), %rax
jle 0x2b34a0
jmp 0x2b34f3
jmp 0x2b34a2
jmp 0x2b34a4
movq 0x80(%rbp), %rax
movq -0x88(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
jl 0x2b34da
movq -0x80(%rbp), %rdx
movq 0x88(%rbp), %rax
movq 0x80(%rbp), %rcx
movq -0x88(%rbp), %rsi
movq (%rcx,%rsi,8), %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x2b34dc
movq -0x88(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x88(%rbp)
jmp 0x2b327a
movq -0x88(%rbp), %rax
movq %rax, -0xc8(%rbp)
cmpq $0x0, -0x180(%rbp)
jl 0x2b3539
movq -0x38(%rbp), %rax
imulq $0x1c, -0x80(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq -0x38(%rbp), %rcx
imulq $0x1c, -0x180(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
addq 0x30(%rbp), %rcx
cmpq %rcx, %rax
jle 0x2b366a
movq $-0x80000000, -0x188(%rbp) # imm = 0x80000000
movq $-0x80000000, -0x190(%rbp) # imm = 0x80000000
movq $-0x1, -0x180(%rbp)
movq -0x80(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rcx
xorl %eax, %eax
cmpq -0x178(%rbp), %rcx
movb %al, -0x1a9(%rbp)
jl 0x2b35b5
movq -0x38(%rbp), %rax
imulq $0x1c, -0x80(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq 0x30(%rbp), %rcx
movq -0x38(%rbp), %rdx
imulq $0x1c, -0x88(%rbp), %rsi
addq %rsi, %rdx
movl 0x8(%rdx), %edx
addq %rdx, %rcx
cmpq %rcx, %rax
setle %al
movb %al, -0x1a9(%rbp)
movb -0x1a9(%rbp), %al
testb $0x1, %al
jne 0x2b35c4
jmp 0x2b3668
movq -0x188(%rbp), %rax
movq 0x60(%rbp), %rcx
movq -0x88(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
cmpq %rcx, %rax
jl 0x2b3615
movq -0x188(%rbp), %rax
movq 0x60(%rbp), %rcx
movq -0x88(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
cmpq %rcx, %rax
jne 0x2b364f
movq -0x190(%rbp), %rax
movq 0x68(%rbp), %rcx
movq -0x88(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
cmpq %rcx, %rax
jge 0x2b364f
movq 0x60(%rbp), %rax
movq -0x88(%rbp), %rcx
movslq (%rax,%rcx,4), %rax
movq %rax, -0x188(%rbp)
movq 0x68(%rbp), %rax
movq -0x88(%rbp), %rcx
movslq (%rax,%rcx,4), %rax
movq %rax, -0x190(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x180(%rbp)
jmp 0x2b3651
movq -0x88(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x88(%rbp)
jmp 0x2b3569
jmp 0x2b366a
cmpq $0x0, -0x180(%rbp)
jl 0x2b3808
movq -0x180(%rbp), %rax
cmpq -0xc8(%rbp), %rax
jge 0x2b3808
movq -0x38(%rbp), %rax
imulq $0x1c, -0x180(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0xd8(%rbp)
movq -0xd8(%rbp), %rax
movl 0x18(%rax), %eax
shrl $0x1e, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x2b3806
movq -0xd8(%rbp), %rax
movl 0x8(%rax), %eax
movq -0xd0(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jbe 0x2b3806
movq -0xd8(%rbp), %rax
movl 0x4(%rax), %eax
movq -0xd0(%rbp), %rcx
cmpl 0x4(%rcx), %eax
ja 0x2b3806
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq -0x58(%rbp), %rcx
movq 0x10(%rbp), %r8
movsd -0x60(%rbp), %xmm0
movq 0x48(%rbp), %r9
movq -0x48(%rbp), %rax
movq 0x50(%rbp), %r13
movq 0x58(%rbp), %r12
movsd -0x68(%rbp), %xmm1
movq 0x38(%rbp), %r14
movq 0x40(%rbp), %rbx
movq 0x60(%rbp), %r11
movq -0x80(%rbp), %r10
movq -0x180(%rbp), %r15
movq %r15, -0x1b8(%rbp)
leaq -0x170(%rbp), %r15
movq %rax, (%rsp)
movq -0x1b8(%rbp), %rax
movq %r13, 0x8(%rsp)
movq %r12, 0x10(%rsp)
movq %r15, 0x18(%rsp)
movq %r14, 0x20(%rsp)
movq %rbx, 0x28(%rsp)
movq %r11, 0x30(%rsp)
movq %r10, 0x38(%rsp)
movq %rax, 0x40(%rsp)
callq 0x2b2a40
movq %rax, -0x90(%rbp)
cmpq $-0x80000000, -0x90(%rbp) # imm = 0x80000000
je 0x2b3804
movq 0x68(%rbp), %rax
movq -0x180(%rbp), %rcx
movl (%rax,%rcx,4), %eax
addl $0x1, %eax
cltq
movq %rax, -0xb8(%rbp)
movq -0x90(%rbp), %rax
cmpq -0xa0(%rbp), %rax
jg 0x2b37d8
movq -0x90(%rbp), %rax
cmpq -0xa0(%rbp), %rax
jne 0x2b3802
movq -0xb8(%rbp), %rax
cmpq -0xb0(%rbp), %rax
jle 0x2b3802
movq -0x90(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x180(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xb8(%rbp), %rax
movq %rax, -0xb0(%rbp)
jmp 0x2b3804
jmp 0x2b3806
jmp 0x2b3808
movq -0x98(%rbp), %rax
movq %rax, -0x90(%rbp)
movq $0x1, -0xb8(%rbp)
movq -0x90(%rbp), %rax
cmpq -0xa0(%rbp), %rax
jg 0x2b3851
movq -0x90(%rbp), %rax
cmpq -0xa0(%rbp), %rax
jne 0x2b3878
movq -0xb8(%rbp), %rax
cmpq -0xb0(%rbp), %rax
jle 0x2b3878
movq -0x90(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq $-0x1, -0xa8(%rbp)
movq -0xb8(%rbp), %rax
movq %rax, -0xb0(%rbp)
cmpq $0x0, -0xa0(%rbp)
jge 0x2b38a6
movq -0x98(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq $-0x1, -0xa8(%rbp)
movq $0x1, -0xb0(%rbp)
cmpq $0x0, -0xa8(%rbp)
jl 0x2b3958
movq -0x50(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq 0x48(%rbp), %rdx
movq 0x10(%rbp), %rcx
movsd -0x60(%rbp), %xmm0
movq -0x38(%rbp), %r8
movq -0x78(%rbp), %rax
addq $0x1, %rax
movl %eax, %r9d
movq -0x80(%rbp), %rax
movq %rax, -0x1c8(%rbp)
movq 0x78(%rbp), %r13
movq 0x60(%rbp), %r12
movq 0x80(%rbp), %r15
movq 0x68(%rbp), %r14
movq 0x88(%rbp), %rbx
leaq -0xa0(%rbp), %r11
leaq -0xa8(%rbp), %r10
leaq -0xb0(%rbp), %rax
movq %rax, -0x1c0(%rbp)
movq -0x1c8(%rbp), %rax
movq %rax, (%rsp)
movq -0x1c0(%rbp), %rax
movq %r13, 0x8(%rsp)
movq %r12, 0x10(%rsp)
movq %r15, 0x18(%rsp)
movq %r14, 0x20(%rsp)
movq %rbx, 0x28(%rsp)
movq %r11, 0x30(%rsp)
movq %r10, 0x38(%rsp)
movq %rax, 0x40(%rsp)
callq 0x2b2c40
jmp 0x2b395a
movq -0xa0(%rbp), %rax
movl %eax, %edx
movq 0x60(%rbp), %rax
movq -0x80(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0xa8(%rbp), %rdx
movq 0x80(%rbp), %rax
movq -0x80(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0xb0(%rbp), %rax
movl %eax, %edx
movq 0x68(%rbp), %rax
movq -0x80(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
cmpq $0x0, -0x180(%rbp)
jl 0x2b39ea
movq -0x38(%rbp), %rax
imulq $0x1c, -0x80(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq 0x30(%rbp), %rcx
movq -0x38(%rbp), %rdx
imulq $0x1c, -0x180(%rbp), %rsi
addq %rsi, %rdx
movl 0x8(%rdx), %edx
addq %rdx, %rcx
cmpq %rcx, %rax
jg 0x2b39f5
movq 0x60(%rbp), %rax
movq -0x180(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq 0x60(%rbp), %rcx
movq -0x80(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0x2b39f5
movq -0x80(%rbp), %rax
movq %rax, -0x180(%rbp)
jmp 0x2b39f7
movq -0x80(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x80(%rbp)
jmp 0x2b30c0
movq $0x0, -0x1a0(%rbp)
movq -0x40(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x80(%rbp)
cmpq $0x0, -0x80(%rbp)
jl 0x2b3a5f
movq -0x80(%rbp), %rdx
movq 0x88(%rbp), %rax
movq -0x1a0(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x1a0(%rbp)
movq %rdx, (%rax,%rcx,8)
movq 0x80(%rbp), %rax
movq -0x80(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x80(%rbp)
jmp 0x2b3a1f
movq -0x1a0(%rbp), %rax
addq $0x1e8, %rsp            # imm = 0x1E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax,%rax)