// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/inter.cpp
// Function: flat_contain_adv(overlap_region_alloc*, All_reads*, ul_idx_t const*, ug_opt_t const*, long, double, long, long, long, long, bit_extz_t*, long, char*, UC_Read*, double, kv_rtrace_t*, ul_ov_t*, long, int*, int*, int*, int*, int*, long*, long*, ul_ov_t*, unsigned long*, unsigned long, long*, ul_ov_t*)
int64_t flat_contain_adv(overlap_region_alloc* ol, All_reads *ridx, const ul_idx_t *uref, 
const ug_opt_t *uopt, int64_t bw, double diff_ec_ul, int64_t qlen, int64_t max_skip, int64_t max_iter, 
int64_t max_dis, bit_extz_t *exz, int64_t trans_sc, char* qstr, UC_Read *tu, double e_rate, 
kv_rtrace_t *trace, ul_ov_t *a, int64_t a_n, int32_t *f0, int32_t *c_n0, int32_t *c_sc0, 
int32_t *rch0, int32_t *ssc0, int64_t *p0, int64_t *t0, ul_ov_t *ori_a, uint64_t *flag, 
uint64_t rechain_w, int64_t *vis, ul_ov_t *idx)
{
	if(a_n <= 0) return 0;
	int32_t *t = f0, *c_n = c_n0; int64_t *p = p0, *f = t0, rech = 0, nf = 0, ori_i, ori_j, ncl; uint64_t qs;
	int64_t mm_ovlp, x, i, j, st, max_ii, mm_sc, mm_n, mm_idx, n_skip, end_j, qo, sc, sn, is_c, cl, csc, cl1; 
	uint32_t li_v, lj_v; ul_ov_t *li, *lj; int64_t max, max_n, tot_sc = INT32_MIN, tot_n = INT32_MIN, tot_i = -1;
	for (i = 1, j = 0; i <= a_n; i++) {
		if (i == a_n || a[i].qe != a[j].qe) {
			if(i - j > 1) radix_sort_ul_ov_srt_qs(a+j, a+i);
			j = i;
		}
	}
	// fprintf(stderr, "\n[M::%s::] sc::%u\n", __func__, idx->qn);
	memset(t, 0, (a_n*sizeof((*t)))); 
	for (i = st = 0, max_ii = -1; i < a_n; ++i) {
        li = &(a[i]); li_v = (li->tn<<1)|li->rev; 
		flag[i] = li->sec; li->sec = ori_a[li->sec>>1].sec; 
		
		csc = ((li->el)?(li->qe-li->qs):(0));
		mm_sc = csc; mm_n = 1; mm_idx = -1; n_skip = 0; end_j = -1; 
		if(flag[i]&1) {//low prority
			rech++; f[i] = INT32_MIN; p[i] = mm_idx; c_n[i] = 0; continue;
		}
		// fprintf(stderr, "[i::%ld] (id::%u)\n", i, li->tn);
		// fprintf(stderr, "[i::%ld] (id::%u)%.*s\t%c\tq::[%u, %u)\tt::[%u, %u)\tc::%u\n", i, li->tn,
        //             (int)Get_NAME_LENGTH(R_INF, a[i].tn), Get_NAME(R_INF, a[i].tn), 
		// 			"+-"[a[i].rev], a[i].qs, a[i].qe, a[i].ts, a[i].te, !a[i].el);
		mm_ovlp = max_ovlp_src(uopt, li_v^1);        
		x = (li->qs + mm_ovlp)*diff_ec_ul; 
		if(x < bw) x = bw; 
		x += li->qs + mm_ovlp;
		if (x > qlen+1) x = qlen+1;
		x = find_ul_ov_max(i, a, x+G_CHAIN_INDEL); 
		
		if ((x-st) > max_iter) st = x-max_iter;
		for (j = x; j >= st; --j) { // collect potential destination vertices
			lj = &(a[j]); lj_v = (lj->tn<<1)|lj->rev;
			if(flag[j]&1) continue;//low prority
			if(lj->qe <= li->qs) break;//even this pair has a overlap, its length will be very small; just ignore
			// if(lj->qs >= li->qs) continue;///no contain
			if(lj->qs > li->qs) continue;///no contain, must be > instad of >=
			qo = infer_rovlp(li, lj, NULL, NULL, ridx, NULL); ///overlap length in query (UL read)
			if(li_v != lj_v && get_ecov_contain_adv(uref, uopt, li_v^1, lj_v^1, bw, diff_ec_ul, qo, &is_c)) {
				if(is_c == 0) {
					sc = f[j] + csc; sn = c_n[j] + 1;
					// if(li->tn == 6312) {
					// 	fprintf(stderr, "***[i::%ld] (id::%u)%.*s\t%c\tj::%ld\t%.*s\tsc::%ld\tsn::%ld\n", i, li->tn,
					// 		(int)Get_NAME_LENGTH(R_INF, a[i].tn), Get_NAME(R_INF, a[i].tn), 
					// 		"+-"[a[i].rev], j, (int)Get_NAME_LENGTH(R_INF, a[j].tn), Get_NAME(R_INF, a[j].tn),
					// 		sc, sn);
					// }
					if((sc > mm_sc) || ((sc == mm_sc) && (sn > mm_n))) {
						mm_sc = sc, mm_idx = j; mm_n = sn;
						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 || ((a[i].qe) > (a[max_ii].qe+max_dis))) {//too long
			max = INT32_MIN; max_n = INT32_MIN; max_ii = -1;
			for (j = i - 1; (j >= st) && (a[i].qe<=(max_dis+a[j].qe)); --j) {
				if ((max < f[j]) || ((max == f[j]) && (max_n < c_n[j]))) {
					max = f[j]; max_n = c_n[j]; max_ii = j;
				}
			}
		}
		
		if (max_ii >= 0 && max_ii < end_j) {///just have a try with a[i]<->a[max_ii]
			lj = &(a[max_ii]); lj_v = (lj->tn<<1)|lj->rev;
			if((lj->qe > li->qs) && (lj->qs <= li->qs) && (!(flag[max_ii]&1))) {
				qo = infer_rovlp(li, lj, NULL, NULL, ridx, NULL); ///overlap length in query (UL read)
				if(li_v != lj_v && get_ecov_contain_adv(uref, uopt, li_v^1, lj_v^1, bw, diff_ec_ul, qo, &is_c)) {
					if(is_c == 0) {
						sc = f[max_ii] + csc; sn = c_n[max_ii] + 1;
						if((sc > mm_sc) || ((sc == mm_sc) && (sn > mm_n))) {
							mm_sc = sc; mm_idx = max_ii; mm_n = sn;
						}
					}
				}
			}
		}

		f[i] = mm_sc; p[i] = mm_idx; c_n[i] = mm_n; 
		if ((max_ii < 0) || ((a[i].qe<=max_dis+a[max_ii].qe) && (f[max_ii]<f[i]))) {
			max_ii = i;
		}

		if((tot_sc < f[i]) || ((tot_sc == f[i]) && (tot_n < c_n[i]))) {
			tot_sc = f[i]; tot_n = c_n[i]; tot_i = i;
		}
	}
	// fprintf(stderr, "+++[i::%ld] (id::%u)\n", i, li->tn);
	cl = 0; i = tot_i; t = NULL;
	while (i >= 0) {
        flag[cl] |= (((uint64_t)i)<<32); 
		i = p[i]; cl++;
    }
	// fprintf(stderr, "+++[i::%ld] (cl::%ld)\n", i, cl);

	st = flag[cl-1]>>32; qs = a[st].qs; cl1 = 0;
	// fprintf(stderr, "[M::%s] qs::%lu\trechain_w::%lu\trech::%ld\tcl::%ld\n", 
	// 	__func__, qs, rechain_w, rech, cl);
	if((qs <= rechain_w) && (rech > 0)) {
		for (i = nf = 0; i < cl; i++) {
			st = flag[cl-i-1]>>32;
			if(a[st].el) break;
			if((a[st].ts == 0) && (a[st].te == Get_READ_LENGTH(R_INF, a[st].tn))) nf++;
		}
		if(i < cl && a[st].qs > qs && nf > 0) {
			
			cl1 = quick_rechain(ol, a, st+1, trace, uref, uopt, bw, diff_ec_ul, qlen, max_skip, max_iter, max_dis, 
			exz, trans_sc, ridx, qstr, tu, e_rate, f0, c_n0, c_sc0, rch0, p0, t0);
			// fprintf(stderr, "st::%ld\tcl1::%ld[M::%s]\t(id::%u)\t%.*s\t%c\tq::[%u, %u)\tt::[%u, %u)\tc::%u\n", 
			// st, cl1, __func__, a[st].tn, (int)Get_NAME_LENGTH(R_INF, a[st].tn), Get_NAME(R_INF, a[st].tn), 
			// 		"+-"[a[st].rev], a[st].qs, a[st].qe, a[st].ts, a[st].te, !a[st].el);
			
			// fprintf(stderr, "i::%ld\t[M::%s]\t(id::%u)\t%.*s\t%c\tq::[%u, %u)\tt::[%u, %u)\tc::%u\n", 
			// i, __func__, a[t0[cl1-1]].tn, (int)Get_NAME_LENGTH(R_INF, a[t0[cl1-1]].tn), 
			// 		Get_NAME(R_INF, a[t0[cl1-1]].tn), "+-"[a[t0[cl1-1]].rev], a[t0[cl1-1]].qs, a[t0[cl1-1]].qe, 
			// 		a[t0[cl1-1]].ts, a[t0[cl1-1]].te, !a[t0[cl1-1]].el);

			if(cl1 > 0 && a[t0[cl1-1]].qs <= qs) {
				cl = cl-i-1; assert(st == t0[0]);
				for (i = 0; i < cl1; i++) {
					flag[cl] <<= 32; flag[cl] >>= 32; 
					flag[cl] |= ((uint64_t)t0[i])<<32; cl++;
				}
			}
		}
	}
	// fprintf(stderr, "---[i::%ld] (cl::%ld)\n", i, cl);
	for (i = 0; i < cl; i++) {
		// fprintf(stderr, "[i::%ld] flag[cl-i-1]>>32::%lu\n", i, flag[cl-i-1]>>32);
		t0[i] = flag[cl-i-1]>>32; 
		vis[((uint32_t)flag[t0[i]])>>1] |= 1;///set as used 
		// fprintf(stderr, "[i::%ld]\t%.*s\traw_i::%u\n", i, 
		// (int)Get_NAME_LENGTH(R_INF, a[t0[i]].tn), Get_NAME(R_INF, a[t0[i]].tn), ((uint32_t)flag[t0[i]])>>1);
		// flag[cl-i-1] = (uint32_t)flag[cl-i-1];
	}

	i = 0; ncl = 0;
	if(cl1 > 1) {
		// for (i = 0; i < cl; i++) vis[((uint32_t)flag[t0[i]])>>1] |= 1;///set as used 
		for (i = 0; i < cl1; i++) {
			if(flag[t0[i]]&1) flag[t0[i]]-=1; 
			vis[((uint32_t)flag[t0[i]])>>1] |= 1;
			c_n[ncl++] = ((uint32_t)flag[t0[i]])>>1;

			// a[ncl] = a[t0[i]];
			// if(a[ncl].qs < idx->qs) idx->qs = a[ncl].qs;
			// if(a[ncl].qe > idx->qe) idx->qe = a[ncl].qe;
			// fprintf(stderr, "[ncl::%ld]\t%.*s\n", ncl, 
			// (int)Get_NAME_LENGTH(R_INF, a[ncl].tn), Get_NAME(R_INF, a[ncl].tn));
			// ncl++;

			if(i < cl1 - 1) {
				ori_i = ((uint32_t)flag[t0[i]])>>1; 
				ori_j = ((uint32_t)flag[t0[i+1]])>>1; 
				ncl += push_trans_aln(uref, uopt, bw, diff_ec_ul, ridx, ori_a, ori_i, ori_j, vis, c_n+ncl);
			}
		}
	}


	for (; i < cl; i++) {
		///t0[i] -> idx of a; (uint32_t)flag[t0[i]] -> idx of ori_a
		if(flag[t0[i]]&1) flag[t0[i]]-=1;
		vis[((uint32_t)flag[t0[i]])>>1] |= 1;
		c_n[ncl++] = ((uint32_t)flag[t0[i]])>>1;
		// a[ncl] = a[t0[i]];
		// if(a[ncl].qs < idx->qs) idx->qs = a[ncl].qs;
		// if(a[ncl].qe > idx->qe) idx->qe = a[ncl].qe;
		// fprintf(stderr, "[ncl::%ld]\t%.*s\n", ncl, 
		// 	(int)Get_NAME_LENGTH(R_INF, a[ncl].tn), Get_NAME(R_INF, a[ncl].tn));
		// ncl++;
		// fprintf(stderr, "[M::%s] (id::%u)%.*s\t%c\tq::[%u, %u)\tt::[%u, %u)\tc::%u\n", 
		// __func__, a[i].tn, (int)Get_NAME_LENGTH(R_INF, a[i].tn), Get_NAME(R_INF, a[i].tn), 
		// 			"+-"[a[i].rev], a[i].qs, a[i].qe, a[i].ts, a[i].te, !a[i].el);
	}
	assert(ncl >= cl);
	if(ncl <= 0) return ncl;

	idx->qs = ori_a[c_n[0]].qs; 
	idx->qe = ori_a[c_n[0]].qe;
	for (i = 0; i < ncl; i++) {
		a[i] = ori_a[c_n[i]];
		if(a[i].qs < idx->qs) idx->qs = a[i].qs;
		if(a[i].qe > idx->qe) idx->qe = a[i].qe;
	}
	return ncl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movsd %xmm1, 0x120(%rsp)
movq %r9, 0x100(%rsp)
movsd %xmm0, 0xb0(%rsp)
movq %r8, 0xa8(%rsp)
movq %rcx, 0xa0(%rsp)
movq %rsi, 0xd0(%rsp)
movq 0x1b8(%rsp), %r14
testq %r14, %r14
jle 0x174f5c
movq %rdi, 0x110(%rsp)
movq %rdx, 0x118(%rsp)
movq 0x1e8(%rsp), %r12
movq 0x1b0(%rsp), %rax
negq %r14
movq 0x180(%rsp), %r13
leaq 0x1c(%rax), %rbx
pushq $0x1
popq %r15
xorl %eax, %eax
leaq (%r14,%r15), %rcx
cmpq $0x1, %rcx
je 0x1747c3
testq %rcx, %rcx
je 0x174791
movl 0x8(%rbx), %ecx
imulq $0x1c, %rax, %rdx
movq 0x1b0(%rsp), %rsi
cmpl 0x8(%rsi,%rdx), %ecx
jne 0x174791
movq %rax, %rcx
jmp 0x1747b7
movq %r15, %rdx
subq %rax, %rdx
movq %r15, %rcx
cmpq $0x2, %rdx
jl 0x1747b7
imulq $0x1c, %rax, %rdi
addq 0x1b0(%rsp), %rdi
movq %rbx, %rsi
callq 0x1571fa
movq %r15, %rcx
incq %r15
addq $0x1c, %rbx
movq %rcx, %rax
jmp 0x174768
movq 0x1b8(%rsp), %r14
leaq (,%r14,4), %rdx
xorl %ebp, %ebp
movq 0x1c0(%rsp), %rdi
xorl %esi, %esi
callq 0x20e0
movq 0x1f0(%rsp), %r11
movq 0x200(%rsp), %r10
movq 0x100(%rsp), %rax
incq %rax
movq %rax, 0x128(%rsp)
movq 0x1b0(%rsp), %r15
leaq -0x14(%r15), %rax
movq %rax, 0x130(%rsp)
movq $-0x80000000, 0xe8(%rsp) # imm = 0x80000000
pushq $-0x1
popq %rax
movq $0x0, 0x98(%rsp)
movq %rax, 0x88(%rsp)
movq $0x0, 0x108(%rsp)
movq $-0x80000000, 0xe0(%rsp) # imm = 0x80000000
movq %rax, 0xd8(%rsp)
movq 0x1c8(%rsp), %r9
cmpq %r14, %rbp
je 0x174ea3
movq %r12, %r8
imulq $0x1c, %rbp, %rcx
leaq (%r15,%rcx), %rbx
movl 0xc(%r15,%rcx), %r12d
movl 0x18(%r15,%rcx), %eax
movl %eax, %edx
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
movq %rbp, 0x90(%rsp)
movq %rdx, (%r10,%rbp,8)
movl 0x18(%r15,%rcx), %edx
movl %edx, %esi
shrl %esi
andl $0x1fffffff, %esi       # imm = 0x1FFFFFFF
imulq $0x1c, %rsi, %rsi
movq 0x1f8(%rsp), %rdi
movl 0x18(%rdi,%rsi), %esi
movl $0x3fffffff, %edi       # imm = 0x3FFFFFFF
andl %edi, %esi
movl %edx, %edi
andl $0xc0000000, %edi       # imm = 0xC0000000
orl %esi, %edi
movl %edi, 0x18(%r15,%rcx)
btl $0x1e, %edx
jb 0x1748e1
movq $0x0, 0xc8(%rsp)
jmp 0x1748ef
movl 0x8(%rbx), %ecx
subl 0x4(%rbx), %ecx
movq %rcx, 0xc8(%rsp)
movq 0x90(%rsp), %rbp
testb $0x1, (%r10,%rbp,8)
jne 0x174b8c
shldl $0x1, %eax, %r12d
movl %r12d, 0xbc(%rsp)
xorl $0x1, %r12d
movq 0xa0(%rsp), %rdi
movl %r12d, 0xb8(%rsp)
movl %r12d, %esi
callq 0x15d49a
movl 0x4(%rbx), %ecx
addq %rax, %rcx
cvtsi2sd %rcx, %xmm0
mulsd 0xb0(%rsp), %xmm0
cvttsd2si %xmm0, %rdx
movq 0xa8(%rsp), %rax
cmpq %rax, %rdx
cmovleq %rax, %rdx
addq %rcx, %rdx
movq 0x128(%rsp), %rax
cmpq %rax, %rdx
cmovgeq %rax, %rdx
subl $-0x80, %edx
movl %ebp, %edi
movq %r15, %rsi
callq 0x160717
movq 0x1f0(%rsp), %r11
movq 0x200(%rsp), %r10
movslq %eax, %r12
movq %r12, %rax
movq 0x98(%rsp), %r8
subq %r8, %rax
movq %r12, %rcx
movq 0x178(%rsp), %rdx
subq %rdx, %rcx
cmpq %rdx, %rax
cmovgq %rcx, %r8
movq %r15, %rax
imulq $0x1c, %r12, %r15
addq %rax, %r15
movq 0xc8(%rsp), %rbp
pushq $0x1
popq %r14
pushq $-0x1
popq %rax
movq %rax, 0xf0(%rsp)
movq $0x0, 0xc0(%rsp)
movq %r8, 0x98(%rsp)
cmpq %r8, %r12
jl 0x174bae
testb $0x1, (%r10,%r12,8)
jne 0x174a00
movl 0x4(%rbx), %eax
cmpl %eax, 0x8(%r15)
jbe 0x174bae
cmpl %eax, 0x4(%r15)
jbe 0x174a15
movq %rbp, %rax
movq %r14, %rcx
decq %r12
addq $-0x1c, %r15
movq %rax, %rbp
movq %rcx, %r14
jmp 0x1749dd
movl 0xc(%r15), %eax
movl 0x18(%r15), %r13d
shrdl $0x1f, %eax, %r13d
movq %rbx, %rdi
movq %r15, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
movq 0xd0(%rsp), %r8
xorl %r9d, %r9d
callq 0x3d261
cmpl %r13d, 0xbc(%rsp)
jne 0x174a6e
movq %rbp, %rax
movq %r14, %rcx
movq 0x200(%rsp), %r10
movq 0x1f0(%rsp), %r11
movq 0x180(%rsp), %r13
movq 0x98(%rsp), %r8
jmp 0x174a06
xorl $0x1, %r13d
leaq 0xf8(%rsp), %rcx
movq %rcx, (%rsp)
movq 0xa0(%rsp), %rsi
movl 0xb8(%rsp), %edx
movl %r13d, %ecx
movq 0xa8(%rsp), %r8
movsd 0xb0(%rsp), %xmm0
movq %rax, %r9
callq 0x1728e0
testq %rax, %rax
je 0x174a46
cmpq $0x0, 0xf8(%rsp)
movq 0x200(%rsp), %r10
movq 0x1f0(%rsp), %r11
movq 0x180(%rsp), %r13
movq 0x98(%rsp), %r8
jne 0x174a00
movq (%r11,%r12,8), %rax
addq 0xc8(%rsp), %rax
movq 0x1c8(%rsp), %rcx
movslq (%rcx,%r12,4), %rcx
incq %rcx
cmpq %rbp, %rax
jg 0x174b04
jne 0x174b29
cmpq %rcx, %r14
jge 0x174b29
xorl %edx, %edx
movq 0xc0(%rsp), %rsi
testq %rsi, %rsi
setg %dl
subq %rdx, %rsi
movq %rsi, 0xc0(%rsp)
movq %r12, 0xf0(%rsp)
jmp 0x174b5f
movq 0x1c0(%rsp), %rax
movslq (%rax,%r12,4), %rax
cmpq %rax, 0x90(%rsp)
jne 0x174b59
movq 0xc0(%rsp), %rax
cmpq 0x170(%rsp), %rax
jge 0x174bae
incq 0xc0(%rsp)
movq %rbp, %rax
movq %r14, %rcx
movq 0x1e8(%rsp), %rdx
movq (%rdx,%r12,8), %rdx
testq %rdx, %rdx
js 0x174a06
movq 0x1c0(%rsp), %rsi
movq 0x90(%rsp), %rdi
movl %edi, (%rsi,%rdx,4)
jmp 0x174a06
movq $-0x80000000, (%r11,%rbp,8) # imm = 0x80000000
movq %r8, %r12
orq $-0x1, (%r8,%rbp,8)
incq 0x108(%rsp)
andl $0x0, (%r9,%rbp,4)
jmp 0x174de3
movq 0x88(%rsp), %rdx
testq %rdx, %rdx
movq 0x1c8(%rsp), %r9
movq 0x1b0(%rsp), %r15
js 0x174be3
movl 0x8(%rbx), %eax
imulq $0x1c, %rdx, %rcx
movl 0x8(%r15,%rcx), %ecx
addq %r13, %rcx
cmpq %rax, %rcx
jge 0x174c88
movq $-0x80000000, %rcx      # imm = 0x80000000
movq 0x90(%rsp), %rax
pushq $-0x1
popq %rdx
movq %rdx, 0x88(%rsp)
movq $-0x80000000, %rdx      # imm = 0x80000000
imulq $0x1c, %rax, %rsi
decq %rax
addq 0x130(%rsp), %rsi
leaq 0x1(%rax), %rdi
cmpq %r8, %rdi
jle 0x174c80
movl 0x8(%rbx), %edi
movl (%rsi), %r8d
addq %r13, %r8
cmpq %rdi, %r8
jl 0x174c80
movq (%r11,%rax,8), %rdi
cmpq %rdi, %rcx
jl 0x174c4f
jne 0x174c3e
movslq (%r9,%rax,4), %r8
cmpq %r8, %rdx
jl 0x174c68
decq %rax
addq $-0x1c, %rsi
movq 0x98(%rsp), %r8
jmp 0x174c13
movslq (%r9,%rax,4), %rdx
movq %rax, 0x88(%rsp)
movq %rdi, %rcx
movq 0x98(%rsp), %r8
jmp 0x174c04
movq %rax, 0x88(%rsp)
movq %rdi, %rcx
movq %r8, %rdx
movq 0x98(%rsp), %r8
jmp 0x174c04
movq 0x88(%rsp), %rdx
testq %rdx, %rdx
movq %rdx, 0x88(%rsp)
js 0x174d26
cmpq %r12, %rdx
jge 0x174d26
imulq $0x1c, %rdx, %rax
movl 0x4(%rbx), %ecx
cmpl %ecx, 0x8(%r15,%rax)
movq 0x1e8(%rsp), %r12
jbe 0x174d2e
leaq (%r15,%rax), %rsi
cmpl %ecx, 0x4(%rsi)
ja 0x174d2e
testb $0x1, (%r10,%rdx,8)
jne 0x174d2e
movl 0xc(%r15,%rax), %ecx
movl 0x18(%r15,%rax), %r15d
shrdl $0x1f, %ecx, %r15d
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
movq 0xd0(%rsp), %r8
xorl %r9d, %r9d
callq 0x3d261
cmpl %r15d, 0xbc(%rsp)
jne 0x174deb
movq 0x1c8(%rsp), %r9
movq 0x1b0(%rsp), %r15
movq 0x200(%rsp), %r10
movq 0x1f0(%rsp), %r11
movq 0x88(%rsp), %rdx
jmp 0x174d2e
movq 0x1e8(%rsp), %r12
movq 0x90(%rsp), %rax
movq %rbp, (%r11,%rax,8)
movq 0xf0(%rsp), %rcx
movq %rcx, (%r12,%rax,8)
movl %r14d, (%r9,%rax,4)
movq (%r11,%rax,8), %rax
testq %rdx, %rdx
js 0x174d75
movl 0x8(%rbx), %ecx
movq 0x88(%rsp), %rsi
imulq $0x1c, %rsi, %rdx
movl 0x8(%r15,%rdx), %edx
addq %r13, %rdx
cmpq %rcx, %rdx
jl 0x174d85
cmpq %rax, (%r11,%rsi,8)
jge 0x174d85
movq 0x90(%rsp), %rcx
movq %rcx, 0x88(%rsp)
cmpq %rax, 0xe8(%rsp)
jge 0x174dac
movslq %r14d, %rcx
movq %rcx, 0xe0(%rsp)
movq %rax, 0xe8(%rsp)
movq 0x90(%rsp), %rbp
jmp 0x174dd3
movq 0x90(%rsp), %rbp
jne 0x174ddb
movslq %r14d, %rcx
cmpq %rcx, 0xe0(%rsp)
jge 0x174ddb
movq %rax, 0xe8(%rsp)
movq %rcx, 0xe0(%rsp)
movq %rbp, 0xd8(%rsp)
movq 0x1b8(%rsp), %r14
incq %rbp
jmp 0x174866
xorl $0x1, %r15d
leaq 0xf8(%rsp), %rcx
movq %rcx, (%rsp)
movq 0xa0(%rsp), %rsi
movl 0xb8(%rsp), %edx
movl %r15d, %ecx
movq 0xa8(%rsp), %r8
movsd 0xb0(%rsp), %xmm0
movq %rax, %r9
callq 0x1728e0
testq %rax, %rax
je 0x174cfc
cmpq $0x0, 0xf8(%rsp)
movq 0x1c8(%rsp), %r9
movq 0x1b0(%rsp), %r15
movq 0x200(%rsp), %r10
movq 0x1f0(%rsp), %r11
movq 0x88(%rsp), %rdx
jne 0x174d2e
movq 0xc8(%rsp), %rsi
addq (%r11,%rdx,8), %rsi
movslq (%r9,%rdx,4), %rax
incq %rax
movq %rsi, %rcx
cmpq %rbp, %rsi
jg 0x174e90
jne 0x174d2e
cmpq %rax, %r14
jge 0x174d2e
movq %rcx, %rbp
movq %rax, %r14
movq %rdx, 0xf0(%rsp)
jmp 0x174d2e
movq 0x1f8(%rsp), %rbp
xorl %r14d, %r14d
movq 0x210(%rsp), %r8
movq 0xd8(%rsp), %rcx
testq %rcx, %rcx
js 0x174ed7
movq %rcx, %rax
shlq $0x20, %rax
orq %rax, (%r10,%r14,8)
movq (%r12,%rcx,8), %rcx
incq %r14
jmp 0x174ebe
movl -0x4(%r10,%r14,8), %eax
imulq $0x1c, %rax, %rax
movl 0x4(%r15,%rax), %r12d
cmpq 0x208(%rsp), %r12
setbe %al
cmpq $0x0, 0x108(%rsp)
setg %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x174f64
leaq -0x1(%r14), %r15
leaq 0xdf322(%rip), %rax     # 0x254230
movq 0x18(%rax), %rcx
xorl %ebx, %ebx
xorl %eax, %eax
cmpq $-0x1, %r15
je 0x17510a
movq (%r10,%r15,8), %r13
shrq $0x20, %r13
imulq $0x1c, %r13, %rdx
movq 0x1b0(%rsp), %rsi
testb $0x40, 0x1b(%rsi,%rdx)
jne 0x174f6b
addq %rsi, %rdx
cmpl $0x0, 0x10(%rdx)
jne 0x174f57
movl 0xc(%rdx), %esi
movl 0x14(%rdx), %edx
xorl %edi, %edi
cmpq %rdx, (%rcx,%rsi,8)
sete %dil
addq %rdi, %rax
decq %r15
jmp 0x174f16
xorl %r12d, %r12d
jmp 0x1752ef
xorl %ebx, %ebx
jmp 0x17511a
xorl %ebx, %ebx
cmpl %r12d, 0x4(%rsi,%rdx)
jbe 0x17510a
testq %rax, %rax
jle 0x17510a
leaq 0x1(%r13), %rdx
movq 0x1e8(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x1d8(%rsp), %rax
movq %rax, 0x68(%rsp)
movq 0x1c0(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x1a0(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x198(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x190(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x188(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x180(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x178(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x170(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x100(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %r11, 0x78(%rsp)
movq 0x1c8(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0xd0(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0xa8(%rsp), %rax
movq %rax, (%rsp)
movq 0x110(%rsp), %rdi
movq 0x1a8(%rsp), %rcx
movq 0x118(%rsp), %r8
movq 0xa0(%rsp), %r9
movsd 0xb0(%rsp), %xmm0
movsd 0x120(%rsp), %xmm1
callq 0x173d1c
movq %rax, %rbx
testq %rax, %rax
jle 0x1750dd
movq 0x1f0(%rsp), %rdx
imulq $0x1c, -0x8(%rdx,%rbx,8), %rax
movq 0x1b0(%rsp), %rcx
cmpl %r12d, 0x4(%rcx,%rax)
movq 0x210(%rsp), %r8
movq 0x200(%rsp), %r10
movq %rdx, %r11
ja 0x17510a
cmpq (%r11), %r13
jne 0x175323
xorl %eax, %eax
cmpq %rax, %rbx
je 0x175107
movl (%r10,%r15,8), %ecx
movq %rcx, (%r10,%r15,8)
movq (%r11,%rax,8), %rdx
shlq $0x20, %rdx
orq %rcx, %rdx
movq %rdx, (%r10,%r15,8)
incq %r15
incq %rax
jmp 0x1750b9
movq 0x1c8(%rsp), %r9
movq 0x1b0(%rsp), %r15
movq 0x210(%rsp), %r8
movq 0x200(%rsp), %r10
movq 0x1f0(%rsp), %r11
jmp 0x17511a
movq %r15, %r14
movq 0x1c8(%rsp), %r9
movq 0x1b0(%rsp), %r15
xorl %eax, %eax
testq %r14, %r14
movl $0x0, %ecx
cmovgq %r14, %rcx
leaq (%r10,%r14,8), %rdx
addq $-0x8, %rdx
cmpq %rax, %rcx
je 0x175154
movq (%rdx), %rsi
shrq $0x20, %rsi
movq %rsi, (%r11,%rax,8)
movl (%r10,%rsi,8), %esi
shrl %esi
orq $0x1, (%r8,%rsi,8)
incq %rax
addq $-0x8, %rdx
jmp 0x175130
cmpq $0x1, %rbx
jle 0x175220
leaq -0x1(%rbx), %r15
xorl %r12d, %r12d
xorl %r13d, %r13d
cmpq %r13, %rbx
je 0x175227
movq (%r11,%r13,8), %rcx
movq (%r10,%rcx,8), %rax
testb $0x1, %al
je 0x17518c
decq %rax
movq %rax, (%r10,%rcx,8)
movq (%r11,%r13,8), %rax
movq (%r10,%rax,8), %rax
shrl %eax
orb $0x1, (%r8,%rax,8)
movq (%r11,%r13,8), %rax
movq (%r10,%rax,8), %r9
movl %r9d, %eax
shrl %eax
movq 0x1c8(%rsp), %rcx
movl %eax, (%rcx,%r12,4)
incq %r12
cmpq %r15, %r13
jge 0x175218
shrl %r9d
movq 0x8(%r11,%r13,8), %rax
movl (%r10,%rax,8), %eax
shrl %eax
leaq (%rcx,%r12,4), %rcx
movq %rcx, 0x10(%rsp)
movq %r8, 0x8(%rsp)
movq %rax, (%rsp)
movq 0xa0(%rsp), %rsi
movq 0xa8(%rsp), %rdx
movsd 0xb0(%rsp), %xmm0
movq 0xd0(%rsp), %rcx
movq %rbp, %r8
callq 0x1744cf
movq 0x1f0(%rsp), %r11
movq 0x200(%rsp), %r10
movq 0x210(%rsp), %r8
addq %rax, %r12
incq %r13
jmp 0x175168
xorl %r12d, %r12d
xorl %ebx, %ebx
jmp 0x17526f
movq 0x1c8(%rsp), %r9
movq 0x1b0(%rsp), %r15
jmp 0x17526f
movq (%r11,%rbx,8), %rcx
movq (%r10,%rcx,8), %rax
testb $0x1, %al
je 0x175254
decq %rax
movq %rax, (%r10,%rcx,8)
movq (%r11,%rbx,8), %rax
movq (%r10,%rax,8), %rax
shrl %eax
orb $0x1, (%r8,%rax,8)
movq (%r11,%rbx,8), %rax
movl (%r10,%rax,8), %eax
shrl %eax
movl %eax, (%r9,%r12,4)
incq %r12
incq %rbx
cmpq %r14, %rbx
jl 0x175239
cmpq %r14, %r12
jl 0x175304
testq %r12, %r12
movq 0x218(%rsp), %rdx
jle 0x1752ef
movslq (%r9), %rax
imulq $0x1c, %rax, %rax
movl 0x4(%rbp,%rax), %eax
movl %eax, 0x4(%rdx)
movslq (%r9), %rax
imulq $0x1c, %rax, %rax
movl 0x8(%rbp,%rax), %eax
movl %eax, 0x8(%rdx)
addq $0x8, %r15
xorl %eax, %eax
cmpq %r12, %rax
jge 0x1752ef
movslq (%r9,%rax,4), %rcx
imulq $0x1c, %rcx, %rcx
movupd (%rbp,%rcx), %xmm0
movups 0xc(%rbp,%rcx), %xmm1
movupd %xmm0, -0x8(%r15)
movups %xmm1, 0x4(%r15)
movl -0x4(%r15), %ecx
cmpl 0x4(%rdx), %ecx
jae 0x1752db
movl %ecx, 0x4(%rdx)
movl (%r15), %ecx
cmpl 0x8(%rdx), %ecx
jbe 0x1752e6
movl %ecx, 0x8(%rdx)
incq %rax
addq $0x1c, %r15
jmp 0x1752ac
movq %r12, %rax
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x7e631(%rip), %rdi     # 0x1f393c
leaq 0x7c811(%rip), %rsi     # 0x1f1b23
leaq 0x7e4b3(%rip), %rcx     # 0x1f37cc
movl $0x20a8, %edx           # imm = 0x20A8
callq 0x2110
leaq 0x7e496(%rip), %rdi     # 0x1f37c0
leaq 0x7c7f2(%rip), %rsi     # 0x1f1b23
leaq 0x7e494(%rip), %rcx     # 0x1f37cc
movl $0x206f, %edx           # imm = 0x206F
callq 0x2110