// File: chhylp123[P]hifiasm/inter.cpp
// Function: filter_ctg_trans(unsigned int, ma_ug_t*, ma_ug_t*, kv_ul_ov_t*, asg64_v*, asg64_v*, double, unsigned long, double, unsigned long, double, unsigned long, unsigned int)
uint64_t filter_ctg_trans(uint32_t qid, ma_ug_t *qry, ma_ug_t *ref, kv_ul_ov_t *aln, asg64_v *aln_e, asg64_v *srt, double reliable_rate, uint64_t reliable_len, double sec_rate, uint64_t sec_bd, double sec_sc, uint64_t soff, uint32_t is_self)
{
	if(aln->n <= 0) return 0;

	uint64_t k, an, *ss, *hs, *bu, *wu, clen, m, wm, z, l, wl, le, os, oe, ovq; ul_ov_t *cz, *mz; uint32_t sce[2]; sce[0] = 0; sce[1] = 1;
	for (k = 0; k < aln->n; k++) {
		aln->a[k].el = 0; clen = 0;
		if((!is_self) || (sce[(qid<soff)?0:1] != sce[(aln->a[k].tn<soff)?0:1])) {
			if(aln->a[k].sec < aln_e->n) {///has reliable regions
				for (z = aln->a[k].sec - aln_e->a[aln->a[k].sec]; z < aln->a[k].sec; z++) {
					clen += ((uint32_t)aln_e->a[z]) - (aln_e->a[z]>>32);
				}
			}
			if((clen > reliable_len) && (clen > ((aln->a[k].qe - aln->a[k].qs)*reliable_rate))) {
				aln->a[k].el = 1;
			}
		}
		aln->a[k].qn = ((uint32_t)-1) - aln->a[k].qn;

		// if(qid == 2 && qry->u.a[qid].len == 112183461) {///h2tg000003l
		// 	fprintf(stderr, "+[M::%s] h2tg%.6u%c\t%u\t%u\t%u\t%c\th1tg%.6u%c\t%u\t%u\t%u\tsec(%u)\tel(%u)\n", __func__,
        // 	qid+1, "lc"[qry->u.a[qid].circ], qry->u.a[qid].len, aln->a[k].qs, aln->a[k].qe, "+-"[aln->a[k].rev],
        // 	aln->a[k].tn+1, "lc"[ref->u.a[aln->a[k].tn].circ], ref->u.a[aln->a[k].tn].len, aln->a[k].ts, aln->a[k].te, aln->a[k].sec, aln->a[k].el);
		// } else if(qid == 30 && qry->u.a[qid].len == 24761445) {///h1tg000031l
		// 	fprintf(stderr, "+[M::%s] h1tg%.6u%c\t%u\t%u\t%u\t%c\th12g%.6u%c\t%u\t%u\t%u\tsec(%u)\tel(%u)\n", __func__,
        // 	qid+1, "lc"[qry->u.a[qid].circ], qry->u.a[qid].len, aln->a[k].qs, aln->a[k].qe, "+-"[aln->a[k].rev],
        // 	aln->a[k].tn+1, "lc"[ref->u.a[aln->a[k].tn].circ], ref->u.a[aln->a[k].tn].len, aln->a[k].ts, aln->a[k].te, aln->a[k].sec, aln->a[k].el);
		// } else if(aln->a[k].tn == 2 && ref->u.a[aln->a[k].tn].len == 112183461) {///h2tg000003l
		// 	fprintf(stderr, "+[M::%s] h1tg%.6u%c\t%u\t%u\t%u\t%c\th12g%.6u%c\t%u\t%u\t%u\tsec(%u)\tel(%u)\n", __func__,
        // 	qid+1, "lc"[qry->u.a[qid].circ], qry->u.a[qid].len, aln->a[k].qs, aln->a[k].qe, "+-"[aln->a[k].rev],
        // 	aln->a[k].tn+1, "lc"[ref->u.a[aln->a[k].tn].circ], ref->u.a[aln->a[k].tn].len, aln->a[k].ts, aln->a[k].te, aln->a[k].sec, aln->a[k].el);
		// } else if(aln->a[k].tn == 30 && ref->u.a[aln->a[k].tn].len == 24761445) {
		// 	fprintf(stderr, "+[M::%s] h2tg%.6u%c\t%u\t%u\t%u\t%c\th1tg%.6u%c\t%u\t%u\t%u\tsec(%u)\tel(%u)\n", __func__,
        // 	qid+1, "lc"[qry->u.a[qid].circ], qry->u.a[qid].len, aln->a[k].qs, aln->a[k].qe, "+-"[aln->a[k].rev],
        // 	aln->a[k].tn+1, "lc"[ref->u.a[aln->a[k].tn].circ], ref->u.a[aln->a[k].tn].len, aln->a[k].ts, aln->a[k].te, aln->a[k].sec, aln->a[k].el);
		// }
	}
	if(aln->n > 1) radix_sort_ul_ov_srt_qn(aln->a, aln->a + aln->n);///qn->score
	for (k = 0; k < aln->n; k++) aln->a[k].qn = ((uint32_t)-1) - aln->a[k].qn;

	an = aln->n; an <<= 2;
	srt->n = 0; kv_resize(uint64_t, *srt, an);
	for (k = 0; k < aln->n; k++) {
		srt->a[srt->n] = aln->a[k].qs;
		srt->a[srt->n] <<= 32;
		srt->a[srt->n] |= k;
		srt->n++;
	}

	ss = srt->a; hs = ss + srt->n; bu = hs + srt->n; wu = bu + srt->n;
	radix_sort_gfa64(ss, ss + aln->n);
	for (k = 0; k < aln->n; k++) {
		ss[k] = (uint32_t)ss[k]; hs[ss[k]] = k;
	}
	for (k = 0; k < aln->n; k++) {
		if(aln->a[k].el) continue;
		cz = &(aln->a[k]); clen = (cz->qe-cz->qs) * sec_rate; m = wm = 0;

		for (z = l = wl = le = 0; z < aln->n; z++) {
			if(z == hs[k]) {
				assert(ss[z] == k);
				continue;
			}
			if(ss[z] > k) continue;///smaller nw than a[k]
			mz = &(aln->a[ss[z]]);
			if(mz->qs >= cz->qe) break;
			if(mz->tn == ((uint32_t)-1)) continue;///has been deleted
			if((!(mz->el)) && (cz->qn > (mz->qn*0.9))) continue;
			os = MAX(cz->qs, mz->qs); oe = MIN(cz->qe, mz->qe);
			ovq = ((oe > os)? (oe - os):0);
			if(!ovq) continue;
			// if(is_connect_arc(cz, mz, s->ug, 0.04) || is_connect_arc(mz, cz, s->ug, 0.04)) continue;

			if((m > 0) && (((uint32_t)bu[m-1]) >= os)) {
				if(oe > ((uint32_t)bu[m-1])) {
					le += cal_reliable_ovlp(cz, aln_e, ((uint32_t)bu[m-1]), oe);
					l += (oe - ((uint32_t)bu[m-1]));
					bu[m-1] += (oe - ((uint32_t)bu[m-1]));
				}
			} else {
				le += cal_reliable_ovlp(cz, aln_e, os, oe);
				l += oe - os;
				bu[m] = os; bu[m] <<= 32; bu[m] |= oe; m++;
			}

			if((wm > 0) && (((uint32_t)wu[wm-1]) >= mz->qs)) {
				if(mz->qe > ((uint32_t)wu[wm-1])) {
					wl += (mz->qe - ((uint32_t)wu[wm-1]));
					wu[wm-1] += (mz->qe - ((uint32_t)wu[wm-1]));
				}
			} else {
				wl += mz->qe - mz->qs;
				wu[wm] = mz->qs; wu[wm] <<= 32; wu[wm] |= mz->qe; wm++;
			}

			if((l > 0) && (l > sec_bd) && (le <= l*0.5)) {
				if((l>=clen) || (l>=(wl*sec_rate))) {
					///sc is small enough
					if(cz->qn <= (mz->qn*sec_sc)) {
						cz->tn = ((uint32_t)-1);
						break;
					}
				}
			}
		}        
	}

	for (k = m = 0; k < aln->n; k++) {
		if(aln->a[k].tn == ((uint32_t)-1)) continue;
		// if(qid == 2 && qry->u.a[qid].len == 112183461) {///h2tg000003l
		// 	fprintf(stderr, "-[M::%s] h2tg%.6u%c\t%u\t%u\t%u\t%c\th1tg%.6u%c\t%u\t%u\t%u\tsec(%u)\tel(%u)\n", __func__,
        // 	qid+1, "lc"[qry->u.a[qid].circ], qry->u.a[qid].len, aln->a[k].qs, aln->a[k].qe, "+-"[aln->a[k].rev],
        // 	aln->a[k].tn+1, "lc"[ref->u.a[aln->a[k].tn].circ], ref->u.a[aln->a[k].tn].len, aln->a[k].ts, aln->a[k].te, aln->a[k].sec, aln->a[k].el);
		// } else if(qid == 30 && qry->u.a[qid].len == 24761445) {///h1tg000031l
		// 	fprintf(stderr, "-[M::%s] h1tg%.6u%c\t%u\t%u\t%u\t%c\th12g%.6u%c\t%u\t%u\t%u\tsec(%u)\tel(%u)\n", __func__,
        // 	qid+1, "lc"[qry->u.a[qid].circ], qry->u.a[qid].len, aln->a[k].qs, aln->a[k].qe, "+-"[aln->a[k].rev],
        // 	aln->a[k].tn+1, "lc"[ref->u.a[aln->a[k].tn].circ], ref->u.a[aln->a[k].tn].len, aln->a[k].ts, aln->a[k].te, aln->a[k].sec, aln->a[k].el);
		// } else if(aln->a[k].tn == 2 && ref->u.a[aln->a[k].tn].len == 112183461) {///h2tg000003l
		// 	fprintf(stderr, "-[M::%s] h1tg%.6u%c\t%u\t%u\t%u\t%c\th12g%.6u%c\t%u\t%u\t%u\tsec(%u)\tel(%u)\n", __func__,
        // 	qid+1, "lc"[qry->u.a[qid].circ], qry->u.a[qid].len, aln->a[k].qs, aln->a[k].qe, "+-"[aln->a[k].rev],
        // 	aln->a[k].tn+1, "lc"[ref->u.a[aln->a[k].tn].circ], ref->u.a[aln->a[k].tn].len, aln->a[k].ts, aln->a[k].te, aln->a[k].sec, aln->a[k].el);
		// } else if(aln->a[k].tn == 30 && ref->u.a[aln->a[k].tn].len == 24761445) {
		// 	fprintf(stderr, "-[M::%s] h2tg%.6u%c\t%u\t%u\t%u\t%c\th1tg%.6u%c\t%u\t%u\t%u\tsec(%u)\tel(%u)\n", __func__,
        // 	qid+1, "lc"[qry->u.a[qid].circ], qry->u.a[qid].len, aln->a[k].qs, aln->a[k].qe, "+-"[aln->a[k].rev],
        // 	aln->a[k].tn+1, "lc"[ref->u.a[aln->a[k].tn].circ], ref->u.a[aln->a[k].tn].len, aln->a[k].ts, aln->a[k].te, aln->a[k].sec, aln->a[k].el);
		// }
		aln->a[m++] = aln->a[k];
	}
	aln->n = m;
	// radix_sort_ul_ov_srt_qs(aln->a, aln->a + aln->n);
	return aln->n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movl 0x28(%rbp), %eax
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 -0x28(%rbp), %rax
cmpq $0x0, 0x8(%rax)
ja 0x2e2a38
movq $0x0, -0x8(%rbp)
jmp 0x2e3705
movl $0x0, -0xe8(%rbp)
movl $0x1, -0xe4(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq -0x28(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x2e2c90
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x18(%rax), %ecx
andl $0xbfffffff, %ecx       # imm = 0xBFFFFFFF
orl $0x0, %ecx
movl %ecx, 0x18(%rax)
movq $0x0, -0x88(%rbp)
cmpl $0x0, 0x28(%rbp)
je 0x2e2ae9
movl -0xc(%rbp), %eax
movl %eax, %edx
movq 0x20(%rbp), %rsi
movl $0x1, %eax
xorl %ecx, %ecx
cmpq %rsi, %rdx
cmovbl %ecx, %eax
cltq
movl -0xe8(%rbp,%rax,4), %eax
movq -0x28(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x1c, -0x58(%rbp), %rdx
addq %rdx, %rcx
movl 0xc(%rcx), %ecx
movl %ecx, %esi
movq 0x20(%rbp), %rdi
movl $0x1, %ecx
xorl %edx, %edx
cmpq %rdi, %rsi
cmovbl %edx, %ecx
movslq %ecx, %rcx
cmpl -0xe8(%rbp,%rcx,4), %eax
je 0x2e2c58
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
movl %eax, %eax
movq -0x30(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x2e2bce
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
movl %eax, %eax
movq -0x30(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x28(%rbp), %rdx
movq (%rdx), %rdx
imulq $0x1c, -0x58(%rbp), %rsi
addq %rsi, %rdx
movl 0x18(%rdx), %edx
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
movl %edx, %edx
subq (%rcx,%rdx,8), %rax
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
movq -0x28(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x1c, -0x58(%rbp), %rdx
addq %rdx, %rcx
movl 0x18(%rcx), %ecx
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
movl %ecx, %ecx
cmpq %rcx, %rax
jae 0x2e2bcc
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq -0xa0(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq -0x30(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0xa0(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
subq %rcx, %rax
addq -0x88(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0xa0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa0(%rbp)
jmp 0x2e2b55
jmp 0x2e2bce
movq -0x88(%rbp), %rax
cmpq 0x10(%rbp), %rax
jbe 0x2e2c56
movaps 0x9f42e(%rip), %xmm1    # 0x382010
movq -0x88(%rbp), %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x9f42a(%rip), %xmm1    # 0x382020
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq -0x58(%rbp), %rcx
leaq (%rcx,%rcx,8), %rdx
leaq (%rdx,%rdx,2), %rdx
addq %rcx, %rdx
movl 0x4(%rax,%rdx), %ecx
movl 0x8(%rax,%rdx), %eax
subl %ecx, %eax
cvtsi2sd %rax, %xmm1
mulsd -0x40(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x2e2c56
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x18(%rax), %ecx
andl $0xbfffffff, %ecx       # imm = 0xBFFFFFFF
orl $0x40000000, %ecx       # imm = 0x40000000
movl %ecx, 0x18(%rax)
jmp 0x2e2c58
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
subl (%rax), %ecx
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x58(%rbp), %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x2e2a54
movq -0x28(%rbp), %rax
cmpq $0x1, 0x8(%rax)
jbe 0x2e2cba
movq -0x28(%rbp), %rax
movq (%rax), %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rsi
movq -0x28(%rbp), %rax
imulq $0x1c, 0x8(%rax), %rax
addq %rax, %rsi
callq 0x27c310
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq -0x28(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x2e2d05
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
subl (%rax), %ecx
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x58(%rbp), %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x2e2cc2
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
shlq $0x2, %rax
movq %rax, -0x60(%rbp)
movq -0x38(%rbp), %rax
movq $0x0, (%rax)
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
cmpq -0x60(%rbp), %rax
jae 0x2e2e01
movq -0x60(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rcx
shrq %rcx
movq -0x38(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x2, %rcx
movq -0x38(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x4, %rcx
movq -0x38(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x8, %rcx
movq -0x38(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x10, %rcx
movq -0x38(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x2e2e03
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq -0x28(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x2e2e95
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, %edx
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x38(%rbp), %rcx
movq (%rcx), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x38(%rbp), %rcx
movq (%rcx), %rcx
movq (%rax,%rcx,8), %rdx
shlq $0x20, %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x58(%rbp), %rdx
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x38(%rbp), %rcx
movq (%rcx), %rcx
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x38(%rbp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x2e2e0b
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movq -0x38(%rbp), %rcx
movq (%rcx), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq -0x38(%rbp), %rcx
movq (%rcx), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq -0x38(%rbp), %rcx
movq (%rcx), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x80(%rbp)
movq -0x68(%rbp), %rdi
movq -0x68(%rbp), %rsi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
shlq $0x3, %rax
addq %rax, %rsi
callq 0x27a9b0
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq -0x28(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x2e2f57
movq -0x68(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movl %eax, %edx
movq -0x68(%rbp), %rax
movq -0x58(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x58(%rbp), %rdx
movq -0x70(%rbp), %rax
movq -0x68(%rbp), %rcx
movq -0x58(%rbp), %rsi
movq (%rcx,%rsi,8), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x2e2f07
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq -0x28(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x2e3653
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
shrl $0x1e, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x2e2f93
jmp 0x2e3642
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq -0x58(%rbp), %rdx
leaq (%rdx,%rdx,8), %rcx
leaq (%rcx,%rcx,2), %rcx
addq %rdx, %rcx
addq %rcx, %rax
movq %rax, -0xd8(%rbp)
movq -0xd8(%rbp), %rax
movl 0x4(%rax), %ecx
movl 0x8(%rax), %eax
subl %ecx, %eax
cvtsi2sd %rax, %xmm0
movsd -0x48(%rbp), %xmm1
mulsd %xmm1, %xmm0
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
movsd 0x9f011(%rip), %xmm1    # 0x381ff8
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
andq %rdx, %rcx
orq %rcx, %rax
movq %rax, -0x88(%rbp)
movq $0x0, -0x98(%rbp)
movq $0x0, -0x90(%rbp)
movq $0x0, -0xb8(%rbp)
movq $0x0, -0xb0(%rbp)
movq $0x0, -0xa8(%rbp)
movq $0x0, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
movq -0x28(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x2e3640
movq -0xa0(%rbp), %rax
movq -0x70(%rbp), %rcx
movq -0x58(%rbp), %rdx
cmpq (%rcx,%rdx,8), %rax
jne 0x2e30a4
movq -0x68(%rbp), %rax
movq -0xa0(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpq -0x58(%rbp), %rax
jne 0x2e3080
jmp 0x2e309f
leaq 0xa45e4(%rip), %rdi     # 0x38766b
leaq 0xad7a1(%rip), %rsi     # 0x39082f
movl $0x4376, %edx           # imm = 0x4376
leaq 0xb1105(%rip), %rcx     # 0x39419f
callq 0x2130
jmp 0x2e3629
movq -0x68(%rbp), %rax
movq -0xa0(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpq -0x58(%rbp), %rax
jbe 0x2e30be
jmp 0x2e3629
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq -0x68(%rbp), %rcx
movq -0xa0(%rbp), %rdx
imulq $0x1c, (%rcx,%rdx,8), %rcx
addq %rcx, %rax
movq %rax, -0xe0(%rbp)
movq -0xe0(%rbp), %rax
movl 0x4(%rax), %eax
movq -0xd8(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jb 0x2e30fa
jmp 0x2e3640
movq -0xe0(%rbp), %rax
cmpl $-0x1, 0xc(%rax)
jne 0x2e310c
jmp 0x2e3629
movq -0xe0(%rbp), %rax
movl 0x18(%rax), %eax
shrl $0x1e, %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x2e3154
movq -0xd8(%rbp), %rax
movl (%rax), %eax
cvtsi2sd %rax, %xmm0
movq -0xe0(%rbp), %rax
movl (%rax), %eax
cvtsi2sd %rax, %xmm1
movsd 0x9f123(%rip), %xmm2    # 0x382268
mulsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x2e3154
jmp 0x2e3629
movq -0xd8(%rbp), %rax
movl 0x4(%rax), %eax
movq -0xe0(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jb 0x2e317c
movq -0xd8(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0xec(%rbp)
jmp 0x2e318c
movq -0xe0(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0xec(%rbp)
movl -0xec(%rbp), %eax
movl %eax, %eax
movq %rax, -0xc0(%rbp)
movq -0xd8(%rbp), %rax
movl 0x8(%rax), %eax
movq -0xe0(%rbp), %rcx
cmpl 0x8(%rcx), %eax
ja 0x2e31c3
movq -0xd8(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0xf0(%rbp)
jmp 0x2e31d3
movq -0xe0(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0xf0(%rbp)
movl -0xf0(%rbp), %eax
movl %eax, %eax
movq %rax, -0xc8(%rbp)
movq -0xc8(%rbp), %rax
cmpq -0xc0(%rbp), %rax
jbe 0x2e3209
movq -0xc8(%rbp), %rax
subq -0xc0(%rbp), %rax
movq %rax, -0xf8(%rbp)
jmp 0x2e3214
xorl %eax, %eax
movq %rax, -0xf8(%rbp)
jmp 0x2e3214
movq -0xf8(%rbp), %rax
movq %rax, -0xd0(%rbp)
cmpq $0x0, -0xd0(%rbp)
jne 0x2e3231
jmp 0x2e3629
cmpq $0x0, -0x90(%rbp)
jbe 0x2e332a
movq -0x78(%rbp), %rax
movq -0x90(%rbp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
cmpq -0xc0(%rbp), %rax
jb 0x2e332a
movq -0xc8(%rbp), %rax
movq -0x78(%rbp), %rcx
movq -0x90(%rbp), %rdx
subq $0x1, %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
cmpq %rcx, %rax
jbe 0x2e3325
movq -0xd8(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x78(%rbp), %rax
movq -0x90(%rbp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movl %eax, %edx
movq -0xc8(%rbp), %rcx
callq 0x2e2870
addq -0xb8(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0xc8(%rbp), %rax
movq -0x78(%rbp), %rcx
movq -0x90(%rbp), %rdx
subq $0x1, %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
subq %rcx, %rax
addq -0xa8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xc8(%rbp), %rdx
movq -0x78(%rbp), %rax
movq -0x90(%rbp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
subq %rax, %rdx
movq -0x78(%rbp), %rax
movq -0x90(%rbp), %rcx
subq $0x1, %rcx
addq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
jmp 0x2e33cb
movq -0xd8(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0xc0(%rbp), %rdx
movq -0xc8(%rbp), %rcx
callq 0x2e2870
addq -0xb8(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0xc8(%rbp), %rax
subq -0xc0(%rbp), %rax
addq -0xa8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xc0(%rbp), %rdx
movq -0x78(%rbp), %rax
movq -0x90(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x78(%rbp), %rax
movq -0x90(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
shlq $0x20, %rdx
movq %rdx, (%rax,%rcx,8)
movq -0xc8(%rbp), %rdx
movq -0x78(%rbp), %rax
movq -0x90(%rbp), %rcx
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x90(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x90(%rbp)
cmpq $0x0, -0x98(%rbp)
jbe 0x2e348b
movq -0x80(%rbp), %rax
movq -0x98(%rbp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rax
movq -0xe0(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jb 0x2e348b
movq -0xe0(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x80(%rbp), %rcx
movq -0x98(%rbp), %rdx
subq $0x1, %rdx
movq (%rcx,%rdx,8), %rcx
cmpl %ecx, %eax
jbe 0x2e3486
movq -0xe0(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x80(%rbp), %rcx
movq -0x98(%rbp), %rdx
subq $0x1, %rdx
movq (%rcx,%rdx,8), %rcx
subl %ecx, %eax
movl %eax, %eax
addq -0xb0(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0xe0(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x80(%rbp), %rcx
movq -0x98(%rbp), %rdx
subq $0x1, %rdx
movq (%rcx,%rdx,8), %rcx
subl %ecx, %eax
movl %eax, %eax
movl %eax, %edx
movq -0x80(%rbp), %rax
movq -0x98(%rbp), %rcx
subq $0x1, %rcx
addq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
jmp 0x2e3512
movq -0xe0(%rbp), %rax
movl 0x8(%rax), %eax
movq -0xe0(%rbp), %rcx
subl 0x4(%rcx), %eax
movl %eax, %eax
addq -0xb0(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0xe0(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, %edx
movq -0x80(%rbp), %rax
movq -0x98(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x80(%rbp), %rax
movq -0x98(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
shlq $0x20, %rdx
movq %rdx, (%rax,%rcx,8)
movq -0xe0(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, %edx
movq -0x80(%rbp), %rax
movq -0x98(%rbp), %rcx
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x98(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x98(%rbp)
cmpq $0x0, -0xa8(%rbp)
jbe 0x2e3627
movq -0xa8(%rbp), %rax
cmpq 0x18(%rbp), %rax
jbe 0x2e3627
movq -0xb8(%rbp), %xmm1
movaps 0x9ead0(%rip), %xmm3    # 0x382010
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
movapd 0x9ead4(%rip), %xmm2    # 0x382020
subpd %xmm2, %xmm1
movaps %xmm1, %xmm0
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm0, %xmm1
movq -0xa8(%rbp), %xmm0
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
subpd %xmm2, %xmm0
movaps %xmm0, %xmm2
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm2, %xmm0
movsd 0x9ecf2(%rip), %xmm2    # 0x382270
mulsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jb 0x2e3627
movq -0xa8(%rbp), %rax
cmpq -0x88(%rbp), %rax
jae 0x2e35ec
movq -0xa8(%rbp), %xmm0
movaps 0x9ea65(%rip), %xmm3    # 0x382010
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
movapd 0x9ea69(%rip), %xmm2    # 0x382020
subpd %xmm2, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movq -0xb0(%rbp), %xmm1
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
mulsd -0x48(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jb 0x2e3625
movq -0xd8(%rbp), %rax
movl (%rax), %eax
cvtsi2sd %rax, %xmm1
movq -0xe0(%rbp), %rax
movl (%rax), %eax
cvtsi2sd %rax, %xmm0
mulsd -0x50(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x2e3623
movq -0xd8(%rbp), %rax
movl $0xffffffff, 0xc(%rax)  # imm = 0xFFFFFFFF
jmp 0x2e3640
jmp 0x2e3625
jmp 0x2e3627
jmp 0x2e3629
movq -0xa0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa0(%rbp)
jmp 0x2e303f
jmp 0x2e3642
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x2e2f5f
movq $0x0, -0x90(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq -0x28(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x2e36ea
movq -0x28(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
cmpl $-0x1, 0xc(%rax)
jne 0x2e368b
jmp 0x2e36d9
movq -0x28(%rbp), %rax
movq (%rax), %rcx
imulq $0x1c, -0x58(%rbp), %rax
addq %rax, %rcx
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq -0x90(%rbp), %rdx
movq %rdx, %rsi
addq $0x1, %rsi
movq %rsi, -0x90(%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 -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x2e3666
movq -0x90(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nopw %cs:(%rax,%rax)