// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/inter.cpp
// Function: get_ul_g(mul_ov_t*, mg_gres_a*, ma_ug_t*, asg_t const*, double, double, int, int)
void get_ul_g(mul_ov_t *aov, mg_gres_a *hits, ma_ug_t *ug, const asg_t *rg, 
double cov_thres, double vv, int32_t min_off, int32_t min_read_ovlp)
{
	int64_t c_thres = (aov->asm_cov*cov_thres)>2?(aov->asm_cov*cov_thres):2;
	uint64_t i, k, l, m, v0, v1, r0, r1;
	int32_t qs, qe, rs, re, qs0, qe0, qs1, qe1, ovlp, mmi, nngc2 = 0, is, ie, iocc, m_iocc, max_i;
	mg_gres_t *p = NULL;
	mg_gchain_t *gc = NULL, *gc0, *gc1;
	mg_lres_t *lf = NULL, *ll = NULL;
	asg_t *xg = copy_read_graph(ug->g);
	asg_arc_t *pe = NULL;
	kvec_t(lc_srt_t) tt; kv_init(tt); lc_srt_t *pt = NULL;
	kvec_t(eg_srt_t) td; kv_init(td); eg_srt_t *pd = NULL;
	kvec_t_u64_warp tidx; kv_init(tidx.a);
	///for debug
	kvec_t(eg_srt_t) dbg_vw_srt; kv_init(dbg_vw_srt);
	for (i = 0; i < hits->n; i++) {
		// fprintf(stderr, "+i+: %lu\n",i);
		p = &(hits->a[i]); tt.n = 0;
		// fprintf(stderr, "-i-: %lu\n",i);
		if(p->n_gc < 2) continue;
		nngc2++;
		// fprintf(stderr, "\nsis: %lu, p->n_gc: %d\n",i,p->n_gc);
		for (k = 0; k < (uint64_t)p->n_gc; k++) {
			gc = &(p->gc[k]);
			assert(gc->cnt > 0);
			lf = &(p->lc[gc->off]); ll = gc->cnt>1?&(p->lc[gc->off+gc->cnt-1]):NULL;
			assert(lf->qs != (uint32_t)-1);
			if(ll) assert(ll->qs != (uint32_t)-1);

			transfor_icoord(lf->qs, lf->qe, lf->ts, lf->te, lf->v&1, p->qlen, ug->g->seq[lf->v>>1].len, 
			&qs, ll?NULL:&qe, &rs, ll?NULL:&re);
			if(ll) {
				transfor_icoord(ll->qs, ll->qe, ll->ts, ll->te, ll->v&1, p->qlen, ug->g->seq[ll->v>>1].len, 
				NULL, &qe, NULL, &re);
			} else {
				ll = lf;
			}
			if(qe - qs < min_read_ovlp || re - rs < min_read_ovlp) continue;
			kv_pushp(lc_srt_t, tt, &pt); 
			pt->qse = qs; pt->qse <<= 32; pt->qse |= qe;
			pt->rse = rs; pt->rse <<= 32; pt->rse |= re;
			pt->gld = i; pt->gld <<= 32; pt->gld |= k;
			// fprintf(stderr, ">>>>k: %lu, qs: %d, qe: %d, qs-utg%.6d%c, qe-utg%.6d%c\n", k, qs, qe, 
			// (int32_t)((lf->v>>1)+1), "lc"[ug->u.a[lf->v>>1].circ], 
			// (int32_t)((ll->v>>1)+1), "lc"[ug->u.a[ll->v>>1].circ]);
			// fprintf(stderr, "lf_qs: %u, lf_qe: %u, lf_ts: %u, lf_te: %u\n", lf->qs, lf->qe, lf->ts, lf->te);
			// fprintf(stderr, "ll_qs: %u, ll_qe: %u, ll_ts: %u, ll_te: %u\n", ll->qs, ll->qe, ll->ts, ll->te);
		}
		// fprintf(stderr, "eie: %lu\n",i);
		radix_sort_lc_srt(tt.a, tt.a + tt.n);
		for (k = 0; k < tt.n; k++) {
			for (m = k + 1; m < tt.n; m++) {
				gc0 = &(p->gc[(uint32_t)(tt.a[k].gld)]); 
				v0 = p->lc[gc0->off+gc0->cnt-1].v;
				gc1 = &(p->gc[(uint32_t)(tt.a[m].gld)]);
				v1 = p->lc[gc1->off].v;
				if((v0>>1) == (v1>>1)) continue;

				qs0 = tt.a[k].qse>>32; qe0 = (uint32_t)(tt.a[k].qse);
				qs1 = tt.a[m].qse>>32; qe1 = (uint32_t)(tt.a[m].qse);
				// fprintf(stderr, "++++k: %lu, qs0: %d, qe0: %d, qs1: %d, qe1: %d, q0-utg%.6d%c, q1-utg%.6d%c\n", 
				// k, qs0, qe0, qs1, qe1, (int32_t)((v0>>1)+1), "lc"[ug->u.a[v0>>1].circ], (int32_t)((v1>>1)+1), "lc"[ug->u.a[v1>>1].circ]);
				if(qs1 <= qs0 && qe1 >= qe0) continue;///contain
				if(qs0 <= qs1 && qe0 >= qe1) continue;///contain
				if(ug->u.a[v0>>1].circ || ug->u.a[v1>>1].circ) continue;
				ovlp = ((MIN((qe0), (qe1)) > MAX((qs0), (qs1)))? MIN((qe0), (qe1)) - MAX((qs0), (qs1)):0);
				r0 = v0&1?(ug->u.a[v0>>1].start>>1):(ug->u.a[v0>>1].end>>1);
				r1 = v1&1?(ug->u.a[v1>>1].end>>1):(ug->u.a[v1>>1].start>>1);
				// fprintf(stderr, "----k: %lu, ovlp: %d\n", k, ovlp);
				// if((ovlp == 0) || (ovlp <= ((qe0 - qs0)*vv) && ovlp <= ((qe1 - qs1)*vv)) || 
				//  (asg_arc_n(ug->g, v0) == 0 && asg_arc_n(ug->g, v1^1) == 0)) {
				if(/**(asg_arc_n(ug->g, v0) == 0 && asg_arc_n(ug->g, v1^1) == 0) 
												&& **/(ovlp < (int32_t)(MIN(rg->seq[r0].len, rg->seq[r1].len)))) {
					kv_pushp(eg_srt_t, td, &pd);
					pd->d = MAX((qs0), (qs1)) - MIN((qe0), (qe1));
					pd->x = v0<v1?((v0<<32)|v1):(((v1^1)<<32)|(v0^1));
					pd->id = p->qid; 
					pd->e = (uint32_t)(tt.a[k].gld);
					pd->e <<= 32; pd->e |= (uint32_t)(tt.a[m].gld);
				}
			}
		}
	}
	fprintf(stderr, "td.n: %d\n", (int)td.n);
	radix_sort_eg_srt_x(td.a, td.a + td.n);
	for (k = 1, l = 0; k <= td.n; ++k) 
    {   
        if (k == td.n || td.a[k].x != td.a[l].x) 
        {
			if(k - l >= (uint64_t)c_thres) {
				for (i = l+1, mmi = l; i < k; i++) {
					if(td.a[mmi].d > td.a[i].d) mmi = i;
				}
				mmi = td.a[mmi].d < 0? -td.a[mmi].d:0;
				if(mmi != 0) {
					for (i = l; i < k; i++) td.a[i].d += mmi;
				}


				radix_sort_eg_srt_d(td.a + l, td.a + k);
				for (i = l, iocc = 0, tidx.a.n = 0; i < k; i++) {
					ovlp = (td.a[i].d > mmi? td.a[i].d - mmi: mmi - td.a[i].d) * vv;
					if(ovlp < min_off) ovlp = min_off;
					// fprintf(stderr, "i-%lu, ovlp: %d, td.a[i].d: %d, qid: %u\n", i, ovlp, td.a[i].d, td.a[i].id);
					// if(spec_ovlp_occ(td.a + l, k-l, i - l, ovlp, c_thres)) break;
					iocc = get_spec_ovlp_occ(td.a + l, k-l, i - l, ovlp, c_thres, &is, &ie, &tidx);
					// fprintf(stderr, "c_thres-%ld, iocc-%d\n", c_thres, iocc);
					if(iocc >= c_thres) break;
				}

				

				if(i < k) {
					m_iocc = iocc; max_i = i;
					for (i = ie + 1; i < k; i++) {
						iocc = get_spec_ovlp_occ(td.a + l, k-l, i - l, ovlp, m_iocc, &is, &ie, &tidx);
						if(iocc > m_iocc) m_iocc = iocc, max_i = i;
						i = ie + l;
					}
					///for debug
					kv_pushp(eg_srt_t, dbg_vw_srt, &pd);
					pd->x = m_iocc; pd->e = td.a[l].x;
					
					v0 = (uint32_t)td.a[l].x; v1 = td.a[l].x>>32;
					pe = asg_arc_pushp(xg);
					pe->del = 0; pe->strong = 0; pe->el = 0; pe->no_l_indel = 0; pe->ol = 0;
					pe->v = v0; pe->ul = v1<<32; pe->ul += xg->seq[v1>>1].len;

					v0 = (td.a[l].x>>32)^1; v1 = ((uint32_t)td.a[l].x)^1;
					pe = asg_arc_pushp(xg);
					pe->del = 0; pe->strong = 0; pe->el = 0; pe->no_l_indel = 0; pe->ol = 0;
					pe->v = v0; pe->ul = v1<<32; pe->ul += xg->seq[v1>>1].len;

					// fprintf(stderr, "++++q0-utg%.6d%c, q1-utg%.6d%c, k-l: %lu, c_thres: %ld, flag: %u\n", 
					// (int32_t)((td.a[l].x>>33)+1), "lc"[ug->u.a[td.a[l].x>>33].circ], 
					// (int32_t)(((uint32_t)td.a[l].x)>>1)+1, "lc"[ug->u.a[(((uint32_t)td.a[l].x)>>1)].circ], k-l, c_thres,
					// (asg_arc_n(ug->g, ((uint32_t)td.a[l].x)^1) == 0 && asg_arc_n(ug->g, (td.a[l].x>>32)) == 0));
				}
			}
            l = k;
        }
    }

	xg->is_srt = 0; xg->idx = 0; free(xg->idx); 
    asg_cleanup(xg);
	clean_ul_g(xg);

	///for debug
	fprintf(stderr, "[M::%s::] ==> nngc2: %d\n", __func__, nngc2);
	radix_sort_eg_srt_x(dbg_vw_srt.a, dbg_vw_srt.a + dbg_vw_srt.n);
	for (max_i = (int32_t)dbg_vw_srt.n - 1; max_i >= 0; --max_i) {
		pd = &(dbg_vw_srt.a[max_i]);
		fprintf(stderr, "++++q0-utg%.6d%c, q1-utg%.6d%c, occ: %lu, c_thres: %ld, flag: %u\n", 
					(int32_t)((pd->e>>33)+1), "lc"[ug->u.a[pd->e>>33].circ], 
					(int32_t)(((uint32_t)pd->e)>>1)+1, "lc"[ug->u.a[(((uint32_t)pd->e)>>1)].circ], pd->x, c_thres,
					(asg_arc_n(ug->g, ((uint32_t)pd->e)^1) == 0 && asg_arc_n(ug->g, (pd->e>>32)) == 0));
	}

	
	kv_destroy(tt); kv_destroy(td); kv_destroy(tidx.a); kv_destroy(dbg_vw_srt);
	asg_destroy(xg);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movl %r9d, 0x80(%rsp)
movl %r8d, 0x6c(%rsp)
movsd %xmm1, 0xa8(%rsp)
movq %rcx, 0x38(%rsp)
movq %rdx, %rbx
movq %rsi, %r14
movsd 0x8(%rdi), %xmm1
unpcklps 0x4cc52(%rip), %xmm1    # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x4cc5a(%rip), %xmm1    # 0x1e3280
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
mulsd %xmm0, %xmm2
maxsd 0x56b12(%rip), %xmm2    # 0x1ed150
cvttsd2si %xmm2, %rax
movq %rax, 0x90(%rsp)
movq 0x18(%rdx), %rdi
callq 0x8c8a9
movq %rbx, %r11
movq %rax, 0x88(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0xb0(%rsp)
andq $0x0, 0xc0(%rsp)
movl $0x0, 0x68(%rsp)
xorl %edx, %edx
xorl %edi, %edi
xorl %esi, %esi
xorl %r9d, %r9d
movq $0x0, 0x20(%rsp)
movq $0x0, 0x60(%rsp)
movq %rbx, 0x58(%rsp)
movq %r14, 0xa0(%rsp)
cmpq (%r14), %rdx
movq %r9, 0x18(%rsp)
jae 0x196b47
movq 0x10(%r14), %r8
imulq $0x28, %rdx, %rcx
movl (%r8,%rcx), %eax
cmpl $0x2, %eax
jl 0x196b3f
movq %rsi, 0x50(%rsp)
addq %rcx, %r8
incl 0x68(%rsp)
movq %rdx, 0x78(%rsp)
shlq $0x20, %rdx
movq %rdx, 0x40(%rsp)
pushq $0xc
popq %r15
xorl %ebx, %ebx
xorl %r13d, %r13d
movq %r8, 0x8(%rsp)
cltq
cmpq %rax, %rbx
movq %rdi, 0x48(%rsp)
jae 0x196903
movq 0x8(%r8), %rdx
movslq (%rdx,%r15), %rax
testq %rax, %rax
jle 0x196ff5
movq 0x10(%r8), %rcx
movslq -0x4(%rdx,%r15), %rsi
imulq $0x1c, %rsi, %rdx
addq %rax, %rsi
imulq $0x1c, %rsi, %rsi
cmpl $0x1, %eax
leaq -0x1c(%rcx,%rsi), %rax
movl $0x0, %r14d
cmovneq %rax, %r14
movl 0xc(%rcx,%rdx), %edi
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, %rdi
je 0x197014
leaq 0x30(%rsp), %r10
leaq 0x34(%rsp), %rax
testq %r14, %r14
je 0x196768
cmpl $-0x1, 0xc(%r14)
je 0x197033
xorl %r10d, %r10d
xorl %eax, %eax
movq %r15, (%rsp)
movq %rbx, %r15
movq %r13, %rbx
addq %rdx, %rcx
movq %r8, %rbp
movl 0x4(%rcx), %r8d
movl 0x10(%rcx), %esi
movl 0x14(%rcx), %edx
movl 0x18(%rcx), %ecx
movq 0x20(%rbp), %r9
movq 0x18(%r11), %r12
movq 0x20(%r12), %r11
movl %r8d, %r13d
shrl %r13d
movl (%r11,%r13,8), %r11d
andl $0x7fffffff, %r11d      # imm = 0x7FFFFFFF
subq $0x8, %rsp
andl $0x1, %r8d
pushq %r10
leaq 0x80(%rsp), %r10
pushq %r10
pushq %rax
leaq 0x94(%rsp), %rax
pushq %rax
pushq %r11
callq 0x15d01a
addq $0x30, %rsp
testq %r14, %r14
je 0x196832
movl 0x4(%r14), %r8d
movl 0xc(%r14), %edi
movl 0x10(%r14), %esi
movl 0x14(%r14), %edx
movl 0x18(%r14), %ecx
movq 0x20(%rbp), %r9
movq 0x20(%r12), %rax
movl %r8d, %r10d
shrl %r10d
movl (%rax,%r10,8), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
subq $0x30, %rsp
leaq 0x60(%rsp), %r10
movq %r10, 0x20(%rsp)
andq $0x0, 0x18(%rsp)
leaq 0x64(%rsp), %r10
movq %r10, 0x10(%rsp)
andq $0x0, 0x8(%rsp)
movq %rax, (%rsp)
andl $0x1, %r8d
callq 0x15d01a
addq $0x30, %rsp
movl 0x34(%rsp), %edx
movl 0x74(%rsp), %eax
movl %edx, %ecx
subl %eax, %ecx
movl 0x80(%rsp), %r8d
cmpl %r8d, %ecx
movq 0x58(%rsp), %r11
movq %rbx, %r13
jge 0x19685d
movq 0x48(%rsp), %rdi
movq %r15, %rbx
jmp 0x196876
movl 0x30(%rsp), %esi
movl 0x70(%rsp), %ecx
movl %esi, %edi
subl %ecx, %edi
cmpl %r8d, %edi
movq 0x48(%rsp), %rdi
movq %r15, %rbx
jge 0x19687c
movq (%rsp), %r15
jmp 0x1968ef
movq 0x50(%rsp), %r8
cmpq %r8, %r13
movq (%rsp), %r15
jne 0x1968be
leaq (%r8,%r8), %r14
testq %r8, %r8
pushq $0x2
popq %rax
cmoveq %rax, %r14
imulq $0x18, %r14, %rsi
callq 0x2370
movq 0x58(%rsp), %r11
movq %rax, %rdi
movl 0x74(%rsp), %eax
movl 0x34(%rsp), %edx
movl 0x70(%rsp), %ecx
movl 0x30(%rsp), %esi
movq %r14, 0x50(%rsp)
imulq $0x18, %r13, %r8
incq %r13
shlq $0x20, %rax
movslq %edx, %rdx
orq %rax, %rdx
movq %rdx, (%rdi,%r8)
shlq $0x20, %rcx
movslq %esi, %rax
orq %rcx, %rax
movq %rax, 0x8(%rdi,%r8)
movq %rbx, %rax
orq 0x40(%rsp), %rax
movq %rax, 0x10(%rdi,%r8)
incq %rbx
movq 0x8(%rsp), %r8
movl (%r8), %eax
addq $0x48, %r15
jmp 0x1966f0
imulq $0x18, %r13, %rsi
addq %rdi, %rsi
callq 0x1591a1
movq 0x8(%rsp), %r8
movq 0x48(%rsp), %rdi
movq 0x18(%rsp), %r9
movq 0x58(%rsp), %r11
leaq 0x28(%rdi), %rbx
xorl %r15d, %r15d
movq %r13, 0x10(%rsp)
cmpq %r13, %r15
je 0x196b2d
imulq $0x18, %r15, %r10
incq %r15
addq %rdi, %r10
movq %rbx, 0x40(%rsp)
movq %r15, 0x18(%rsp)
movq %r10, (%rsp)
cmpq %r13, %r15
jae 0x196b1a
movl 0x10(%r10), %eax
imulq $0x48, %rax, %rax
movq 0x8(%r8), %rcx
movq 0x10(%r8), %rdx
movslq 0x8(%rcx,%rax), %rsi
movslq 0xc(%rcx,%rax), %rax
addq %rsi, %rax
imulq $0x1c, %rax, %rax
movl -0x18(%rdx,%rax), %r12d
movl (%rbx), %eax
imulq $0x48, %rax, %rax
movslq 0x8(%rcx,%rax), %rax
imulq $0x1c, %rax, %rax
movl 0x4(%rdx,%rax), %ebp
movl %r12d, %edx
shrl %edx
movl %ebp, %eax
shrl %eax
cmpq %rax, %rdx
je 0x196acc
movq (%r10), %rcx
movq %rcx, %r13
shrq $0x20, %r13
movq -0x10(%rbx), %r14
movq %r14, %r10
shrq $0x20, %r10
cmpl %ecx, %r14d
jl 0x1969c7
cmpl %r13d, %r10d
jle 0x196ac3
cmpl %r14d, %ecx
jl 0x1969d5
cmpl %r10d, %r13d
jle 0x196ac3
movq 0x10(%r11), %rsi
imulq $0x28, %rdx, %r8
cmpl $0x0, (%rsi,%r8)
js 0x196abe
imulq $0x28, %rax, %rdx
cmpl $0x0, (%rsi,%rdx)
js 0x196abe
cmpl %r14d, %ecx
cmovll %ecx, %r14d
cmpl %r13d, %r10d
cmovgl %r10d, %r13d
movl %r14d, %eax
subl %r13d, %eax
movl $0x0, %ecx
cmovlel %ecx, %eax
xorl %ecx, %ecx
testb $0x1, %r12b
sete %cl
addq %rsi, %r8
movl 0x4(%r8,%rcx,4), %ecx
shrl %ecx
addq %rsi, %rdx
movl %ebp, %esi
andl $0x1, %esi
movl 0x4(%rdx,%rsi,4), %edx
shrl %edx
movq 0x38(%rsp), %rsi
movq 0x20(%rsi), %rsi
movl (%rsi,%rcx,8), %ecx
movl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
andl %r8d, %ecx
movl (%rsi,%rdx,8), %edx
andl %r8d, %edx
cmpl %edx, %ecx
cmovbl %ecx, %edx
cmpl %edx, %eax
jge 0x196abe
movq 0x20(%rsp), %rcx
cmpq %rcx, 0x60(%rsp)
jne 0x196a94
leaq (%rcx,%rcx), %rdx
testq %rcx, %rcx
pushq $0x2
popq %rax
cmoveq %rax, %rdx
movq %rdx, 0x20(%rsp)
imulq $0x18, %rdx, %rsi
movq %r9, %rdi
callq 0x2370
movq 0x48(%rsp), %rdi
movq 0x58(%rsp), %r11
movq %rax, %r9
movq 0x20(%rsp), %rcx
movq 0x8(%rsp), %r8
movq (%rsp), %r10
imulq $0x18, 0x60(%rsp), %rax
subl %r14d, %r13d
movl %r13d, 0x10(%r9,%rax)
cmpl %ebp, %r12d
movq %rcx, 0x20(%rsp)
jae 0x196ad8
shlq $0x20, %r12
orq %rbp, %r12
jmp 0x196af0
movq 0x8(%rsp), %r8
movq 0x10(%rsp), %r13
movq (%rsp), %r10
incq %r15
addq $0x18, %rbx
jmp 0x196950
shlq $0x20, %rbp
orq %r12, %rbp
movabsq $0x100000000, %rcx      # imm = 0x100000000
leaq 0x1(%rcx), %r12
xorq %rbp, %r12
movq 0x10(%rsp), %r13
incq 0x60(%rsp)
addq %r9, %rax
movq %r12, (%rax)
movl 0x18(%r8), %ecx
movl %ecx, 0x14(%rax)
movq 0x10(%r10), %rcx
shlq $0x20, %rcx
movl (%rbx), %edx
orq %rcx, %rdx
movq %rdx, 0x8(%rax)
jmp 0x196acc
movq 0x40(%rsp), %rbx
addq $0x18, %rbx
movq 0x18(%rsp), %r15
jmp 0x19692f
movq 0xa0(%rsp), %r14
movq 0x78(%rsp), %rdx
movq 0x50(%rsp), %rsi
incq %rdx
jmp 0x1966a5
movq %rdi, 0x48(%rsp)
movq 0xbc48d(%rip), %rax     # 0x252fe0
movq (%rax), %rdi
leaq 0x5f9dd(%rip), %rsi     # 0x1f653a
movq 0x60(%rsp), %rbx
movl %ebx, %edx
xorl %eax, %eax
callq 0x22b0
imulq $0x18, %rbx, %rsi
addq 0x18(%rsp), %rsi
movq 0x18(%rsp), %rdi
callq 0x1593e3
movq 0x18(%rsp), %r8
leaq 0x28(%r8), %rax
movq %rax, 0x50(%rsp)
leaq 0x10(%r8), %rax
movq %rax, 0x80(%rsp)
pushq $0x1
popq %r15
xorl %edx, %edx
xorl %r13d, %r13d
movq $0x0, 0x78(%rsp)
xorl %r12d, %r12d
cmpq 0x60(%rsp), %r15
ja 0x196e9d
je 0x196bd0
imulq $0x18, %r15, %rax
movq (%r8,%rax), %rax
imulq $0x18, %rdx, %rcx
cmpq (%r8,%rcx), %rax
je 0x196e95
movq %r15, %rax
subq %rdx, %rax
movq %rax, (%rsp)
cmpq 0x90(%rsp), %rax
jae 0x196bec
movq %r15, %rdx
jmp 0x196e95
movq %r13, 0x20(%rsp)
imulq $0x18, %rdx, %rbp
movq 0x50(%rsp), %rax
addq %rbp, %rax
leaq 0x1(%rdx), %rcx
movq %rdx, 0x8(%rsp)
movslq %edx, %rsi
imulq $0x18, %rsi, %rsi
movl 0x10(%r8,%rsi), %ebx
cmpq %r15, %rcx
jae 0x196c2a
movl %ecx, %esi
cmpl (%rax), %ebx
jg 0x196c1f
movl %edx, %esi
addq $0x18, %rax
incq %rcx
movl %esi, %edx
jmp 0x196c06
movq %r12, 0x38(%rsp)
movl %ebx, %eax
negl %eax
sarl $0x1f, %ebx
andl %eax, %ebx
je 0x196c5a
movq 0x80(%rsp), %rax
addq %rbp, %rax
movq 0x8(%rsp), %rcx
cmpq %r15, %rcx
jae 0x196c5a
addl %ebx, (%rax)
incq %rcx
addq $0x18, %rax
jmp 0x196c4a
leaq (%r8,%rbp), %rdi
imulq $0x18, %r15, %rsi
addq %r8, %rsi
movq %rdi, 0x10(%rsp)
callq 0x159648
andq $0x0, 0xb0(%rsp)
addq 0x80(%rsp), %rbp
xorl %r14d, %r14d
movq %r15, 0x40(%rsp)
movq 0x8(%rsp), %rax
addq %r14, %rax
cmpq %r15, %rax
jae 0x196d72
movl (%rbp), %eax
subl %ebx, %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
cvtsi2sd %ecx, %xmm0
mulsd 0xa8(%rsp), %xmm0
cvttsd2si %xmm0, %r12d
cmpl 0x6c(%rsp), %r12d
jg 0x196cc3
movl 0x6c(%rsp), %r12d
movq 0x10(%rsp), %rdi
movq (%rsp), %rsi
movl %r14d, %edx
movl %r12d, %ecx
movq 0x90(%rsp), %r15
movl %r15d, %r8d
leaq 0x9c(%rsp), %r9
leaq 0xb0(%rsp), %rax
pushq %rax
leaq 0x34(%rsp), %rax
pushq %rax
callq 0x1960f5
popq %rcx
popq %rdx
movl %eax, %r13d
cltq
addq $0x18, %rbp
incq %r14
cmpq %rax, %r15
movq 0x40(%rsp), %r15
jg 0x196c88
movslq 0x2c(%rsp), %rdx
incq %rdx
movq 0x8(%rsp), %rbp
leaq 0x1(%rbp), %rbx
movq 0x20(%rsp), %r14
cmpq %r15, %rdx
jae 0x196d89
subl %ebp, %edx
movq 0x10(%rsp), %rdi
movq (%rsp), %rsi
movl %r12d, %ecx
movl %r13d, %r8d
leaq 0x9c(%rsp), %r9
leaq 0xb0(%rsp), %rax
pushq %rax
leaq 0x34(%rsp), %rax
pushq %rax
callq 0x1960f5
addq $0x10, %rsp
cmpl %r13d, %eax
cmovgl %eax, %r13d
movslq 0x2c(%rsp), %rdx
addq %rbx, %rdx
jmp 0x196d2b
movq %r15, %rdx
movq 0x18(%rsp), %r8
movq 0x20(%rsp), %r13
movq 0x38(%rsp), %r12
jmp 0x196e95
movq 0x38(%rsp), %r15
movq 0x78(%rsp), %rax
cmpq %rax, %r15
jne 0x196dba
leaq (%rax,%rax), %rbx
testq %rax, %rax
pushq $0x2
popq %rax
cmoveq %rax, %rbx
imulq $0x18, %rbx, %rsi
movq %r14, %rdi
callq 0x2370
movq %rax, %r14
movq %rbx, 0x78(%rsp)
imulq $0x18, %r15, %rax
incq %r15
movq %r15, 0x38(%rsp)
movslq %r13d, %rcx
movq %rcx, (%r14,%rax)
movq 0x10(%rsp), %rbp
movq (%rbp), %rbx
movq %rbx, 0x8(%r14,%rax)
movq 0x88(%rsp), %r12
movq %r12, %rdi
callq 0x197052
xorl %r15d, %r15d
movb %r15b, 0x12(%rax)
andb $0x3f, 0x11(%rax)
andl $0x0, 0xc(%rax)
movl %ebx, 0x8(%rax)
movq %rbx, %rcx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
andq %rdx, %rcx
movq %rcx, (%rax)
movq 0x20(%r12), %rdx
shrq $0x21, %rbx
movl (%rdx,%rbx,8), %edx
movq %r14, %r13
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
andq %rsi, %rdx
orq %rcx, %rdx
movq %rdx, (%rax)
movq (%rbp), %rbx
movq %rbx, %r14
shrq $0x20, %r14
movq %r12, %rdi
callq 0x197052
movb %r15b, 0x12(%rax)
andb $0x3f, 0x11(%rax)
andl $0x0, 0xc(%rax)
xorl $0x1, %r14d
movl %r14d, 0x8(%rax)
movq %rbx, %rcx
shlq $0x20, %rcx
movabsq $0x100000000, %rdx      # imm = 0x100000000
xorq %rdx, %rcx
movq %rcx, (%rax)
movq 0x20(%r12), %rdx
movq 0x38(%rsp), %r12
shrl %ebx
movl (%rdx,%rbx,8), %edx
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
andq %rsi, %rdx
orq %rcx, %rdx
movq %rdx, (%rax)
movq 0x40(%rsp), %r15
movq %r15, %rdx
movq 0x18(%rsp), %r8
incq %r15
jmp 0x196bad
movq 0x88(%rsp), %rbx
andb $0x7f, 0x7(%rbx)
andq $0x0, 0x28(%rbx)
movq %rbx, %rdi
callq 0x694eb
movq %rbx, %rdi
callq 0x196336
movq 0xbc11b(%rip), %rax     # 0x252fe0
movq (%rax), %rdi
leaq 0x5f675(%rip), %rsi     # 0x1f6544
leaq 0x5f687(%rip), %rdx     # 0x1f655d
movl 0x68(%rsp), %ecx
xorl %eax, %eax
callq 0x22b0
imulq $0x18, %r12, %rsi
addq %r13, %rsi
movq %r13, %rdi
callq 0x1593e3
movl %r12d, %eax
imulq $0x18, %rax, %rax
leaq (%rax,%r13), %rbx
addq $-0x10, %rbx
leaq 0x4f785(%rip), %r15     # 0x1e668b
leaq 0x5f659(%rip), %r14     # 0x1f6566
testl %r12d, %r12d
movq 0x58(%rsp), %rsi
jle 0x196fad
movq (%rbx), %rax
movq 0x18(%rsi), %rcx
movq 0x28(%rcx), %rcx
movl %eax, %edx
xorq $0x1, %rdx
xorl %r10d, %r10d
cmpl $0x0, (%rcx,%rdx,8)
jne 0x196f47
movq %rax, %rdx
shrq $0x20, %rdx
xorl %r10d, %r10d
cmpl $0x0, (%rcx,%rdx,8)
sete %r10b
movq 0xbc092(%rip), %rcx     # 0x252fe0
movq (%rcx), %rdi
movq %rax, %rcx
shrq $0x21, %rcx
leal 0x1(%rcx), %edx
imulq $0x28, %rcx, %rcx
movq 0x10(%rsi), %rsi
movl (%rsi,%rcx), %ecx
shrl $0x1f, %ecx
movsbl (%rcx,%r15), %ecx
shrl %eax
leal 0x1(%rax), %r8d
imulq $0x28, %rax, %rax
movl (%rsi,%rax), %eax
shrl $0x1f, %eax
movsbl (%rax,%r15), %r9d
subq $0x8, %rsp
movq %r14, %rsi
xorl %eax, %eax
pushq %r10
pushq 0xa0(%rsp)
pushq -0x8(%rbx)
callq 0x22b0
addq $0x20, %rsp
decl %r12d
addq $-0x18, %rbx
jmp 0x196f0d
movq 0x48(%rsp), %rdi
callq 0x2220
movq 0x18(%rsp), %rdi
callq 0x2220
movq 0xc0(%rsp), %rdi
callq 0x2220
movq %r13, %rdi
callq 0x2220
movq 0x88(%rsp), %rdi
callq 0x68f68
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5aec5(%rip), %rdi     # 0x1f1ec1
leaq 0x5ab20(%rip), %rsi     # 0x1f1b23
leaq 0x5f49f(%rip), %rcx     # 0x1f64a9
movl $0x4fa4, %edx           # imm = 0x4FA4
callq 0x2110
leaq 0x5f4f1(%rip), %rdi     # 0x1f650c
leaq 0x5ab01(%rip), %rsi     # 0x1f1b23
leaq 0x5f480(%rip), %rcx     # 0x1f64a9
movl $0x4fa6, %edx           # imm = 0x4FA6
callq 0x2110
leaq 0x5f4e9(%rip), %rdi     # 0x1f6523
leaq 0x5aae2(%rip), %rsi     # 0x1f1b23
leaq 0x5f461(%rip), %rcx     # 0x1f64a9
movl $0x4fa7, %edx           # imm = 0x4FA7
callq 0x2110