// File: chhylp123[P]hifiasm/inter.cpp
// Function: hc_gchain1_dp(void*, ul_idx_t const*, ma_ug_t const*, vec_mg_lchain_t*, vec_mg_lchain_t*, vec_mg_path_dst_t*, vec_sp_node_t*, vec_mg_pathv_t*, long, ug_opt_t const*, long, double, double, unsigned long*, st_mt_t*, long*, unsigned long*, unsigned long*)
int64_t hc_gchain1_dp(void *km, const ul_idx_t *uref, const ma_ug_t *ug, vec_mg_lchain_t *lc, vec_mg_lchain_t *sw, vec_mg_path_dst_t *dst, vec_sp_node_t *out, vec_mg_pathv_t *path,
int64_t qlen, const ug_opt_t *uopt, int64_t bw, double diff_thre, double ng_diff_thre, uint64_t *srt, st_mt_t *bf, int64_t *f, uint64_t *p, uint64_t *v)
{
	bf->n = 0;
	if(lc->n == 0) return 0;
	int64_t i, j, lc_n = lc->n, n_ext, mm_ovlp, target_dist, max_target_dist, x, m_idx, m_sc, qo, sc; 
	int64_t max_f, max_j = -1, max_d = -1, max_inner = 0, share; uint32_t max_hash = 0; int64_t k, k0, n_u, n_v, ni;
	mg_lchain_t *r, *li, *lj; mg_path_dst_t *q; asg_t *g = ug->g; uint64_t isolated, *u; ul_ov_t ui, uj;
	for (i = n_ext = 0; i < lc_n; i++) {
		r = &lc->a[i]; r->dist_pre = -1; isolated = 0;///dist_pre -> parent in graph chain
		if((r->re < g->seq[r->v>>1].len) && (r->rs > 0)) isolated = 1;///UL contained in one vertice
		if (!isolated) ++n_ext;
		srt[i] = r->qe; srt[i] <<= 32; srt[i] |= (uint64_t)i; srt[i] |= (isolated<<63);
	}
	radix_sort_gfa64(srt, srt+lc_n); 
	for (i = 1, j = 0; i <= lc_n; i++) {
		if (i == lc_n || (srt[i]>>32) != (srt[j]>>32)) {
			if(i - j > 1) {
				for (x = j; x < i; x++) {
					srt[x] <<= 32; srt[x] >>= 32; srt[x] |= ((uint64_t)lc->a[(uint32_t)srt[x]].qs)<<32;
				}
				radix_sort_gfa64(srt+j, srt+i);
			}
			j = i;
		}
	}

	kv_resize(mg_lchain_t, *sw, (uint64_t)lc_n); sw->n = lc_n;
	for (i = 0; i < lc_n; i++) sw->a[i] = lc->a[(uint32_t)srt[i]];
	memcpy(lc->a, sw->a, lc_n *sizeof((*(lc->a))));
	// fprintf(stderr, "[M::%s::] n_ext:%ld, lc_n:%ld\n", __func__, n_ext, lc_n);

	if(ng_diff_thre >= 0) {
		//first non-gap chain
		for (i = 0; i < n_ext; ++i) { // core loop
			li = &lc->a[i]; set_ul_ov_t_by_mg_lchain_t(&ui, li);
			mm_ovlp = max_ovlp(g, li->v^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_mg_lchain_max(i, lc->a, x+G_CHAIN_INDEL);
			// fprintf(stderr, "\nli->(%ld)\tutg%.6d%c(%u)\tqs:%u\tqe:%u\t%c\trs:%u\tre:%u\tsrc:%u\tscore:%d, x:%ld\n", 
			// 	i, (int32_t)(li->v>>1)+1, "lc"[ug->u.a[li->v>>1].circ], ug->u.a[li->v>>1].len,
			// 	li->qs, li->qe, "+-"[li->v&1], li->rs, li->re, li->v^1, li->score, x);
			max_f = li->score, max_j = -1;
			// collect potential destination vertices
			for (j = x; j >= 0; --j) { 
				lj = &lc->a[j]; ///extend_end_coord(lj, qlen, g->seq[lj->v>>1].len, &jqs, &jqe, &jrs, &jre);
				//even this pair has a overlap, its length will be very small; just ignore; only for non-gapped chains
				if(lj->qe+G_CHAIN_INDEL <= li->qs) break;
				if(lj->qs >= li->qs/**+G_CHAIN_INDEL**/) continue;
				set_ul_ov_t_by_mg_lchain_t(&uj, lj);
				qo = infer_rovlp(&ui, &uj, NULL, NULL, NULL, (ma_ug_t *)ug); ///overlap length in query (UL read)
				if(li->v!=lj->v && get_ecov_adv(uref, uopt, li->v^1, lj->v^1, bw, ng_diff_thre, qo, 0, &share)) {
					sc = li->score + f[j];
					if(sc > max_f) {
						max_f = sc; max_j = j;
					}
				}
			}

			f[i] = max_f, p[i] = max_j<0?(uint64_t)-1:max_j;
			li->dist_pre = max_j<0?-1:g_adjacent_dis(g, li->v^1, lc->a[max_j].v^1); li->inner_pre = 0;
			li->hash_pre = max_j<0?0:(__ac_Wang_hash((li->v^1))+__ac_Wang_hash((lc->a[max_j].v^1))); 
			// fprintf(stderr, "i->%ld, utg%.6d%c->utg%.6d%c, max_f:%ld\n", i, (int32_t)(li->v>>1)+1, "lc"[ug->u.a[li->v>>1].circ], 
			// max_j<0?0:(int32_t)(lc->a[max_j].v>>1)+1, max_j<0?'*':"lc"[ug->u.a[lc->a[max_j].v>>1].circ], max_f);
		}

		kv_resize(uint64_t, *bf, (uint64_t)lc_n); u = bf->a;
		hc_chain_backtrack(n_ext, f, p, srt, u, v, &n_u, &n_v);
		for (i = 0; i < lc_n - n_ext; ++i) {
			u[n_u++] = (((uint64_t)lc->a[n_ext + i].score)<<32) | 1;
			v[n_v++] = n_ext + i;
		}

		sw->n = 0; kv_resize(mg_lchain_t, *sw, (uint64_t)n_v); m_idx = m_sc = -1; bf->n = 0;
		for (i = 0, k = 0; i < n_u; ++i) {
			k0 = k, ni = (int32_t)u[i];
			for (j = 0; j < ni; ++j) {
				sw->a[k++] = lc->a[v[k0 + (ni - j - 1)]];
			}
			if(m_idx < 0 || m_sc < ((int64_t)(u[i]>>32))) {
				m_idx = i; m_sc = ((int64_t)(u[i]>>32));
			}
		}
		assert(k == n_v); bf->n = n_u;

		if(primary_chain_check(u, n_u, sw->a)) {
			memcpy(lc->a, sw->a, n_v*sizeof(mg_lchain_t));
			return m_idx;
		} 
	}
	bf->n = 0;

	///then gapped-chaining
	for (i = 0; i < n_ext; ++i) { // core loop
		li = &lc->a[i]; 
		mm_ovlp = max_ovlp(g, li->v^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_mg_lchain_max(i, lc->a, x+G_CHAIN_INDEL);
		// fprintf(stderr, "\nli->(%ld)\tutg%.6d%c(%u)\tqs:%u\tqe:%u\t%c\trs:%u\tre:%u\tsrc:%u\tscore:%d, x:%ld\n", 
		// 	i, (int32_t)(li->v>>1)+1, "lc"[ug->u.a[li->v>>1].circ], ug->u.a[li->v>>1].len,
		// 	li->qs, li->qe, "+-"[li->v&1], li->rs, li->re, li->v^1, li->score, x);

		// collect potential destination vertices
		for (dst->n = 0, max_target_dist= -1, j = x; j >= 0; --j) { 
			///same time for gchain
			// if((p[j]>>33) == ((uint64_t)i)) continue;

			lj = &lc->a[j]; ///extend_end_coord(lj, qlen, g->seq[lj->v>>1].len, &jqs, &jqe, &jrs, &jre);
			//lj contained in li; actually in circle, this might happen; need to deal with it later
			if(lj->qs >= li->qs/**+G_CHAIN_INDEL**/) continue;
			///if there is a circle, the two linear chains might be at the same vertice
			target_dist = hc_target_len(g, li, lj);
			// fprintf(stderr, "j:%ld, target_dist:%ld\n", j, target_dist);
			if(target_dist < 0) continue;
			kv_pushp(mg_path_dst_t, *dst, &q);
			memset(q, 0, sizeof(*q));
			q->inner = 0;//we set q->inner = 0 to allow circles
			q->v = lj->v^1;///must be v^1 instead of v
			q->meta = j;
			///lj->qs************lj->qe
			///			li->qs************li->qe
			q->qlen = li->qs - lj->qe;///might be negative; this is the region that need to be checked in base-level
			q->target_dist = target_dist;///cannot understand the target_dist
			q->target_hash = 0;
			q->check_hash = 0;
			if(max_target_dist < target_dist) max_target_dist = target_dist;
			///not sure how to use this cut-off
			// if (t[j] == i) {
			// 	if (++n_skip > max_skip)
			// 		break;
			// }
			// if (p[j] >= 0) t[p[j]] = i;
			// if((li->v>>1)==10 && ((lj->v>>1)==15||(lj->v>>1)==14)) max_target_dist = 100000;
			// fprintf(stderr, "+++lj->(%ld)\tutg%.6d%c(%u)\t%u\t%u\t%c\ttarget_dist:%d\n", 
			// j, (int32_t)(lj->v>>1)+1, "lc"[ug->u.a[lj->v>>1].circ], ug->u.a[lj->v>>1].len,
			// lj->qs, lj->qe, "+-"[lj->v&1], q->target_dist);

			///j-th has pre, and the pre is good alignment 
			///same time for gchain
			// if((((uint32_t)p[j])!=((uint32_t)-1)) && (p[j]&(uint64_t)(0x100000000))) {
			// 	p[((uint32_t)p[j])] &= (uint64_t)(0x1ffffffff);
			// 	p[((uint32_t)p[j])] |= (((uint64_t)i)<<33);
			// }
		}

		// confirm reach-ability
		max_f = li->score, max_j = -1, max_d = -1, max_inner = 0; max_hash = 0;
		if(dst->n) {
			max_target_dist *= (1+diff_thre); if(max_target_dist < bw) max_target_dist = bw;
			hc_shortest_k(km, g, li->v^1, dst->n, dst->a, max_target_dist, MG_MAX_SHORT_K, bf, srt, out, NULL, 1, 0, 0);
			// remove unreachable destinations
			//TODO: check sequence identity
            for (j = 0; j < (int64_t)dst->n; ++j) {
                mg_path_dst_t *dj = &dst->a[j];
                if (dj->n_path == 0) continue; // unreachable
                sc = cal_gchain_sc(dj, li, lc->a, f, bw, diff_thre, W_CHN_PEN_GAP);		

				// fprintf(stderr, "---dj->(%ld)\tutg%.6d%c(%u)\tsc:%d\tmax_f:%ld\ttarget_dist:%d\tdj->dist:%d\n", 
				// j, (int32_t)(dj->v>>1)+1, "lc"[ug->u.a[dj->v>>1].circ], ug->u.a[dj->v>>1].len, sc, max_f, dj->target_dist, dj->dist);	
                if (sc == INT32_MIN) continue; // out of band
				// fprintf(stderr, "+max_f->%d, max_j->%d\n", max_f, max_j);
				if (sc < 0) continue;// negative score
				// fprintf(stderr, "++max_f->%d, max_j->%d\n", max_f, max_j);
				if (sc > max_f) {
					max_f = sc, max_j = dj->meta, max_d = dj->dist, max_hash = dj->hash, max_inner = dj->inner;
					// fprintf(stderr, "+++max_f->%d, max_j->%d\n", max_f, max_j);
				}
            }
		}

		f[i] = max_f; p[i] = max_j<0?(uint64_t)-1:max_j;
		///same time for gchain
		// if(max_j < 0) {
		// 	p[i] = (uint32_t)-1;
		// } else {
		// 	p[i] = max_j;
		// 	if(ck_hq_chain(li, &(lc->a[max_j]), (ma_ug_t *)ug, uref, uopt, bw, ng_diff_thre)) {
		// 		p[i] |= (uint64_t)(0x100000000);
		// 	}
		// }


		li->dist_pre = max_d;
		li->hash_pre = max_hash;
		li->inner_pre = max_inner;
		// fprintf(stderr, "i->%ld, utg%.6d%c->utg%.6d%c, max_f:%ld\n", i, (int32_t)(li->v>>1)+1, "lc"[ug->u.a[li->v>>1].circ], 
		// max_j<0?0:(int32_t)(lc->a[max_j].v>>1)+1, max_j<0?'*':"lc"[ug->u.a[lc->a[max_j].v>>1].circ], max_f);
	}

	///same time for gchain
	// for (i = 0; i < n_ext; ++i) {
	// 	if(((uint32_t)p[i])==((uint32_t)-1)) p[i] = (uint64_t)-1;
	// 	else p[i] = (uint32_t)p[i];
	// }

	kv_resize(uint64_t, *bf, (uint64_t)lc_n); u = bf->a;
	hc_chain_backtrack(n_ext, f, p, srt, u, v, &n_u, &n_v);
	for (i = 0; i < lc_n - n_ext; ++i) {
        u[n_u++] = (((uint64_t)lc->a[n_ext + i].score)<<32) | 1;
        v[n_v++] = n_ext + i;
    }

	sw->n = 0; kv_resize(mg_lchain_t, *sw, (uint64_t)n_v); m_idx = m_sc = -1; bf->n = 0;
	for (i = 0, k = 0; i < n_u; ++i) {
        k0 = k, ni = (int32_t)u[i];
        for (j = 0; j < ni; ++j) {
			sw->a[k++] = lc->a[v[k0 + (ni - j - 1)]];
		}
		if(m_idx < 0 || m_sc < ((int64_t)(u[i]>>32))) {
			m_idx = i; m_sc = ((int64_t)(u[i]>>32));
		}
    }
    assert(k == n_v); bf->n = n_u;
	memcpy(lc->a, sw->a, n_v*sizeof(mg_lchain_t));
	return m_idx;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x1d8, %rsp            # imm = 0x1D8
movq 0x58(%rbp), %rax
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, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movq %rdx, -0x28(%rbp)
movq %rcx, -0x30(%rbp)
movq %r8, -0x38(%rbp)
movq %r9, -0x40(%rbp)
movsd %xmm0, -0x48(%rbp)
movsd %xmm1, -0x50(%rbp)
movq 0x40(%rbp), %rax
movq $0x0, (%rax)
movq -0x30(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x29e389
movq $0x0, -0x10(%rbp)
jmp 0x29f9dc
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x68(%rbp)
movq $-0x1, -0xc0(%rbp)
movq $-0x1, -0xc8(%rbp)
movq $0x0, -0xd0(%rbp)
movl $0x0, -0xdc(%rbp)
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x130(%rbp)
movq $0x0, -0x70(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x68(%rbp), %rax
jge 0x29e4e5
movq -0x30(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x58(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x110(%rbp)
movq -0x110(%rbp), %rax
movl $0xffffffff, 0x20(%rax) # imm = 0xFFFFFFFF
movq $0x0, -0x138(%rbp)
movq -0x110(%rbp), %rax
movl 0x10(%rax), %eax
movq -0x130(%rbp), %rcx
movq 0x20(%rcx), %rcx
movq -0x110(%rbp), %rdx
movl 0x8(%rdx), %edx
shrl %edx
movl %edx, %edx
movl (%rcx,%rdx,8), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl %ecx, %eax
jge 0x29e464
movq -0x110(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jle 0x29e464
movq $0x1, -0x138(%rbp)
cmpq $0x0, -0x138(%rbp)
jne 0x29e47a
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
movq -0x110(%rbp), %rax
movslq 0x18(%rax), %rdx
movq 0x38(%rbp), %rax
movq -0x58(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x38(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
shlq $0x20, %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x58(%rbp), %rdx
movq 0x38(%rbp), %rax
movq -0x58(%rbp), %rcx
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x138(%rbp), %rdx
shlq $0x3f, %rdx
movq 0x38(%rbp), %rax
movq -0x58(%rbp), %rcx
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x29e3df
movq 0x38(%rbp), %rdi
movq 0x38(%rbp), %rsi
movq -0x68(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
callq 0x27a9b0
movq $0x1, -0x58(%rbp)
movq $0x0, -0x60(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x68(%rbp), %rax
jg 0x29e635
movq -0x58(%rbp), %rax
cmpq -0x68(%rbp), %rax
je 0x29e54e
movq 0x38(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movq 0x38(%rbp), %rcx
movq -0x60(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
cmpq %rcx, %rax
je 0x29e622
movq -0x58(%rbp), %rax
subq -0x60(%rbp), %rax
cmpq $0x1, %rax
jle 0x29e61a
movq -0x60(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rax
cmpq -0x58(%rbp), %rax
jge 0x29e5f7
movq 0x38(%rbp), %rax
movq -0x90(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
shlq $0x20, %rdx
movq %rdx, (%rax,%rcx,8)
movq 0x38(%rbp), %rax
movq -0x90(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
shrq $0x20, %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq 0x38(%rbp), %rcx
movq -0x90(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movslq 0x14(%rax), %rdx
shlq $0x20, %rdx
movq 0x38(%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)
jmp 0x29e56b
movq 0x38(%rbp), %rdi
movq -0x60(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq 0x38(%rbp), %rsi
movq -0x58(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
callq 0x27a9b0
movq -0x58(%rbp), %rax
movq %rax, -0x60(%rbp)
jmp 0x29e624
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x29e50d
jmp 0x29e637
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
cmpq -0x68(%rbp), %rax
jae 0x29e70b
movq -0x68(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rcx
shrq %rcx
movq -0x38(%rbp), %rax
orq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rcx
shrq $0x2, %rcx
movq -0x38(%rbp), %rax
orq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rcx
shrq $0x4, %rcx
movq -0x38(%rbp), %rax
orq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rcx
shrq $0x8, %rcx
movq -0x38(%rbp), %rax
orq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rcx
shrq $0x10, %rcx
movq -0x38(%rbp), %rax
orq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rax
movq (%rax), %rdi
movq -0x38(%rbp), %rax
imulq $0x28, 0x10(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
jmp 0x29e70d
movq -0x68(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x68(%rbp), %rax
jge 0x29e76e
movq -0x30(%rbp), %rax
movq (%rax), %rsi
movq 0x38(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
imulq $0x28, %rax, %rax
addq %rax, %rsi
movq -0x38(%rbp), %rax
movq (%rax), %rdi
imulq $0x28, -0x58(%rbp), %rax
addq %rax, %rdi
movl $0x28, %edx
callq 0x2180
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x29e721
movq -0x30(%rbp), %rax
movq (%rax), %rdi
movq -0x38(%rbp), %rax
movq (%rax), %rsi
imulq $0x28, -0x68(%rbp), %rdx
callq 0x2180
movsd -0x50(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x29efd3
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x70(%rbp), %rax
jge 0x29eb63
movq -0x30(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x58(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x118(%rbp)
movq -0x118(%rbp), %rsi
leaq -0x15c(%rbp), %rdi
callq 0x2a3930
movq -0x130(%rbp), %rdi
movq -0x118(%rbp), %rax
movl 0x8(%rax), %esi
xorl $0x1, %esi
callq 0x287d20
movq %rax, -0x78(%rbp)
movq -0x118(%rbp), %rax
movslq 0x14(%rax), %rax
addq -0x78(%rbp), %rax
cvtsi2sd %rax, %xmm0
mulsd -0x48(%rbp), %xmm0
cvttsd2si %xmm0, %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rax
cmpq 0x30(%rbp), %rax
jge 0x29e831
movq 0x30(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x118(%rbp), %rax
movslq 0x14(%rax), %rax
addq -0x78(%rbp), %rax
addq -0x90(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rax
movq 0x20(%rbp), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
jle 0x29e871
movq 0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x90(%rbp)
movq -0x58(%rbp), %rdi
movq -0x30(%rbp), %rax
movq (%rax), %rsi
movq -0x90(%rbp), %rax
addq $0x80, %rax
movl %eax, %edx
callq 0x2a39b0
movq %rax, -0x90(%rbp)
movq -0x118(%rbp), %rax
movslq 0x1c(%rax), %rax
movq %rax, -0xb8(%rbp)
movq $-0x1, -0xc0(%rbp)
movq -0x90(%rbp), %rax
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
jl 0x29ea20
movq -0x30(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x60(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x120(%rbp)
movq -0x120(%rbp), %rax
movl 0x18(%rax), %eax
addl $0x80, %eax
movq -0x118(%rbp), %rcx
cmpl 0x14(%rcx), %eax
jg 0x29e900
jmp 0x29ea20
movq -0x120(%rbp), %rax
movl 0x14(%rax), %eax
movq -0x118(%rbp), %rcx
cmpl 0x14(%rcx), %eax
jl 0x29e91b
jmp 0x29ea0f
movq -0x120(%rbp), %rsi
leaq -0x178(%rbp), %rdi
callq 0x2a3930
movq -0x28(%rbp), %r9
leaq -0x15c(%rbp), %rdi
leaq -0x178(%rbp), %rsi
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rdx
movq %r8, %rcx
callq 0x71a90
movq %rax, -0xa8(%rbp)
movq -0x118(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x120(%rbp), %rcx
cmpl 0x8(%rcx), %eax
je 0x29ea0d
movq -0x20(%rbp), %rdi
movq 0x28(%rbp), %rsi
movq -0x118(%rbp), %rax
movl 0x8(%rax), %edx
xorl $0x1, %edx
movq -0x120(%rbp), %rax
movl 0x8(%rax), %ecx
xorl $0x1, %ecx
movq 0x30(%rbp), %r8
movsd -0x50(%rbp), %xmm0
movq -0xa8(%rbp), %r9
xorl %eax, %eax
leaq -0xd8(%rbp), %rax
movq $0x0, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x292000
cmpq $0x0, %rax
je 0x29ea0d
movq -0x118(%rbp), %rax
movslq 0x1c(%rax), %rax
movq 0x48(%rbp), %rcx
movq -0x60(%rbp), %rdx
addq (%rcx,%rdx,8), %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rax
cmpq -0xb8(%rbp), %rax
jle 0x29ea0b
movq -0xb0(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0xc0(%rbp)
jmp 0x29ea0d
jmp 0x29ea0f
movq -0x60(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x29e8bf
movq -0xb8(%rbp), %rdx
movq 0x48(%rbp), %rax
movq -0x58(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
cmpq $0x0, -0xc0(%rbp)
jge 0x29ea4d
movq $-0x1, %rax
movq %rax, -0x188(%rbp)
jmp 0x29ea5b
movq -0xc0(%rbp), %rax
movq %rax, -0x188(%rbp)
movq -0x188(%rbp), %rdx
movq 0x50(%rbp), %rax
movq -0x58(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
cmpq $0x0, -0xc0(%rbp)
jge 0x29ea88
movq $-0x1, %rax
movq %rax, -0x190(%rbp)
jmp 0x29eac0
movq -0x130(%rbp), %rdi
movq -0x118(%rbp), %rax
movl 0x8(%rax), %esi
xorl $0x1, %esi
movq -0x30(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0xc0(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %edx
xorl $0x1, %edx
callq 0x298410
movq %rax, -0x190(%rbp)
movq -0x190(%rbp), %rax
movl %eax, %ecx
movq -0x118(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x118(%rbp), %rax
movl 0x4(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x0, %ecx
movl %ecx, 0x4(%rax)
cmpq $0x0, -0xc0(%rbp)
jge 0x29eafd
xorl %eax, %eax
movl %eax, -0x194(%rbp)
jmp 0x29eb42
movq -0x118(%rbp), %rax
movl 0x8(%rax), %edi
xorl $0x1, %edi
callq 0x286f50
movl %eax, -0x198(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0xc0(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %edi
xorl $0x1, %edi
callq 0x286f50
movl %eax, %ecx
movl -0x198(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x194(%rbp)
movl -0x194(%rbp), %ecx
movq -0x118(%rbp), %rax
movl %ecx, 0x24(%rax)
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x29e7a0
jmp 0x29eb65
movq 0x40(%rbp), %rax
movq 0x8(%rax), %rax
cmpq -0x68(%rbp), %rax
jae 0x29ec3e
movq -0x68(%rbp), %rcx
movq 0x40(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x40(%rbp), %rax
movq 0x8(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x8(%rax)
movq 0x40(%rbp), %rax
movq 0x8(%rax), %rcx
shrq %rcx
movq 0x40(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x40(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x2, %rcx
movq 0x40(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x40(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x4, %rcx
movq 0x40(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x40(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x8, %rcx
movq 0x40(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x40(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x10, %rcx
movq 0x40(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x40(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
movq 0x40(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x40(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x40(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x29ec40
movq 0x40(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x140(%rbp)
movq -0x70(%rbp), %rdi
movq 0x48(%rbp), %rsi
movq 0x50(%rbp), %rdx
movq 0x38(%rbp), %rcx
movq -0x140(%rbp), %r8
movq 0x58(%rbp), %r9
leaq -0xf8(%rbp), %r10
leaq -0x100(%rbp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x2d4150
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq -0x68(%rbp), %rcx
subq -0x70(%rbp), %rcx
cmpq %rcx, %rax
jge 0x29ed17
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x70(%rbp), %rcx
addq -0x58(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movslq 0x1c(%rax), %rdx
shlq $0x20, %rdx
orq $0x1, %rdx
movq -0x140(%rbp), %rax
movq -0xf8(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0xf8(%rbp)
movq %rdx, (%rax,%rcx,8)
movq -0x70(%rbp), %rdx
addq -0x58(%rbp), %rdx
movq 0x58(%rbp), %rax
movq -0x100(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x100(%rbp)
movq %rdx, (%rax,%rcx,8)
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x29ec8e
movq -0x38(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
cmpq -0x100(%rbp), %rax
jae 0x29edfd
movq -0x100(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rcx
shrq %rcx
movq -0x38(%rbp), %rax
orq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rcx
shrq $0x2, %rcx
movq -0x38(%rbp), %rax
orq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rcx
shrq $0x4, %rcx
movq -0x38(%rbp), %rax
orq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rcx
shrq $0x8, %rcx
movq -0x38(%rbp), %rax
orq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rcx
shrq $0x10, %rcx
movq -0x38(%rbp), %rax
orq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rax
movq (%rax), %rdi
movq -0x38(%rbp), %rax
imulq $0x28, 0x10(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
jmp 0x29edff
movq $-0x1, -0xa0(%rbp)
movq $-0x1, -0x98(%rbp)
movq 0x40(%rbp), %rax
movq $0x0, (%rax)
movq $0x0, -0x58(%rbp)
movq $0x0, -0xe8(%rbp)
movq -0x58(%rbp), %rax
cmpq -0xf8(%rbp), %rax
jge 0x29ef47
movq -0xe8(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0x140(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cltq
movq %rax, -0x108(%rbp)
movq $0x0, -0x60(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x108(%rbp), %rax
jge 0x29eee6
movq -0x30(%rbp), %rax
movq (%rax), %rsi
movq 0x58(%rbp), %rax
movq -0xf0(%rbp), %rcx
movq -0x108(%rbp), %rdx
subq -0x60(%rbp), %rdx
subq $0x1, %rdx
addq %rdx, %rcx
imulq $0x28, (%rax,%rcx,8), %rax
addq %rax, %rsi
movq -0x38(%rbp), %rax
movq (%rax), %rdi
movq -0xe8(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0xe8(%rbp)
imulq $0x28, %rax, %rax
addq %rax, %rdi
movl $0x28, %edx
callq 0x2180
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x29ee72
cmpq $0x0, -0x98(%rbp)
jl 0x29ef0f
movq -0xa0(%rbp), %rax
movq -0x140(%rbp), %rcx
movq -0x58(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
cmpq %rcx, %rax
jge 0x29ef34
movq -0x58(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x140(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movq %rax, -0xa0(%rbp)
jmp 0x29ef36
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x29ee33
movq -0xe8(%rbp), %rax
cmpq -0x100(%rbp), %rax
jne 0x29ef59
jmp 0x29ef78
leaq 0xf1ae5(%rip), %rdi     # 0x390a45
leaq 0xf18c8(%rip), %rsi     # 0x39082f
movl $0x3878, %edx           # imm = 0x3878
leaq 0xf4144(%rip), %rcx     # 0x3930b7
callq 0x2130
movq -0xf8(%rbp), %rcx
movq 0x40(%rbp), %rax
movq %rcx, (%rax)
movq -0x140(%rbp), %rdi
movq -0xf8(%rbp), %rsi
movq -0x38(%rbp), %rax
movq (%rax), %rdx
callq 0x2a3bf0
cmpq $0x0, %rax
je 0x29efd1
movq -0x30(%rbp), %rax
movq (%rax), %rdi
movq -0x38(%rbp), %rax
movq (%rax), %rsi
imulq $0x28, -0x100(%rbp), %rdx
callq 0x2180
movq -0x98(%rbp), %rax
movq %rax, -0x10(%rbp)
jmp 0x29f9dc
jmp 0x29efd3
movq 0x40(%rbp), %rax
movq $0x0, (%rax)
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x70(%rbp), %rax
jge 0x29f593
movq -0x30(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x58(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x118(%rbp)
movq -0x130(%rbp), %rdi
movq -0x118(%rbp), %rax
movl 0x8(%rax), %esi
xorl $0x1, %esi
callq 0x287d20
movq %rax, -0x78(%rbp)
movq -0x118(%rbp), %rax
movslq 0x14(%rax), %rax
addq -0x78(%rbp), %rax
cvtsi2sd %rax, %xmm0
mulsd -0x48(%rbp), %xmm0
cvttsd2si %xmm0, %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rax
cmpq 0x30(%rbp), %rax
jge 0x29f064
movq 0x30(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x118(%rbp), %rax
movslq 0x14(%rax), %rax
addq -0x78(%rbp), %rax
addq -0x90(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rax
movq 0x20(%rbp), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
jle 0x29f0a4
movq 0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x90(%rbp)
movq -0x58(%rbp), %rdi
movq -0x30(%rbp), %rax
movq (%rax), %rsi
movq -0x90(%rbp), %rax
addq $0x80, %rax
movl %eax, %edx
callq 0x2a39b0
movq %rax, -0x90(%rbp)
movq -0x40(%rbp), %rax
movq $0x0, 0x8(%rax)
movq $-0x1, -0x88(%rbp)
movq -0x90(%rbp), %rax
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
jl 0x29f2c6
movq -0x30(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x60(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x120(%rbp)
movq -0x120(%rbp), %rax
movl 0x14(%rax), %eax
movq -0x118(%rbp), %rcx
cmpl 0x14(%rcx), %eax
jl 0x29f128
jmp 0x29f2b5
movq -0x130(%rbp), %rdi
movq -0x118(%rbp), %rsi
movq -0x120(%rbp), %rdx
callq 0x2a3ad0
movq %rax, -0x80(%rbp)
cmpq $0x0, -0x80(%rbp)
jge 0x29f152
jmp 0x29f2b5
jmp 0x29f154
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x40(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jne 0x29f1c1
movq -0x40(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x29f185
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
shlq %rax
movq %rax, -0x1a0(%rbp)
jmp 0x29f193
movl $0x2, %eax
movq %rax, -0x1a0(%rbp)
jmp 0x29f193
movq -0x1a0(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x40(%rbp), %rax
movq (%rax), %rdi
movq -0x40(%rbp), %rax
imulq $0x30, 0x10(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, (%rax)
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq -0x40(%rbp), %rdx
movq 0x8(%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0x8(%rdx)
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x128(%rbp)
movq -0x128(%rbp), %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x2100
movq -0x128(%rbp), %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x0, %ecx
movl %ecx, 0xc(%rax)
movq -0x120(%rbp), %rax
movl 0x8(%rax), %ecx
xorl $0x1, %ecx
movq -0x128(%rbp), %rax
movl %ecx, (%rax)
movq -0x60(%rbp), %rax
movl %eax, %edx
movq -0x128(%rbp), %rax
movl 0xc(%rax), %ecx
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
andl $0xc0000000, %ecx       # imm = 0xC0000000
orl %edx, %ecx
movl %ecx, 0xc(%rax)
movq -0x118(%rbp), %rax
movl 0x14(%rax), %ecx
movq -0x120(%rbp), %rax
subl 0x18(%rax), %ecx
movq -0x128(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x80(%rbp), %rax
movl %eax, %ecx
movq -0x128(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x128(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0x128(%rbp), %rax
movl 0xc(%rax), %ecx
andl $0xbfffffff, %ecx       # imm = 0xBFFFFFFF
orl $0x0, %ecx
movl %ecx, 0xc(%rax)
movq -0x88(%rbp), %rax
cmpq -0x80(%rbp), %rax
jge 0x29f2b3
movq -0x80(%rbp), %rax
movq %rax, -0x88(%rbp)
jmp 0x29f2b5
movq -0x60(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x29f0ec
movq -0x118(%rbp), %rax
movslq 0x1c(%rax), %rax
movq %rax, -0xb8(%rbp)
movq $-0x1, -0xc0(%rbp)
movq $-0x1, -0xc8(%rbp)
movq $0x0, -0xd0(%rbp)
movl $0x0, -0xdc(%rbp)
movq -0x40(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x29f4ed
movsd 0xe2ce6(%rip), %xmm1    # 0x382000
addsd -0x48(%rbp), %xmm1
cvtsi2sdq -0x88(%rbp), %xmm0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
cmpq 0x30(%rbp), %rax
jge 0x29f350
movq 0x30(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x18(%rbp), %rdi
movq -0x130(%rbp), %rsi
movq -0x118(%rbp), %rax
movl 0x8(%rax), %edx
xorl $0x1, %edx
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
movl %eax, %ecx
movq -0x40(%rbp), %rax
movq (%rax), %r8
movq -0x88(%rbp), %rax
movl %eax, %r9d
movq 0x40(%rbp), %r11
movq 0x38(%rbp), %r10
movq 0x10(%rbp), %rax
xorl %ebx, %ebx
xorps %xmm0, %xmm0
movl $0xf, (%rsp)
movq %r11, 0x8(%rsp)
movq %r10, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movq $0x0, 0x20(%rsp)
movq $0x1, 0x28(%rsp)
movq $0x0, 0x30(%rsp)
callq 0x29be70
movq $0x0, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq -0x40(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jge 0x29f4eb
movq -0x40(%rbp), %rax
movq (%rax), %rax
imulq $0x30, -0x60(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x180(%rbp)
movq -0x180(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpl $0x0, %eax
jne 0x29f413
jmp 0x29f4da
movq -0x180(%rbp), %rdi
movq -0x118(%rbp), %rsi
movq -0x30(%rbp), %rax
movq (%rax), %rdx
movq 0x48(%rbp), %rcx
movq 0x30(%rbp), %r8
movsd -0x48(%rbp), %xmm0
cvtsd2ss %xmm0, %xmm0
movss 0xe7457(%rip), %xmm1    # 0x386898
callq 0x30cb50
cltq
movq %rax, -0xb0(%rbp)
cmpq $-0x80000000, -0xb0(%rbp) # imm = 0x80000000
jne 0x29f45e
jmp 0x29f4da
cmpq $0x0, -0xb0(%rbp)
jge 0x29f46a
jmp 0x29f4da
movq -0xb0(%rbp), %rax
cmpq -0xb8(%rbp), %rax
jle 0x29f4d8
movq -0xb0(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x180(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
movl %eax, %eax
movq %rax, -0xc0(%rbp)
movq -0x180(%rbp), %rax
movslq 0x1c(%rax), %rax
movq %rax, -0xc8(%rbp)
movq -0x180(%rbp), %rax
movl 0x24(%rax), %eax
movl %eax, -0xdc(%rbp)
movq -0x180(%rbp), %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
movl %eax, %eax
movq %rax, -0xd0(%rbp)
jmp 0x29f4da
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x29f3d2
jmp 0x29f4ed
movq -0xb8(%rbp), %rdx
movq 0x48(%rbp), %rax
movq -0x58(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
cmpq $0x0, -0xc0(%rbp)
jge 0x29f51a
movq $-0x1, %rax
movq %rax, -0x1a8(%rbp)
jmp 0x29f528
movq -0xc0(%rbp), %rax
movq %rax, -0x1a8(%rbp)
movq -0x1a8(%rbp), %rdx
movq 0x50(%rbp), %rax
movq -0x58(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0xc8(%rbp), %rax
movl %eax, %ecx
movq -0x118(%rbp), %rax
movl %ecx, 0x20(%rax)
movl -0xdc(%rbp), %ecx
movq -0x118(%rbp), %rax
movl %ecx, 0x24(%rax)
movq -0xd0(%rbp), %rax
movl %eax, %edx
movq -0x118(%rbp), %rax
movl 0x4(%rax), %ecx
andl $0x1, %edx
shll $0x1f, %edx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl %edx, %ecx
movl %ecx, 0x4(%rax)
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x29efe6
jmp 0x29f595
movq 0x40(%rbp), %rax
movq 0x8(%rax), %rax
cmpq -0x68(%rbp), %rax
jae 0x29f66e
movq -0x68(%rbp), %rcx
movq 0x40(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x40(%rbp), %rax
movq 0x8(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x8(%rax)
movq 0x40(%rbp), %rax
movq 0x8(%rax), %rcx
shrq %rcx
movq 0x40(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x40(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x2, %rcx
movq 0x40(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x40(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x4, %rcx
movq 0x40(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x40(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x8, %rcx
movq 0x40(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x40(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x10, %rcx
movq 0x40(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x40(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
movq 0x40(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x40(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x40(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x29f670
movq 0x40(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x140(%rbp)
movq -0x70(%rbp), %rdi
movq 0x48(%rbp), %rsi
movq 0x50(%rbp), %rdx
movq 0x38(%rbp), %rcx
movq -0x140(%rbp), %r8
movq 0x58(%rbp), %r9
leaq -0xf8(%rbp), %r10
leaq -0x100(%rbp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x2d4150
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq -0x68(%rbp), %rcx
subq -0x70(%rbp), %rcx
cmpq %rcx, %rax
jge 0x29f747
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x70(%rbp), %rcx
addq -0x58(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movslq 0x1c(%rax), %rdx
shlq $0x20, %rdx
orq $0x1, %rdx
movq -0x140(%rbp), %rax
movq -0xf8(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0xf8(%rbp)
movq %rdx, (%rax,%rcx,8)
movq -0x70(%rbp), %rdx
addq -0x58(%rbp), %rdx
movq 0x58(%rbp), %rax
movq -0x100(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x100(%rbp)
movq %rdx, (%rax,%rcx,8)
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x29f6be
movq -0x38(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
cmpq -0x100(%rbp), %rax
jae 0x29f82d
movq -0x100(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rcx
shrq %rcx
movq -0x38(%rbp), %rax
orq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rcx
shrq $0x2, %rcx
movq -0x38(%rbp), %rax
orq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rcx
shrq $0x4, %rcx
movq -0x38(%rbp), %rax
orq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rcx
shrq $0x8, %rcx
movq -0x38(%rbp), %rax
orq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rcx
shrq $0x10, %rcx
movq -0x38(%rbp), %rax
orq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rax
movq (%rax), %rdi
movq -0x38(%rbp), %rax
imulq $0x28, 0x10(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
jmp 0x29f82f
movq $-0x1, -0xa0(%rbp)
movq $-0x1, -0x98(%rbp)
movq 0x40(%rbp), %rax
movq $0x0, (%rax)
movq $0x0, -0x58(%rbp)
movq $0x0, -0xe8(%rbp)
movq -0x58(%rbp), %rax
cmpq -0xf8(%rbp), %rax
jge 0x29f977
movq -0xe8(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0x140(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cltq
movq %rax, -0x108(%rbp)
movq $0x0, -0x60(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x108(%rbp), %rax
jge 0x29f916
movq -0x30(%rbp), %rax
movq (%rax), %rsi
movq 0x58(%rbp), %rax
movq -0xf0(%rbp), %rcx
movq -0x108(%rbp), %rdx
subq -0x60(%rbp), %rdx
subq $0x1, %rdx
addq %rdx, %rcx
imulq $0x28, (%rax,%rcx,8), %rax
addq %rax, %rsi
movq -0x38(%rbp), %rax
movq (%rax), %rdi
movq -0xe8(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0xe8(%rbp)
imulq $0x28, %rax, %rax
addq %rax, %rdi
movl $0x28, %edx
callq 0x2180
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x29f8a2
cmpq $0x0, -0x98(%rbp)
jl 0x29f93f
movq -0xa0(%rbp), %rax
movq -0x140(%rbp), %rcx
movq -0x58(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
cmpq %rcx, %rax
jge 0x29f964
movq -0x58(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x140(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movq %rax, -0xa0(%rbp)
jmp 0x29f966
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x29f863
movq -0xe8(%rbp), %rax
cmpq -0x100(%rbp), %rax
jne 0x29f989
jmp 0x29f9a8
leaq 0xf10b5(%rip), %rdi     # 0x390a45
leaq 0xf0e98(%rip), %rsi     # 0x39082f
movl $0x38fb, %edx           # imm = 0x38FB
leaq 0xf3714(%rip), %rcx     # 0x3930b7
callq 0x2130
movq -0xf8(%rbp), %rcx
movq 0x40(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rax
movq (%rax), %rdi
movq -0x38(%rbp), %rax
movq (%rax), %rsi
imulq $0x28, -0x100(%rbp), %rdx
callq 0x2180
movq -0x98(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %rbp
retq
nopw (%rax,%rax)