// File: chhylp123[P]hifiasm/inter.cpp
// Function: flat_contain(All_reads*, ul_idx_t const*, ug_opt_t const*, long, double, long, long, long, long, ul_ov_t*, long, int*, int*, long*, long*, ul_ov_t*)
int64_t flat_contain(All_reads *ridx, 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, 
ul_ov_t *a, int64_t a_n, int32_t *t, int32_t *c_n, int64_t *p, int64_t *f, ul_ov_t *idx)
{
	if(a_n <= 0) return 0;
	int64_t mm_ovlp, x, i, j, st, max_ii, mm_sc, mm_n, mm_idx, n_skip, end_j, qo, sc, sn, is_c, cl, csc; 
	uint32_t li_v, lj_v; ul_ov_t *li, *lj; int64_t max, max_n, tot_sc = INT32_MIN, tot_n = INT32_MIN, tot_i = -1;
	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;
		}
	}
	// fprintf(stderr, "\n[M::%s::] sc::%u\n", __func__, idx->qn);
	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;
		// fprintf(stderr, "[i::%ld] (id::%u)%.*s\t%c\tq::[%u, %u)\tt::[%u, %u)\tc::%u\n", i, li->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);
        mm_ovlp = max_ovlp_src(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); csc = ((li->el)?(li->qe-li->qs):(0));
        mm_sc = csc; mm_n = 1; mm_idx = -1; n_skip = 0; end_j = -1; 
        if ((x-st) > max_iter) st = x-max_iter;
		for (j = x; j >= st; --j) { // collect potential destination vertices
            lj = &(a[j]); lj_v = (lj->tn<<1)|lj->rev;
            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
            qo = infer_rovlp(li, lj, NULL, NULL, ridx, NULL); ///overlap length in query (UL read)
            if(li_v != lj_v && get_ecov_contain_adv(uref, uopt, li_v^1, lj_v^1, bw, diff_ec_ul, qo, &is_c)) {
				if(is_c == 0) {
					sc = f[j] + csc; sn = c_n[j] + 1;
					// if(li->tn == 20171) {
					// 	fprintf(stderr, "[i::%ld] (id::%u)%.*s\t%c\tj::%ld\tsc::%ld\tsn::%ld\n", i, li->tn,
					// 		(int)Get_NAME_LENGTH(R_INF, a[i].tn), Get_NAME(R_INF, a[i].tn), 
					// 		"+-"[a[i].rev], j, sc, sn);
					// }
					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;
				}
            }
        }

		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 (max_ii >= 0 && max_ii < end_j) {///just have a try with a[i]<->a[max_ii]
            lj = &(a[max_ii]); lj_v = (lj->tn<<1)|lj->rev;
            if(lj->qe > li->qs && lj->qs < li->qs) {
				qo = infer_rovlp(li, lj, NULL, NULL, ridx, NULL); ///overlap length in query (UL read)
                if(li_v != lj_v && get_ecov_contain_adv(uref, uopt, li_v^1, lj_v^1, bw, diff_ec_ul, qo, &is_c)) {
					if(is_c == 0) {
						sc = f[max_ii] + csc; 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;
						}
					}
				}
            }
        }

		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;
        }

		if((tot_sc < f[i]) || ((tot_sc == f[i]) && (tot_n < c_n[i]))) {
			tot_sc = f[i]; tot_n = c_n[i]; tot_i = i;
		}
	}
	cl = 0; i = tot_i; 
	while (i >= 0) {
        t[cl++] = i; i = p[i];
    }
	idx->qs = a[t[cl-1]].qs; idx->qe = a[t[cl-1]].qe;
	for (i = 0; i < cl; i++) {
		a[i] = a[t[cl-i-1]];
		if(a[i].qs < idx->qs) idx->qs = a[i].qs;
		if(a[i].qe > idx->qe) idx->qe = a[i].qe;
	}
	return cl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
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, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movsd %xmm0, -0x30(%rbp)
movq %r8, -0x38(%rbp)
movq %r9, -0x40(%rbp)
cmpq $0x0, 0x28(%rbp)
jg 0x2b5310
movq $0x0, -0x8(%rbp)
jmp 0x2b5ca9
movq $-0x80000000, -0xf8(%rbp) # imm = 0x80000000
movq $-0x80000000, -0x100(%rbp) # imm = 0x80000000
movq $-0x1, -0x108(%rbp)
movq $0x1, -0x58(%rbp)
movq $0x0, -0x60(%rbp)
movq -0x58(%rbp), %rax
cmpq 0x28(%rbp), %rax
jg 0x2b53b8
movq -0x58(%rbp), %rax
cmpq 0x28(%rbp), %rax
je 0x2b5375
movq 0x20(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq 0x20(%rbp), %rcx
imulq $0x1c, -0x60(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x8(%rcx), %eax
je 0x2b53a8
movq -0x58(%rbp), %rax
subq -0x60(%rbp), %rax
cmpq $0x1, %rax
jle 0x2b53a0
movq 0x20(%rbp), %rdi
imulq $0x1c, -0x60(%rbp), %rax
addq %rax, %rdi
movq 0x20(%rbp), %rsi
imulq $0x1c, -0x58(%rbp), %rax
addq %rax, %rsi
callq 0x27b890
movq -0x58(%rbp), %rax
movq %rax, -0x60(%rbp)
jmp 0x2b53aa
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x2b5341
movq 0x30(%rbp), %rdi
movq 0x28(%rbp), %rdx
shlq $0x2, %rdx
xorl %esi, %esi
callq 0x2100
movq $0x0, -0x68(%rbp)
movq $0x0, -0x58(%rbp)
movq $-0x1, -0x70(%rbp)
movq -0x58(%rbp), %rax
cmpq 0x28(%rbp), %rax
jge 0x2b5b2b
movq 0x20(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0xd8(%rbp)
movq -0xd8(%rbp), %rax
movl 0xc(%rax), %eax
shll %eax
movq -0xd8(%rbp), %rcx
movl 0x18(%rcx), %ecx
shrl $0x1f, %ecx
orl %ecx, %eax
movl %eax, -0xcc(%rbp)
movq -0x20(%rbp), %rdi
movl -0xcc(%rbp), %esi
xorl $0x1, %esi
callq 0x287de0
movq %rax, -0x48(%rbp)
movq -0xd8(%rbp), %rax
movl 0x4(%rax), %eax
addq -0x48(%rbp), %rax
cvtsi2sd %rax, %xmm0
mulsd -0x30(%rbp), %xmm0
cvttsd2si %xmm0, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x28(%rbp), %rax
jge 0x2b546e
movq -0x28(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0xd8(%rbp), %rax
movl 0x4(%rax), %eax
addq -0x48(%rbp), %rax
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq -0x38(%rbp), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
jle 0x2b54a1
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
movq -0x58(%rbp), %rax
movl %eax, %edi
movq 0x20(%rbp), %rsi
movq -0x50(%rbp), %rax
addq $0x80, %rax
movl %eax, %edx
callq 0x28cf00
cltq
movq %rax, -0x50(%rbp)
movq -0xd8(%rbp), %rax
movl 0x18(%rax), %eax
shrl $0x1e, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x2b54f3
movq -0xd8(%rbp), %rax
movl 0x8(%rax), %eax
movq -0xd8(%rbp), %rcx
subl 0x4(%rcx), %eax
movl %eax, -0x10c(%rbp)
jmp 0x2b54fd
xorl %eax, %eax
movl %eax, -0x10c(%rbp)
jmp 0x2b54fd
movl -0x10c(%rbp), %eax
movl %eax, %eax
movq %rax, -0xc8(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x78(%rbp)
movq $0x1, -0x80(%rbp)
movq $-0x1, -0x88(%rbp)
movq $0x0, -0x90(%rbp)
movq $-0x1, -0x98(%rbp)
movq -0x50(%rbp), %rax
subq -0x68(%rbp), %rax
cmpq 0x10(%rbp), %rax
jle 0x2b555a
movq -0x50(%rbp), %rax
subq 0x10(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x68(%rbp), %rax
jl 0x2b5752
movq 0x20(%rbp), %rax
imulq $0x1c, -0x60(%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, -0xd0(%rbp)
movq -0xe0(%rbp), %rax
movl 0x8(%rax), %eax
movq -0xd8(%rbp), %rcx
cmpl 0x4(%rcx), %eax
ja 0x2b55bf
jmp 0x2b5752
movq -0xd8(%rbp), %rdi
movq -0xe0(%rbp), %rsi
movq -0x10(%rbp), %r8
xorl %eax, %eax
movl %eax, %r9d
movq %r9, %rdx
movq %r9, %rcx
callq 0x71a90
movq %rax, -0xa0(%rbp)
movl -0xcc(%rbp), %eax
cmpl -0xd0(%rbp), %eax
je 0x2b573f
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl -0xcc(%rbp), %edx
xorl $0x1, %edx
movl -0xd0(%rbp), %ecx
xorl $0x1, %ecx
movq -0x28(%rbp), %r8
movsd -0x30(%rbp), %xmm0
movq -0xa0(%rbp), %r9
leaq -0xb8(%rbp), %rax
movq %rax, (%rsp)
callq 0x2b0c90
cmpq $0x0, %rax
je 0x2b573f
cmpq $0x0, -0xb8(%rbp)
jne 0x2b573d
movq 0x48(%rbp), %rax
movq -0x60(%rbp), %rcx
movq (%rax,%rcx,8), %rax
addq -0xc8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq 0x38(%rbp), %rax
movq -0x60(%rbp), %rcx
movl (%rax,%rcx,4), %eax
addl $0x1, %eax
cltq
movq %rax, -0xb0(%rbp)
movq -0xa8(%rbp), %rax
cmpq -0x78(%rbp), %rax
jg 0x2b56a4
movq -0xa8(%rbp), %rax
cmpq -0x78(%rbp), %rax
jne 0x2b56e3
movq -0xb0(%rbp), %rax
cmpq -0x80(%rbp), %rax
jle 0x2b56e3
movq -0xa8(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0xb0(%rbp), %rax
movq %rax, -0x80(%rbp)
cmpq $0x0, -0x90(%rbp)
jle 0x2b56e1
movq -0x90(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x90(%rbp)
jmp 0x2b5713
movq 0x30(%rbp), %rax
movq -0x60(%rbp), %rcx
movslq (%rax,%rcx,4), %rax
cmpq -0x58(%rbp), %rax
jne 0x2b5711
movq -0x90(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x90(%rbp)
cmpq -0x40(%rbp), %rax
jle 0x2b570f
jmp 0x2b5752
jmp 0x2b5711
jmp 0x2b5713
movq 0x40(%rbp), %rax
movq -0x60(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
jl 0x2b573b
movq -0x58(%rbp), %rax
movl %eax, %edx
movq 0x30(%rbp), %rax
movq 0x40(%rbp), %rcx
movq -0x60(%rbp), %rsi
movq (%rcx,%rsi,8), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x2b573d
jmp 0x2b573f
jmp 0x2b5741
movq -0x60(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x2b5562
movq -0x60(%rbp), %rax
movq %rax, -0x98(%rbp)
cmpq $0x0, -0x70(%rbp)
jl 0x2b578f
movq 0x20(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq 0x20(%rbp), %rcx
imulq $0x1c, -0x70(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
addq 0x18(%rbp), %rcx
cmpq %rcx, %rax
jle 0x2b5890
movq $-0x80000000, -0xe8(%rbp) # imm = 0x80000000
movq $-0x80000000, -0xf0(%rbp) # imm = 0x80000000
movq $-0x1, -0x70(%rbp)
movq -0x58(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rcx
xorl %eax, %eax
cmpq -0x68(%rbp), %rcx
movb %al, -0x10d(%rbp)
jl 0x2b57fc
movq 0x20(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq 0x18(%rbp), %rcx
movq 0x20(%rbp), %rdx
imulq $0x1c, -0x60(%rbp), %rsi
addq %rsi, %rdx
movl 0x8(%rdx), %edx
addq %rdx, %rcx
cmpq %rcx, %rax
setle %al
movb %al, -0x10d(%rbp)
movb -0x10d(%rbp), %al
testb $0x1, %al
jne 0x2b580b
jmp 0x2b588e
movq -0xe8(%rbp), %rax
movq 0x48(%rbp), %rcx
movq -0x60(%rbp), %rdx
cmpq (%rcx,%rdx,8), %rax
jl 0x2b584d
movq -0xe8(%rbp), %rax
movq 0x48(%rbp), %rcx
movq -0x60(%rbp), %rdx
cmpq (%rcx,%rdx,8), %rax
jne 0x2b587b
movq -0xf0(%rbp), %rax
movq 0x38(%rbp), %rcx
movq -0x60(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
cmpq %rcx, %rax
jge 0x2b587b
movq 0x48(%rbp), %rax
movq -0x60(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xe8(%rbp)
movq 0x38(%rbp), %rax
movq -0x60(%rbp), %rcx
movslq (%rax,%rcx,4), %rax
movq %rax, -0xf0(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x70(%rbp)
jmp 0x2b587d
movq -0x60(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x2b57b9
jmp 0x2b5890
cmpq $0x0, -0x70(%rbp)
jl 0x2b5a1e
movq -0x70(%rbp), %rax
cmpq -0x98(%rbp), %rax
jge 0x2b5a1e
movq 0x20(%rbp), %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, -0xd0(%rbp)
movq -0xe0(%rbp), %rax
movl 0x8(%rax), %eax
movq -0xd8(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jbe 0x2b5a1c
movq -0xe0(%rbp), %rax
movl 0x4(%rax), %eax
movq -0xd8(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jae 0x2b5a1c
movq -0xd8(%rbp), %rdi
movq -0xe0(%rbp), %rsi
movq -0x10(%rbp), %r8
xorl %eax, %eax
movl %eax, %r9d
movq %r9, %rdx
movq %r9, %rcx
callq 0x71a90
movq %rax, -0xa0(%rbp)
movl -0xcc(%rbp), %eax
cmpl -0xd0(%rbp), %eax
je 0x2b5a1a
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl -0xcc(%rbp), %edx
xorl $0x1, %edx
movl -0xd0(%rbp), %ecx
xorl $0x1, %ecx
movq -0x28(%rbp), %r8
movsd -0x30(%rbp), %xmm0
movq -0xa0(%rbp), %r9
leaq -0xb8(%rbp), %rax
movq %rax, (%rsp)
callq 0x2b0c90
cmpq $0x0, %rax
je 0x2b5a1a
cmpq $0x0, -0xb8(%rbp)
jne 0x2b5a18
movq 0x48(%rbp), %rax
movq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rax
addq -0xc8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq 0x38(%rbp), %rax
movq -0x70(%rbp), %rcx
movl (%rax,%rcx,4), %eax
addl $0x1, %eax
cltq
movq %rax, -0xb0(%rbp)
movq -0xa8(%rbp), %rax
cmpq -0x78(%rbp), %rax
jg 0x2b59f5
movq -0xa8(%rbp), %rax
cmpq -0x78(%rbp), %rax
jne 0x2b5a16
movq -0xb0(%rbp), %rax
cmpq -0x80(%rbp), %rax
jle 0x2b5a16
movq -0xa8(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0xb0(%rbp), %rax
movq %rax, -0x80(%rbp)
jmp 0x2b5a18
jmp 0x2b5a1a
jmp 0x2b5a1c
jmp 0x2b5a1e
movq -0x78(%rbp), %rdx
movq 0x48(%rbp), %rax
movq -0x58(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x88(%rbp), %rdx
movq 0x40(%rbp), %rax
movq -0x58(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x80(%rbp), %rax
movl %eax, %edx
movq 0x38(%rbp), %rax
movq -0x58(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
cmpq $0x0, -0x70(%rbp)
jl 0x2b5a9d
movq 0x20(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq 0x18(%rbp), %rcx
movq 0x20(%rbp), %rdx
imulq $0x1c, -0x70(%rbp), %rsi
addq %rsi, %rdx
movl 0x8(%rdx), %edx
addq %rdx, %rcx
cmpq %rcx, %rax
jg 0x2b5aa5
movq 0x48(%rbp), %rax
movq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x48(%rbp), %rcx
movq -0x58(%rbp), %rdx
cmpq (%rcx,%rdx,8), %rax
jge 0x2b5aa5
movq -0x58(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0xf8(%rbp), %rax
movq 0x48(%rbp), %rcx
movq -0x58(%rbp), %rdx
cmpq (%rcx,%rdx,8), %rax
jl 0x2b5ae7
movq -0xf8(%rbp), %rax
movq 0x48(%rbp), %rcx
movq -0x58(%rbp), %rdx
cmpq (%rcx,%rdx,8), %rax
jne 0x2b5b18
movq -0x100(%rbp), %rax
movq 0x38(%rbp), %rcx
movq -0x58(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
cmpq %rcx, %rax
jge 0x2b5b18
movq 0x48(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xf8(%rbp)
movq 0x38(%rbp), %rax
movq -0x58(%rbp), %rcx
movslq (%rax,%rcx,4), %rax
movq %rax, -0x100(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x108(%rbp)
jmp 0x2b5b1a
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x2b53e3
movq $0x0, -0xc0(%rbp)
movq -0x108(%rbp), %rax
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x58(%rbp)
jl 0x2b5b7c
movq -0x58(%rbp), %rax
movl %eax, %edx
movq 0x30(%rbp), %rax
movq -0xc0(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0xc0(%rbp)
movl %edx, (%rax,%rcx,4)
movq 0x40(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x58(%rbp)
jmp 0x2b5b41
movq 0x20(%rbp), %rax
movq 0x30(%rbp), %rcx
movq -0xc0(%rbp), %rdx
subq $0x1, %rdx
movslq (%rcx,%rdx,4), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %ecx
movq 0x50(%rbp), %rax
movl %ecx, 0x4(%rax)
movq 0x20(%rbp), %rax
movq 0x30(%rbp), %rcx
movq -0xc0(%rbp), %rdx
subq $0x1, %rdx
movslq (%rcx,%rdx,4), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %ecx
movq 0x50(%rbp), %rax
movl %ecx, 0x8(%rax)
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpq -0xc0(%rbp), %rax
jge 0x2b5c9e
movq 0x20(%rbp), %rcx
movq 0x30(%rbp), %rax
movq -0xc0(%rbp), %rdx
subq -0x58(%rbp), %rdx
subq $0x1, %rdx
movslq (%rax,%rdx,4), %rax
imulq $0x1c, %rax, %rax
addq %rax, %rcx
movq 0x20(%rbp), %rax
imulq $0x1c, -0x58(%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 0x20(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq 0x50(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jae 0x2b5c5d
movq 0x20(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %ecx
movq 0x50(%rbp), %rax
movl %ecx, 0x4(%rax)
movq 0x20(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq 0x50(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jbe 0x2b5c8b
movq 0x20(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %ecx
movq 0x50(%rbp), %rax
movl %ecx, 0x8(%rax)
jmp 0x2b5c8d
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x2b5bd4
movq -0xc0(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
nopw %cs:(%rax,%rax)