// File: chhylp123[P]hifiasm/inter.cpp
// Function: linear_chain_dp(ul_ov_t*, long, ul_ov_t*, ul_idx_t const*, ug_opt_t const*, long, double, long, long, unsigned long*, unsigned long*, ma_ug_t*, long)
uint64_t linear_chain_dp(ul_ov_t *ch, int64_t ch_n, ul_ov_t *sv, 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 *idx, uint64_t *track, ma_ug_t *ug, int64_t chain_offset)
{	///all in[].el must be 1
	if(ch_n == 0) return 0;
    int64_t /**mm_ovlp, x,**/ i, j, k, sc, csc, mm_sc, mm_idx, its, ite, jts, jte, cov_i, dq, dt, dd, mm;
    ul_ov_t *li = NULL, *lj = NULL;
    radix_sort_ul_ov_srt_qe(ch, ch + ch_n);
	for (i = 1, j = 0; i <= ch_n; i++) {
		// if(i < ch_n) {
		// 	li = &(ch[i]); 
		// 	fprintf(stderr, "##(%ld) %u\t%u\t%c\tutg%.6d%c(%u)\t%u\t%u\tmm_idx:%ld\tmm_sc:%ld\n", i, li->qs, li->qe, "+-"[li->rev], 
        // 	(int32_t)(li->tn)+1, "lc"[uref->ug->u.a[li->tn].circ], uref->ug->u.a[li->tn].len, li->ts, li->te, mm_idx, mm_sc);
		// }
        if (i == ch_n || ch[i].qe != ch[j].qe) {
            if(i - j > 1) {
                radix_sort_ul_ov_srt_qs(ch+j, ch+i);
            }
            j = i;
        }
    }

	// fprintf(stderr, "[M::%s::] ch_n:%ld\n", __func__, ch_n);
	for (i = 0; i < ch_n; ++i) {
		li = &(ch[i]); 
		// mm_ovlp = max_ovlp_src(uopt, ((li->tn<<1)|li->rev)^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, ch, x+G_CHAIN_INDEL); 
		adjust_rev_tse(li, ug->g->seq[li->tn].len, &its, &ite);
		cov_i = 0;
		csc = retrieve_u_cov_region(uref, li->tn, 0, its, ite, &cov_i);
		mm_sc = csc; mm_idx = -1; 
		for (j = i-1/**x**/; j >= 0; --j) {
			lj = &(ch[j]); 
			// fprintf(stderr, "<0>\n");
			if(lj->qs <= li->qs && lj->qe <= li->qe && lj->ts <= li->ts && lj->te <= li->te) {///co-linear
				assert(li->tn == lj->tn && li->rev == lj->rev);
				// fprintf(stderr, "<1>\n");
				if(lj->qs == li->qs && lj->qe == li->qe && lj->ts == li->ts && lj->te == li->te) continue;
				dq = li->qe - lj->qs; dt = li->te - lj->ts;
				dd = (dq>dt? dq-dt:dt-dq);
				mm = MAX(dq, dt); mm *= diff_ec_ul; if(mm < bw) mm = bw;
				// fprintf(stderr, "+++i->%ld, j->%ld, dd->%ld, mm->%ld\n", i, j, dd, mm);
				if(dd <= mm) {///pass distance checking
					adjust_rev_tse(lj, ug->g->seq[lj->tn].len, &jts, &jte);
					sc = get_add_cov_score(uref, jts, jte, its, ite, li->tn, &cov_i) + pop_sc(track[j]);
					
					if((sc > mm_sc) || (sc == mm_sc && mm_idx == -1)) { ///must be >= instead of >
						mm_sc = sc, mm_idx = j;
					}
					// fprintf(stderr, "<i->%ld, its:%ld, ite:%ld>, <j->%ld, jts:%ld, jte:%ld> sc:%ld, pop_sc(track[j]):%ld, csc:%ld\n", 
					// i, its, ite, j, jts, jte, sc, pop_sc(track[j]), csc);
				}
			}
		}

		// fprintf(stderr, "##(%ld) %u\t%u\t%c\tutg%.6d%c(%u)\t%u\t%u\tmm_idx:%ld\tmm_sc:%ld\n", i, li->qs, li->qe, "+-"[li->rev], 
        // (int32_t)(li->tn)+1, "lc"[uref->ug->u.a[li->tn].circ], uref->ug->u.a[li->tn].len, li->ts, li->te, mm_idx, mm_sc);
		track[i] = push_sc_pre(mm_sc, mm_idx); 
		li->sec = (mm_idx<0?0x3FFFFFFF:i-mm_idx); sv[i] = *li;
	}

	int64_t n_u;
	for (k = ch_n-1, n_u = 0; k >= 0; --k) {
		if(track[k]&((uint64_t)0x80000000)) continue;
		i = k; ch[n_u]=sv[i]; sc = pop_sc(track[i]);
		for (;i>=0;) {
			track[i] |= ((uint64_t)0x80000000);
			if(sv[i].qs < ch[n_u].qs) ch[n_u].qs = sv[i].qs;
			if(sv[i].ts < ch[n_u].ts) ch[n_u].ts = sv[i].ts;
			if(sv[i].qe > ch[n_u].qe) ch[n_u].qe = sv[i].qe;
			if(sv[i].te > ch[n_u].te) ch[n_u].te = sv[i].te;
			// ch[n_u].qn = i;//start idx of read alignment in chain
			i = pop_pre(track[i]);
		}
		adjust_rev_tse(&(ch[n_u]), ug->g->seq[ch[n_u].tn].len, &its, &ite);
		ch[n_u].ts = its; ch[n_u].te = ite; ch[n_u].sec = (sc>0x3FFFFFFF?0x3FFFFFFF:sc);
		// ch[n_u].qn += chain_offset; //start idx of read alignment in chain
		// ch[n_u].tn = k + chain_offset; //end idx of read alignment in chain
		ch[n_u].qn = k + chain_offset; //end idx of read alignment in chain
		n_u++;
	}
	for (i = 0; i < ch_n; ++i) {
		adjust_rev_tse(&(sv[i]), ug->g->seq[sv[i].tn].len, &its, &ite);
		sv[i].ts = its; sv[i].te = ite; 
		k = pop_pre(track[i]); sv[i].tn = k>=0?k+chain_offset:(uint32_t)-1;
	}
	return n_u;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
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)
cmpq $0x0, -0x18(%rbp)
jne 0x2d01f4
movq $0x0, -0x8(%rbp)
jmp 0x2d0b22
movq $0x0, -0xc8(%rbp)
movq $0x0, -0xd0(%rbp)
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rsi
imulq $0x1c, -0x18(%rbp), %rax
addq %rax, %rsi
callq 0x27b350
movq $0x1, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x18(%rbp), %rax
jg 0x2d02a6
movq -0x48(%rbp), %rax
cmpq -0x18(%rbp), %rax
je 0x2d0263
movq -0x10(%rbp), %rax
imulq $0x1c, -0x48(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq -0x10(%rbp), %rcx
imulq $0x1c, -0x50(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x8(%rcx), %eax
je 0x2d0296
movq -0x48(%rbp), %rax
subq -0x50(%rbp), %rax
cmpq $0x1, %rax
jle 0x2d028e
movq -0x10(%rbp), %rdi
imulq $0x1c, -0x50(%rbp), %rax
addq %rax, %rdi
movq -0x10(%rbp), %rsi
imulq $0x1c, -0x48(%rbp), %rax
addq %rax, %rsi
callq 0x27b890
movq -0x48(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x2d0298
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x2d022f
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x18(%rbp), %rax
jge 0x2d073e
movq -0x10(%rbp), %rax
imulq $0x1c, -0x48(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0xc8(%rbp)
movq -0xc8(%rbp), %rdi
movq 0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rax
movq -0xc8(%rbp), %rcx
movl 0xc(%rcx), %ecx
movl (%rax,%rcx,8), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl %eax, %esi
leaq -0x80(%rbp), %rdx
leaq -0x88(%rbp), %rcx
callq 0x2cffe0
movq $0x0, -0xa0(%rbp)
movq -0x28(%rbp), %rdi
movq -0xc8(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, %esi
movq -0x80(%rbp), %rcx
movq -0x88(%rbp), %r8
xorl %edx, %edx
leaq -0xa0(%rbp), %r9
callq 0x110c0
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x70(%rbp)
movq $-0x1, -0x78(%rbp)
movq -0x48(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jl 0x2d069a
movq -0x10(%rbp), %rax
imulq $0x1c, -0x50(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0xd0(%rbp)
movq -0xd0(%rbp), %rax
movl 0x4(%rax), %eax
movq -0xc8(%rbp), %rcx
cmpl 0x4(%rcx), %eax
ja 0x2d0687
movq -0xd0(%rbp), %rax
movl 0x8(%rax), %eax
movq -0xc8(%rbp), %rcx
cmpl 0x8(%rcx), %eax
ja 0x2d0687
movq -0xd0(%rbp), %rax
movl 0x10(%rax), %eax
movq -0xc8(%rbp), %rcx
cmpl 0x10(%rcx), %eax
ja 0x2d0687
movq -0xd0(%rbp), %rax
movl 0x14(%rax), %eax
movq -0xc8(%rbp), %rcx
cmpl 0x14(%rcx), %eax
ja 0x2d0687
movq -0xc8(%rbp), %rax
movl 0xc(%rax), %ecx
movq -0xd0(%rbp), %rdx
xorl %eax, %eax
cmpl 0xc(%rdx), %ecx
movb %al, -0xd9(%rbp)
jne 0x2d0425
movq -0xc8(%rbp), %rax
movl 0x18(%rax), %eax
shrl $0x1f, %eax
movq -0xd0(%rbp), %rcx
movl 0x18(%rcx), %ecx
shrl $0x1f, %ecx
cmpl %ecx, %eax
sete %al
movb %al, -0xd9(%rbp)
movb -0xd9(%rbp), %al
testb $0x1, %al
jne 0x2d0431
jmp 0x2d0433
jmp 0x2d0452
leaq 0xc2a1e(%rip), %rdi     # 0x392e58
leaq 0xc03ee(%rip), %rsi     # 0x39082f
movl $0x3460, %edx           # imm = 0x3460
leaq 0xc2a32(%rip), %rcx     # 0x392e7f
callq 0x2130
movq -0xd0(%rbp), %rax
movl 0x4(%rax), %eax
movq -0xc8(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jne 0x2d04af
movq -0xd0(%rbp), %rax
movl 0x8(%rax), %eax
movq -0xc8(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jne 0x2d04af
movq -0xd0(%rbp), %rax
movl 0x10(%rax), %eax
movq -0xc8(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jne 0x2d04af
movq -0xd0(%rbp), %rax
movl 0x14(%rax), %eax
movq -0xc8(%rbp), %rcx
cmpl 0x14(%rcx), %eax
jne 0x2d04af
jmp 0x2d0689
movq -0xc8(%rbp), %rax
movl 0x8(%rax), %eax
movq -0xd0(%rbp), %rcx
subl 0x4(%rcx), %eax
movl %eax, %eax
movq %rax, -0xa8(%rbp)
movq -0xc8(%rbp), %rax
movl 0x14(%rax), %eax
movq -0xd0(%rbp), %rcx
subl 0x10(%rcx), %eax
movl %eax, %eax
movq %rax, -0xb0(%rbp)
movq -0xa8(%rbp), %rax
cmpq -0xb0(%rbp), %rax
jle 0x2d0510
movq -0xa8(%rbp), %rax
subq -0xb0(%rbp), %rax
movq %rax, -0xe8(%rbp)
jmp 0x2d0525
movq -0xb0(%rbp), %rax
subq -0xa8(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0xe8(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0xa8(%rbp), %rax
cmpq -0xb0(%rbp), %rax
jl 0x2d0553
movq -0xa8(%rbp), %rax
movq %rax, -0xf0(%rbp)
jmp 0x2d0561
movq -0xb0(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0xf0(%rbp), %rax
movq %rax, -0xc0(%rbp)
movsd -0x40(%rbp), %xmm1
cvtsi2sdq -0xc0(%rbp), %xmm0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rax
cmpq -0x38(%rbp), %rax
jge 0x2d05a5
movq -0x38(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0xb8(%rbp), %rax
cmpq -0xc0(%rbp), %rax
jg 0x2d0685
movq -0xd0(%rbp), %rdi
movq 0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rax
movq -0xd0(%rbp), %rcx
movl 0xc(%rcx), %ecx
movl (%rax,%rcx,8), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl %eax, %esi
leaq -0x90(%rbp), %rdx
leaq -0x98(%rbp), %rcx
callq 0x2cffe0
movq -0x28(%rbp), %rdi
movq -0x90(%rbp), %rsi
movq -0x98(%rbp), %rdx
movq -0x80(%rbp), %rcx
movq -0x88(%rbp), %r8
movq -0xc8(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, %r9d
leaq -0xa0(%rbp), %rax
movq %rax, (%rsp)
callq 0x2d0050
movq %rax, -0xf8(%rbp)
movq 0x28(%rbp), %rax
movq -0x50(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x292b40
movq %rax, %rcx
movq -0xf8(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x70(%rbp), %rax
jg 0x2d0673
movq -0x60(%rbp), %rax
cmpq -0x70(%rbp), %rax
jne 0x2d0683
cmpq $-0x1, -0x78(%rbp)
jne 0x2d0683
movq -0x60(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x78(%rbp)
jmp 0x2d0685
jmp 0x2d0687
jmp 0x2d0689
movq -0x50(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x2d035c
movq -0x70(%rbp), %rdi
movq -0x78(%rbp), %rsi
callq 0x292ac0
movq %rax, %rdx
movq 0x28(%rbp), %rax
movq -0x48(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
cmpq $0x0, -0x78(%rbp)
jge 0x2d06cb
movl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
movq %rax, -0x100(%rbp)
jmp 0x2d06da
movq -0x48(%rbp), %rax
subq -0x78(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0x100(%rbp), %rax
movl %eax, %edx
movq -0xc8(%rbp), %rax
movl 0x18(%rax), %ecx
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
andl $0xc0000000, %ecx       # imm = 0xC0000000
orl %edx, %ecx
movl %ecx, 0x18(%rax)
movq -0xc8(%rbp), %rcx
movq -0x20(%rbp), %rax
imulq $0x1c, -0x48(%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 -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x2d02ae
movq -0x18(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x58(%rbp)
movq $0x0, -0xd8(%rbp)
cmpq $0x0, -0x58(%rbp)
jl 0x2d0a2d
movq 0x28(%rbp), %rcx
movq -0x58(%rbp), %rdx
movabsq $0x80000000, %rax       # imm = 0x80000000
andq (%rcx,%rdx,8), %rax
cmpq $0x0, %rax
je 0x2d0781
jmp 0x2d0a1c
movq -0x58(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rcx
imulq $0x1c, -0x48(%rbp), %rax
addq %rax, %rcx
movq -0x10(%rbp), %rax
imulq $0x1c, -0xd8(%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 0x28(%rbp), %rax
movq -0x48(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x292b40
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x48(%rbp)
jl 0x2d0924
movq 0x28(%rbp), %rax
movq -0x48(%rbp), %rcx
movabsq $0x80000000, %rdx       # imm = 0x80000000
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x20(%rbp), %rax
imulq $0x1c, -0x48(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq -0x10(%rbp), %rcx
imulq $0x1c, -0xd8(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x4(%rcx), %eax
jae 0x2d083e
movq -0x20(%rbp), %rax
imulq $0x1c, -0x48(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %ecx
movq -0x10(%rbp), %rax
imulq $0x1c, -0xd8(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movq -0x20(%rbp), %rax
imulq $0x1c, -0x48(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movq -0x10(%rbp), %rcx
imulq $0x1c, -0xd8(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x10(%rcx), %eax
jae 0x2d0882
movq -0x20(%rbp), %rax
imulq $0x1c, -0x48(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %ecx
movq -0x10(%rbp), %rax
imulq $0x1c, -0xd8(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x10(%rax)
movq -0x20(%rbp), %rax
imulq $0x1c, -0x48(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq -0x10(%rbp), %rcx
imulq $0x1c, -0xd8(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x8(%rcx), %eax
jbe 0x2d08c6
movq -0x20(%rbp), %rax
imulq $0x1c, -0x48(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %ecx
movq -0x10(%rbp), %rax
imulq $0x1c, -0xd8(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
movq -0x20(%rbp), %rax
imulq $0x1c, -0x48(%rbp), %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movq -0x10(%rbp), %rcx
imulq $0x1c, -0xd8(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x14(%rcx), %eax
jbe 0x2d090a
movq -0x20(%rbp), %rax
imulq $0x1c, -0x48(%rbp), %rcx
addq %rcx, %rax
movl 0x14(%rax), %ecx
movq -0x10(%rbp), %rax
imulq $0x1c, -0xd8(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x14(%rax)
movq 0x28(%rbp), %rax
movq -0x48(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x292ba0
movq %rax, -0x48(%rbp)
jmp 0x2d07d5
movq -0x10(%rbp), %rdi
imulq $0x1c, -0xd8(%rbp), %rax
addq %rax, %rdi
movq 0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rax
movq -0x10(%rbp), %rcx
imulq $0x1c, -0xd8(%rbp), %rdx
addq %rdx, %rcx
movl 0xc(%rcx), %ecx
movl (%rax,%rcx,8), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl %eax, %esi
leaq -0x80(%rbp), %rdx
leaq -0x88(%rbp), %rcx
callq 0x2cffe0
movq -0x80(%rbp), %rax
movl %eax, %ecx
movq -0x10(%rbp), %rax
imulq $0x1c, -0xd8(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x10(%rax)
movq -0x88(%rbp), %rax
movl %eax, %ecx
movq -0x10(%rbp), %rax
imulq $0x1c, -0xd8(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x14(%rax)
cmpq $0x3fffffff, -0x60(%rbp) # imm = 0x3FFFFFFF
jle 0x2d09b8
movl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
movq %rax, -0x108(%rbp)
jmp 0x2d09c3
movq -0x60(%rbp), %rax
movq %rax, -0x108(%rbp)
movq -0x108(%rbp), %rax
movl %eax, %edx
movq -0x10(%rbp), %rax
imulq $0x1c, -0xd8(%rbp), %rcx
addq %rcx, %rax
movl 0x18(%rax), %ecx
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
andl $0xc0000000, %ecx       # imm = 0xC0000000
orl %edx, %ecx
movl %ecx, 0x18(%rax)
movq -0x58(%rbp), %rax
addq 0x38(%rbp), %rax
movl %eax, %ecx
movq -0x10(%rbp), %rax
imulq $0x1c, -0xd8(%rbp), %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movq -0xd8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xd8(%rbp)
movq -0x58(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x2d0755
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x18(%rbp), %rax
jge 0x2d0b17
movq -0x20(%rbp), %rdi
imulq $0x1c, -0x48(%rbp), %rax
addq %rax, %rdi
movq 0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rax
movq -0x20(%rbp), %rcx
imulq $0x1c, -0x48(%rbp), %rdx
addq %rdx, %rcx
movl 0xc(%rcx), %ecx
movl (%rax,%rcx,8), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl %eax, %esi
leaq -0x80(%rbp), %rdx
leaq -0x88(%rbp), %rcx
callq 0x2cffe0
movq -0x80(%rbp), %rax
movl %eax, %ecx
movq -0x20(%rbp), %rax
imulq $0x1c, -0x48(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x10(%rax)
movq -0x88(%rbp), %rax
movl %eax, %ecx
movq -0x20(%rbp), %rax
imulq $0x1c, -0x48(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x14(%rax)
movq 0x28(%rbp), %rax
movq -0x48(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x292ba0
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x58(%rbp)
jl 0x2d0ae0
movq -0x58(%rbp), %rax
addq 0x38(%rbp), %rax
movq %rax, -0x110(%rbp)
jmp 0x2d0aee
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, -0x110(%rbp)
jmp 0x2d0aee
movq -0x110(%rbp), %rax
movl %eax, %ecx
movq -0x20(%rbp), %rax
imulq $0x1c, -0x48(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0xc(%rax)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x2d0a35
movq -0xd8(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
nop