// File: chhylp123[P]hifiasm/inter.cpp
// Function: gen_cns_chain_linear_hard(ul_ov_t*, long, asg_t const*, long, long, double, Chain_Data*, long, long, long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long)
uint64_t gen_cns_chain_linear_hard(ul_ov_t *a, int64_t a_n, const asg_t *rg, int64_t qlen, int64_t bw, double diff_thre, Chain_Data* dp, 
int64_t max_skip, int64_t max_iter, int64_t max_dis, uint64_t mqs, uint64_t mqe, uint64_t ulid, uint64_t ltn, uint64_t rtn)
{
    if(a_n == 0) return 0;
    uint32_t li_v, lj_v; int32_t *f; int64_t *p, *t, st, max_ii, max, qo, cL; ul_ov_t *li, *lj; 
    int64_t mm_ovlp, x, i, j, sc, csc, mm_sc, mm_idx, n_skip, end_j, ch_sc, ch_i; 
    resize_Chain_Data(dp, a_n, NULL); t = dp->tmp; f = dp->score; p = dp->pre;
        
    radix_sort_ul_ov_srt_qe(a, a + a_n);
    for (i = 1, j = 0; i <= a_n; i++) {
        if (i == a_n || a[i].qe != a[j].qe) {
            if(i - j > 1) radix_sort_ul_ov_srt_qs(a+j, a+i);
            j = i;
        }
    }

    memset(t, 0, (a_n*sizeof((*t)))); 
    ch_sc = ch_i = INT32_MIN; 
    for (i = st = 0, max_ii = -1; i < a_n; ++i) {
        li = &(a[i]); 
        mm_ovlp = max_ovlp(rg, ((li->tn<<1)|li->rev)^1);        
        x = (li->qs + mm_ovlp)*diff_thre; 
        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); 

        csc = 1; if(li->el) csc = 0;
        mm_sc = INT32_MIN+1; mm_idx = -1; n_skip = 0; end_j = -1; 

        li_v = (li->tn<<1)|li->rev; li_v ^= 1;
        if ((x-st) > max_iter) st = x-max_iter;
        for (j = x; j >= st; --j) { // collect potential destination vertices
            lj = &(a[j]); 
            if(lj->qe+G_CHAIN_INDEL <= li->qs) break;//even this pair has a overlap, its length will be very small; just ignore
            if(f[j] == INT32_MIN) continue;///could not reach the left end
            sc = INT32_MIN;
            if(lj->qs <= li->qs && lj->qe <= li->qe) {///not contained
                lj_v = (lj->tn<<1)|lj->rev; lj_v ^= 1;
                qo = infer_rovlp(li, lj, NULL, NULL, NULL, NULL);
                if(gconnect_test(rg, li_v, lj_v, bw, diff_thre, qo)) {
                    sc = f[j] + csc; 
                }
            }
            if(sc == INT32_MIN) continue;
            if(sc > mm_sc) {
                mm_sc = sc, mm_idx = j;
                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;
        }
        
        end_j = j;
        if (max_ii < 0 || (a[i].qe > (a[max_ii].qe+max_dis))) {//too long
            max = 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_ii = j;
                }
            }
        }
                
        if (max_ii >= 0 && max_ii < end_j) {///just have a try with a[i]<->a[max_ii]
            lj = &(a[max_ii]); 
            if(((lj->qe+G_CHAIN_INDEL)>li->qs) && (lj->qs<=li->qs) && (lj->qe<=li->qe) && (f[max_ii]!=INT32_MIN)) {
                lj_v = (lj->tn<<1)|lj->rev; lj_v ^= 1; sc = INT32_MIN;
                qo = infer_rovlp(li, lj, NULL, NULL, NULL, NULL);
                if(gconnect_test(rg, li_v, lj_v, bw, diff_thre, qo)) {
                    sc = f[max_ii] + csc; 
                }
                if(sc != INT32_MIN) {
                    if(sc > mm_sc) {
                        mm_sc = sc, mm_idx = max_ii;
                    }
                }
            }
        }

		if(mm_idx == -1) {
			if((ltn) != ((uint64_t)-1)) {
				if(ltn != li->tn) mm_sc = mm_idx = INT32_MIN;
			} else {
				if(((int64_t)li->qs) > ((int64_t)(mqs+bw))) mm_sc = mm_idx = INT32_MIN;
			}
		}
        
        if((mm_sc==(INT32_MIN+1))) {
            mm_sc = csc; 
        }

        
        f[i] = mm_sc; p[i] = mm_idx; 

		// if(ulid == 7723 && ltn == (7723>>1) && rtn == (7829>>1)) {
		// 	fprintf(stderr, "[M::%s::id->%u::%.*s] i::%ld, q::[%u, %u), t::[%u, %u), mm_idx::%ld, mm_sc::%ld\n", 
		// 	__func__, li->tn, (int)Get_NAME_LENGTH(R_INF, li->tn), Get_NAME(R_INF, li->tn), i, 
		// 	li->qs, li->qe, li->ts, li->te, mm_idx, mm_sc);
        // }

		if(mm_sc == INT32_MIN) continue;
		if((rtn != ((uint64_t)-1)) && (rtn != li->tn)) continue;
		if((rtn == ((uint64_t)-1)) && (((int64_t)(a[i].qe+bw))<((int64_t)(mqe)))) continue;
        if(mm_sc >= ch_sc) {
			ch_sc = mm_sc; ch_i = i;
		}
		if ((max_ii < 0) || (f[max_ii]<f[i])) {
            max_ii = i;
        }
    }
    // if(ulid == 442462) {
    //  fprintf(stderr, "[M::%s::] ch_i::%ld, mqs::%lu, mqe::%lu\n", 
    //  __func__, ch_i, mqs, mqe);
    // }
    if(ch_i == INT32_MIN) return 0;

    i = ch_i; cL = 0;
    while (i >= 0) {t[cL++] = i; i = p[i];}
    for (i = 0; i < cL; i++) a[i] = a[t[cL-i-1]];
    return cL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
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)
movsd %xmm0, -0x38(%rbp)
movq %r9, -0x40(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x2ea36c
movq $0x0, -0x8(%rbp)
jmp 0x2ead55
movq -0x40(%rbp), %rdi
movq -0x18(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x226f0
movq -0x40(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rsi
imulq $0x1c, -0x18(%rbp), %rax
addq %rax, %rsi
callq 0x27b350
movq $0x1, -0xb0(%rbp)
movq $0x0, -0xb8(%rbp)
movq -0xb0(%rbp), %rax
cmpq -0x18(%rbp), %rax
jg 0x2ea46d
movq -0xb0(%rbp), %rax
cmpq -0x18(%rbp), %rax
je 0x2ea40f
movq -0x10(%rbp), %rax
imulq $0x1c, -0xb0(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq -0x10(%rbp), %rcx
imulq $0x1c, -0xb8(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x8(%rcx), %eax
je 0x2ea454
movq -0xb0(%rbp), %rax
subq -0xb8(%rbp), %rax
cmpq $0x1, %rax
jle 0x2ea446
movq -0x10(%rbp), %rdi
imulq $0x1c, -0xb8(%rbp), %rax
addq %rax, %rdi
movq -0x10(%rbp), %rsi
imulq $0x1c, -0xb0(%rbp), %rax
addq %rax, %rsi
callq 0x27b890
movq -0xb0(%rbp), %rax
movq %rax, -0xb8(%rbp)
jmp 0x2ea456
movq -0xb0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xb0(%rbp)
jmp 0x2ea3cb
movq -0x60(%rbp), %rdi
movq -0x18(%rbp), %rdx
shlq $0x3, %rdx
xorl %esi, %esi
callq 0x2100
movq $-0x80000000, -0xf8(%rbp) # imm = 0x80000000
movq $-0x80000000, -0xf0(%rbp) # imm = 0x80000000
movq $0x0, -0x68(%rbp)
movq $0x0, -0xb0(%rbp)
movq $-0x1, -0x70(%rbp)
movq -0xb0(%rbp), %rax
cmpq -0x18(%rbp), %rax
jge 0x2eac55
movq -0x10(%rbp), %rax
imulq $0x1c, -0xb0(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x90(%rbp)
movq -0x20(%rbp), %rdi
movq -0x90(%rbp), %rax
movl 0xc(%rax), %esi
shll %esi
movq -0x90(%rbp), %rax
movl 0x18(%rax), %eax
shrl $0x1f, %eax
orl %eax, %esi
xorl $0x1, %esi
callq 0x287d20
movq %rax, -0xa0(%rbp)
movq -0x90(%rbp), %rax
movl 0x4(%rax), %eax
addq -0xa0(%rbp), %rax
cvtsi2sd %rax, %xmm0
mulsd -0x38(%rbp), %xmm0
cvttsd2si %xmm0, %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
cmpq -0x30(%rbp), %rax
jge 0x2ea545
movq -0x30(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x90(%rbp), %rax
movl 0x4(%rax), %eax
addq -0xa0(%rbp), %rax
addq -0xa8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
movq -0x28(%rbp), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
jle 0x2ea587
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa8(%rbp)
movq -0xb0(%rbp), %rax
movl %eax, %edi
movq -0x10(%rbp), %rsi
movq -0xa8(%rbp), %rax
addq $0x80, %rax
movl %eax, %edx
callq 0x28cf00
cltq
movq %rax, -0xa8(%rbp)
movq $0x1, -0xc8(%rbp)
movq -0x90(%rbp), %rax
movl 0x18(%rax), %eax
shrl $0x1e, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x2ea5dc
movq $0x0, -0xc8(%rbp)
movq $-0x7fffffff, -0xd0(%rbp) # imm = 0x80000001
movq $-0x1, -0xd8(%rbp)
movq $0x0, -0xe0(%rbp)
movq $-0x1, -0xe8(%rbp)
movq -0x90(%rbp), %rax
movl 0xc(%rax), %eax
shll %eax
movq -0x90(%rbp), %rcx
movl 0x18(%rcx), %ecx
shrl $0x1f, %ecx
orl %ecx, %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
xorl $0x1, %eax
movl %eax, -0x44(%rbp)
movq -0xa8(%rbp), %rax
subq -0x68(%rbp), %rax
cmpq 0x18(%rbp), %rax
jle 0x2ea64f
movq -0xa8(%rbp), %rax
subq 0x18(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0xa8(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rax
cmpq -0x68(%rbp), %rax
jl 0x2ea864
movq -0x10(%rbp), %rax
imulq $0x1c, -0xb8(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
movl 0x8(%rax), %eax
addl $0x80, %eax
movq -0x90(%rbp), %rcx
cmpl 0x4(%rcx), %eax
ja 0x2ea6a4
jmp 0x2ea864
movq -0x50(%rbp), %rax
movq -0xb8(%rbp), %rcx
cmpl $0x80000000, (%rax,%rcx,4) # imm = 0x80000000
jne 0x2ea6bd
jmp 0x2ea84d
movq $-0x80000000, -0xc0(%rbp) # imm = 0x80000000
movq -0x98(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x90(%rbp), %rcx
cmpl 0x4(%rcx), %eax
ja 0x2ea789
movq -0x98(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x90(%rbp), %rcx
cmpl 0x8(%rcx), %eax
ja 0x2ea789
movq -0x98(%rbp), %rax
movl 0xc(%rax), %eax
shll %eax
movq -0x98(%rbp), %rcx
movl 0x18(%rcx), %ecx
shrl $0x1f, %ecx
orl %ecx, %eax
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %eax
xorl $0x1, %eax
movl %eax, -0x48(%rbp)
movq -0x90(%rbp), %rdi
movq -0x98(%rbp), %rsi
xorl %eax, %eax
movl %eax, %r9d
movq %r9, %rdx
movq %r9, %rcx
movq %r9, %r8
callq 0x71a90
movq %rax, -0x80(%rbp)
movq -0x20(%rbp), %rdi
movl -0x44(%rbp), %esi
movl -0x48(%rbp), %edx
movq -0x30(%rbp), %rcx
movsd -0x38(%rbp), %xmm0
movq -0x80(%rbp), %r8
callq 0x2e6e20
cmpq $0x0, %rax
je 0x2ea787
movq -0x50(%rbp), %rax
movq -0xb8(%rbp), %rcx
movslq (%rax,%rcx,4), %rax
addq -0xc8(%rbp), %rax
movq %rax, -0xc0(%rbp)
jmp 0x2ea789
cmpq $-0x80000000, -0xc0(%rbp) # imm = 0x80000000
jne 0x2ea79b
jmp 0x2ea84d
movq -0xc0(%rbp), %rax
cmpq -0xd0(%rbp), %rax
jle 0x2ea7e5
movq -0xc0(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0xb8(%rbp), %rax
movq %rax, -0xd8(%rbp)
cmpq $0x0, -0xe0(%rbp)
jle 0x2ea7e3
movq -0xe0(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0xe0(%rbp)
jmp 0x2ea81b
movq -0x60(%rbp), %rax
movq -0xb8(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpq -0xb0(%rbp), %rax
jne 0x2ea819
movq -0xe0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xe0(%rbp)
cmpq 0x10(%rbp), %rax
jle 0x2ea817
jmp 0x2ea864
jmp 0x2ea819
jmp 0x2ea81b
movq -0x58(%rbp), %rax
movq -0xb8(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
jl 0x2ea84b
movq -0xb0(%rbp), %rdx
movq -0x60(%rbp), %rax
movq -0x58(%rbp), %rcx
movq -0xb8(%rbp), %rsi
movq (%rcx,%rsi,8), %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x2ea84d
movq -0xb8(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0xb8(%rbp)
jmp 0x2ea65d
movq -0xb8(%rbp), %rax
movq %rax, -0xe8(%rbp)
cmpq $0x0, -0x70(%rbp)
jl 0x2ea8a7
movq -0x10(%rbp), %rax
imulq $0x1c, -0xb0(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq -0x10(%rbp), %rcx
imulq $0x1c, -0x70(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
addq 0x20(%rbp), %rcx
cmpq %rcx, %rax
jle 0x2ea972
movq $-0x80000000, -0x78(%rbp) # imm = 0x80000000
movq $-0x1, -0x70(%rbp)
movq -0xb0(%rbp), %rax
subq $0x1, %rax
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rcx
xorl %eax, %eax
cmpq -0x68(%rbp), %rcx
movb %al, -0xf9(%rbp)
jl 0x2ea915
movq -0x10(%rbp), %rax
imulq $0x1c, -0xb0(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq 0x20(%rbp), %rcx
movq -0x10(%rbp), %rdx
imulq $0x1c, -0xb8(%rbp), %rsi
addq %rsi, %rdx
movl 0x8(%rdx), %edx
addq %rdx, %rcx
cmpq %rcx, %rax
setle %al
movb %al, -0xf9(%rbp)
movb -0xf9(%rbp), %al
testb $0x1, %al
jne 0x2ea921
jmp 0x2ea970
movq -0x78(%rbp), %rax
movq -0x50(%rbp), %rcx
movq -0xb8(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
cmpq %rcx, %rax
jge 0x2ea957
movq -0x50(%rbp), %rax
movq -0xb8(%rbp), %rcx
movslq (%rax,%rcx,4), %rax
movq %rax, -0x78(%rbp)
movq -0xb8(%rbp), %rax
movq %rax, -0x70(%rbp)
jmp 0x2ea959
movq -0xb8(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0xb8(%rbp)
jmp 0x2ea8c9
jmp 0x2ea972
cmpq $0x0, -0x70(%rbp)
jl 0x2eaad8
movq -0x70(%rbp), %rax
cmpq -0xe8(%rbp), %rax
jge 0x2eaad8
movq -0x10(%rbp), %rax
imulq $0x1c, -0x70(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
movl 0x8(%rax), %eax
addl $0x80, %eax
movq -0x90(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jbe 0x2eaad6
movq -0x98(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x90(%rbp), %rcx
cmpl 0x4(%rcx), %eax
ja 0x2eaad6
movq -0x98(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x90(%rbp), %rcx
cmpl 0x8(%rcx), %eax
ja 0x2eaad6
movq -0x50(%rbp), %rax
movq -0x70(%rbp), %rcx
cmpl $0x80000000, (%rax,%rcx,4) # imm = 0x80000000
je 0x2eaad6
movq -0x98(%rbp), %rax
movl 0xc(%rax), %eax
shll %eax
movq -0x98(%rbp), %rcx
movl 0x18(%rcx), %ecx
shrl $0x1f, %ecx
orl %ecx, %eax
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %eax
xorl $0x1, %eax
movl %eax, -0x48(%rbp)
movq $-0x80000000, -0xc0(%rbp) # imm = 0x80000000
movq -0x90(%rbp), %rdi
movq -0x98(%rbp), %rsi
xorl %eax, %eax
movl %eax, %r9d
movq %r9, %rdx
movq %r9, %rcx
movq %r9, %r8
callq 0x71a90
movq %rax, -0x80(%rbp)
movq -0x20(%rbp), %rdi
movl -0x44(%rbp), %esi
movl -0x48(%rbp), %edx
movq -0x30(%rbp), %rcx
movsd -0x38(%rbp), %xmm0
movq -0x80(%rbp), %r8
callq 0x2e6e20
cmpq $0x0, %rax
je 0x2eaa9c
movq -0x50(%rbp), %rax
movq -0x70(%rbp), %rcx
movslq (%rax,%rcx,4), %rax
addq -0xc8(%rbp), %rax
movq %rax, -0xc0(%rbp)
cmpq $-0x80000000, -0xc0(%rbp) # imm = 0x80000000
je 0x2eaad4
movq -0xc0(%rbp), %rax
cmpq -0xd0(%rbp), %rax
jle 0x2eaad2
movq -0xc0(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0xd8(%rbp)
jmp 0x2eaad4
jmp 0x2eaad6
jmp 0x2eaad8
cmpq $-0x1, -0xd8(%rbp)
jne 0x2eab45
cmpq $-0x1, 0x40(%rbp)
je 0x2eab14
movq 0x40(%rbp), %rax
movq -0x90(%rbp), %rcx
movl 0xc(%rcx), %ecx
cmpq %rcx, %rax
je 0x2eab12
movq $-0x80000000, -0xd8(%rbp) # imm = 0x80000000
movq $-0x80000000, -0xd0(%rbp) # imm = 0x80000000
jmp 0x2eab43
movq -0x90(%rbp), %rax
movl 0x4(%rax), %eax
movq 0x28(%rbp), %rcx
addq -0x30(%rbp), %rcx
cmpq %rcx, %rax
jle 0x2eab41
movq $-0x80000000, -0xd8(%rbp) # imm = 0x80000000
movq $-0x80000000, -0xd0(%rbp) # imm = 0x80000000
jmp 0x2eab43
jmp 0x2eab45
cmpq $-0x7fffffff, -0xd0(%rbp) # imm = 0x80000001
jne 0x2eab60
movq -0xc8(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0xd0(%rbp), %rax
movl %eax, %edx
movq -0x50(%rbp), %rax
movq -0xb0(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0xd8(%rbp), %rdx
movq -0x58(%rbp), %rax
movq -0xb0(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
cmpq $-0x80000000, -0xd0(%rbp) # imm = 0x80000000
jne 0x2eab9f
jmp 0x2eac3e
cmpq $-0x1, 0x48(%rbp)
je 0x2eabbe
movq 0x48(%rbp), %rax
movq -0x90(%rbp), %rcx
movl 0xc(%rcx), %ecx
cmpq %rcx, %rax
je 0x2eabbe
jmp 0x2eac3e
cmpq $-0x1, 0x48(%rbp)
jne 0x2eabe3
movq -0x10(%rbp), %rax
imulq $0x1c, -0xb0(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
addq -0x30(%rbp), %rax
cmpq 0x30(%rbp), %rax
jge 0x2eabe3
jmp 0x2eac3e
movq -0xd0(%rbp), %rax
cmpq -0xf0(%rbp), %rax
jl 0x2eac0f
movq -0xd0(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0xb0(%rbp), %rax
movq %rax, -0xf8(%rbp)
cmpq $0x0, -0x70(%rbp)
jl 0x2eac31
movq -0x50(%rbp), %rax
movq -0x70(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq -0x50(%rbp), %rcx
movq -0xb0(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0x2eac3c
movq -0xb0(%rbp), %rax
movq %rax, -0x70(%rbp)
jmp 0x2eac3e
movq -0xb0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xb0(%rbp)
jmp 0x2ea4b1
cmpq $-0x80000000, -0xf8(%rbp) # imm = 0x80000000
jne 0x2eac6f
movq $0x0, -0x8(%rbp)
jmp 0x2ead55
movq -0xf8(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq $0x0, -0x88(%rbp)
cmpq $0x0, -0xb0(%rbp)
jl 0x2eacce
movq -0xb0(%rbp), %rdx
movq -0x60(%rbp), %rax
movq -0x88(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x88(%rbp)
movq %rdx, (%rax,%rcx,8)
movq -0x58(%rbp), %rax
movq -0xb0(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xb0(%rbp)
jmp 0x2eac88
movq $0x0, -0xb0(%rbp)
movq -0xb0(%rbp), %rax
cmpq -0x88(%rbp), %rax
jge 0x2ead4a
movq -0x10(%rbp), %rcx
movq -0x60(%rbp), %rax
movq -0x88(%rbp), %rdx
subq -0xb0(%rbp), %rdx
subq $0x1, %rdx
imulq $0x1c, (%rax,%rdx,8), %rax
addq %rax, %rcx
movq -0x10(%rbp), %rax
imulq $0x1c, -0xb0(%rbp), %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 -0xb0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xb0(%rbp)
jmp 0x2eacd9
movq -0x88(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nopw %cs:(%rax,%rax)