// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/anchor.cpp
// Function: lchain_qgen_mcopy_fast(Candidates_list*, overlap_region_alloc*, unsigned int, unsigned long, All_reads*, unsigned int, unsigned long, long, long, long, double, double, double, long, unsigned int, long, double, unsigned int, unsigned int, st_mt_t*, unsigned long)
void lchain_qgen_mcopy_fast(Candidates_list* cl, overlap_region_alloc* ol, uint32_t rid, uint64_t rl, All_reads* rdb, 
				uint32_t apend_be, uint64_t max_n_chain, int64_t max_skip, int64_t max_iter, 
				int64_t max_dis, double chn_pen_gap, double chn_pen_skip, double bw_rate, int64_t quick_check, 
				uint32_t gen_off, int64_t mcopy_num, double mcopy_rate, uint32_t chain_cutoff, uint32_t mcopy_khit_cut, st_mt_t *sp, uint64_t ocv_w)
{
	// fprintf(stderr, "+[M::%s] chain_cutoff::%u\n", __func__, chain_cutoff);
	uint64_t i, k, l, m, cn = cl->length, yid, ol0, lch, *cc = NULL, cwn = 0, cws, cwe, os, oe, rs, re, cw0, cw1/**, dbgn = 0**/; overlap_region *r, t; ///srt = 0
	clear_overlap_region_alloc(ol);

	for (l = 0, k = 1, m = 0, lch = 0; k <= cn; k++) {
		if((k == cn) || (cl->list[k].readID != cl->list[l].readID)) {
			if(cl->list[l].readID != rid) {
				yid = cl->list[l].readID; ol0 = ol->length;
				m += lchain_qdp_mcopy_fast(cl, l, k-l, m, &(cl->chainDP), ol, max_skip, max_iter, max_dis, chn_pen_gap, chn_pen_skip, bw_rate, 
				rid, rl, Get_READ_LENGTH((*rdb), yid), quick_check, apend_be, gen_off, mcopy_num, mcopy_rate, mcopy_khit_cut, 1);
				if((chain_cutoff >= 2) && (!lch)) {
					for (i = ol0; (i<ol->length) && (!lch); i++) {
						if(ol->list[i].align_length < chain_cutoff) lch = 1;
					}
				}
			}
			l = k;
		}
	}
	cl->length = m;

	// fprintf(stderr, "[M::%s::] rn::%lu\tmax_n_chain::%lu\n", __func__, ol->length, max_n_chain);
	// for (k = 0; k < ol->length; k++) {
	// 	fprintf(stderr, "---[M::%s::%.*s(qid::%u)] q[%d, %d), t[%d, %d), sc::%d, type::%d\n", __func__, 
	// 	(int32_t)Get_NAME_LENGTH(R_INF, ol->list[k].y_id), Get_NAME(R_INF, ol->list[k].y_id), ol->list[k].y_id,
	// 	ol->list[k].x_pos_s, ol->list[k].x_pos_e+1, ol->list[k].y_pos_s, ol->list[k].y_pos_e+1, ol->list[k].shared_seed, ha_ov_type(&(ol->list[k]), rl));
	// }

	k = ol->length;
	if (ol->length > max_n_chain) {
		int32_t w, n[4], s[4]; 
		n[0] = n[1] = n[2] = n[3] = 0, s[0] = s[1] = s[2] = s[3] = 0; 
		ks_introsort_or_ss(ol->length, ol->list); 
		for (i = 0; i < ol->length; ++i) {
			r = &(ol->list[i]);
			w = ha_ov_type(r, rl);
			++n[w];
			if (((uint64_t)n[w]) == max_n_chain) s[w] = r->shared_seed;
		}
		// fprintf(stderr, "[M::%s::] s[0]::%d, s[1]::%d, s[2]::%d, s[3]::%d\n", __func__, s[0], s[1], s[2], s[3]);
		if (s[0] > 0 || s[1] > 0 || s[2] > 0 || s[3] > 0) {
			if((((uint64_t)n[3]) >= max_n_chain) && (rl >= ocv_w)) {
				cwn = (rl/ocv_w) + ((rl % ocv_w)?(1):(0));
				kv_resize(uint64_t, (*sp), (cwn));
				cc = sp->a;
				for (i = cws = cwe = 0; i < cwn; i++) {
					cwe = cws + ocv_w; if(cwe > rl) cwe = rl;
					assert(cwe > cws);
					cc[i] = (cwe - cws)*(max_n_chain>>1); 
					// fprintf(stderr, "[M::%s::] cw::[%lu, %lu), cc::%lu\n", __func__, cws, cwe, cc[i]);
					if(cc[i] > UINT32_MAX) cc[i] = UINT32_MAX; cc[i] <<= 32;
					cws += ocv_w;
				}
			}
			for (i = 0, k = 0, lch = 0; i < ol->length; ++i) {
				r = &(ol->list[i]);
				w = ha_ov_type(r, rl);
				// ++n[w];
				// if (((int)n[w] <= max_n_chain) || (r->shared_seed >= s[w] && s[w] >= (asm_opt.k_mer_length<<1))) {
				if (r->shared_seed >= s[w]) {
					if(cwn) {
						m = (ol->list[i].x_pos_s/ocv_w); 
						rs = ol->list[i].x_pos_s; re = ol->list[i].x_pos_e + 1;
						for (cws = m*ocv_w; m < cwn; m++) {
							cwe = cws + ocv_w; if(cwe > rl) cwe = rl;
							os = ((rs >= cws)? rs : cws);
        					oe = ((re <= cwe)? re : cwe);
							if(oe <= os) break;
							if(((uint32_t)cc[m]) + (oe - os) < UINT32_MAX) {
								cc[m] += (oe - os);
							} else {
								cc[m] >>= 32; cc[m] <<= 32; cc[m] |= UINT32_MAX;
							}
							cws += ocv_w;
						}
					}
					if (k != i) {
						t = ol->list[k];
						ol->list[k] = ol->list[i];
						ol->list[i] = t;
					}
					if(ol->list[k].align_length < chain_cutoff) lch = 1;
					++k;
				} else if(w == 3 && cwn > 0) {
					m = (ol->list[i].x_pos_s/ocv_w); cw0 = cw1 = 0;
					rs = ol->list[i].x_pos_s; re = ol->list[i].x_pos_e + 1;
					for (cws = m*ocv_w; m < cwn; m++) {
						cwe = cws + ocv_w; if(cwe > rl) cwe = rl;
						os = ((rs >= cws)? rs : cws);
						oe = ((re <= cwe)? re : cwe);
						if(oe <= os) break;
						// fprintf(stderr, "+++[M::%s::%.*s(qid::%u)] o[%lu, %lu), cur::%lu, max::%lu\n", __func__, 
						// 	(int32_t)Get_NAME_LENGTH(R_INF, ol->list[i].y_id), Get_NAME(R_INF, ol->list[i].y_id), ol->list[i].y_id,
						// 	os, oe, ((uint64_t)((uint32_t)cc[m])), (cc[m]>>32));
						if((oe - os) + ((uint64_t)((uint32_t)cc[m])) >= (cc[m]>>32)) {
							cw1 += (oe - os);
						} else {
							cw0 += (oe - os);
						}
						cws += ocv_w;
					}

					if(cw0 >= ((cw0 + cw1)*0.7)) {
						m = (ol->list[i].x_pos_s/ocv_w); 
						rs = ol->list[i].x_pos_s; re = ol->list[i].x_pos_e + 1;
						for (cws = m*ocv_w; m < cwn; m++) {
							cwe = cws + ocv_w; if(cwe > rl) cwe = rl;
							os = ((rs >= cws)? rs : cws);
        					oe = ((re <= cwe)? re : cwe);
							if(oe <= os) break;
							if(((uint32_t)cc[m]) + (oe - os) < UINT32_MAX) {
								cc[m] += (oe - os);
							} else {
								cc[m] >>= 32; cc[m] <<= 32; cc[m] |= UINT32_MAX;
							}
							cws += ocv_w;
						}
						if (k != i) {
							t = ol->list[k];
							ol->list[k] = ol->list[i];
							ol->list[i] = t;
						}
						if(ol->list[k].align_length < chain_cutoff) lch = 1;
						++k;
						// dbgn++;
						// fprintf(stderr, "+++[M::%s::%.*s(qid::%u)] q[%d, %d), t[%d, %d), sc::%d, type::%d, cw0::%lu, cw1::%lu\n", __func__, 
						// 	(int32_t)Get_NAME_LENGTH(R_INF, ol->list[k].y_id), Get_NAME(R_INF, ol->list[k].y_id), ol->list[k].y_id,
						// 	ol->list[k].x_pos_s, ol->list[k].x_pos_e+1, ol->list[k].y_pos_s, ol->list[k].y_pos_e+1, ol->list[k].shared_seed, ha_ov_type(&(ol->list[k]), rl), cw0, cw1);
					}
				}
			}
			ol->length = k;
		}
	} 
	
	ks_introsort_or_xs(ol->length, ol->list);
	if(lch) {
		//@brief r485
		uint64_t zs, ze, rs, re, ob, os, oe, ocn, pp, kn, ms, me; int64_t osc;
		for (i = l = 0, cn = cl->length; i < ol->length; ++i) {
			if(ol->list[i].align_length < chain_cutoff) {
				zs = ol->list[i].x_pos_s; ze = ol->list[i].x_pos_e + 1;
				ob = (ze - zs)*OFL; if(ob < 16) ob = 16;
				osc = ol->list[i].shared_seed*CH_SC;
				ocn = ol->list[i].align_length<<CH_OCC;
				for (k = 0; (k < ol->length) && (ze > ol->list[k].x_pos_s); k++) {
					if(ol->list[k].align_length < chain_cutoff) continue;
					if(ol->list[k].align_length < ocn) continue;
					if(ol->list[k].shared_seed < osc) continue;
					rs = ol->list[k].x_pos_s; re = ol->list[k].x_pos_e + 1;
					os = ((rs>=zs)?rs:zs); oe = ((re<=ze)?re:ze);
					if((oe > os) && (oe - os) >= ob) {
						m = ol->list[k].non_homopolymer_errors;
						pp = cl->list[m].readID; kn = 0;
						for (; (m < cn) && (cl->list[m].readID == pp) && (kn < ocn); m++) {
							me = cl->list[m].self_offset; ms = me - (cl->list[m].cnt&(0xffu)); 
							if((ms >= os) && (me <= oe)) kn++;
						}
						if(kn >= ocn) break;
					}
				}
				if((k < ol->length) && (ze > ol->list[k].x_pos_s)) continue;
			}
			if (l != i) {
				t = ol->list[l];
				ol->list[l] = ol->list[i];
				ol->list[i] = t;
			}
			l++;
		}
		ol->length = l;
	} 

	for (i = 0; i < ol->length; ++i) ol->list[i].align_length = 0;
	// fprintf(stderr, "+[M::%s] rid::%u, ol->length0::%lu, dbgn::%lu\n", __func__, rid, ol->length, dbgn);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movsd %xmm3, 0x8(%rsp)
movsd %xmm2, 0x20(%rsp)
movq %xmm1, 0x18(%rsp)
movsd %xmm0, 0x38(%rsp)
movq %r9, 0x50(%rsp)
movq %r8, 0x10(%rsp)
movq %rcx, %r15
movl %edx, %r13d
movq %rsi, %rbx
movq %rdi, %r14
movq 0x160(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x8(%rdi), %r12
movq %rsi, %rdi
callq 0x11935
movq %r13, %r11
movq %rbx, %r9
movq %r14, 0x40(%rsp)
leaq 0x18(%r14), %rax
movq %rax, 0x48(%rsp)
pushq $0x1
popq %rbp
xorl %r13d, %r13d
xorl %r14d, %r14d
xorl %esi, %esi
movq %rbx, (%rsp)
movq %r12, 0x28(%rsp)
cmpq %r12, %rbp
ja 0xe958b
movq 0x40(%rsp), %rax
movq (%rax), %rcx
jne 0xe9464
movq %rsi, %rax
shlq $0x4, %rax
movl (%rcx,%rax), %eax
jmp 0xe9486
movq %rbp, %rdx
shlq $0x4, %rdx
movq %rsi, %rax
shlq $0x4, %rax
movl (%rcx,%rax), %eax
movl (%rcx,%rdx), %ecx
xorl %eax, %ecx
testl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
je 0xe9583
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpl %r11d, %eax
jne 0xe9498
movq %rbp, %rsi
jmp 0xe9583
movl %eax, %eax
movq 0x10(%r9), %r12
movq %rbp, %rdx
subq %rsi, %rdx
movq 0x10(%rsp), %rcx
movq 0x18(%rcx), %r10
movq 0x40(%rsp), %rdi
movq %r14, %rcx
movq 0x48(%rsp), %r8
movsd 0x38(%rsp), %xmm0
movq 0x18(%rsp), %xmm1
movsd 0x20(%rsp), %xmm2
movsd 0x8(%rsp), %xmm3
pushq $0x1
movl 0x1a8(%rsp), %ebx
pushq %rbx
pushq 0x1a0(%rsp)
movl 0x1a0(%rsp), %ebx
pushq %rbx
pushq 0x70(%rsp)
pushq 0x1a8(%rsp)
pushq (%r10,%rax,8)
pushq %r15
movq %r11, %rbx
pushq %r11
pushq 0x1c0(%rsp)
pushq 0x1c0(%rsp)
pushq 0x1c0(%rsp)
callq 0x1609d
movl 0x1f8(%rsp), %esi
addq $0x60, %rsp
addq %rax, %r14
cmpl $0x2, %esi
jb 0xe956f
testq %r13, %r13
jne 0xe956f
movq (%rsp), %r9
movq 0x10(%r9), %rax
imulq $0xa8, %r12, %rcx
addq $0x28, %rcx
xorl %r13d, %r13d
movq %rbx, %r11
cmpq %rax, %r12
jae 0xe957b
testq %r13, %r13
jne 0xe957b
movq (%r9), %rdx
xorl %r13d, %r13d
cmpl %esi, (%rdx,%rcx)
setb %r13b
incq %r12
addq $0xa8, %rcx
jmp 0xe954c
movq %rbp, %rsi
movq (%rsp), %r9
movq %rbx, %r11
jmp 0xe957e
movq %rbp, %rsi
movq 0x28(%rsp), %r12
incq %rbp
jmp 0xe9445
movq 0x40(%rsp), %rax
movq %r14, 0x8(%rax)
movq (%r9), %rsi
movq 0x10(%r9), %rdi
cmpq 0x160(%rsp), %rdi
jbe 0xe9a5f
xorps %xmm0, %xmm0
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x60(%rsp)
callq 0xe248f
movq (%rsp), %rcx
movq 0x10(%rcx), %r14
xorl %ebx, %ebx
movq %r14, %rbp
subq $0x1, %r14
jb 0xe960b
movq (%rcx), %r12
leaq (%r12,%rbx), %rdi
movl %r15d, %esi
callq 0xe3aee
movl %eax, %eax
movslq 0x70(%rsp,%rax,4), %rcx
incq %rcx
movl %ecx, 0x70(%rsp,%rax,4)
cmpq 0x160(%rsp), %rcx
jne 0xe95fe
movl 0x24(%r12,%rbx), %ecx
movl %ecx, 0x60(%rsp,%rax,4)
addq $0xa8, %rbx
movq (%rsp), %rcx
jmp 0xe95c8
movdqa 0x60(%rsp), %xmm0
pxor %xmm1, %xmm1
pcmpgtd %xmm1, %xmm0
movmskps %xmm0, %eax
testl %eax, %eax
movq %rbp, %rdi
je 0xe9a5c
xorl %r12d, %r12d
movq 0x1b0(%rsp), %r14
cmpq %r14, %r15
jb 0xe96cc
movslq 0x7c(%rsp), %rax
movl $0x0, %ebp
cmpq 0x160(%rsp), %rax
jb 0xe9739
movq %r15, %rax
xorl %edx, %edx
divq %r14
movq %rax, %r12
cmpq $0x1, %rdx
sbbq $-0x1, %r12
movq 0x1a8(%rsp), %rbx
cmpq %r12, 0x8(%rbx)
jae 0xe96d0
leaq -0x1(%r12), %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
leaq 0x1(%rcx), %rax
movq %rax, 0x8(%rbx)
movq 0x10(%rbx), %rdi
leaq 0x8(,%rcx,8), %rsi
callq 0x2370
movq %rax, %rbp
movq %rax, 0x10(%rbx)
jmp 0xe96d4
xorl %ebp, %ebp
jmp 0xe9739
movq 0x10(%rbx), %rbp
shrq 0x58(%rsp)
xorl %eax, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movq %r14, %rdx
xorl %r9d, %r9d
xorl %esi, %esi
cmpq %rdx, %r15
movq %rdx, %r8
cmovbq %r15, %r8
cmpq %r12, %rsi
jae 0xe9735
leaq (%r9,%r14), %rdi
cmpq %r15, %rdi
movq %r15, %r10
cmovbq %rdi, %r10
cmpq %r9, %r10
jbe 0xe9ce6
addq %rax, %r8
imulq 0x58(%rsp), %r8
cmpq %rcx, %r8
cmovaeq %rcx, %r8
shlq $0x20, %r8
movq %r8, (%rbp,%rsi,8)
incq %rsi
addq %r14, %rdx
subq %r14, %rax
movq %rdi, %r9
jmp 0xe96e8
movq (%rsp), %rcx
xorl %r13d, %r13d
xorl %edi, %edi
xorl %r8d, %r8d
movq %r15, 0x30(%rsp)
cmpq 0x10(%rcx), %r8
jae 0xe9a58
movq %rdi, %r14
movq %r15, %rsi
movq %r12, %r15
movq (%rcx), %rbx
movq %r8, 0x8(%rsp)
imulq $0xa8, %r8, %r12
leaq (%rbx,%r12), %rdi
movq %rdi, 0x20(%rsp)
callq 0xe3aee
movq %r12, 0x38(%rsp)
movl 0x24(%rbx,%r12), %ecx
movl %eax, %edx
cmpl 0x60(%rsp,%rdx,4), %ecx
jge 0xe9846
movq %r15, %r12
testq %r15, %r15
sete %cl
cmpl $0x3, %eax
setne %al
orb %cl, %al
movq %r14, %rdi
jne 0xe98df
movq %rbx, 0x18(%rsp)
movq %rdi, 0x10(%rsp)
movq 0x20(%rsp), %rax
movl 0x4(%rax), %ecx
movl 0x8(%rax), %esi
movq %rcx, %rax
xorl %edx, %edx
movq 0x1b0(%rsp), %r14
divq %r14
incl %esi
movq %rax, %rdx
imulq %r14, %rdx
xorl %edi, %edi
xorl %r8d, %r8d
movq %rdx, %rbx
movq %rax, %r9
movq 0x30(%rsp), %r15
cmpq %r12, %r9
jae 0xe98f2
leaq (%rbx,%r14), %r10
cmpq %r15, %r10
movq %r15, %r11
cmovbq %r10, %r11
cmpq %rcx, %rbx
cmovbeq %rcx, %rbx
cmpq %rsi, %r11
cmovaeq %rsi, %r11
subq %rbx, %r11
jbe 0xe98f2
movq (%rbp,%r9,8), %rbx
movl %ebx, %r14d
addq %r11, %r14
shrq $0x20, %rbx
cmpq %rbx, %r14
jb 0xe982a
xorl %ebx, %ebx
jmp 0xe9830
movq %r11, %rbx
xorl %r11d, %r11d
addq %rbx, %rdi
addq %r11, %r8
incq %r9
movq %r10, %rbx
movq 0x1b0(%rsp), %r14
jmp 0xe97e4
movq %rbx, 0x18(%rsp)
movq %r15, %r12
testq %r15, %r15
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
movq 0x30(%rsp), %r15
movq %r14, %rdi
movq 0x1b0(%rsp), %r14
je 0xe99b1
movq 0x20(%rsp), %rax
movl 0x4(%rax), %ecx
movl 0x8(%rax), %esi
movq %rcx, %rax
xorl %edx, %edx
divq %r14
incl %esi
movq %rax, %r9
imulq %r14, %r9
cmpq %r12, %rax
jae 0xe99b1
leaq (%r9,%r14), %rdx
cmpq %r15, %rdx
movq %r15, %r8
cmovbq %rdx, %r8
cmpq %rcx, %r9
cmovbeq %rcx, %r9
cmpq %rsi, %r8
cmovaeq %rsi, %r8
subq %r9, %r8
jbe 0xe99b1
movq (%rbp,%rax,8), %rbx
movl %ebx, %r9d
addq %r8, %r9
movq %rbx, %r10
orq %r11, %r10
addq %r8, %rbx
cmpq %r11, %r9
cmovaeq %r10, %rbx
movq %rbx, (%rbp,%rax,8)
incq %rax
movq %rdx, %r9
jmp 0xe9889
movq (%rsp), %rcx
movq 0x8(%rsp), %r8
movq 0x30(%rsp), %r15
jmp 0xe9a50
movq %rdi, %xmm0
movq 0xf9971(%rip), %xmm2    # 0x1e3270
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movapd 0xf9975(%rip), %xmm3    # 0x1e3280
subpd %xmm3, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
addq %rdi, %r8
movq %r8, %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
subpd %xmm3, %xmm0
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
addsd %xmm0, %xmm2
mulsd 0xf9bb1(%rip), %xmm2    # 0x1e34f0
ucomisd %xmm2, %xmm1
jae 0xe9958
movq (%rsp), %rcx
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %r8
jmp 0xe9a50
movq 0x10(%rsp), %rdi
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
cmpq %r12, %rax
jae 0xe99b1
leaq (%rdx,%r14), %rbx
cmpq %r15, %rbx
movq %r15, %r8
cmovbq %rbx, %r8
cmpq %rcx, %rdx
cmovbeq %rcx, %rdx
cmpq %rsi, %r8
cmovaeq %rsi, %r8
subq %rdx, %r8
jbe 0xe99b1
movq (%rbp,%rax,8), %rdx
movl %edx, %r9d
addq %r8, %r9
movq %rdx, %r10
orq %r11, %r10
addq %r8, %rdx
cmpq %r11, %r9
cmovaeq %r10, %rdx
movq %rdx, (%rbp,%rax,8)
incq %rax
movq %rbx, %rdx
jmp 0xe9963
movq 0x8(%rsp), %r8
cmpq %r8, %rdi
jne 0xe99cd
movq (%rsp), %rcx
movl 0x198(%rsp), %edx
movq 0x18(%rsp), %rsi
jmp 0xe9a3b
movq %rdi, 0x10(%rsp)
imulq $0xa8, %rdi, %rax
movq 0x18(%rsp), %rbx
addq %rax, %rbx
movl $0xa8, %edx
leaq 0x80(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2160
movl $0xa8, %edx
movq %rbx, %rdi
movq 0x20(%rsp), %rsi
callq 0x2160
movq (%rsp), %rbx
movq 0x38(%rsp), %rdi
addq (%rbx), %rdi
movl $0xa8, %edx
movq %r14, %rsi
callq 0x2160
movq 0x8(%rsp), %r8
movq %rbx, %rcx
movq 0x10(%rsp), %rdi
movq (%rbx), %rsi
movl 0x198(%rsp), %edx
imulq $0xa8, %rdi, %rax
cmpl %edx, 0x28(%rsi,%rax)
pushq $0x1
popq %rax
cmovbq %rax, %r13
incq %rdi
incq %r8
jmp 0xe9746
movq %rdi, 0x10(%rcx)
movq (%rcx), %rsi
callq 0xe1c6f
testq %r13, %r13
je 0xe9cb4
movq 0x40(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x8(%rsp)
xorl %r14d, %r14d
xorl %r15d, %r15d
movq (%rsp), %rdx
movl 0x198(%rsp), %eax
movq 0x10(%rdx), %rbp
cmpq %rbp, %r15
jae 0xe9cae
movq (%rdx), %r12
imulq $0xa8, %r15, %rcx
leaq (%r12,%rcx), %r13
movq %rcx, 0x38(%rsp)
movl 0x28(%r12,%rcx), %ecx
cmpl %eax, %ecx
jae 0xe9c53
movl 0x4(%r13), %eax
movl 0x8(%r13), %edx
incl %edx
movq %rdx, %rsi
movq %rax, 0x20(%rsp)
subq %rax, %rsi
movq %rsi, %xmm0
punpckldq 0xf9795(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0xf979d(%rip), %xmm0    # 0x1e3280
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0xf99f1(%rip), %xmm1    # 0x1e34e8
cvttsd2si %xmm1, %rsi
movq %rsi, %rdi
sarq $0x3f, %rdi
subsd 0xf978d(%rip), %xmm1    # 0x1e3298
cvttsd2si %xmm1, %r8
andq %rdi, %r8
orq %rsi, %r8
cmpq $0x11, %r8
pushq $0x10
popq %rax
cmovbq %rax, %r8
movq %r8, 0x18(%rsp)
movl 0x24(%r13), %esi
shll $0x4, %esi
shll $0x4, %ecx
movl 0x198(%rsp), %eax
cmpl %ecx, %eax
movl %ecx, %r9d
cmoval %eax, %r9d
movl %esi, %eax
xorl %r10d, %r10d
movq %r14, 0x10(%rsp)
movq %r15, 0x50(%rsp)
movq %r13, 0x28(%rsp)
movq %rbp, 0x48(%rsp)
movl %esi, 0x30(%rsp)
cmpq %rbp, %r10
je 0xe9c53
imulq $0xa8, %r10, %rdi
movl 0x4(%r12,%rdi), %r11d
cmpl %r11d, %edx
jbe 0xe9c53
addq %r12, %rdi
cmpl %r9d, 0x28(%rdi)
jb 0xe9c46
cmpl %eax, 0x24(%rdi)
jl 0xe9c46
movl 0x8(%rdi), %ebx
incl %ebx
movq 0x20(%rsp), %rsi
cmpl %esi, %r11d
cmoval %r11d, %esi
cmpl %edx, %ebx
cmovael %edx, %ebx
cmpl %esi, %ebx
jbe 0xe9c46
movq %rbx, %r8
subq %rsi, %r8
cmpq 0x18(%rsp), %r8
jb 0xe9c46
movl 0x30(%rdi), %r15d
movq 0x40(%rsp), %rax
movq (%rax), %rdi
movq %r15, %r8
shlq $0x4, %r8
leaq (%rdi,%r8), %r13
addq $0xc, %r13
movl -0xc(%r13), %edi
xorl %r8d, %r8d
cmpq 0x8(%rsp), %r15
jae 0xe9c29
movl -0xc(%r13), %ebp
xorl %edi, %ebp
testl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
jne 0xe9c29
cmpq %rcx, %r8
jae 0xe9c29
movl -0x4(%r13), %eax
movzbl (%r13), %r14d
movq %rax, %rbp
subq %r14, %rbp
cmpq %rsi, %rbp
setae %bpl
cmpl %ebx, %eax
setbe %al
andb %bpl, %al
movzbl %al, %eax
addq %rax, %r8
incq %r15
addq $0x10, %r13
jmp 0xe9be2
cmpq %rcx, %r8
movq 0x10(%rsp), %r14
movq 0x50(%rsp), %r15
movq 0x28(%rsp), %r13
movq 0x48(%rsp), %rbp
movl 0x30(%rsp), %eax
jae 0xe9c4e
incq %r10
jmp 0xe9b5d
cmpl %r11d, %edx
ja 0xe9ca6
cmpq %r15, %r14
je 0xe9ca3
imulq $0xa8, %r14, %rax
addq %rax, %r12
movl $0xa8, %edx
leaq 0x80(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2160
movl $0xa8, %edx
movq %r12, %rdi
movq %r13, %rsi
callq 0x2160
movq (%rsp), %rax
movq 0x38(%rsp), %rdi
addq (%rax), %rdi
movl $0xa8, %edx
movq %rbx, %rsi
callq 0x2160
incq %r14
incq %r15
jmp 0xe9a81
movq %r14, 0x10(%rdx)
jmp 0xe9cbc
movq (%rsp), %rdx
movq 0x10(%rdx), %r14
pushq $0x28
popq %rax
subq $0x1, %r14
jb 0xe9cd4
movq (%rdx), %rcx
andl $0x0, (%rcx,%rax)
addq $0xa8, %rax
jmp 0xe9cbf
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x102fc8(%rip), %rdi    # 0x1eccb5
leaq 0x102dff(%rip), %rsi    # 0x1ecaf3
leaq 0x102fc4(%rip), %rcx    # 0x1eccbf
movl $0x7b4, %edx            # imm = 0x7B4
callq 0x2110