// File: chhylp123[P]hifiasm/inter.cpp
// Function: ed_dp_c(overlap_region_alloc*, kv_ul_ov_t*, ul_ov_t*, ul_idx_t const*, ug_opt_t const*, long, double, long, long, unsigned long*, unsigned long*, unsigned long*, double, unsigned long, All_reads*, ma_ug_t*, unsigned int)
int64_t ed_dp_c(overlap_region_alloc *o, kv_ul_ov_t *res, ul_ov_t *ex, const ul_idx_t *uref, const ug_opt_t *uopt, int64_t bw, 
double diff_ec_ul, int64_t qlen, int64_t max_skip, uint64_t *srt, uint64_t *idx, uint64_t *track, double err_sc, 
uint64_t mode, All_reads *ridx, ma_ug_t *ug, uint32_t need_srt)
{
    if(res->n == 0) return 0;
    uint32_t li_v, lj_v, rev_n;
    int64_t mm_ovlp, x, i, j, k, sc, csc, mm_sc, mm_idx, qo, qovl, minus_sc, pj, n_skip, wi, werr;
    ul_ov_t *li = NULL, *lj = NULL, rev_t;
	if(need_srt) {
		radix_sort_ul_ov_srt_qe(res->a, res->a + res->n);
		for (i = 1, j = 0; i <= (int64_t)res->n; i++) {
			if (i == (int64_t)res->n || res->a[i].qe != res->a[j].qe) {
				if(i - j > 1) radix_sort_ul_ov_srt_qs(res->a+j, res->a+i);
				j = i;
			}
		}
	}
	///res->a[0].qe: min_qe; res->a[res->n-1].qs: max_qs
	if(res->a[0].qe == qlen && res->a[res->n-1].qs == 0) {///all alignments are contained
		for (i = 0; i < (int64_t)res->n; ++i) {
			li = &(res->a[i]); assert(li->qs == 0 && li->qe == qlen);
			csc = (li->qe-li->qs); minus_sc = (o->list[li->qn].non_homopolymer_errors*err_sc);
			csc -= minus_sc; if(csc <= 0) csc = 1; mm_sc = csc; mm_idx = -1;

			if(mm_sc > ((int64_t)0x7fffffff)) mm_sc = ((int64_t)0x7fffffff);
			track[i] = push_sc_pre(mm_sc, mm_idx);
			srt[i] = track[i]>>32; srt[i] <<= 32; srt[i] |= i;
		}
	} else {
		memset(idx, 0, (sizeof((*idx))*res->n));
		for (i = 0; i < (int64_t)res->n; ++i) {
			li = &(res->a[i]); li_v = (li->tn<<1)|li->rev;
			// fprintf(stderr, "[M::%s::i->%ld::utg%.6dl] q[%u, %u), t[%u, %u)\n", __func__, i, (int32_t)li->tn+1, li->qs, li->qe, li->ts, li->te);
			mm_ovlp = mode?max_ovlp_src(uopt, li_v^1):max_ovlp(uref->ug->g, 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, res->a, x+G_CHAIN_INDEL); 
			csc = (li->qe-li->qs); minus_sc = (o->list[li->qn].non_homopolymer_errors*err_sc);
			csc -= minus_sc; if(csc <= 0) csc = 1;
			mm_sc = csc; mm_idx = -1; n_skip = 0; wi = werr = 0;
			for (j = x; j >= 0; --j) { // collect potential destination vertices
				lj = &(res->a[j]); lj_v = (lj->tn<<1)|lj->rev;
				if(lj->qe+G_CHAIN_INDEL <= li->qs) break;//even this pair has a overlap, its length will be very small; just ignore
				if(lj->qs > li->qs+G_CHAIN_INDEL) continue;///at boundary, migh be lj->qs == li->qs
				qo = infer_rovlp(li, lj, NULL, NULL, ridx, ug); ///overlap length in query (UL read)
				// fprintf(stderr, "[M::%s::j->%ld] qo::%ld\n", __func__, j, qo);
				if(li_v != lj_v && get_ecov_adv(uref, uopt, li_v^1, lj_v^1, bw, diff_ec_ul, qo, mode, NULL)) {
					qovl = ((MIN(li->qe, lj->qe) > MAX(li->qs, lj->qs))? (MIN(li->qe, lj->qe) - MAX(li->qs, lj->qs)):0);
					// fprintf(stderr, "[M::%s::] utg%.6dl->utg%.6dl, icsc::%ld, ierr::%u, ilen::%u, aln::%u, app_sc::%ld\n", 
					// __func__, (int32_t)li->tn+1, (int32_t)lj->tn+1, csc, o->list[li->qn].non_homopolymer_errors, 
					// li->qe - li->qs, o->list[li->qn].align_length, comput_sc_partial_cigar(csc, qovl, err_sc, &(o->list[li->qn]), &wi, &werr));
					sc = comput_sc_partial_cigar(csc, qovl, err_sc, &(o->list[li->qn]), &wi, &werr) 
																						+ pop_sc(track[j]);
					// fprintf(stderr, "[M::%s::j->%ld] qo::%ld, sc::%ld, mm_sc::%ld\n", __func__, j, qo, sc, mm_sc);
					if(sc > mm_sc) {
						mm_sc = sc, mm_idx = j;
						if (n_skip > 0) --n_skip;
					} else if (idx[j] == (uint64_t)i) {
						if (++n_skip > max_skip)
							break;
					}
					pj = pop_pre(track[j]);
					if(pj >= 0) idx[pj] = i;
				}
			}
			if(mm_sc > ((int64_t)0x7fffffff)) mm_sc = ((int64_t)0x7fffffff);
			track[i] = push_sc_pre(mm_sc, mm_idx);
			srt[i] = track[i]>>32; srt[i] <<= 32; srt[i] |= i;
			// fprintf(stderr, "[M::%s::i->%ld] mm_idx::%ld\n", __func__, i, mm_idx);
		}
	}
    
    int64_t n_v, n_u, n_v0; 
    radix_sort_gfa64(srt, srt+res->n); 
    for (k = (int64_t)res->n-1, n_v = n_u = 0; k >= 0; --k) {
        n_v0 = n_v; 
		for (i = (uint32_t)srt[k]; i >= 0 && (track[i]&((uint64_t)0x80000000)) == 0;) {
			ex[n_v++] = res->a[i]; track[i] |= ((uint64_t)0x80000000);
			i = pop_pre(track[i]);
		}
        if(n_v0 == n_v) continue;
        sc = (i<0?(pop_sc(srt[k])):(pop_sc(srt[k])-pop_sc(track[i])));
        if(sc < 0) {
            n_v = n_v0;
            continue;
        }
        idx[n_u++] = ((uint64_t)sc<<32)|(n_v-n_v0); 
    }

    for (k = 0, n_v = n_v0 = 0; k < n_u; k++) {
        n_v0 = n_v; n_v += (uint32_t)idx[k];
        res->a[k].qn = idx[k]>>32;//score
        res->a[k].ts = n_v0; res->a[k].te = n_v;///idx
        
        rev_n = ((uint32_t)idx[k])>>1; 
        ///we need to consider contained reads; so determining qs is not such easy
        res->a[k].qs = (uint32_t)-1; res->a[k].qe = ex[n_v0].qe;
        for (i = 0; i < rev_n; i++) {
            rev_t = ex[n_v0+i]; ex[n_v0+i] = ex[n_v-i-1]; ex[n_v-i-1] = rev_t;
            if(res->a[k].qs > ex[n_v0+i].qs) res->a[k].qs = ex[n_v0+i].qs;
            if(res->a[k].qs > ex[n_v-i-1].qs) res->a[k].qs = ex[n_v-i-1].qs;
        }
        if(((uint32_t)idx[k])&1) {
            if(res->a[k].qs > ex[n_v0+i].qs) res->a[k].qs = ex[n_v0+i].qs;
        }
    }
    
    res->n = n_u;
    radix_sort_ul_ov_srt_qn(res->a, res->a + res->n);//sort by score
    // fprintf(stderr, "---[M::%s] n_u:%ld, n_v:%ld\n", __func__, n_u, n_v);
    return n_v;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x180, %rsp            # imm = 0x180
movl 0x50(%rbp), %eax
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, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movsd %xmm0, -0x40(%rbp)
movsd %xmm1, -0x48(%rbp)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x2abbf8
movq $0x0, -0x8(%rbp)
jmp 0x2aca0e
movq $0x0, -0xe0(%rbp)
movq $0x0, -0xe8(%rbp)
cmpl $0x0, 0x50(%rbp)
je 0x2abcdb
movq -0x18(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
movq -0x18(%rbp), %rax
imulq $0x1c, 0x8(%rax), %rax
addq %rax, %rsi
callq 0x27b350
movq $0x1, -0x70(%rbp)
movq $0x0, -0x78(%rbp)
movq -0x70(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jg 0x2abcd9
movq -0x70(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq 0x8(%rcx), %rax
je 0x2abc8d
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x70(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x1c, -0x78(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x8(%rcx), %eax
je 0x2abcc6
movq -0x70(%rbp), %rax
subq -0x78(%rbp), %rax
cmpq $0x1, %rax
jle 0x2abcbe
movq -0x18(%rbp), %rax
movq (%rax), %rdi
imulq $0x1c, -0x78(%rbp), %rax
addq %rax, %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
imulq $0x1c, -0x70(%rbp), %rax
addq %rax, %rsi
callq 0x27b890
movq -0x70(%rbp), %rax
movq %rax, -0x78(%rbp)
jmp 0x2abcc8
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x2abc47
jmp 0x2abcdb
movq -0x18(%rbp), %rax
movq (%rax), %rax
movl 0x8(%rax), %eax
cmpq 0x10(%rbp), %rax
jne 0x2abebd
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x8(%rcx), %rcx
subq $0x1, %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x4(%rax)
jne 0x2abebd
movq $0x0, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jge 0x2abeb8
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x70(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0xe0(%rbp)
movq -0xe0(%rbp), %rcx
xorl %eax, %eax
cmpl $0x0, 0x4(%rcx)
movb %al, -0x121(%rbp)
jne 0x2abd6f
movq -0xe0(%rbp), %rax
movl 0x8(%rax), %eax
cmpq 0x10(%rbp), %rax
sete %al
movb %al, -0x121(%rbp)
movb -0x121(%rbp), %al
testb $0x1, %al
jne 0x2abd7b
jmp 0x2abd7d
jmp 0x2abd9c
leaq 0xe64fe(%rip), %rdi     # 0x392282
leaq 0xe4aa4(%rip), %rsi     # 0x39082f
movl $0x1a8a, %edx           # imm = 0x1A8A
leaq 0xe6509(%rip), %rcx     # 0x3922a0
callq 0x2130
movq -0xe0(%rbp), %rax
movl 0x4(%rax), %ecx
movl 0x8(%rax), %eax
subl %ecx, %eax
movq %rax, -0x90(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0xe0(%rbp), %rcx
movl (%rcx), %ecx
imulq $0xa8, %rcx, %rcx
movl 0x30(%rax,%rcx), %eax
cvtsi2sd %rax, %xmm0
mulsd -0x48(%rbp), %xmm0
cvttsd2si %xmm0, %rax
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rcx
movq -0x90(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x90(%rbp)
cmpq $0x0, -0x90(%rbp)
jg 0x2abe10
movq $0x1, -0x90(%rbp)
movq -0x90(%rbp), %rax
movq %rax, -0x98(%rbp)
movq $-0x1, -0xa0(%rbp)
cmpq $0x7fffffff, -0x98(%rbp) # imm = 0x7FFFFFFF
jle 0x2abe41
movq $0x7fffffff, -0x98(%rbp) # imm = 0x7FFFFFFF
movq -0x98(%rbp), %rdi
movq -0xa0(%rbp), %rsi
callq 0x292ac0
movq %rax, %rdx
movq 0x30(%rbp), %rax
movq -0x70(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x30(%rbp), %rax
movq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
shrq $0x20, %rdx
movq 0x20(%rbp), %rax
movq -0x70(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x20(%rbp), %rax
movq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
shlq $0x20, %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x70(%rbp), %rdx
movq 0x20(%rbp), %rax
movq -0x70(%rbp), %rcx
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x2abd1b
jmp 0x2ac497
movq 0x28(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdx
shlq $0x3, %rdx
xorl %esi, %esi
callq 0x2100
movq $0x0, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jge 0x2ac495
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x70(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0xe0(%rbp)
movq -0xe0(%rbp), %rax
movl 0xc(%rax), %eax
shll %eax
movq -0xe0(%rbp), %rcx
movl 0x18(%rcx), %ecx
shrl $0x1f, %ecx
orl %ecx, %eax
movl %eax, -0x4c(%rbp)
cmpq $0x0, 0x38(%rbp)
je 0x2abf41
movq -0x30(%rbp), %rdi
movl -0x4c(%rbp), %esi
xorl $0x1, %esi
callq 0x287de0
movq %rax, -0x130(%rbp)
jmp 0x2abf5e
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rdi
movl -0x4c(%rbp), %esi
xorl $0x1, %esi
callq 0x287d20
movq %rax, -0x130(%rbp)
movq -0x130(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0xe0(%rbp), %rax
movl 0x4(%rax), %eax
addq -0x60(%rbp), %rax
cvtsi2sd %rax, %xmm0
mulsd -0x40(%rbp), %xmm0
cvttsd2si %xmm0, %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
cmpq -0x38(%rbp), %rax
jge 0x2abf9c
movq -0x38(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0xe0(%rbp), %rax
movl 0x4(%rax), %eax
addq -0x60(%rbp), %rax
addq -0x68(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movq 0x10(%rbp), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
jle 0x2abfcf
movq 0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
movl -0x70(%rbp), %edi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
movl -0x68(%rbp), %edx
subl $-0x80, %edx
callq 0x28cf00
cltq
movq %rax, -0x68(%rbp)
movq -0xe0(%rbp), %rax
movl 0x4(%rax), %ecx
movl 0x8(%rax), %eax
subl %ecx, %eax
movq %rax, -0x90(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0xe0(%rbp), %rcx
movl (%rcx), %ecx
imulq $0xa8, %rcx, %rcx
movl 0x30(%rax,%rcx), %eax
cvtsi2sd %rax, %xmm0
mulsd -0x48(%rbp), %xmm0
cvttsd2si %xmm0, %rax
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rcx
movq -0x90(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x90(%rbp)
cmpq $0x0, -0x90(%rbp)
jg 0x2ac05e
movq $0x1, -0x90(%rbp)
movq -0x90(%rbp), %rax
movq %rax, -0x98(%rbp)
movq $-0x1, -0xa0(%rbp)
movq $0x0, -0xc8(%rbp)
movq $0x0, -0xd8(%rbp)
movq $0x0, -0xd0(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x78(%rbp)
cmpq $0x0, -0x78(%rbp)
jl 0x2ac406
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x78(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0xe8(%rbp)
movq -0xe8(%rbp), %rax
movl 0xc(%rax), %eax
shll %eax
movq -0xe8(%rbp), %rcx
movl 0x18(%rcx), %ecx
shrl $0x1f, %ecx
orl %ecx, %eax
movl %eax, -0x50(%rbp)
movq -0xe8(%rbp), %rax
movl 0x8(%rax), %eax
addl $0x80, %eax
movq -0xe0(%rbp), %rcx
cmpl 0x4(%rcx), %eax
ja 0x2ac0ff
jmp 0x2ac406
movq -0xe8(%rbp), %rax
movl 0x4(%rax), %eax
movq -0xe0(%rbp), %rcx
movl 0x4(%rcx), %ecx
addl $0x80, %ecx
cmpl %ecx, %eax
jbe 0x2ac122
jmp 0x2ac3f5
movq -0xe0(%rbp), %rdi
movq -0xe8(%rbp), %rsi
movq 0x40(%rbp), %r8
movq 0x48(%rbp), %r9
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0x71a90
movq %rax, -0xa8(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x50(%rbp), %eax
je 0x2ac3f3
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl -0x4c(%rbp), %edx
xorl $0x1, %edx
movl -0x50(%rbp), %ecx
xorl $0x1, %ecx
movq -0x38(%rbp), %r8
movsd -0x40(%rbp), %xmm0
movq -0xa8(%rbp), %r9
movq 0x38(%rbp), %rax
xorl %r10d, %r10d
movq %rax, (%rsp)
movq $0x0, 0x8(%rsp)
callq 0x292000
cmpq $0x0, %rax
je 0x2ac3f3
movq -0xe0(%rbp), %rax
movl 0x8(%rax), %eax
movq -0xe8(%rbp), %rcx
cmpl 0x8(%rcx), %eax
ja 0x2ac1c6
movq -0xe0(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x134(%rbp)
jmp 0x2ac1d6
movq -0xe8(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x134(%rbp)
movl -0x134(%rbp), %eax
movl %eax, -0x138(%rbp)
movq -0xe0(%rbp), %rax
movl 0x4(%rax), %eax
movq -0xe8(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jb 0x2ac20a
movq -0xe0(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x13c(%rbp)
jmp 0x2ac21a
movq -0xe8(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x13c(%rbp)
movl -0x138(%rbp), %eax
movl -0x13c(%rbp), %ecx
cmpl %ecx, %eax
jbe 0x2ac2c0
movq -0xe0(%rbp), %rax
movl 0x8(%rax), %eax
movq -0xe8(%rbp), %rcx
cmpl 0x8(%rcx), %eax
ja 0x2ac256
movq -0xe0(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x140(%rbp)
jmp 0x2ac266
movq -0xe8(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x140(%rbp)
movl -0x140(%rbp), %eax
movl %eax, -0x144(%rbp)
movq -0xe0(%rbp), %rax
movl 0x4(%rax), %eax
movq -0xe8(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jb 0x2ac29a
movq -0xe0(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x148(%rbp)
jmp 0x2ac2aa
movq -0xe8(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x148(%rbp)
movl -0x144(%rbp), %eax
movl -0x148(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x14c(%rbp)
jmp 0x2ac2ca
xorl %eax, %eax
movl %eax, -0x14c(%rbp)
jmp 0x2ac2ca
movl -0x14c(%rbp), %eax
movl %eax, %eax
movq %rax, -0xb0(%rbp)
movq -0x90(%rbp), %rdi
movq -0xb0(%rbp), %rsi
movsd -0x48(%rbp), %xmm0
movq -0x10(%rbp), %rax
movq (%rax), %rdx
movq -0xe0(%rbp), %rax
movl (%rax), %eax
imulq $0xa8, %rax, %rax
addq %rax, %rdx
leaq -0xd0(%rbp), %rcx
leaq -0xd8(%rbp), %r8
callq 0x2ab6f0
movq %rax, -0x158(%rbp)
movq 0x30(%rbp), %rax
movq -0x78(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x292b40
movq %rax, %rcx
movq -0x158(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
cmpq -0x98(%rbp), %rax
jle 0x2ac38c
movq -0x88(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0xa0(%rbp)
cmpq $0x0, -0xc8(%rbp)
jle 0x2ac38a
movq -0xc8(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0xc8(%rbp)
jmp 0x2ac3bc
movq 0x28(%rbp), %rax
movq -0x78(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpq -0x70(%rbp), %rax
jne 0x2ac3ba
movq -0xc8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xc8(%rbp)
cmpq 0x18(%rbp), %rax
jle 0x2ac3b8
jmp 0x2ac406
jmp 0x2ac3ba
jmp 0x2ac3bc
movq 0x30(%rbp), %rax
movq -0x78(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x292ba0
movq %rax, -0xc0(%rbp)
cmpq $0x0, -0xc0(%rbp)
jl 0x2ac3f1
movq -0x70(%rbp), %rdx
movq 0x28(%rbp), %rax
movq -0xc0(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x2ac3f3
jmp 0x2ac3f5
movq -0x78(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x78(%rbp)
jmp 0x2ac0a0
cmpq $0x7fffffff, -0x98(%rbp) # imm = 0x7FFFFFFF
jle 0x2ac41e
movq $0x7fffffff, -0x98(%rbp) # imm = 0x7FFFFFFF
movq -0x98(%rbp), %rdi
movq -0xa0(%rbp), %rsi
callq 0x292ac0
movq %rax, %rdx
movq 0x30(%rbp), %rax
movq -0x70(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x30(%rbp), %rax
movq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
shrq $0x20, %rdx
movq 0x20(%rbp), %rax
movq -0x70(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x20(%rbp), %rax
movq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
shlq $0x20, %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x70(%rbp), %rdx
movq 0x20(%rbp), %rax
movq -0x70(%rbp), %rcx
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x2abedc
jmp 0x2ac497
movq 0x20(%rbp), %rdi
movq 0x20(%rbp), %rsi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
shlq $0x3, %rax
addq %rax, %rsi
callq 0x27a9b0
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
subq $0x1, %rax
movq %rax, -0x80(%rbp)
movq $0x0, -0x118(%rbp)
movq $0x0, -0x110(%rbp)
cmpq $0x0, -0x80(%rbp)
jl 0x2ac6a6
movq -0x110(%rbp), %rax
movq %rax, -0x120(%rbp)
movq 0x20(%rbp), %rax
movq -0x80(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0x70(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x70(%rbp)
movb %al, -0x159(%rbp)
jl 0x2ac536
movq 0x30(%rbp), %rcx
movq -0x70(%rbp), %rdx
movabsq $0x80000000, %rax       # imm = 0x80000000
andq (%rcx,%rdx,8), %rax
cmpq $0x0, %rax
sete %al
movb %al, -0x159(%rbp)
movb -0x159(%rbp), %al
testb $0x1, %al
jne 0x2ac542
jmp 0x2ac5c1
movq -0x18(%rbp), %rax
movq (%rax), %rcx
imulq $0x1c, -0x70(%rbp), %rax
addq %rax, %rcx
movq -0x20(%rbp), %rax
movq -0x110(%rbp), %rdx
movq %rdx, %rsi
addq $0x1, %rsi
movq %rsi, -0x110(%rbp)
imulq $0x1c, %rdx, %rdx
addq %rdx, %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rdx
movq %rdx, 0x10(%rax)
movl 0x18(%rcx), %ecx
movl %ecx, 0x18(%rax)
movq 0x30(%rbp), %rax
movq -0x70(%rbp), %rcx
movabsq $0x80000000, %rdx       # imm = 0x80000000
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movq 0x30(%rbp), %rax
movq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x292ba0
movq %rax, -0x70(%rbp)
jmp 0x2ac504
movq -0x120(%rbp), %rax
cmpq -0x110(%rbp), %rax
jne 0x2ac5d6
jmp 0x2ac695
cmpq $0x0, -0x70(%rbp)
jge 0x2ac5f7
movq 0x20(%rbp), %rax
movq -0x80(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x292b40
movq %rax, -0x168(%rbp)
jmp 0x2ac634
movq 0x20(%rbp), %rax
movq -0x80(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x292b40
movq %rax, -0x170(%rbp)
movq 0x30(%rbp), %rax
movq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x292b40
movq %rax, %rcx
movq -0x170(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x168(%rbp)
movq -0x168(%rbp), %rax
movq %rax, -0x88(%rbp)
cmpq $0x0, -0x88(%rbp)
jge 0x2ac65c
movq -0x120(%rbp), %rax
movq %rax, -0x110(%rbp)
jmp 0x2ac695
movq -0x88(%rbp), %rdx
shlq $0x20, %rdx
movq -0x110(%rbp), %rax
subq -0x120(%rbp), %rax
orq %rax, %rdx
movq 0x28(%rbp), %rax
movq -0x118(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x118(%rbp)
movq %rdx, (%rax,%rcx,8)
movq -0x80(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x80(%rbp)
jmp 0x2ac4d9
movq $0x0, -0x80(%rbp)
movq $0x0, -0x120(%rbp)
movq $0x0, -0x110(%rbp)
movq -0x80(%rbp), %rax
cmpq -0x118(%rbp), %rax
jge 0x2ac9d5
movq -0x110(%rbp), %rax
movq %rax, -0x120(%rbp)
movq 0x28(%rbp), %rax
movq -0x80(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
addq -0x110(%rbp), %rax
movq %rax, -0x110(%rbp)
movq 0x28(%rbp), %rax
movq -0x80(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x80(%rbp), %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movq -0x120(%rbp), %rax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x80(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x10(%rax)
movq -0x110(%rbp), %rax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x80(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x14(%rax)
movq 0x28(%rbp), %rax
movq -0x80(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shrl %eax
movl %eax, -0x54(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x80(%rbp), %rcx
addq %rcx, %rax
movl $0xffffffff, 0x4(%rax)  # imm = 0xFFFFFFFF
movq -0x20(%rbp), %rax
imulq $0x1c, -0x120(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %ecx
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x80(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
movq $0x0, -0x70(%rbp)
movq -0x70(%rbp), %rax
movl -0x54(%rbp), %ecx
cmpq %rcx, %rax
jge 0x2ac954
movq -0x20(%rbp), %rax
movq -0x120(%rbp), %rcx
addq -0x70(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x104(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0xfc(%rbp)
movq 0x10(%rax), %rcx
movq %rcx, -0xf4(%rbp)
movl 0x18(%rax), %eax
movl %eax, -0xec(%rbp)
movq -0x20(%rbp), %rcx
movq -0x110(%rbp), %rax
subq -0x70(%rbp), %rax
subq $0x1, %rax
imulq $0x1c, %rax, %rax
addq %rax, %rcx
movq -0x20(%rbp), %rax
movq -0x120(%rbp), %rdx
addq -0x70(%rbp), %rdx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rdx
movq %rdx, 0x10(%rax)
movl 0x18(%rcx), %ecx
movl %ecx, 0x18(%rax)
movq -0x20(%rbp), %rax
movq -0x110(%rbp), %rcx
subq -0x70(%rbp), %rcx
subq $0x1, %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq -0x104(%rbp), %rcx
movq %rcx, (%rax)
movq -0xfc(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0xf4(%rbp), %rcx
movq %rcx, 0x10(%rax)
movl -0xec(%rbp), %ecx
movl %ecx, 0x18(%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x80(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq -0x20(%rbp), %rcx
movq -0x120(%rbp), %rdx
addq -0x70(%rbp), %rdx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x4(%rcx), %eax
jbe 0x2ac8e1
movq -0x20(%rbp), %rax
movq -0x120(%rbp), %rcx
addq -0x70(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %ecx
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x80(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x80(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq -0x20(%rbp), %rcx
movq -0x110(%rbp), %rdx
subq -0x70(%rbp), %rdx
subq $0x1, %rdx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x4(%rcx), %eax
jbe 0x2ac941
movq -0x20(%rbp), %rax
movq -0x110(%rbp), %rcx
subq -0x70(%rbp), %rcx
subq $0x1, %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %ecx
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x80(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
jmp 0x2ac943
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x2ac7ab
movq 0x28(%rbp), %rax
movq -0x80(%rbp), %rcx
movq (%rax,%rcx,8), %rax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x2ac9c2
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x80(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq -0x20(%rbp), %rcx
movq -0x120(%rbp), %rdx
addq -0x70(%rbp), %rdx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x4(%rcx), %eax
jbe 0x2ac9c0
movq -0x20(%rbp), %rax
movq -0x120(%rbp), %rcx
addq -0x70(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %ecx
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x80(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
jmp 0x2ac9c2
jmp 0x2ac9c4
movq -0x80(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x80(%rbp)
jmp 0x2ac6c4
movq -0x118(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
movq -0x18(%rbp), %rax
imulq $0x1c, 0x8(%rax), %rax
addq %rax, %rsi
callq 0x27c310
movq -0x110(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x180, %rsp            # imm = 0x180
popq %rbp
retq
nopl (%rax,%rax)