// File: /workspace/github_cpp_makefile_star2_O1/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 $0x148, %rsp            # imm = 0x148
movsd %xmm1, 0x138(%rsp)
movq %r9, 0x100(%rsp)
movsd %xmm0, 0xc8(%rsp)
movq %r8, 0xc0(%rsp)
movq %rcx, 0xb8(%rsp)
movq %rsi, 0xe8(%rsp)
movq 0x1c8(%rsp), %r14
testq %r14, %r14
jle 0x1b5ee9
movq %rdi, 0x128(%rsp)
movq %rdx, 0x130(%rsp)
movq 0x1d8(%rsp), %r13
movq 0x1c0(%rsp), %r12
negq %r14
leaq 0x1c(%r12), %rbx
movl $0x1, %r15d
xorl %eax, %eax
movq %r14, %rcx
addq %r15, %rcx
je 0x1b56a5
movl 0x8(%rbx), %ecx
leaq (%rax,%rax,8), %rdx
leaq (%rdx,%rdx,2), %rdx
addq %rax, %rdx
cmpl 0x8(%r12,%rdx), %ecx
jne 0x1b56a5
movq %rax, %rcx
jmp 0x1b56cd
movq %r15, %rdx
subq %rax, %rdx
movq %r15, %rcx
cmpq $0x2, %rdx
jl 0x1b56cd
leaq (%rax,%rax,8), %rcx
leaq (%rcx,%rcx,2), %rdi
addq %rax, %rdi
addq %r12, %rdi
movq %rbx, %rsi
callq 0x1957bd
movq %r15, %rcx
leaq (%r14,%r15), %rdx
incq %rdx
incq %r15
addq $0x1c, %rbx
movq %rcx, %rax
cmpq $0x1, %rdx
jne 0x1b5683
movq 0x1c8(%rsp), %r15
leaq (,%r15,4), %rdx
movq $0x0, 0x110(%rsp)
movq 0x1d0(%rsp), %rdi
xorl %esi, %esi
callq 0x20e0
movq 0x210(%rsp), %r11
movq 0x100(%rsp), %rax
incq %rax
movq %rax, 0x140(%rsp)
leaq -0x14(%r12), %r8
movq $-0x80000000, 0x118(%rsp) # imm = 0x80000000
movq $-0x1, %r9
movq $-0x1, 0x108(%rsp)
movq $-0x80000000, 0xf0(%rsp) # imm = 0x80000000
movq $-0x1, 0x88(%rsp)
xorl %ebx, %ebx
xorl %r10d, %r10d
movq 0x200(%rsp), %r14
movq %r13, %r15
leaq (%r10,%r10,8), %rax
leaq (%rax,%rax,2), %rcx
addq %r10, %rcx
movq 0x1c0(%rsp), %r12
leaq (%r12,%rcx), %rbp
movl 0xc(%r12,%rcx), %r13d
movl 0x18(%r12,%rcx), %eax
movl %eax, %edx
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
movq %rdx, (%r11,%r10,8)
movl 0x18(%r12,%rcx), %edx
movl %edx, %esi
shrl %esi
andl $0x1fffffff, %esi       # imm = 0x1FFFFFFF
leaq (%rsi,%rsi,8), %rdi
leaq (%rdi,%rdi,2), %rdi
addq %rsi, %rdi
movq 0x208(%rsp), %rsi
movl 0x18(%rsi,%rdi), %esi
movl $0x3fffffff, %edi       # imm = 0x3FFFFFFF
andl %edi, %esi
movl %edx, %edi
andl $0xc0000000, %edi       # imm = 0xC0000000
orl %esi, %edi
movl %edi, 0x18(%r12,%rcx)
btl $0x1e, %edx
movq %rbp, 0x90(%rsp)
jb 0x1b57f1
xorl %ebp, %ebp
jmp 0x1b57fa
movl 0x8(%rbp), %ecx
subl 0x4(%rbp), %ecx
movq %rcx, %rbp
testb $0x1, (%r11,%r10,8)
jne 0x1b58fa
movq %r9, 0xa8(%rsp)
movq %r8, 0xb0(%rsp)
shldl $0x1, %eax, %r13d
movl %r13d, 0xd4(%rsp)
xorl $0x1, %r13d
movq 0xb8(%rsp), %rdi
movl %r13d, 0xd0(%rsp)
movl %r13d, %esi
movq %r10, %r14
callq 0x19c00f
movq 0x90(%rsp), %rcx
movl 0x4(%rcx), %ecx
addq %rax, %rcx
cvtsi2sd %rcx, %xmm0
mulsd 0xc8(%rsp), %xmm0
cvttsd2si %xmm0, %rdx
movq 0xc0(%rsp), %rax
cmpq %rax, %rdx
cmovleq %rax, %rdx
addq %rcx, %rdx
movq 0x140(%rsp), %rax
cmpq %rax, %rdx
cmovgeq %rax, %rdx
subl $-0x80, %edx
movq %r14, 0x98(%rsp)
movl %r14d, %edi
movq 0x1c0(%rsp), %r14
movq %r14, %rsi
callq 0x19f679
cltq
movq %rax, %rcx
subq %rbx, %rcx
movq %rax, %rsi
movq 0x188(%rsp), %rdx
subq %rdx, %rsi
cmpq %rdx, %rcx
cmovleq %rbx, %rsi
cmpq %rax, %rsi
movq %rsi, 0xa0(%rsp)
movq %rbp, 0x120(%rsp)
jle 0x1b593a
movq $-0x1, 0xe0(%rsp)
movl $0x1, %r12d
movq 0x210(%rsp), %r11
movq 0x98(%rsp), %r10
jmp 0x1b5b37
incq 0x110(%rsp)
movq $-0x80000000, (%r14,%r10,8) # imm = 0x80000000
movq 0x1f8(%rsp), %rax
movq $-0x1, (%rax,%r10,8)
movq %r15, %r13
movl $0x0, (%r15,%r10,4)
movq 0xf0(%rsp), %rax
movq 0x1c8(%rsp), %r15
jmp 0x1b5dbf
leaq (%rax,%rax,8), %rcx
leaq (%rcx,%rcx,2), %r13
addq %r14, %r13
addq %rax, %r13
movl $0x1, %r15d
movq $-0x1, 0xe0(%rsp)
movq $0x0, 0xd8(%rsp)
movq %rbp, %r14
movq %rax, %rbx
movq 0x210(%rsp), %r11
movq 0x98(%rsp), %r10
movq 0x90(%rsp), %rdi
testb $0x1, (%r11,%rbx,8)
jne 0x1b599e
movl 0x4(%rdi), %eax
cmpl %eax, 0x8(%r13)
jbe 0x1b5b2e
cmpl %eax, 0x4(%r13)
jbe 0x1b59bf
movq %r14, %rbp
movq %r15, %r12
leaq -0x1(%rbx), %rax
addq $-0x1c, %r13
movq %r12, %r15
movq %rbp, %r14
cmpq %rsi, %rbx
movq %rax, %rbx
jg 0x1b5984
jmp 0x1b5b37
movl 0xc(%r13), %eax
movl 0x18(%r13), %ebp
shrdl $0x1f, %eax, %ebp
movq %r13, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
movq 0xe8(%rsp), %r8
xorl %r9d, %r9d
callq 0x6f050
cmpl %ebp, 0xd4(%rsp)
jne 0x1b5a13
movq %r14, %rbp
movq %r15, %r12
movq 0x210(%rsp), %r11
movq 0x98(%rsp), %r10
movq 0xa0(%rsp), %rsi
movq 0x90(%rsp), %rdi
jmp 0x1b59a4
xorl $0x1, %ebp
leaq 0xf8(%rsp), %rcx
movq %rcx, (%rsp)
movq 0xb8(%rsp), %rsi
movl 0xd0(%rsp), %edx
movl %ebp, %ecx
movq 0xc0(%rsp), %r8
movsd 0xc8(%rsp), %xmm0
movq %rax, %r9
callq 0x1b3728
testq %rax, %rax
je 0x1b59eb
cmpq $0x0, 0xf8(%rsp)
movq 0x210(%rsp), %r11
movq 0x98(%rsp), %r10
movq 0xa0(%rsp), %rsi
movq 0x90(%rsp), %rdi
jne 0x1b599e
movq 0x200(%rsp), %rax
movq (%rax,%rbx,8), %rbp
addq 0x120(%rsp), %rbp
movq 0x1d8(%rsp), %rax
movslq (%rax,%rbx,4), %r12
incq %r12
cmpq %r14, %rbp
jg 0x1b5aaf
jne 0x1b5ad4
cmpq %r12, %r15
jge 0x1b5ad4
xorl %eax, %eax
movq 0xd8(%rsp), %rcx
testq %rcx, %rcx
setg %al
subq %rax, %rcx
movq %rcx, 0xd8(%rsp)
movq %rbx, 0xe0(%rsp)
jmp 0x1b5b08
movq 0x1d0(%rsp), %rax
movslq (%rax,%rbx,4), %rax
cmpq %rax, %r10
jne 0x1b5b02
movq 0xd8(%rsp), %rax
cmpq 0x180(%rsp), %rax
jge 0x1b5b2e
incq %rax
movq %rax, 0xd8(%rsp)
movq %r14, %rbp
movq %r15, %r12
movq 0x1f8(%rsp), %rax
movq (%rax,%rbx,8), %rax
testq %rax, %rax
js 0x1b59a4
movq 0x1d0(%rsp), %rcx
movl %r10d, (%rcx,%rax,4)
jmp 0x1b59a4
movq %rbx, %rax
movq %r14, %rbp
movq %r15, %r12
cmpq $0x0, 0x88(%rsp)
movq 0x1d8(%rsp), %r13
movq 0x200(%rsp), %r14
movq 0x1f8(%rsp), %rbx
movq 0x190(%rsp), %r15
js 0x1b5b98
movq 0x90(%rsp), %rcx
movl 0x8(%rcx), %ecx
movq 0x88(%rsp), %rsi
leaq (%rsi,%rsi,8), %rdx
leaq (%rdx,%rdx,2), %rdx
addq %rsi, %rdx
movq 0x1c0(%rsp), %rsi
movl 0x8(%rsi,%rdx), %edx
addq %r15, %rdx
cmpq %rcx, %rdx
jge 0x1b5c36
movq $-0x1, 0x88(%rsp)
cmpq 0xa0(%rsp), %r10
jle 0x1b5c36
movq 0x90(%rsp), %rcx
movl 0x8(%rcx), %ecx
movq $-0x1, 0x88(%rsp)
movq $-0x80000000, %rdx      # imm = 0x80000000
movq 0xa8(%rsp), %rsi
movq 0xb0(%rsp), %rdi
movq $-0x80000000, %r8       # imm = 0x80000000
movl (%rdi), %r9d
addq %r15, %r9
cmpq %rcx, %r9
jl 0x1b5c36
movq (%r14,%rsi,8), %r9
cmpq %r9, %r8
jge 0x1b5c0d
movslq (%r13,%rsi,4), %rdx
movq %rsi, 0x88(%rsp)
movq %r9, %r8
jmp 0x1b5c21
jne 0x1b5c21
movslq (%r13,%rsi,4), %r10
cmpq %r10, %rdx
movq 0x98(%rsp), %r10
jl 0x1b5bfb
addq $-0x1c, %rdi
leaq -0x1(%rsi), %r9
cmpq 0xa0(%rsp), %rsi
movq %r9, %rsi
jg 0x1b5be7
movq 0x88(%rsp), %rcx
testq %rcx, %rcx
js 0x1b5d06
cmpq %rax, %rcx
movq 0xb0(%rsp), %r8
jge 0x1b5d0e
leaq (%rcx,%rcx,8), %rax
leaq (%rax,%rax,2), %rax
addq %rcx, %rax
movq 0x90(%rsp), %rcx
movl 0x4(%rcx), %ecx
movq 0x1c0(%rsp), %rdx
cmpl %ecx, 0x8(%rdx,%rax)
movq 0xa8(%rsp), %r9
jbe 0x1b5d16
leaq (%rdx,%rax), %rsi
cmpl %ecx, 0x4(%rsi)
ja 0x1b5d16
movq 0x88(%rsp), %rcx
testb $0x1, (%r11,%rcx,8)
jne 0x1b5d16
movl 0xc(%rdx,%rax), %ecx
movl 0x18(%rdx,%rax), %r13d
shrdl $0x1f, %ecx, %r13d
movq 0x90(%rsp), %rdi
xorl %edx, %edx
xorl %ecx, %ecx
movq 0xe8(%rsp), %r8
xorl %r9d, %r9d
callq 0x6f050
cmpl %r13d, 0xd4(%rsp)
jne 0x1b5ddf
movq 0x1d8(%rsp), %r13
movq 0x210(%rsp), %r11
movq 0xb0(%rsp), %r8
movq 0xa8(%rsp), %r9
movq 0x98(%rsp), %r10
jmp 0x1b5d16
movq 0xb0(%rsp), %r8
movq 0xa8(%rsp), %r9
movq %rbp, (%r14,%r10,8)
movq 0xe0(%rsp), %rax
movq %rax, (%rbx,%r10,8)
movl %r12d, (%r13,%r10,4)
movq 0x88(%rsp), %rsi
testq %rsi, %rsi
movq 0xf0(%rsp), %rdi
js 0x1b5d74
movq 0x90(%rsp), %rax
movl 0x8(%rax), %eax
leaq (%rsi,%rsi,8), %rcx
leaq (%rcx,%rcx,2), %rcx
addq %rsi, %rcx
movq 0x1c0(%rsp), %rdx
movl 0x8(%rdx,%rcx), %ecx
addq %r15, %rcx
cmpq %rax, %rcx
jl 0x1b5d77
movq (%r14,%rsi,8), %rax
cmpq (%r14,%r10,8), %rax
jge 0x1b5d77
movq %r10, %rsi
movq (%r14,%r10,8), %rax
cmpq %rax, %rdi
movq 0x1c8(%rsp), %r15
movq %rsi, 0x88(%rsp)
jl 0x1b5d9f
jne 0x1b5db4
movslq %r12d, %rcx
cmpq %rcx, 0x118(%rsp)
jge 0x1b5db4
movslq %r12d, %rcx
movq %rcx, 0x118(%rsp)
movq %r10, 0x108(%rsp)
jmp 0x1b5db7
movq %rdi, %rax
movq 0xa0(%rsp), %rbx
incq %r10
addq $0x1c, %r8
incq %r9
movq %rax, 0xf0(%rsp)
cmpq %r15, %r10
jne 0x1b5773
jmp 0x1b5ea8
xorl $0x1, %r13d
leaq 0xf8(%rsp), %rcx
movq %rcx, (%rsp)
movq 0xb8(%rsp), %rsi
movl 0xd0(%rsp), %edx
movl %r13d, %ecx
movq 0xc0(%rsp), %r8
movsd 0xc8(%rsp), %xmm0
movq %rax, %r9
callq 0x1b3728
testq %rax, %rax
je 0x1b5cdc
cmpq $0x0, 0xf8(%rsp)
movq 0x1d8(%rsp), %r13
movq 0x210(%rsp), %r11
movq 0xb0(%rsp), %r8
movq 0xa8(%rsp), %r9
movq 0x98(%rsp), %r10
jne 0x1b5d16
movq 0x88(%rsp), %rax
movq 0x120(%rsp), %rdx
addq (%r14,%rax,8), %rdx
movslq (%r13,%rax,4), %rax
incq %rax
movq %rdx, %rcx
cmpq %rbp, %rdx
jg 0x1b5e8d
jne 0x1b5d16
cmpq %rax, %r12
jge 0x1b5d16
movq %rcx, %rbp
movq %rax, %r12
movq 0x88(%rsp), %rax
movq %rax, 0xe0(%rsp)
jmp 0x1b5d16
movq 0x108(%rsp), %rdx
xorl %r15d, %r15d
movq 0x220(%rsp), %r10
testq %rdx, %rdx
js 0x1b5ef0
movq 0x1f8(%rsp), %rcx
movq 0x1c0(%rsp), %r12
movq %rdx, %rax
shlq $0x20, %rax
orq %rax, (%r11,%r15,8)
movq (%rcx,%rdx,8), %rdx
incq %r15
testq %rdx, %rdx
jns 0x1b5ed0
jmp 0x1b5ef8
xorl %ebx, %ebx
jmp 0x1b638d
movq 0x1c0(%rsp), %r12
movq -0x8(%r11,%r15,8), %rbx
shrq $0x20, %rbx
leaq (%rbx,%rbx,8), %rax
leaq (%rax,%rax,2), %rax
addq %rbx, %rax
movl 0x4(%r12,%rax), %r14d
cmpq 0x218(%rsp), %r14
setbe %al
cmpq $0x0, 0x110(%rsp)
setg %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x1b5fce
movq $-0x1, %r13
testq %r15, %r15
setne %cl
je 0x1b5fd6
movq -0x8(%r11,%r15,8), %rbx
shrq $0x20, %rbx
leaq (%rbx,%rbx,8), %rax
leaq (%rax,%rax,2), %rdi
addq %rbx, %rdi
testb $0x40, 0x1b(%r12,%rdi)
jne 0x1b5fd6
leaq 0xd52c7(%rip), %rax     # 0x28b230
movq 0x18(%rax), %rcx
addq %r12, %rdi
leaq (%r11,%r15,8), %rdx
addq $-0x10, %rdx
movl $0x1, %r13d
xorl %eax, %eax
movq %r13, %rsi
cmpl $0x0, 0x10(%rdi)
jne 0x1b5f9e
movl 0xc(%rdi), %r8d
movl 0x14(%rdi), %edi
xorl %r9d, %r9d
cmpq %rdi, (%rcx,%r8,8)
sete %r9b
addq %r9, %rax
cmpq %rsi, %r15
je 0x1b5fda
movq (%rdx), %rbx
shrq $0x20, %rbx
leaq (%rbx,%rbx,8), %rdi
leaq (%rdi,%rdi,2), %r8
addq %rbx, %r8
leaq (%r12,%r8), %rdi
addq $-0x8, %rdx
leaq 0x1(%rsi), %r13
testb $0x40, 0x1b(%r12,%r8)
je 0x1b5f80
decq %r13
jmp 0x1b5fdd
xorl %r12d, %r12d
jmp 0x1b6164
xorl %eax, %eax
jmp 0x1b5fec
movq %r15, %r13
cmpq %r15, %rsi
setb %cl
testq %rax, %rax
setg %al
notq %r13
testb %cl, %cl
je 0x1b6159
leaq (%rbx,%rbx,8), %rcx
leaq (%rcx,%rcx,2), %rcx
addq %rbx, %rcx
cmpl %r14d, 0x4(%r12,%rcx)
seta %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x1b6159
leaq 0x1(%rbx), %rdx
movq 0x1f8(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x1e8(%rsp), %rax
movq %rax, 0x68(%rsp)
movq 0x1d0(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x1b0(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x1a8(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x1a0(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x198(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x190(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x188(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x180(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x100(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x200(%rsp), %rbp
movq %rbp, 0x78(%rsp)
movq 0x1d8(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0xe8(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0xc0(%rsp), %rax
movq %rax, (%rsp)
movq 0x128(%rsp), %rdi
movq %r12, %rsi
movq 0x1b8(%rsp), %rcx
movq 0x130(%rsp), %r8
movq 0xb8(%rsp), %r9
movsd 0xc8(%rsp), %xmm0
movsd 0x138(%rsp), %xmm1
callq 0x1b4c34
movq %r12, %rdx
movq %rax, %r12
testq %rax, %rax
jle 0x1b63a2
movq -0x8(%rbp,%r12,8), %rax
leaq (%rax,%rax,8), %rcx
leaq (%rcx,%rcx,2), %rcx
addq %rax, %rcx
cmpl %r14d, 0x4(%rdx,%rcx)
movq 0x220(%rsp), %r10
movq 0x210(%rsp), %r11
jbe 0x1b63c2
movq 0x1d8(%rsp), %r13
jmp 0x1b63ba
xorl %r12d, %r12d
movq 0x1d8(%rsp), %r13
movq 0x200(%rsp), %rdi
testq %r15, %r15
jle 0x1b6197
movq %rdi, %rax
movq %r15, %rcx
movq -0x8(%r11,%rcx,8), %rdx
shrq $0x20, %rdx
movq %rdx, (%rax)
movl (%r11,%rdx,8), %edx
shrl %edx
orq $0x1, (%r10,%rdx,8)
addq $0x8, %rax
decq %rcx
jne 0x1b6177
cmpq $0x2, %r12
jl 0x1b627d
leaq -0x1(%r12), %r14
xorl %r13d, %r13d
xorl %ebx, %ebx
movq 0x200(%rsp), %rax
movq (%rax,%r13,8), %rax
movq (%r11,%rax,8), %rcx
testb $0x1, %cl
je 0x1b61c7
decq %rcx
movq %rcx, (%r11,%rax,8)
movq 0x200(%rsp), %rdx
movq (%rdx,%r13,8), %rax
movl (%r11,%rax,8), %eax
shrl %eax
orq $0x1, (%r10,%rax,8)
movq (%rdx,%r13,8), %rax
movq (%r11,%rax,8), %r9
movl %r9d, %eax
shrl %eax
movq 0x1d8(%rsp), %rcx
movl %eax, (%rcx,%rbx,4)
incq %rbx
cmpq %r14, %r13
jge 0x1b625f
shrl %r9d
movq 0x8(%rdx,%r13,8), %rax
movl (%r11,%rax,8), %eax
shrl %eax
leaq (%rcx,%rbx,4), %rcx
movq %rcx, 0x10(%rsp)
movq %r10, 0x8(%rsp)
movq %rax, (%rsp)
movq 0xb8(%rsp), %rsi
movq 0xc0(%rsp), %rdx
movsd 0xc8(%rsp), %xmm0
movq 0xe8(%rsp), %rcx
movq 0x208(%rsp), %r8
callq 0x1b53b5
movq 0x210(%rsp), %r11
movq 0x220(%rsp), %r10
addq %rax, %rbx
incq %r13
cmpq %r13, %r12
jne 0x1b61ab
movq 0x1d8(%rsp), %r13
movq 0x200(%rsp), %rdi
jmp 0x1b6282
xorl %ebx, %ebx
xorl %r12d, %r12d
movq %r15, %rax
subq %r12, %rax
jle 0x1b62e1
leaq (%rdi,%r12,8), %rdx
leaq (,%rbx,4), %rsi
addq %r13, %rsi
xorl %ecx, %ecx
movq 0x1c0(%rsp), %r9
movq (%rdx,%rcx,8), %rdi
movq (%r11,%rdi,8), %r8
testb $0x1, %r8b
je 0x1b62b8
decq %r8
movq %r8, (%r11,%rdi,8)
movq (%rdx,%rcx,8), %rdi
movl (%r11,%rdi,8), %edi
shrl %edi
orq $0x1, (%r10,%rdi,8)
movq (%rdx,%rcx,8), %rdi
movl (%r11,%rdi,8), %edi
shrl %edi
movl %edi, (%rsi,%rcx,4)
incq %rcx
cmpq %rcx, %rax
jne 0x1b62a3
addq %rcx, %rbx
jmp 0x1b62e9
movq 0x1c0(%rsp), %r9
cmpq %r15, %rbx
jl 0x1b6402
testq %rbx, %rbx
movq 0x228(%rsp), %rsi
jle 0x1b638d
movslq (%r13), %rax
leaq (%rax,%rax,8), %rcx
leaq (%rcx,%rcx,2), %rcx
addq %rax, %rcx
movq 0x208(%rsp), %rdx
movl 0x4(%rdx,%rcx), %eax
movl %eax, 0x4(%rsi)
movslq (%r13), %rax
leaq (%rax,%rax,8), %rcx
leaq (%rcx,%rcx,2), %rcx
addq %rax, %rcx
movl 0x8(%rdx,%rcx), %eax
movl %eax, 0x8(%rsi)
addq $0x8, %r9
xorl %eax, %eax
movslq (%r13,%rax,4), %rcx
leaq (%rcx,%rcx,8), %rdx
leaq (%rdx,%rdx,2), %rdx
addq %rcx, %rdx
movq 0x208(%rsp), %rcx
movupd (%rcx,%rdx), %xmm0
movups 0xc(%rcx,%rdx), %xmm1
movupd %xmm0, -0x8(%r9)
movups %xmm1, 0x4(%r9)
movl -0x4(%r9), %ecx
cmpl 0x4(%rsi), %ecx
jae 0x1b6376
movl %ecx, 0x4(%rsi)
movl (%r9), %ecx
cmpl 0x8(%rsi), %ecx
jbe 0x1b6381
movl %ecx, 0x8(%rsi)
incq %rax
addq $0x1c, %r9
cmpq %rax, %rbx
jne 0x1b633d
movq %rbx, %rax
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1d8(%rsp), %r13
movq 0x220(%rsp), %r10
movq 0x210(%rsp), %r11
movq %rbp, %rdi
jmp 0x1b616c
cmpq (%rbp), %rbx
jne 0x1b6421
movq %rbp, %rdi
addq %r13, %r15
leaq (%r11,%r15,8), %rcx
xorl %eax, %eax
movl (%rcx,%rax,8), %edx
movq %rdx, (%rcx,%rax,8)
movq (%rdi,%rax,8), %rsi
shlq $0x20, %rsi
orq %rdx, %rsi
movq %rsi, (%rcx,%rax,8)
incq %rax
cmpq %rax, %r12
jne 0x1b63d4
addq %rax, %r15
movq 0x1d8(%rsp), %r13
jmp 0x1b616c
leaq 0x7f39b(%rip), %rdi     # 0x2357a4
leaq 0x7d57b(%rip), %rsi     # 0x23398b
leaq 0x7f21d(%rip), %rcx     # 0x235634
movl $0x20a8, %edx           # imm = 0x20A8
callq 0x2110
leaq 0x7f200(%rip), %rdi     # 0x235628
leaq 0x7d55c(%rip), %rsi     # 0x23398b
leaq 0x7f1fe(%rip), %rcx     # 0x235634
movl $0x206f, %edx           # imm = 0x206F
callq 0x2110