// File: chhylp123[P]hifiasm/inter.cpp
// Function: linear_ctg_trans_chain_dp(unsigned int, ul_ov_t*, long, ul_idx_t const*, ug_opt_t const*, long, double, double, double, long, long, long, long, long, Chain_Data*, ul_ov_t*, asg64_v*)
uint64_t linear_ctg_trans_chain_dp(uint32_t qid, ul_ov_t *ch, int64_t ch_n, const ul_idx_t *uref, const ug_opt_t *uopt, int64_t bw, 
double diff_ec_ul, double ovlp_max, double unmatch_max, int64_t qlen, int64_t tlen, int64_t max_skip, int64_t max_iter, int64_t max_dis, Chain_Data* dp, ul_ov_t *res, asg64_v *ea)
{
	memset(res, 0, sizeof((*res)));
	if(ch_n == 0) return 0;
    int64_t i, j, k, l, sc, csc, se, cse, mm_sc, mm_se, mm_idx, max, max_e, peak_sc, peak_e, peak_i, rts, rte, rqs, rqe;
    ul_ov_t *li = NULL, *lj = NULL; int64_t *f, *e, st, plus, max_ii, n_skip, end_j; int32_t *p, *t;
    resize_Chain_Data(dp, ch_n, NULL);
    e = dp->tmp; f = dp->pre; p = dp->score; t = dp->indels;

	i = 0;
	if(i < ch_n) {
		ch[i].tn >>= 1;
		if(ch[i].rev) {
			adjust_rev_tse(&(ch[i]), tlen, &rts, &rte);
			ch[i].ts = rts; ch[i].te = rte; 
		}
	}

	for (i = 1, j = 0; i <= ch_n; i++) {
		if(i < ch_n) {
			ch[i].tn >>= 1;
			if(ch[i].rev) {
				adjust_rev_tse(&(ch[i]), tlen, &rts, &rte);
				ch[i].ts = rts; ch[i].te = rte; 
			}
		}
        if (i == ch_n || ch[i].rev != ch[j].rev) {
            if(i - j > 1) {
				radix_sort_ul_ov_srt_qe(ch+j, ch+i);
				for (k = j + 1, l = j; k <= i; k++) {
					if(k == i || ch[k].qe != ch[l].qe) {
						if(k - l > 1) radix_sort_ul_ov_srt_qs(ch+l, ch+k);
						l = k;
					}
				}
			}
            j = i;
        }
    }

    // fprintf(stderr, "[M::%s::] ch_n:%ld\n", __func__, ch_n);
    memset(t, 0, (ch_n*sizeof((*t)))); peak_sc = peak_e = peak_i = INT32_MIN;
    for (i = st = plus = 0, max_ii = -1; i < ch_n; ++i) {
        li = &(ch[i]); csc = li->sec; cse = 0; 
		if(li->el || li->qn == RC_0 || li->qn == RC_1) cse = li->qe - li->qs;

        mm_sc = csc; mm_se = cse; mm_idx = -1; n_skip = 0; end_j = -1; 
        st = (i<max_iter)?(0):(i-max_iter);
		while (ch[i].rev != ch[st].rev) ++st;

		// if(qid == 2 && qlen == 112183461 && ch[i].tn == 30 && tlen == 24761445) {
		// 	 fprintf(stderr, "+(%ld)[M::%s] h2tg%.6u%c\t%ld\t%u\t%u\t%c\th1tg%.6u%c\t%ld\t%u\t%u\tsec(%u)\tel(%u)\tf(%u)\n", i, __func__,
        //     	qid+1, "lc"[0], qlen, ch[i].qs, ch[i].qe, "+-"[ch[i].rev], ch[i].tn+1, "lc"[0], tlen, ch[i].ts, ch[i].te, ch[i].sec, ch[i].el, ch[i].qn);
		// } else if(ch[i].tn == 2 && tlen == 112183461 && ch[i].qn == 30 && qlen == 24761445) {
		// 	fprintf(stderr, "+(%ld)[M::%s] h1tg%.6u%c\t%ld\t%u\t%u\t%c\th2tg%.6u%c\t%ld\t%u\t%u\tsec(%u)\tel(%u)\tf(%u)\n", i, __func__,
        //     	qid+1, "lc"[0], qlen, ch[i].qs, ch[i].qe, "+-"[ch[i].rev], ch[i].tn+1, "lc"[0], tlen, ch[i].ts, ch[i].te, ch[i].sec, ch[i].el, ch[i].qn);
		// }

        for (j = i-1; j >= st; --j) {
            lj = &(ch[j]); 
            sc = comput_linear_ctg_trans_sc(li, lj, diff_ec_ul, ovlp_max, bw); ///should allow contain
            if(sc == INT32_MIN) continue;
            sc += f[j]; se = cse + e[j];
            if((sc > mm_sc) || (sc == mm_sc && se > mm_se)) {
                mm_sc = sc, mm_se = se, 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 || (ch[i].qe>(ch[max_ii].qe+max_dis))) {//too long
            max = INT32_MIN; max_e = INT32_MIN; max_ii = -1;
            for (j = i - 1; (j >= st) && (ch[i].qe<=(max_dis+ch[j].qe)); --j) {
                if ((max < f[j]) || (max == f[j] && max_e < e[j])) {
                    max = f[j], max_e = e[j], max_ii = j;
                }
            }
        }
        
        if (max_ii >= 0 && max_ii < end_j) {///just have a try with a[i]<->a[max_ii]
            lj = &(ch[max_ii]); 
            sc = comput_linear_ctg_trans_sc(li, lj, diff_ec_ul, ovlp_max, bw); ///should allow contain
            if(sc != INT32_MIN) {
                sc += f[max_ii];
				se = cse + e[max_ii];
                if((sc > mm_sc) || (sc == mm_sc && se > mm_se)) {
                    mm_sc = sc; mm_se = se; mm_idx = max_ii;
                }
            }
        }
		
        f[i] = mm_sc; e[i] = mm_se; p[i] = mm_idx; 
        if ((max_ii < 0) || ((ch[i].qe<=max_dis+ch[max_ii].qe) && ((f[max_ii]<f[i]) || (f[max_ii] == f[i] && e[max_ii] < e[i])))) {
            max_ii = i;
        }

		if((f[i] > peak_sc) || (f[i] == peak_sc || e[i] > peak_e)) {
			peak_sc = f[i]; peak_e = e[i]; peak_i = i;
		}
        // li->sec = (mm_idx<0?0x3FFFFFFF:i-mm_idx); 
        // sv[i] = *li;
        // 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;
    }

	if(peak_i < 0) return 0;

	uint64_t qs, qgap = 0, ts, tgap = 0, eqs = (uint64_t)-1, eqe = (uint64_t)-1, ea_n = ea->n;
	i = peak_i; *res = ch[i]; 
	res->qn = ((peak_sc>UINT32_MAX)?(UINT32_MAX):(peak_sc));
	res->sec = 0; qs = res->qs; ts = res->ts; 

	// memset(er, 0, sizeof((*er))); er->qs = er->qe = er->ts = er->te = (uint32_t)-1;
	// er->qn = ((peak_e>UINT32_MAX)?(UINT32_MAX):(peak_e));
    
	///has been sorted by qe && te
	while (i >= 0) {
		if(ch[i].qe >= qs) {
			if(ch[i].qs < qs) qs = ch[i].qs;
		} else {
			qgap += qs - ch[i].qe;
			qs = ch[i].qs; 
		}

		if(ch[i].te >= ts) {
			if(ch[i].ts < ts) ts = ch[i].ts;
		} else {
			tgap += ts - ch[i].te;
			ts = ch[i].ts; 
		} 

		if(ch[i].el || ch[i].qn == RC_0 || ch[i].qn == RC_1) {///reliable
			if ((ea->n > ea_n) && (ch[i].qe >= (ea->a[ea->n-1]>>32))) {
				if(ch[i].qs < (ea->a[ea->n-1]>>32)) {
					eqs = ch[i].qs; eqe = (uint32_t)(ea->a[ea->n-1]);
					ea->a[ea->n-1] = eqs << 32; ea->a[ea->n-1] |= eqe;
				}
			} else {
				eqs = ch[i].qs; eqe = ch[i].qe; eqs <<= 32; eqs |= eqe;
				kv_push(uint64_t, *ea, eqs);
				// ea->a[ea->n-1] = eqs << 32; ea->a[ea->n-1] |= eqe;
			}
		}

		if(ch[i].qs < res->qs) res->qs = ch[i].qs;
		if(ch[i].qe > res->qe) res->qe = ch[i].qe;
		if(ch[i].ts < res->ts) res->ts = ch[i].ts;
		if(ch[i].te > res->te) res->te = ch[i].te;
		// if(qid == 2 && qlen == 112183461 && ch[i].tn == 30 && tlen == 24761445) {
		// 	 fprintf(stderr, "-(%ld)[M::%s] h2tg%.6u%c\t%ld\t%u\t%u\t%c\th1tg%.6u%c\t%ld\t%u\t%u\tsec(%u)\tel(%u)\tf(%u)\n", i, __func__,
        //     	qid+1, "lc"[0], qlen, ch[i].qs, ch[i].qe, "+-"[ch[i].rev], ch[i].tn+1, "lc"[0], tlen, ch[i].ts, ch[i].te, ch[i].sec, ch[i].el, ch[i].qn);
		// } else if(ch[i].tn == 2 && tlen == 112183461 && ch[i].qn == 30 && qlen == 24761445) {
		// 	fprintf(stderr, "-(%ld)[M::%s] h1tg%.6u%c\t%ld\t%u\t%u\t%c\th2tg%.6u%c\t%ld\t%u\t%u\tsec(%u)\tel(%u)\tf(%u)\n", i, __func__,
        //     	qid+1, "lc"[0], qlen, ch[i].qs, ch[i].qe, "+-"[ch[i].rev], ch[i].tn+1, "lc"[0], tlen, ch[i].ts, ch[i].te, ch[i].sec, ch[i].el, ch[i].qn);
		// }
        i = p[i];
    }
	////0x3fffffff
	// if(qgap > 0x3fffffff || tgap > 0x3fffffff) {
	// 	ea->n = ea_n; return 0;
	// }

	adjust_rev_tse(res, tlen, &rts, &rte);
	res->ts = rts; res->te = rte; 
	extend_end_coord(NULL, res, qlen, tlen, &rqs, &rqe, &rts, &rte);
	qgap += (rqe - rqs) - (res->qe - res->qs);
	tgap += (rte - rts) - (res->te - res->ts);

	// if(qid == 2 && qlen == 112183461 && ch[0].tn == 30 && tlen == 24761445) {
	// 	fprintf(stderr, "+(%ld)[M::%s] h2tg%.6u%c\t%ld\t%ld(%u)\t%ld(%u)\t%c\th1tg%.6u%c\t%ld\t%ld(%u)\t%ld(%u)\tqgap(%ld)\ttgap(%ld)\n", i, __func__,
	// 	qid+1, "lc"[0], qlen, rqs, res->qs, rqe, res->qe, "+-"[ch[0].rev], ch[0].tn+1, "lc"[0], tlen, rts, res->ts, rte, res->te, qgap, tgap);
	// } else if(ch[i].tn == 2 && tlen == 112183461 && ch[0].qn == 30 && qlen == 24761445) {
	// 	fprintf(stderr, "+(%ld)[M::%s] h2tg%.6u%c\t%ld\t%ld(%u)\t%ld(%u)\t%c\th1tg%.6u%c\t%ld\t%ld(%u)\t%ld(%u)\tqgap(%ld)\ttgap(%ld)\n", i, __func__,
	// 	qid+1, "lc"[0], qlen, rqs, res->qs, rqe, res->qe, "+-"[ch[0].rev], ch[0].tn+1, "lc"[0], tlen, rts, res->ts, rte, res->te, qgap, tgap);
	// }

	// if(qgap > 0x3fffffff || tgap > 0x3fffffff) {
	// 	ea->n = ea_n; return 0;
	// }
	if((qgap > ((rqe-rqs)*unmatch_max)) || (tgap > ((rte-rts)*unmatch_max))) {
		ea->n = ea_n; return 0;
	}

	double qrate = ((double)((rqe-rqs)-qgap))/((double)(rqe-rqs));
	double trate = ((double)((rte-rts)-tgap))/((double)(rte-rts));
	double mrate = MIN(qrate, trate); if(mrate < 0) mrate = 0;
	res->qn *= mrate; 
	if(res->qn <= 0) {
		ea->n = ea_n; return 0;
	}

	res->qs = rqs; res->qe = rqe; res->ts = rts; res->te = rte;
	res->sec = (0x3fffffff);
	if(ea->n > ea_n) {
		uint64_t *a = ea->a + ea_n, an = ea->n - ea_n, ai, an1 = an>>1;
		for(ai = 0; ai < an1; ai++) {
			qs = a[ai]; a[ai] = a[an - ai - 1]; a[an - ai - 1] = qs;
		}
		res->sec = ea->n; kv_push(uint64_t, *ea, an);
	}

    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x210, %rsp            # imm = 0x210
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
movl %edi, -0xc(%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)
movsd %xmm2, -0x50(%rbp)
movq 0x40(%rbp), %rdi
xorl %esi, %esi
movl $0x1c, %edx
callq 0x2100
cmpq $0x0, -0x20(%rbp)
jne 0x2e1235
movq $0x0, -0x8(%rbp)
jmp 0x2e25a7
movq $0x0, -0xf8(%rbp)
movq $0x0, -0x100(%rbp)
movq 0x38(%rbp), %rdi
movq -0x20(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x226f0
movq 0x38(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x110(%rbp)
movq 0x38(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x108(%rbp)
movq 0x38(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x140(%rbp)
movq 0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x148(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x20(%rbp), %rax
jge 0x2e132d
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %ecx
shrl %ecx
movl %ecx, 0xc(%rax)
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x2e132b
movq -0x18(%rbp), %rdi
imulq $0x1c, -0x58(%rbp), %rax
addq %rax, %rdi
movq 0x18(%rbp), %rsi
leaq -0xd8(%rbp), %rdx
leaq -0xe0(%rbp), %rcx
callq 0x2cffe0
movq -0xd8(%rbp), %rax
movl %eax, %ecx
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x10(%rax)
movq -0xe0(%rbp), %rax
movl %eax, %ecx
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x14(%rax)
jmp 0x2e132d
movq $0x1, -0x58(%rbp)
movq $0x0, -0x60(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x20(%rbp), %rax
jg 0x2e14e6
movq -0x58(%rbp), %rax
cmpq -0x20(%rbp), %rax
jge 0x2e13d9
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %ecx
shrl %ecx
movl %ecx, 0xc(%rax)
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x2e13d7
movq -0x18(%rbp), %rdi
imulq $0x1c, -0x58(%rbp), %rax
addq %rax, %rdi
movq 0x18(%rbp), %rsi
leaq -0xd8(%rbp), %rdx
leaq -0xe0(%rbp), %rcx
callq 0x2cffe0
movq -0xd8(%rbp), %rax
movl %eax, %ecx
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x10(%rax)
movq -0xe0(%rbp), %rax
movl %eax, %ecx
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x14(%rax)
jmp 0x2e13d9
movq -0x58(%rbp), %rax
cmpq -0x20(%rbp), %rax
je 0x2e140f
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
shrl $0x1f, %eax
movq -0x18(%rbp), %rcx
imulq $0x1c, -0x60(%rbp), %rdx
addq %rdx, %rcx
movl 0x18(%rcx), %ecx
shrl $0x1f, %ecx
cmpl %ecx, %eax
je 0x2e14d3
movq -0x58(%rbp), %rax
subq -0x60(%rbp), %rax
cmpq $0x1, %rax
jle 0x2e14cb
movq -0x18(%rbp), %rdi
imulq $0x1c, -0x60(%rbp), %rax
addq %rax, %rdi
movq -0x18(%rbp), %rsi
imulq $0x1c, -0x58(%rbp), %rax
addq %rax, %rsi
callq 0x27b350
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x68(%rbp), %rax
cmpq -0x58(%rbp), %rax
jg 0x2e14c9
movq -0x68(%rbp), %rax
cmpq -0x58(%rbp), %rax
je 0x2e1486
movq -0x18(%rbp), %rax
imulq $0x1c, -0x68(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq -0x18(%rbp), %rcx
imulq $0x1c, -0x70(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x8(%rcx), %eax
je 0x2e14b9
movq -0x68(%rbp), %rax
subq -0x70(%rbp), %rax
cmpq $0x1, %rax
jle 0x2e14b1
movq -0x18(%rbp), %rdi
imulq $0x1c, -0x70(%rbp), %rax
addq %rax, %rdi
movq -0x18(%rbp), %rsi
imulq $0x1c, -0x68(%rbp), %rax
addq %rax, %rsi
callq 0x27b890
movq -0x68(%rbp), %rax
movq %rax, -0x70(%rbp)
jmp 0x2e14bb
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
jmp 0x2e1452
jmp 0x2e14cb
movq -0x58(%rbp), %rax
movq %rax, -0x60(%rbp)
jmp 0x2e14d5
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x2e133d
movq -0x148(%rbp), %rdi
movq -0x20(%rbp), %rdx
shlq $0x2, %rdx
xorl %esi, %esi
callq 0x2100
movq $-0x80000000, -0xd0(%rbp) # imm = 0x80000000
movq $-0x80000000, -0xc8(%rbp) # imm = 0x80000000
movq $-0x80000000, -0xc0(%rbp) # imm = 0x80000000
movq $0x0, -0x120(%rbp)
movq $0x0, -0x118(%rbp)
movq $0x0, -0x58(%rbp)
movq $-0x1, -0x128(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x20(%rbp), %rax
jge 0x2e1bcd
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0xf8(%rbp)
movq -0xf8(%rbp), %rax
movl 0x18(%rax), %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
movl %eax, %eax
movq %rax, -0x80(%rbp)
movq $0x0, -0x90(%rbp)
movq -0xf8(%rbp), %rax
movl 0x18(%rax), %eax
shrl $0x1e, %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x2e15b4
movq -0xf8(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2e15b4
movq -0xf8(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x2e15d1
movq -0xf8(%rbp), %rax
movl 0x8(%rax), %eax
movq -0xf8(%rbp), %rcx
subl 0x4(%rcx), %eax
movl %eax, %eax
movq %rax, -0x90(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x90(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq $-0x1, -0xa8(%rbp)
movq $0x0, -0x130(%rbp)
movq $-0x1, -0x138(%rbp)
movq -0x58(%rbp), %rax
cmpq 0x28(%rbp), %rax
jge 0x2e1620
xorl %eax, %eax
movq %rax, -0x1c0(%rbp)
jmp 0x2e162f
movq -0x58(%rbp), %rax
subq 0x28(%rbp), %rax
movq %rax, -0x1c0(%rbp)
movq -0x1c0(%rbp), %rax
movq %rax, -0x118(%rbp)
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
shrl $0x1f, %eax
movq -0x18(%rbp), %rcx
imulq $0x1c, -0x118(%rbp), %rdx
addq %rdx, %rcx
movl 0x18(%rcx), %ecx
shrl $0x1f, %ecx
cmpl %ecx, %eax
je 0x2e167c
movq -0x118(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x118(%rbp)
jmp 0x2e163d
movq -0x58(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x118(%rbp), %rax
jl 0x2e17f6
movq -0x18(%rbp), %rax
imulq $0x1c, -0x60(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x100(%rbp)
movq -0xf8(%rbp), %rdi
movq -0x100(%rbp), %rsi
movsd -0x40(%rbp), %xmm0
movsd -0x48(%rbp), %xmm1
movq -0x38(%rbp), %rdx
callq 0x30d8d0
movq %rax, -0x78(%rbp)
cmpq $-0x80000000, -0x78(%rbp) # imm = 0x80000000
jne 0x2e16e0
jmp 0x2e17e5
movq -0x108(%rbp), %rax
movq -0x60(%rbp), %rcx
movq (%rax,%rcx,8), %rax
addq -0x78(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x90(%rbp), %rax
movq -0x110(%rbp), %rcx
movq -0x60(%rbp), %rdx
addq (%rcx,%rdx,8), %rax
movq %rax, -0x88(%rbp)
movq -0x78(%rbp), %rax
cmpq -0x98(%rbp), %rax
jg 0x2e173e
movq -0x78(%rbp), %rax
cmpq -0x98(%rbp), %rax
jne 0x2e1780
movq -0x88(%rbp), %rax
cmpq -0xa0(%rbp), %rax
jle 0x2e1780
movq -0x78(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0xa8(%rbp)
cmpq $0x0, -0x130(%rbp)
jle 0x2e177e
movq -0x130(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x130(%rbp)
jmp 0x2e17b3
movq -0x148(%rbp), %rax
movq -0x60(%rbp), %rcx
movslq (%rax,%rcx,4), %rax
cmpq -0x58(%rbp), %rax
jne 0x2e17b1
movq -0x130(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x130(%rbp)
cmpq 0x20(%rbp), %rax
jle 0x2e17af
jmp 0x2e17f6
jmp 0x2e17b1
jmp 0x2e17b3
movq -0x140(%rbp), %rax
movq -0x60(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jl 0x2e17e3
movq -0x58(%rbp), %rax
movl %eax, %edx
movq -0x148(%rbp), %rax
movq -0x140(%rbp), %rcx
movq -0x60(%rbp), %rsi
movslq (%rcx,%rsi,4), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x2e17e5
movq -0x60(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x2e1688
movq -0x60(%rbp), %rax
movq %rax, -0x138(%rbp)
cmpq $0x0, -0x128(%rbp)
jl 0x2e1839
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq -0x18(%rbp), %rcx
imulq $0x1c, -0x128(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
addq 0x30(%rbp), %rcx
cmpq %rcx, %rax
jle 0x2e194f
movq $-0x80000000, -0xb0(%rbp) # imm = 0x80000000
movq $-0x80000000, -0xb8(%rbp) # imm = 0x80000000
movq $-0x1, -0x128(%rbp)
movq -0x58(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rcx
xorl %eax, %eax
cmpq -0x118(%rbp), %rcx
movb %al, -0x1c1(%rbp)
jl 0x2e18ac
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq 0x30(%rbp), %rcx
movq -0x18(%rbp), %rdx
imulq $0x1c, -0x60(%rbp), %rsi
addq %rsi, %rdx
movl 0x8(%rdx), %edx
addq %rdx, %rcx
cmpq %rcx, %rax
setle %al
movb %al, -0x1c1(%rbp)
movb -0x1c1(%rbp), %al
testb $0x1, %al
jne 0x2e18bb
jmp 0x2e194d
movq -0xb0(%rbp), %rax
movq -0x108(%rbp), %rcx
movq -0x60(%rbp), %rdx
cmpq (%rcx,%rdx,8), %rax
jl 0x2e1903
movq -0xb0(%rbp), %rax
movq -0x108(%rbp), %rcx
movq -0x60(%rbp), %rdx
cmpq (%rcx,%rdx,8), %rax
jne 0x2e193a
movq -0xb8(%rbp), %rax
movq -0x110(%rbp), %rcx
movq -0x60(%rbp), %rdx
cmpq (%rcx,%rdx,8), %rax
jge 0x2e193a
movq -0x108(%rbp), %rax
movq -0x60(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xb0(%rbp)
movq -0x110(%rbp), %rax
movq -0x60(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xb8(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x128(%rbp)
jmp 0x2e193c
movq -0x60(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x2e1866
jmp 0x2e194f
cmpq $0x0, -0x128(%rbp)
jl 0x2e1a49
movq -0x128(%rbp), %rax
cmpq -0x138(%rbp), %rax
jge 0x2e1a49
movq -0x18(%rbp), %rax
imulq $0x1c, -0x128(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x100(%rbp)
movq -0xf8(%rbp), %rdi
movq -0x100(%rbp), %rsi
movsd -0x40(%rbp), %xmm0
movsd -0x48(%rbp), %xmm1
movq -0x38(%rbp), %rdx
callq 0x30d8d0
movq %rax, -0x78(%rbp)
cmpq $-0x80000000, -0x78(%rbp) # imm = 0x80000000
je 0x2e1a47
movq -0x108(%rbp), %rax
movq -0x128(%rbp), %rcx
movq (%rax,%rcx,8), %rax
addq -0x78(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x90(%rbp), %rax
movq -0x110(%rbp), %rcx
movq -0x128(%rbp), %rdx
addq (%rcx,%rdx,8), %rax
movq %rax, -0x88(%rbp)
movq -0x78(%rbp), %rax
cmpq -0x98(%rbp), %rax
jg 0x2e1a1e
movq -0x78(%rbp), %rax
cmpq -0x98(%rbp), %rax
jne 0x2e1a45
movq -0x88(%rbp), %rax
cmpq -0xa0(%rbp), %rax
jle 0x2e1a45
movq -0x78(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x128(%rbp), %rax
movq %rax, -0xa8(%rbp)
jmp 0x2e1a47
jmp 0x2e1a49
movq -0x98(%rbp), %rdx
movq -0x108(%rbp), %rax
movq -0x58(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0xa0(%rbp), %rdx
movq -0x110(%rbp), %rax
movq -0x58(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0xa8(%rbp), %rax
movl %eax, %edx
movq -0x140(%rbp), %rax
movq -0x58(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
cmpq $0x0, -0x128(%rbp)
jl 0x2e1b30
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq 0x30(%rbp), %rcx
movq -0x18(%rbp), %rdx
imulq $0x1c, -0x128(%rbp), %rsi
addq %rsi, %rdx
movl 0x8(%rdx), %edx
addq %rdx, %rcx
cmpq %rcx, %rax
jg 0x2e1b3b
movq -0x108(%rbp), %rax
movq -0x128(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x108(%rbp), %rcx
movq -0x58(%rbp), %rdx
cmpq (%rcx,%rdx,8), %rax
jl 0x2e1b30
movq -0x108(%rbp), %rax
movq -0x128(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x108(%rbp), %rcx
movq -0x58(%rbp), %rdx
cmpq (%rcx,%rdx,8), %rax
jne 0x2e1b3b
movq -0x110(%rbp), %rax
movq -0x128(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x110(%rbp), %rcx
movq -0x58(%rbp), %rdx
cmpq (%rcx,%rdx,8), %rax
jge 0x2e1b3b
movq -0x58(%rbp), %rax
movq %rax, -0x128(%rbp)
movq -0x108(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpq -0xc0(%rbp), %rax
jg 0x2e1b83
movq -0x108(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpq -0xc0(%rbp), %rax
je 0x2e1b83
movq -0x110(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpq -0xc8(%rbp), %rax
jle 0x2e1bba
movq -0x108(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xc0(%rbp)
movq -0x110(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xc8(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0xd0(%rbp)
jmp 0x2e1bbc
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x2e1546
cmpq $0x0, -0xd0(%rbp)
jge 0x2e1be4
movq $0x0, -0x8(%rbp)
jmp 0x2e25a7
movq $0x0, -0x158(%rbp)
movq $0x0, -0x168(%rbp)
movq $-0x1, -0x170(%rbp)
movq $-0x1, -0x178(%rbp)
movq 0x48(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x180(%rbp)
movq -0xd0(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rcx
imulq $0x1c, -0x58(%rbp), %rax
addq %rax, %rcx
movq 0x40(%rbp), %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)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, -0xc0(%rbp)
jle 0x2e1c71
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, -0x1d0(%rbp)
jmp 0x2e1c7f
movq -0xc0(%rbp), %rax
movq %rax, -0x1d0(%rbp)
movq -0x1d0(%rbp), %rax
movl %eax, %ecx
movq 0x40(%rbp), %rax
movl %ecx, (%rax)
movq 0x40(%rbp), %rax
movl 0x18(%rax), %ecx
andl $0xc0000000, %ecx       # imm = 0xC0000000
orl $0x0, %ecx
movl %ecx, 0x18(%rax)
movq 0x40(%rbp), %rax
movl 0x4(%rax), %eax
movq %rax, -0x150(%rbp)
movq 0x40(%rbp), %rax
movl 0x10(%rax), %eax
movq %rax, -0x160(%rbp)
cmpq $0x0, -0x58(%rbp)
jl 0x2e20c3
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
cmpq -0x150(%rbp), %rax
jb 0x2e1d10
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
cmpq -0x150(%rbp), %rax
jae 0x2e1d0e
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq %rax, -0x150(%rbp)
jmp 0x2e1d4d
movq -0x150(%rbp), %rax
movq -0x18(%rbp), %rcx
imulq $0x1c, -0x58(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
subq %rcx, %rax
addq -0x158(%rbp), %rax
movq %rax, -0x158(%rbp)
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq %rax, -0x150(%rbp)
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
cmpq -0x160(%rbp), %rax
jb 0x2e1d95
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
cmpq -0x160(%rbp), %rax
jae 0x2e1d93
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movq %rax, -0x160(%rbp)
jmp 0x2e1dd2
movq -0x160(%rbp), %rax
movq -0x18(%rbp), %rcx
imulq $0x1c, -0x58(%rbp), %rdx
addq %rdx, %rcx
movl 0x14(%rcx), %ecx
subq %rcx, %rax
addq -0x168(%rbp), %rax
movq %rax, -0x168(%rbp)
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movq %rax, -0x160(%rbp)
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
shrl $0x1e, %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x2e1e12
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
cmpl $0x0, (%rax)
je 0x2e1e12
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
cmpl $0x1, (%rax)
jne 0x2e1ff3
movq 0x48(%rbp), %rax
movq (%rax), %rax
cmpq -0x180(%rbp), %rax
jbe 0x2e1f07
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq 0x48(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq 0x48(%rbp), %rdx
movq (%rdx), %rdx
subq $0x1, %rdx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
cmpq %rcx, %rax
jb 0x2e1f07
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq 0x48(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq 0x48(%rbp), %rdx
movq (%rdx), %rdx
subq $0x1, %rdx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
cmpq %rcx, %rax
jae 0x2e1f02
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq %rax, -0x170(%rbp)
movq 0x48(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x48(%rbp), %rcx
movq (%rcx), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0x178(%rbp)
movq -0x170(%rbp), %rdx
shlq $0x20, %rdx
movq 0x48(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x48(%rbp), %rcx
movq (%rcx), %rcx
subq $0x1, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x178(%rbp), %rdx
movq 0x48(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x48(%rbp), %rcx
movq (%rcx), %rcx
subq $0x1, %rcx
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
jmp 0x2e1ff1
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq %rax, -0x170(%rbp)
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq %rax, -0x178(%rbp)
movq -0x170(%rbp), %rax
shlq $0x20, %rax
movq %rax, -0x170(%rbp)
movq -0x178(%rbp), %rax
orq -0x170(%rbp), %rax
movq %rax, -0x170(%rbp)
movq 0x48(%rbp), %rax
movq (%rax), %rax
movq 0x48(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x2e1fcb
movq 0x48(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x2e1f8a
movq 0x48(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x1d8(%rbp)
jmp 0x2e1f98
movl $0x2, %eax
movq %rax, -0x1d8(%rbp)
jmp 0x2e1f98
movq -0x1d8(%rbp), %rcx
movq 0x48(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x48(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x48(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x48(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x170(%rbp), %rdx
movq 0x48(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x48(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
jmp 0x2e1ff1
jmp 0x2e1ff3
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq 0x40(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jae 0x2e2021
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %ecx
movq 0x40(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq 0x40(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jbe 0x2e204f
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %ecx
movq 0x40(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movq 0x40(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jae 0x2e207d
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %ecx
movq 0x40(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movq 0x40(%rbp), %rcx
cmpl 0x14(%rcx), %eax
jbe 0x2e20ab
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x14(%rax), %ecx
movq 0x40(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x140(%rbp), %rax
movq -0x58(%rbp), %rcx
movslq (%rax,%rcx,4), %rax
movq %rax, -0x58(%rbp)
jmp 0x2e1cbd
movq 0x40(%rbp), %rdi
movq 0x18(%rbp), %rsi
leaq -0xd8(%rbp), %rdx
movq %rdx, -0x1e0(%rbp)
leaq -0xe0(%rbp), %rcx
movq %rcx, -0x1e8(%rbp)
callq 0x2cffe0
movq -0x1e8(%rbp), %r8
movq -0x1e0(%rbp), %rdi
movl -0xd8(%rbp), %ecx
movq 0x40(%rbp), %rax
movl %ecx, 0x10(%rax)
movl -0xe0(%rbp), %ecx
movq 0x40(%rbp), %rax
movl %ecx, 0x14(%rax)
movq 0x40(%rbp), %rsi
movq 0x10(%rbp), %rdx
movq 0x18(%rbp), %rcx
movq %rsp, %rax
movq %r8, 0x8(%rax)
movq %rdi, (%rax)
xorl %eax, %eax
movl %eax, %edi
leaq -0xe8(%rbp), %r8
leaq -0xf0(%rbp), %r9
callq 0x2d2ba0
movq -0xf0(%rbp), %rcx
movq -0xe8(%rbp), %rax
subq %rax, %rcx
movq 0x40(%rbp), %rax
movl 0x4(%rax), %edx
movl 0x8(%rax), %eax
subl %edx, %eax
subq %rax, %rcx
movq -0x158(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x158(%rbp)
movq -0xe0(%rbp), %rcx
movq -0xd8(%rbp), %rax
subq %rax, %rcx
movq 0x40(%rbp), %rax
movl 0x10(%rax), %edx
movl 0x14(%rax), %eax
subl %edx, %eax
subq %rax, %rcx
movq -0x168(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x168(%rbp)
movaps 0x9fe66(%rip), %xmm1    # 0x382010
movq -0x158(%rbp), %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x9fe62(%rip), %xmm1    # 0x382020
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movq -0xf0(%rbp), %rax
subq -0xe8(%rbp), %rax
cvtsi2sd %rax, %xmm1
mulsd -0x50(%rbp), %xmm1
ucomisd %xmm1, %xmm0
ja 0x2e2233
movaps 0x9fe1e(%rip), %xmm1    # 0x382010
movq -0x168(%rbp), %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x9fe1a(%rip), %xmm1    # 0x382020
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movq -0xe0(%rbp), %rax
subq -0xd8(%rbp), %rax
cvtsi2sd %rax, %xmm1
mulsd -0x50(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x2e224e
movq -0x180(%rbp), %rcx
movq 0x48(%rbp), %rax
movq %rcx, (%rax)
movq $0x0, -0x8(%rbp)
jmp 0x2e25a7
movq -0xf0(%rbp), %rax
movq -0xe8(%rbp), %rcx
subq %rcx, %rax
movq -0x158(%rbp), %rdx
movq %rax, %rcx
subq %rdx, %rcx
movq %rcx, %xmm0
movaps 0x9fd98(%rip), %xmm2    # 0x382010
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movapd 0x9fd9c(%rip), %xmm1    # 0x382020
subpd %xmm1, %xmm0
movaps %xmm0, %xmm3
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm3, %xmm0
cvtsi2sd %rax, %xmm3
divsd %xmm3, %xmm0
movsd %xmm0, -0x188(%rbp)
movq -0xe0(%rbp), %rax
movq -0xd8(%rbp), %rcx
subq %rcx, %rax
movq -0x168(%rbp), %rcx
subq %rcx, %rax
movq %rax, %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movq -0xe0(%rbp), %rax
subq -0xd8(%rbp), %rax
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x190(%rbp)
movsd -0x188(%rbp), %xmm1
movsd -0x190(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x2e231e
movsd -0x188(%rbp), %xmm0
movsd %xmm0, -0x1f0(%rbp)
jmp 0x2e232e
movsd -0x190(%rbp), %xmm0
movsd %xmm0, -0x1f0(%rbp)
movsd -0x1f0(%rbp), %xmm0
movsd %xmm0, -0x198(%rbp)
xorps %xmm0, %xmm0
ucomisd -0x198(%rbp), %xmm0
jbe 0x2e2356
xorps %xmm0, %xmm0
movsd %xmm0, -0x198(%rbp)
movsd -0x198(%rbp), %xmm1
movq 0x40(%rbp), %rax
movl (%rax), %ecx
cvtsi2sd %rcx, %xmm0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
movl %ecx, (%rax)
movq 0x40(%rbp), %rax
cmpl $0x0, (%rax)
ja 0x2e2398
movq -0x180(%rbp), %rcx
movq 0x48(%rbp), %rax
movq %rcx, (%rax)
movq $0x0, -0x8(%rbp)
jmp 0x2e25a7
movq -0xe8(%rbp), %rax
movl %eax, %ecx
movq 0x40(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0xf0(%rbp), %rax
movl %eax, %ecx
movq 0x40(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0xd8(%rbp), %rax
movl %eax, %ecx
movq 0x40(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0xe0(%rbp), %rax
movl %eax, %ecx
movq 0x40(%rbp), %rax
movl %ecx, 0x14(%rax)
movq 0x40(%rbp), %rax
movl 0x18(%rax), %ecx
andl $0xc0000000, %ecx       # imm = 0xC0000000
orl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
movl %ecx, 0x18(%rax)
movq 0x48(%rbp), %rax
movq (%rax), %rax
cmpq -0x180(%rbp), %rax
jbe 0x2e259f
movq 0x48(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x180(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x1a0(%rbp)
movq 0x48(%rbp), %rax
movq (%rax), %rax
subq -0x180(%rbp), %rax
movq %rax, -0x1a8(%rbp)
movq -0x1a8(%rbp), %rax
shrq %rax
movq %rax, -0x1b8(%rbp)
movq $0x0, -0x1b0(%rbp)
movq -0x1b0(%rbp), %rax
cmpq -0x1b8(%rbp), %rax
jae 0x2e24e7
movq -0x1a0(%rbp), %rax
movq -0x1b0(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x150(%rbp)
movq -0x1a0(%rbp), %rax
movq -0x1a8(%rbp), %rcx
subq -0x1b0(%rbp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rdx
movq -0x1a0(%rbp), %rax
movq -0x1b0(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x150(%rbp), %rdx
movq -0x1a0(%rbp), %rax
movq -0x1a8(%rbp), %rcx
subq -0x1b0(%rbp), %rcx
subq $0x1, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x1b0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x1b0(%rbp)
jmp 0x2e2450
movq 0x48(%rbp), %rax
movq (%rax), %rax
movl %eax, %edx
movq 0x40(%rbp), %rax
movl 0x18(%rax), %ecx
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
andl $0xc0000000, %ecx       # imm = 0xC0000000
orl %edx, %ecx
movl %ecx, 0x18(%rax)
movq 0x48(%rbp), %rax
movq (%rax), %rax
movq 0x48(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x2e2579
movq 0x48(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x2e2538
movq 0x48(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x1f8(%rbp)
jmp 0x2e2546
movl $0x2, %eax
movq %rax, -0x1f8(%rbp)
jmp 0x2e2546
movq -0x1f8(%rbp), %rcx
movq 0x48(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x48(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x48(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x48(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x1a8(%rbp), %rdx
movq 0x48(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x48(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
jmp 0x2e259f
movq $0x1, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x210, %rsp            # imm = 0x210
popq %rbp
retq
nopw %cs:(%rax,%rax)