// File: chhylp123[P]hifiasm/inter.cpp
// Function: cal_exact_batch(overlap_region*, ul_ov_t*, unsigned long, long, unsigned long*, unsigned long*, unsigned long*, unsigned long*, unsigned long*, unsigned long*, ma_ug_t*)
int64_t cal_exact_batch(overlap_region *z, ul_ov_t *sa, uint64_t sn, int64_t ylen, uint64_t *q0l, uint64_t *t0l, uint64_t *e0l, uint64_t *q1l, uint64_t *t1l, uint64_t *e1l, ma_ug_t *ug)
{
	int64_t wn = z->w_list.n, wk, xk, yk, is_t, is_f, err0, err1, tot, mask_win = 0; window_list *m; bit_extz_t ez; 
    int64_t qs, qe, ts, te, rev = !!(z->y_pos_strand), qoff, toff, elen, sube;
	tot = z->non_homopolymer_errors;
	if(!tot) {
		(*q0l) = (*q1l) = z->x_pos_e+1-z->x_pos_s;
		(*t0l) = (*t1l) = z->y_pos_e+1-z->y_pos_s;
		(*e0l) = (*e1l) = z->x_pos_e+1-z->x_pos_s;
		return 0;
	}
	(*q0l) = (*t0l) = (*e0l) = (*q1l) = (*t1l) = (*e1l) = (uint64_t)-1;
	wk = xk = yk = -1; if(!wn) return INT32_MAX;

	///forward
	(*q0l) = (*t0l) = (*e0l) = err0 = 0;
	wk = 0; xk = z->w_list.a[wk].x_start; yk = z->w_list.a[wk].y_start; is_t = 0;
	if((xk == z->x_pos_s) && (yk == z->y_pos_s)) is_t = 1;
	if((!is_t) && (sn > 0)) {///if the flanking unmapped regions could be masked
		qs = z->x_pos_s; qe = xk; 
		if(!rev) {
			ts = z->y_pos_s; te = yk;
		} else {
			ts = ylen - yk; te = ylen - z->y_pos_s; 
		}
		is_t = is_mask_err_full(sa, sn, qs, qe, ts, te);
		if(is_t) {
			(*q0l) += qe - qs; (*t0l) += te - ts; (*e0l) = 0;
		}
	}
	if(is_t) {
		for (; wk < wn; wk++) {		
			m = &(z->w_list.a[wk]); 
			qs = m->x_start; qe = m->x_end+1;
			if(!rev) {
				ts = m->y_start; te = m->y_end+1;
			} else {
				ts = ylen-(m->y_end+1); te = ylen-m->y_start;
			}

			if((is_ualn_win((*m))) || ((is_est_aln((*m))) && (m->error > 0))) {///unmapped 				
				if(is_mask_err_full(sa, sn, qs, qe, ts, te)) {
					(*q0l) += qe - qs; (*t0l) += te - ts; (*e0l) = 0; mask_win = 1;
					continue;
				}
				break;
			} 
			if(m->error == 0) {///an exactly matched window
				(*q0l) += qe - qs; (*t0l) += te - ts; (*e0l) += qe - qs;
				continue;
			}
			set_bit_extz_t(ez, (*z), wk); 
			is_f = cal_exact_len(&ez, rev, sa, sn, ylen, &qoff, &toff, &elen, &sube, 0);
			(*q0l) += qoff; (*t0l) += toff; err0 += sube;
			///exactly match
			if(elen == qoff && elen == toff) (*e0l) += elen;
			else (*e0l) = elen;
			if(!is_f) break;
		}
	}


	///backward
	(*q1l) = (*t1l) = (*e1l) = err1 = 0;
	wk = wn-1; xk = z->w_list.a[wk].x_end+1; yk = z->w_list.a[wk].y_end+1; is_t = 0;
	if((xk == (z->x_pos_e+1)) && (yk == (z->y_pos_e+1))) is_t = 1;
	if((!is_t) && (sn > 0)) {///if the flanking unmapped regions could be masked
		qs = xk; qe = z->x_pos_e+1;
		if(!rev) {
			ts = yk; te = z->y_pos_e+1;
		} else {
			ts = ylen-(z->y_pos_e+1); te = ylen-yk;
		}
		is_t = is_mask_err_full(sa, sn, qs, qe, ts, te);
        if(is_t) {
            (*q1l) += qe - qs; (*t1l) += te - ts; (*e1l) = 0;
        }
	}
	if(is_t) {
		for (; wk >= 0; wk--) {
			m = &(z->w_list.a[wk]); 
			qs = m->x_start; qe = m->x_end+1;
			if(!rev) {
				ts = m->y_start; te = m->y_end+1;
			} else {
				ts = ylen-(m->y_end+1); te = ylen-m->y_start;
			}

			if((is_ualn_win((*m))) || ((is_est_aln((*m))) && (m->error > 0))) {///unmapped 				
				if(is_mask_err_full(sa, sn, qs, qe, ts, te)) {
					(*q1l) += qe - qs; (*t1l) += te - ts; (*e1l) = 0; mask_win = 1;
					continue;
				}
				break;
			} 
			if(m->error == 0) {///an exactly matched window
				(*q1l) += qe - qs; (*t1l) += te - ts; (*e1l) += qe - qs;
				continue;
			}
			set_bit_extz_t(ez, (*z), wk); 
			is_f = cal_exact_len(&ez, rev, sa, sn, ylen, &qoff, &toff, &elen, &sube, 1);
			(*q1l) += qoff; (*t1l) += toff; err1 += sube;
			///exactly match
			if(elen == qoff && elen == toff) (*e1l) += elen;
			else (*e1l) = elen;
			if(!is_f) break;
		}
	}

	if((*q0l) >= (z->x_pos_e+1-z->x_pos_s) && (*t0l) >= (z->y_pos_e+1-z->y_pos_s)) {
		// if((!(((*q0l) == (*q1l)) && ((*t0l) == (*t1l)) && (err0 == err1)))/** || (!(err0 == tot))**/) {
		// 	fprintf(stderr, "[M::%s]\tutg%.6u%c\txl::%u\tx::[%u,\t%u)\t%c\tutg%.6u%c\tyl::%u\ty::[%u,\t%u)\terr::%u\twn::%u\n", 
        //     __func__, 
		// 	z->x_id+1, "lc"[ug->u.a[z->x_id].circ], ug->u.a[z->x_id].len, z->x_pos_s, z->x_pos_e+1,
		// 	"+-"[z->y_pos_strand],
		// 	z->y_id+1, "lc"[ug->u.a[z->y_id].circ], ug->u.a[z->y_id].len, z->y_pos_s, z->y_pos_e+1,
		// 	z->non_homopolymer_errors, (uint32_t)z->w_list.n);
		// 	uint64_t k;
		// 	for (k = 0; k < z->w_list.n; k++) {
		// 		m = &(z->w_list.a[k]);
		// 		fprintf(stderr, "k::%ld[M::%s]\tutg%.6u%c\twx::[%u,\t%u)\t%c\tutg%.6u%c\twy::[%u,\t%u)\terr::%d\tualn::%u\test::%u\n", k, __func__, 
		// 		z->x_id+1, "lc"[ug->u.a[z->x_id].circ], m->x_start, m->x_end+1,
		// 		"+-"[z->y_pos_strand], 
		// 		z->y_id+1, "lc"[ug->u.a[z->y_id].circ], m->y_start, m->y_end+1, m->error, 
		// 		(is_ualn_win((*m))), (is_est_aln((*m))));
		// 	}
		// 	fprintf(stderr, "[M::%s]\tutg%.6ul\tutg%.6ul\terr0::%ld\terr1::%ld\ttot::%ld\n", __func__, 
		// 	z->x_id+1, z->y_id+1, err0, err1, tot);
		// 	fprintf(stderr, "[M::%s]\tutg%.6ul\tq0l::%lu\tt0l::%lu\te0l::%lu\tutg%.6ul\tq1l::%lu\tt1l::%lu\te1l::%lu\n", __func__, 
		// 		z->x_id+1, *q0l, *t0l, *e0l, z->y_id+1, *q1l, *t1l, *e1l);
		// }
		assert(((*q0l) == (*q1l)) && ((*t0l) == (*t1l)) && (err0 == err1));
		assert((mask_win) || (err0 == tot));
		return 0;
	}

	// if(!(err0+err1 < tot)) {
	// 	fprintf(stderr, "[M::%s]\tutg%.6ul\tutg%.6ul\terr0::%ld\terr1::%ld\ttot::%ld\n", __func__, 
	// 	z->x_id+1, z->y_id+1, err0, err1, tot);
	// 	fprintf(stderr, "[M::%s]\tutg%.6ul\tq0l::%lu\tt0l::%lu\te0l::%lu\tutg%.6ul\tq1l::%lu\tt1l::%lu\te1l::%lu\n", __func__, 
	// 		z->x_id+1, *q0l, *t0l, *e0l, z->y_id+1, *q1l, *t1l, *e1l);
	// }
	
	assert(err0+err1 < tot);
	return tot-(err0+err1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x1d8, %rsp            # imm = 0x1D8
movq 0x30(%rbp), %rax
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movq %rdx, -0x28(%rbp)
movq %rcx, -0x30(%rbp)
movq %r8, -0x38(%rbp)
movq %r9, -0x40(%rbp)
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x48(%rbp)
movq $0x0, -0x90(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
setne %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movq %rax, -0x198(%rbp)
movq -0x18(%rbp), %rax
movl 0x30(%rax), %eax
movq %rax, -0x88(%rbp)
cmpq $0x0, -0x88(%rbp)
jne 0x2c95f8
movq -0x18(%rbp), %rax
movl 0x8(%rax), %eax
addl $0x1, %eax
movq -0x18(%rbp), %rcx
subl 0x4(%rcx), %eax
movl %eax, %eax
movl %eax, %ecx
movq 0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movl 0x18(%rax), %eax
addl $0x1, %eax
movq -0x18(%rbp), %rcx
subl 0x14(%rcx), %eax
movl %eax, %eax
movl %eax, %ecx
movq 0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x40(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movl 0x8(%rax), %eax
addl $0x1, %eax
movq -0x18(%rbp), %rcx
subl 0x4(%rcx), %eax
movl %eax, %eax
movl %eax, %ecx
movq 0x28(%rbp), %rax
movq %rcx, (%rax)
movq 0x10(%rbp), %rax
movq %rcx, (%rax)
movq $0x0, -0x10(%rbp)
jmp 0x2ca2b4
movq 0x28(%rbp), %rax
movq $-0x1, (%rax)
movq 0x20(%rbp), %rax
movq $-0x1, (%rax)
movq 0x18(%rbp), %rax
movq $-0x1, (%rax)
movq 0x10(%rbp), %rax
movq $-0x1, (%rax)
movq -0x40(%rbp), %rax
movq $-0x1, (%rax)
movq -0x38(%rbp), %rax
movq $-0x1, (%rax)
movq $-0x1, -0x60(%rbp)
movq $-0x1, -0x58(%rbp)
movq $-0x1, -0x50(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x2c9666
movq $0x7fffffff, -0x10(%rbp) # imm = 0x7FFFFFFF
jmp 0x2ca2b4
movq $0x0, -0x78(%rbp)
movq 0x10(%rbp), %rax
movq $0x0, (%rax)
movq -0x40(%rbp), %rax
movq $0x0, (%rax)
movq -0x38(%rbp), %rax
movq $0x0, (%rax)
movq $0x0, -0x50(%rbp)
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x50(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq (%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x50(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq 0x8(%rax), %rax
movq %rax, -0x60(%rbp)
movq $0x0, -0x68(%rbp)
movq -0x58(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x4(%rcx), %ecx
cmpq %rcx, %rax
jne 0x2c96fc
movq -0x60(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x14(%rcx), %ecx
cmpq %rcx, %rax
jne 0x2c96fc
movq $0x1, -0x68(%rbp)
cmpq $0x0, -0x68(%rbp)
jne 0x2c97e5
cmpq $0x0, -0x28(%rbp)
jbe 0x2c97e5
movq -0x18(%rbp), %rax
movl 0x4(%rax), %eax
movq %rax, -0x178(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x180(%rbp)
cmpq $0x0, -0x198(%rbp)
jne 0x2c9750
movq -0x18(%rbp), %rax
movl 0x14(%rax), %eax
movq %rax, -0x188(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x190(%rbp)
jmp 0x2c9774
movq -0x30(%rbp), %rax
subq -0x60(%rbp), %rax
movq %rax, -0x188(%rbp)
movq -0x30(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x14(%rcx), %ecx
subq %rcx, %rax
movq %rax, -0x190(%rbp)
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x178(%rbp), %rdx
movq -0x180(%rbp), %rcx
movq -0x188(%rbp), %r8
movq -0x190(%rbp), %r9
callq 0x30d250
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x68(%rbp)
je 0x2c97e3
movq -0x180(%rbp), %rcx
subq -0x178(%rbp), %rcx
movq -0x38(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq -0x190(%rbp), %rcx
subq -0x188(%rbp), %rcx
movq -0x40(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq 0x10(%rbp), %rax
movq $0x0, (%rax)
jmp 0x2c97e5
cmpq $0x0, -0x68(%rbp)
je 0x2c9bd0
jmp 0x2c97f2
movq -0x50(%rbp), %rax
cmpq -0x48(%rbp), %rax
jge 0x2c9bce
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x50(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
movslq (%rax), %rax
movq %rax, -0x178(%rbp)
movq -0x98(%rbp), %rax
movl 0x4(%rax), %eax
addl $0x1, %eax
cltq
movq %rax, -0x180(%rbp)
cmpq $0x0, -0x198(%rbp)
jne 0x2c9875
movq -0x98(%rbp), %rax
movslq 0x8(%rax), %rax
movq %rax, -0x188(%rbp)
movq -0x98(%rbp), %rax
movl 0xc(%rax), %eax
addl $0x1, %eax
cltq
movq %rax, -0x190(%rbp)
jmp 0x2c98ac
movq -0x30(%rbp), %rax
movq -0x98(%rbp), %rcx
movl 0xc(%rcx), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
subq %rcx, %rax
movq %rax, -0x188(%rbp)
movq -0x30(%rbp), %rax
movq -0x98(%rbp), %rcx
movslq 0x8(%rcx), %rcx
subq %rcx, %rax
movq %rax, -0x190(%rbp)
movq -0x98(%rbp), %rax
movswl 0x14(%rax), %eax
cmpl $0x7fff, %eax           # imm = 0x7FFF
jne 0x2c98db
movq -0x98(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
jne 0x2c98db
movq -0x98(%rbp), %rax
movswl 0x12(%rax), %eax
cmpl $0x0, %eax
jl 0x2c9912
movq -0x98(%rbp), %rax
movswl 0x14(%rax), %eax
cmpl $0x7fff, %eax           # imm = 0x7FFF
jge 0x2c9991
movq -0x98(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
jne 0x2c9991
movq -0x98(%rbp), %rax
movswl 0x14(%rax), %eax
cmpl $0x0, %eax
jle 0x2c9991
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x178(%rbp), %rdx
movq -0x180(%rbp), %rcx
movq -0x188(%rbp), %r8
movq -0x190(%rbp), %r9
callq 0x30d250
cmpq $0x0, %rax
je 0x2c998c
movq -0x180(%rbp), %rcx
subq -0x178(%rbp), %rcx
movq -0x38(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq -0x190(%rbp), %rcx
subq -0x188(%rbp), %rcx
movq -0x40(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq 0x10(%rbp), %rax
movq $0x0, (%rax)
movq $0x1, -0x90(%rbp)
jmp 0x2c9bbd
jmp 0x2c9bce
movq -0x98(%rbp), %rax
movswl 0x14(%rax), %eax
cmpl $0x0, %eax
jne 0x2c99ee
movq -0x180(%rbp), %rcx
subq -0x178(%rbp), %rcx
movq -0x38(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq -0x190(%rbp), %rcx
subq -0x188(%rbp), %rcx
movq -0x40(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq -0x180(%rbp), %rcx
subq -0x178(%rbp), %rcx
movq 0x10(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
jmp 0x2c9bbd
jmp 0x2c99f0
movq -0x18(%rbp), %rax
movq 0x70(%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x58(%rcx), %rcx
movq -0x50(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
movl 0x18(%rcx), %ecx
shlq %rcx
addq %rcx, %rax
movq %rax, -0xb8(%rbp)
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x50(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x1c(%rax), %eax
movq %rax, -0xc0(%rbp)
movq %rax, -0xc8(%rbp)
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x50(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x154(%rbp)
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x50(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0x150(%rbp)
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x50(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0x160(%rbp)
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x50(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
movl %eax, -0x15c(%rbp)
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x50(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movswl 0x14(%rax), %eax
movl %eax, -0x144(%rbp)
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x50(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movswl 0x14(%rax), %eax
movl %eax, -0x148(%rbp)
movq -0x198(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %r8
leaq -0x170(%rbp), %rdi
leaq -0x1a0(%rbp), %r9
leaq -0x1a8(%rbp), %r11
leaq -0x1b0(%rbp), %r10
leaq -0x1b8(%rbp), %rax
xorl %ebx, %ebx
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
callq 0x2c9010
movq %rax, -0x70(%rbp)
movq -0x1a0(%rbp), %rcx
movq -0x38(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq -0x1a8(%rbp), %rcx
movq -0x40(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq -0x1b8(%rbp), %rax
addq -0x78(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x1b0(%rbp), %rax
cmpq -0x1a0(%rbp), %rax
jne 0x2c9ba4
movq -0x1b0(%rbp), %rax
cmpq -0x1a8(%rbp), %rax
jne 0x2c9ba4
movq -0x1b0(%rbp), %rcx
movq 0x10(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
jmp 0x2c9bb2
movq -0x1b0(%rbp), %rcx
movq 0x10(%rbp), %rax
movq %rcx, (%rax)
cmpq $0x0, -0x70(%rbp)
jne 0x2c9bbb
jmp 0x2c9bce
jmp 0x2c9bbd
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x2c97f2
jmp 0x2c9bd0
movq $0x0, -0x80(%rbp)
movq 0x28(%rbp), %rax
movq $0x0, (%rax)
movq 0x20(%rbp), %rax
movq $0x0, (%rax)
movq 0x18(%rbp), %rax
movq $0x0, (%rax)
movq -0x48(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x50(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
addl $0x1, %eax
cltq
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x50(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
addl $0x1, %eax
cltq
movq %rax, -0x60(%rbp)
movq $0x0, -0x68(%rbp)
movq -0x58(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x8(%rcx), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
jne 0x2c9c7d
movq -0x60(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x18(%rcx), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
jne 0x2c9c7d
movq $0x1, -0x68(%rbp)
cmpq $0x0, -0x68(%rbp)
jne 0x2c9d75
cmpq $0x0, -0x28(%rbp)
jbe 0x2c9d75
movq -0x58(%rbp), %rax
movq %rax, -0x178(%rbp)
movq -0x18(%rbp), %rax
movl 0x8(%rax), %eax
addl $0x1, %eax
movl %eax, %eax
movq %rax, -0x180(%rbp)
cmpq $0x0, -0x198(%rbp)
jne 0x2c9cdb
movq -0x60(%rbp), %rax
movq %rax, -0x188(%rbp)
movq -0x18(%rbp), %rax
movl 0x18(%rax), %eax
addl $0x1, %eax
movl %eax, %eax
movq %rax, -0x190(%rbp)
jmp 0x2c9d04
movq -0x30(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x18(%rcx), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
subq %rcx, %rax
movq %rax, -0x188(%rbp)
movq -0x30(%rbp), %rax
subq -0x60(%rbp), %rax
movq %rax, -0x190(%rbp)
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x178(%rbp), %rdx
movq -0x180(%rbp), %rcx
movq -0x188(%rbp), %r8
movq -0x190(%rbp), %r9
callq 0x30d250
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x68(%rbp)
je 0x2c9d73
movq -0x180(%rbp), %rcx
subq -0x178(%rbp), %rcx
movq 0x18(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq -0x190(%rbp), %rcx
subq -0x188(%rbp), %rcx
movq 0x20(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq 0x28(%rbp), %rax
movq $0x0, (%rax)
jmp 0x2c9d75
cmpq $0x0, -0x68(%rbp)
je 0x2ca15b
jmp 0x2c9d82
cmpq $0x0, -0x50(%rbp)
jl 0x2ca159
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x50(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
movslq (%rax), %rax
movq %rax, -0x178(%rbp)
movq -0x98(%rbp), %rax
movl 0x4(%rax), %eax
addl $0x1, %eax
cltq
movq %rax, -0x180(%rbp)
cmpq $0x0, -0x198(%rbp)
jne 0x2c9e02
movq -0x98(%rbp), %rax
movslq 0x8(%rax), %rax
movq %rax, -0x188(%rbp)
movq -0x98(%rbp), %rax
movl 0xc(%rax), %eax
addl $0x1, %eax
cltq
movq %rax, -0x190(%rbp)
jmp 0x2c9e39
movq -0x30(%rbp), %rax
movq -0x98(%rbp), %rcx
movl 0xc(%rcx), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
subq %rcx, %rax
movq %rax, -0x188(%rbp)
movq -0x30(%rbp), %rax
movq -0x98(%rbp), %rcx
movslq 0x8(%rcx), %rcx
subq %rcx, %rax
movq %rax, -0x190(%rbp)
movq -0x98(%rbp), %rax
movswl 0x14(%rax), %eax
cmpl $0x7fff, %eax           # imm = 0x7FFF
jne 0x2c9e68
movq -0x98(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
jne 0x2c9e68
movq -0x98(%rbp), %rax
movswl 0x12(%rax), %eax
cmpl $0x0, %eax
jl 0x2c9e9f
movq -0x98(%rbp), %rax
movswl 0x14(%rax), %eax
cmpl $0x7fff, %eax           # imm = 0x7FFF
jge 0x2c9f1e
movq -0x98(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
jne 0x2c9f1e
movq -0x98(%rbp), %rax
movswl 0x14(%rax), %eax
cmpl $0x0, %eax
jle 0x2c9f1e
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x178(%rbp), %rdx
movq -0x180(%rbp), %rcx
movq -0x188(%rbp), %r8
movq -0x190(%rbp), %r9
callq 0x30d250
cmpq $0x0, %rax
je 0x2c9f19
movq -0x180(%rbp), %rcx
subq -0x178(%rbp), %rcx
movq 0x18(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq -0x190(%rbp), %rcx
subq -0x188(%rbp), %rcx
movq 0x20(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq 0x28(%rbp), %rax
movq $0x0, (%rax)
movq $0x1, -0x90(%rbp)
jmp 0x2ca148
jmp 0x2ca159
movq -0x98(%rbp), %rax
movswl 0x14(%rax), %eax
cmpl $0x0, %eax
jne 0x2c9f7b
movq -0x180(%rbp), %rcx
subq -0x178(%rbp), %rcx
movq 0x18(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq -0x190(%rbp), %rcx
subq -0x188(%rbp), %rcx
movq 0x20(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq -0x180(%rbp), %rcx
subq -0x178(%rbp), %rcx
movq 0x28(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
jmp 0x2ca148
jmp 0x2c9f7d
movq -0x18(%rbp), %rax
movq 0x70(%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x58(%rcx), %rcx
movq -0x50(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
movl 0x18(%rcx), %ecx
shlq %rcx
addq %rcx, %rax
movq %rax, -0xb8(%rbp)
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x50(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x1c(%rax), %eax
movq %rax, -0xc0(%rbp)
movq %rax, -0xc8(%rbp)
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x50(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x154(%rbp)
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x50(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0x150(%rbp)
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x50(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0x160(%rbp)
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x50(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
movl %eax, -0x15c(%rbp)
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x50(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movswl 0x14(%rax), %eax
movl %eax, -0x144(%rbp)
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x50(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movswl 0x14(%rax), %eax
movl %eax, -0x148(%rbp)
movq -0x198(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %r8
leaq -0x170(%rbp), %rdi
leaq -0x1a0(%rbp), %r9
leaq -0x1a8(%rbp), %r11
leaq -0x1b0(%rbp), %r10
leaq -0x1b8(%rbp), %rax
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
movq $0x1, 0x18(%rsp)
callq 0x2c9010
movq %rax, -0x70(%rbp)
movq -0x1a0(%rbp), %rcx
movq 0x18(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq -0x1a8(%rbp), %rcx
movq 0x20(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq -0x1b8(%rbp), %rax
addq -0x80(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x1b0(%rbp), %rax
cmpq -0x1a0(%rbp), %rax
jne 0x2ca12f
movq -0x1b0(%rbp), %rax
cmpq -0x1a8(%rbp), %rax
jne 0x2ca12f
movq -0x1b0(%rbp), %rcx
movq 0x28(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
jmp 0x2ca13d
movq -0x1b0(%rbp), %rcx
movq 0x28(%rbp), %rax
movq %rcx, (%rax)
cmpq $0x0, -0x70(%rbp)
jne 0x2ca146
jmp 0x2ca159
jmp 0x2ca148
movq -0x50(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x2c9d82
jmp 0x2ca15b
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movl 0x8(%rcx), %ecx
addl $0x1, %ecx
movq -0x18(%rbp), %rdx
subl 0x4(%rdx), %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
jb 0x2ca26c
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movl 0x18(%rcx), %ecx
addl $0x1, %ecx
movq -0x18(%rbp), %rdx
subl 0x14(%rdx), %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
jb 0x2ca26c
movq -0x38(%rbp), %rax
movq (%rax), %rcx
movq 0x18(%rbp), %rdx
xorl %eax, %eax
cmpq (%rdx), %rcx
movb %al, -0x1b9(%rbp)
jne 0x2ca1e2
movq -0x40(%rbp), %rax
movq (%rax), %rcx
movq 0x20(%rbp), %rdx
xorl %eax, %eax
cmpq (%rdx), %rcx
movb %al, -0x1b9(%rbp)
jne 0x2ca1e2
movq -0x78(%rbp), %rax
cmpq -0x80(%rbp), %rax
sete %al
movb %al, -0x1b9(%rbp)
movb -0x1b9(%rbp), %al
testb $0x1, %al
jne 0x2ca1ee
jmp 0x2ca1f0
jmp 0x2ca20f
leaq 0xc87a4(%rip), %rdi     # 0x39299b
leaq 0xc6631(%rip), %rsi     # 0x39082f
movl $0x2ee2, %edx           # imm = 0x2EE2
leaq 0xc87cc(%rip), %rcx     # 0x3929d6
callq 0x2130
movb $0x1, %al
cmpq $0x0, -0x90(%rbp)
movb %al, -0x1ba(%rbp)
jne 0x2ca235
movq -0x78(%rbp), %rax
cmpq -0x88(%rbp), %rax
sete %al
movb %al, -0x1ba(%rbp)
movb -0x1ba(%rbp), %al
testb $0x1, %al
jne 0x2ca241
jmp 0x2ca243
jmp 0x2ca262
leaq 0xc8827(%rip), %rdi     # 0x392a71
leaq 0xc65de(%rip), %rsi     # 0x39082f
movl $0x2ee3, %edx           # imm = 0x2EE3
leaq 0xc8779(%rip), %rcx     # 0x3929d6
callq 0x2130
movq $0x0, -0x10(%rbp)
jmp 0x2ca2b4
movq -0x78(%rbp), %rax
addq -0x80(%rbp), %rax
cmpq -0x88(%rbp), %rax
jge 0x2ca27f
jmp 0x2ca29e
leaq 0xc8807(%rip), %rdi     # 0x392a8d
leaq 0xc65a2(%rip), %rsi     # 0x39082f
movl $0x2eee, %edx           # imm = 0x2EEE
leaq 0xc873d(%rip), %rcx     # 0x3929d6
callq 0x2130
movq -0x88(%rbp), %rax
movq -0x78(%rbp), %rcx
addq -0x80(%rbp), %rcx
subq %rcx, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %rbp
retq
nopw %cs:(%rax,%rax)