// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/inter.cpp
// Function: gl_chain_advance(kv_ul_ov_t*, ul_ov_t*, ul_idx_t const*, ug_opt_t const*, long, double, long, long, unsigned long*, unsigned long*, unsigned long*, long, unsigned long, All_reads*, ma_ug_t*, long, void*)
int64_t gl_chain_advance(kv_ul_ov_t *res, ul_ov_t *ex, const ul_idx_t *uref, const ug_opt_t *uopt, int64_t bw, 
double diff_ec_ul, int64_t qlen, int64_t max_skip, uint64_t *srt, uint64_t *idx, uint64_t *track, int64_t trans_sc, 
uint64_t mode, All_reads *ridx, ma_ug_t *ug, int64_t debug_i, void *km)
{
	// fprintf(stderr, "\n+++[M::%s] res->n:%u\n", __func__, (uint32_t)res->n);
	if(res->n == 0) return 0;
	uint32_t li_v, lj_v, rev_n;
	int64_t mm_ovlp, x, i, j, k, sc, csc, mm_sc, mm_idx, qo, share, n_el = 0;
	ul_ov_t *li = NULL, *lj = NULL, rev_t;
	radix_sort_ul_ov_srt_qe(res->a, res->a + res->n);
	for (i = 1, j = 0; i <= (int64_t)res->n; i++) {
        if (i == (int64_t)res->n || res->a[i].qe != res->a[j].qe) {
            if(i - j > 1) {
                radix_sort_ul_ov_srt_qs(res->a+j, res->a+i);
            }
            j = i;
        }
    }
	for (i = 0; i < (int64_t)res->n; ++i) {
		li = &(res->a[i]); li_v = (li->tn<<1)|li->rev;
		mm_ovlp = mode?max_ovlp_src(uopt, li_v^1):max_ovlp(uref->ug->g, 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, res->a, x+G_CHAIN_INDEL); 
		if(li->el) csc = mode?retrieve_r_cov_region(uref, li->tn, 0, li->ts, li->te, NULL):retrieve_u_cov_region(uref, li->tn, 0, li->ts, li->te, NULL);
		else csc = (trans_sc*li->sec); //trans overlaps
		mm_sc = csc; mm_idx = -1; 
		// if(i == 37 || i == 36 || i == 35 || i == 32) fprintf(stderr, "*i:%ld, x:%ld, mm_sc:%ld\n", i, x, mm_sc);
		for (j = x; j >= 0; --j) { // collect potential destination vertices
			lj = &(res->a[j]); lj_v = (lj->tn<<1)|lj->rev;
			// if((lj->qe+gapLen) <= li->qs) break; 
			if(lj->qe+G_CHAIN_INDEL <= li->qs) break;//even this pair has a overlap, its length will be very small; just ignore
			// if(lj->qs >= li->qs+G_CHAIN_INDEL) continue; // lj is contained in li on the query coordinate; 128 for indel offset
			if(lj->qs >= li->qs) continue;
			qo = infer_rovlp(li, lj, NULL, NULL, ridx, ug); ///overlap length in query (UL read)
			// if(i == 37 || i == 36 || i == 35 || i == 32) fprintf(stderr, ">i:%ld, j:%ld, qo:%ld\n", i, j, qo);
			if(li_v != lj_v && get_ecov_adv(uref, uopt, li_v^1, lj_v^1, bw, diff_ec_ul, qo, mode, &share)) {
				// if(i == 37 || i == 36 || i == 35 || i == 32) fprintf(stderr, "#i:%ld, j:%ld, share:%ld\n", i, j, share);
				sc = csc + pop_sc(track[j]);
				// if((!mode)&&i==11&&j==10) {
				// 	fprintf(stderr,"+share:%ld, i:%ld, j:%ld, li_v^1:%u, lj_v^1:%u\n", 
				// 															share, i, j, li_v^1, lj_v^1);
				// }
				// if((mode&&i==21&&j==20) || (mode&&i==22&&j==21) || (mode&&i==23&&j==22)) {
				// 	fprintf(stderr,"-share:%ld, i:%ld, j:%ld, li_v^1:%u, lj_v^1:%u\n", 
				// 															share, i, j, li_v^1, lj_v^1);
				// }
				if(li->el && lj->el) sc -= (share>=csc?csc:share);///csc must be larger than 0
				// if((!li->el) && (!lj->el)) sc -= ((share>=o_csc?o_csc:share)*(-trans_scl));
				if(sc > mm_sc) mm_sc = sc, mm_idx = j;
			}
		}

		track[i] = push_sc_pre(mm_sc, mm_idx);
		srt[i] = track[i]>>32; srt[i] <<= 32; srt[i] |= i;
		n_el += li->el;

		// if(mode) {
		// 	fprintf(stderr, "[M::%.*s] i:%ld, li->el:%u, li->score:%ld (raw_sc:%u), mm_idx:%ld, mm_sc:%ld, q[%u, %u), t[%u, %u), rev:%c\n", 
		// 		(int32_t)Get_NAME_LENGTH(R_INF, li->tn), Get_NAME(R_INF, li->tn), i, li->el, csc, li->te - li->ts, mm_idx, mm_sc, li->qs, li->qe, li->ts, li->te, "+-"[li->rev]);
		// } else {
		// 	fprintf(stderr, "[M::utg%.6u%c] i:%ld, li->el:%u, li->score:%ld (raw_sc:%u), mm_idx:%ld, mm_sc:%ld, q[%u, %u), t[%u, %u), rev:%c\n", 
		// 		li->tn+1, "lc"[uref->ug->u.a[li->tn].circ], i, li->el, csc, li->te - li->ts, mm_idx, mm_sc, li->qs, li->qe, li->ts, li->te, "+-"[li->rev]);
		// }
		// if(!mode) {
		// 	fprintf(stderr, "[M::utg%.6d%c] qs->%u; qe->%u\n", li->tn+1, "lc"[uref->ug->u.a[li->tn].circ], li->qs, li->qe);
		// }
		// fprintf(stderr, "[M::utg%.6d%c] qs->%u; qe->%u; sc->%ld; pre->%ld; el->%u;\n", 
		// li->tn+1, "lc"[uref->ug->u.a[li->tn].circ], li->qs, li->qe, pop_sc(track[i]), pop_pre(track[i]), li->el);
	}
	
	int64_t n_v, n_u, n_v0, le, lnv; 
	radix_sort_gfa64(srt, srt+res->n); 
	for (k = (int64_t)res->n-1, n_v = n_u = 0; k >= 0; --k) {
		n_v0 = n_v; i = (uint32_t)srt[k];
		// fprintf(stderr, "+[M::utg%.6d%c] n_v0->%ld;\n", res->a[i].tn+1, "lc"[uref->ug->u.a[res->a[i].tn].circ], n_v0);
		if(res->a[i].el) { ///chain must start from cis alignments
			for (le = -1; i >= 0 && (track[i]&((uint64_t)0x80000000)) == 0;) {
				if(res->a[i].el) {
					le = -1;
				}else if(n_v>n_v0 && ex[n_v-1].el) {
					le = i; lnv = n_v;///cut the cis alignments in the end
				}
				ex[n_v++] = res->a[i]; track[i] |= ((uint64_t)0x80000000);
				// fprintf(stderr, "[M::utg%.6d%c] qs->%u; qe->%u\n", res->a[i].tn+1, "lc"[uref->ug->u.a[res->a[i].tn].circ], res->a[i].qs, res->a[i].qe);
				i = pop_pre(track[i]);
			}
		}
		// fprintf(stderr, "-[M::] n_v->%ld;\n", n_v);
		if(n_v0 == n_v) continue;
		if(le >= 0) {
			i = le; n_v = lnv;
		}
		if(n_v0 == n_v) continue;
		// fprintf(stderr, "[++chain::] beg_idx->%u, end_idx->%ld, le->%ld, chain_n->%ld\n", (uint32_t)srt[k], i, le, n_v - n_v0);
		///keep the whole score; do not cut score like minigraph
		// sc = pop_sc(srt[k]);
		sc = (i<0?(pop_sc(srt[k])):(pop_sc(srt[k])-pop_sc(track[i])));
		// fprintf(stderr, "++[M::%s] k:%ld, n_v0:%ld, n_v:%ld, le:%ld, sc:%ld, beg:%u, end:%ld, p_score:%ld, cut_score:%ld\n", 
		// __func__, k, n_v0, n_v, le, sc, (uint32_t)srt[k], i, pop_sc(srt[k]), i<0?0:pop_sc(track[i]));
		if(sc /**<=**/< 0) {///sc might be 0, if the UL alignment cannot cover the whole overlap between two HiFi reads
			n_v = n_v0;
			continue;
		}
		// idx[n_u++] = push_sc_pre(sc, n_v-n_v0);	
		idx[n_u++] = ((uint64_t)sc<<32)|(n_v-n_v0);	
	}
	// fprintf(stderr, "[M::%s] n_u:%ld, n_v:%ld\n", __func__, n_u, n_v);
	for (k = 0, n_v = n_v0 = 0; k < n_u; k++) {
		n_v0 = n_v; n_v += (uint32_t)idx[k];
		// fprintf(stderr, "[M::%s] k:%ld, n_v0:%ld, n_v:%ld\n", __func__, k, n_v0, n_v);
		res->a[k].qn = idx[k]>>32;//score
		res->a[k].ts = n_v0; res->a[k].te = n_v;///idx
		
		rev_n = ((uint32_t)idx[k])>>1; 
		///we need to consider contained reads; so determining qs is not such easy
		res->a[k].qs = (uint32_t)-1; res->a[k].qe = ex[n_v0].qe;
		for (i = 0; i < rev_n; i++) {
			rev_t = ex[n_v0+i]; ex[n_v0+i] = ex[n_v-i-1]; ex[n_v-i-1] = rev_t;
			
			if(res->a[k].qs > ex[n_v0+i].qs) res->a[k].qs = ex[n_v0+i].qs;
			if(res->a[k].qs > ex[n_v-i-1].qs) res->a[k].qs = ex[n_v-i-1].qs;
			n_el -= ex[n_v0+i].el; n_el -= ex[n_v-i-1].el;
			ex[n_v0+i].sec = ex[n_v-i-1].sec = SEC_MODE; 
		}
		if(((uint32_t)idx[k])&1) {
			if(res->a[k].qs > ex[n_v0+i].qs) res->a[k].qs = ex[n_v0+i].qs;
			n_el -= ex[n_v0+i].el; ex[n_v0+i].sec = SEC_MODE; 
		}
		assert(ex[n_v0].el && ex[n_v-1].el);
		// fprintf(stderr, "[M::%s] k:%ld, qs:%u, qe:%u, chain_occ:%u, chain_score:%u\n", __func__, k, 
		// 					res->a[k].qs, res->a[k].qe, res->a[k].te - res->a[k].ts, res->a[k].qn);
	}
	// if(n_el) {
	// 	fprintf(stderr, "[M::%s] debug_i->%ld, n_el->%ld, n_u->%ld, n_v->%ld\n", __func__, debug_i, n_el, n_u, n_v);
	// }
	assert(n_el == 0);
	res->n = n_u;
	radix_sort_ul_ov_srt_qn(res->a, res->a + res->n);//sort by score
	// fprintf(stderr, "---[M::%s] n_u:%ld, n_v:%ld\n", __func__, n_u, n_v);
	return n_v;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %r9, 0x38(%rsp)
movsd %xmm0, 0x58(%rsp)
movq %r8, 0x50(%rsp)
movq %rcx, 0x48(%rsp)
movq %rdx, 0x28(%rsp)
movq %rsi, %rbx
movq 0x8(%rdi), %rsi
testq %rsi, %rsi
je 0x1ac574
movq %rdi, %r13
movq (%rdi), %rdi
leaq (%rsi,%rsi,8), %rax
leaq (%rax,%rax,2), %rax
addq %rdi, %rsi
addq %rax, %rsi
callq 0x19e2b4
movq 0x8(%r13), %rax
testq %rax, %rax
movq %r13, 0x8(%rsp)
movq %rbx, 0x20(%rsp)
jle 0x1ac1c6
movl $0x1, %r15d
movl $0x1c, %r14d
xorl %ecx, %ecx
cmpq %rax, %r15
je 0x1abe25
movq (%r13), %rdx
movl 0x8(%rdx,%r14), %esi
leaq (%rcx,%rcx,8), %rdi
leaq (%rdi,%rdi,2), %rdi
addq %rcx, %rdi
cmpl 0x8(%rdx,%rdi), %esi
jne 0x1abe25
movq %rcx, %rdx
jmp 0x1abe55
movq %r15, %rsi
subq %rcx, %rsi
movq %r15, %rdx
cmpq $0x2, %rsi
jl 0x1abe55
movq (%r13), %rsi
leaq (%rcx,%rcx,8), %rax
leaq (%rax,%rax,2), %rdi
addq %rcx, %rdi
addq %rsi, %rdi
addq %r14, %rsi
callq 0x19e55c
movq 0x8(%r13), %rax
movq %r15, %rdx
leaq 0x1(%r15), %rsi
addq $0x1c, %r14
movq %rdx, %rcx
cmpq %rax, %r15
movq %rsi, %r15
jl 0x1abe01
testq %rax, %rax
jle 0x1ac1c6
incq 0x38(%rsp)
xorl %r14d, %r14d
xorl %ebx, %ebx
movq (%r13), %r15
leaq (%rbx,%rbx,8), %rax
leaq (%rax,%rax,2), %r12
addq %rbx, %r12
movl 0xc(%r15,%r12), %eax
movl 0x18(%r15,%r12), %ebp
shrdl $0x1f, %eax, %ebp
cmpq $0x0, 0xf8(%rsp)
je 0x1abeb4
movl %ebp, %esi
xorl $0x1, %esi
movq 0x48(%rsp), %rdi
callq 0x1a4c50
jmp 0x1abf1e
movq 0x28(%rsp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rax
movl %ebp, %ecx
xorl $0x1, %ecx
movq 0x28(%rax), %rdx
movq (%rdx,%rcx,8), %rcx
movq %rcx, %rdx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
andq %rsi, %rdx
je 0x1abf1c
movq 0x8(%rax), %rsi
shrq $0x20, %rcx
shlq $0x3, %rdx
leaq (%rdx,%rdx,2), %rax
leaq (%rcx,%rcx,2), %rcx
leaq (%rsi,%rcx,8), %rcx
addq $0xc, %rcx
xorl %edx, %edx
xorl %esi, %esi
movl %esi, %edi
movl (%rcx,%rdx), %r8d
cmpl %r8d, %esi
movl %r8d, %esi
cmoval %edi, %esi
testl %r8d, %r8d
cmovsl %edi, %esi
addq $0x18, %rdx
cmpq %rdx, %rax
jne 0x1abefa
movl %esi, %eax
jmp 0x1abf1e
xorl %eax, %eax
addq %r15, %r12
movl 0x4(%r12), %ecx
addq %rax, %rcx
cvtsi2sd %rcx, %xmm0
mulsd 0x58(%rsp), %xmm0
cvttsd2si %xmm0, %rdx
movq 0x50(%rsp), %rax
cmpq %rax, %rdx
cmovleq %rax, %rdx
addq %rcx, %rdx
movq 0x38(%rsp), %rax
cmpq %rax, %rdx
cmovgeq %rax, %rdx
subl $-0x80, %edx
movl %ebx, %edi
movq %r15, %rsi
callq 0x1a83b5
movl %eax, %r15d
movl 0x18(%r12), %eax
btl $0x1e, %eax
jb 0x1abf7f
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
imulq 0xf0(%rsp), %rax
jmp 0x1abfb9
movl 0xc(%r12), %esi
movl 0x10(%r12), %ecx
movl 0x14(%r12), %r8d
cmpq $0x0, 0xf8(%rsp)
je 0x1abfaa
movq 0x28(%rsp), %rdi
xorl %edx, %edx
xorl %r9d, %r9d
callq 0x36530
jmp 0x1abfb9
movq 0x28(%rsp), %rdi
xorl %edx, %edx
xorl %r9d, %r9d
callq 0x363d1
testl %r15d, %r15d
js 0x1ac15a
movq %rbx, 0x60(%rsp)
movq %rax, %rcx
movl %ebp, %eax
movslq %r15d, %rbp
movl %eax, (%rsp)
xorl $0x1, %eax
movl %eax, 0x34(%rsp)
leaq (,%rbp,8), %rax
addq %rbp, %rax
leaq (%rax,%rax,2), %r15
addq %rbp, %r15
movq $-0x1, 0x18(%rsp)
movq %rcx, 0x40(%rsp)
movq %rcx, 0x10(%rsp)
movq (%r13), %rbx
movl 0x8(%rbx,%r15), %ecx
subl $-0x80, %ecx
movl 0x4(%r12), %eax
cmpl %eax, %ecx
jbe 0x1ac125
cmpl %eax, 0x4(%rbx,%r15)
jae 0x1ac111
leaq (%rbx,%r15), %rsi
movl 0xc(%rbx,%r15), %eax
movl 0x18(%rbx,%r15), %r13d
shrdl $0x1f, %eax, %r13d
movq %r12, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
movq 0x100(%rsp), %r8
movq 0x108(%rsp), %r9
callq 0x6ea22
cmpl %r13d, (%rsp)
je 0x1ac10c
xorl $0x1, %r13d
movq 0x28(%rsp), %rdi
movq 0x48(%rsp), %rsi
movl 0x34(%rsp), %edx
movl %r13d, %ecx
movq 0x50(%rsp), %r8
movsd 0x58(%rsp), %xmm0
movq %rax, %r9
leaq 0x68(%rsp), %rax
pushq %rax
pushq 0x100(%rsp)
callq 0x1ab640
addq $0x10, %rsp
testq %rax, %rax
je 0x1ac10c
movq 0xe8(%rsp), %rax
movq (%rax,%rbp,8), %rcx
movq %rcx, %rax
shrq $0x20, %rax
leaq -0x80000000(%rax), %rdx
negq %rax
testq %rcx, %rcx
cmovsq %rdx, %rax
addq 0x40(%rsp), %rax
testb $0x40, 0x1b(%r12)
movq 0x8(%rsp), %r13
je 0x1ac0eb
testb $0x40, 0x1b(%rbx,%r15)
je 0x1ac0eb
movq 0x68(%rsp), %rcx
movq 0x40(%rsp), %rdx
cmpq %rdx, %rcx
cmovgeq %rdx, %rcx
subq %rcx, %rax
movq 0x10(%rsp), %rcx
cmpq %rcx, %rax
cmovgq %rax, %rcx
movq %rcx, 0x10(%rsp)
movq 0x18(%rsp), %rax
cmovgq %rbp, %rax
movq %rax, 0x18(%rsp)
jmp 0x1ac111
movq 0x8(%rsp), %r13
leaq -0x1(%rbp), %rax
addq $-0x1c, %r15
testq %rbp, %rbp
movq %rax, %rbp
jg 0x1abffe
movq 0x10(%rsp), %rdx
movq %rdx, %rcx
movl $0x80000000, %eax       # imm = 0x80000000
orq %rax, %rcx
movq %rdx, %rax
negq %rax
testq %rdx, %rdx
cmovnsq %rcx, %rax
movq 0x18(%rsp), %rdx
testq %rdx, %rdx
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmovsq %rcx, %rdx
movq 0x60(%rsp), %rbx
jmp 0x1ac17a
movq %rax, %rcx
movq %rax, %rdx
movl $0x80000000, %eax       # imm = 0x80000000
orq %rax, %rcx
movq %rdx, %rax
negq %rax
testq %rdx, %rdx
cmovnsq %rcx, %rax
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
shlq $0x20, %rax
orq %rdx, %rax
movq 0xe8(%rsp), %rcx
movq %rax, (%rcx,%rbx,8)
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
andq %rcx, %rax
orq %rbx, %rax
movq 0xd8(%rsp), %rcx
movq %rax, (%rcx,%rbx,8)
btl $0x1e, 0x18(%r12)
adcq $0x0, %r14
incq %rbx
movq 0x8(%r13), %rax
cmpq %rax, %rbx
jl 0x1abe7b
jmp 0x1ac1c9
xorl %r14d, %r14d
movq 0xd8(%rsp), %rdi
leaq (%rdi,%rax,8), %rsi
callq 0x19dd99
movq 0x8(%r13), %r11
testq %r11, %r11
jle 0x1ac579
movq $0x0, (%rsp)
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
xorl %r9d, %r9d
movl $0x80000000, %ebp       # imm = 0x80000000
movq %r11, %r8
movq 0xd8(%rsp), %rax
movl -0x8(%rax,%r11,8), %r11d
movq (%r13), %rax
leaq (%r11,%r11,8), %rcx
leaq (%rcx,%rcx,2), %rcx
addq %r11, %rcx
testb $0x40, 0x1b(%rax,%rcx)
jne 0x1ac22d
movq %r11, %r15
movq %r9, %r10
jmp 0x1ac2e1
leaq (%r9,%r9,8), %rax
leaq (%rax,%rax,2), %r12
movq 0x20(%rsp), %rax
addq %r9, %rax
addq %rax, %r12
movq $-0x1, %rdi
movq %r9, %r10
movq 0xe8(%rsp), %rcx
testb $-0x80, 0x3(%rcx,%r11,8)
jne 0x1ac2de
movq (%r13), %rcx
leaq (%r11,%r11,8), %rax
leaq (%rax,%rax,2), %rbx
addq %r11, %rbx
movq $-0x1, %r15
testb $0x40, 0x1b(%rcx,%rbx)
jne 0x1ac290
cmpq %r9, %r10
jle 0x1ac297
testb $0x40, -0x1(%r12)
cmovneq %r11, %rdi
cmovneq %r10, %rsi
jmp 0x1ac297
movq $-0x1, %rdi
incq %r10
movupd (%rcx,%rbx), %xmm0
movups 0xc(%rcx,%rbx), %xmm1
movups %xmm1, 0xc(%r12)
movupd %xmm0, (%r12)
movq 0xe8(%rsp), %rbx
movq (%rbx,%r11,8), %rax
movq %rax, %rcx
orq %rbp, %rcx
movq %rcx, (%rbx,%r11,8)
movq %rbx, %rcx
andq %rdx, %rax
addq $0x1c, %r12
movq %rax, %r11
cmpq %rdx, %rax
jne 0x1ac252
jmp 0x1ac2e1
movq %r11, %r15
leaq -0x1(%r8), %r11
cmpq %r10, %r9
je 0x1ac376
testq %rdi, %rdi
cmovnsq %rdi, %r15
cmovnsq %rsi, %r10
movq %r10, %rcx
subq %r9, %rcx
je 0x1ac376
movq 0xd8(%rsp), %rax
movq (%rax,%r11,8), %rax
movq %rax, %rbx
shrq $0x20, %rbx
leaq -0x80000000(%rbx), %r12
negq %rbx
testq %rax, %rax
cmovsq %r12, %rbx
testq %r15, %r15
js 0x1ac351
movq 0xe8(%rsp), %rax
movq (%rax,%r15,8), %rax
movq %rax, %r15
shrq $0x20, %r15
leaq -0x80000000(%r15), %r12
negq %r15
testq %rax, %rax
cmovsq %r12, %r15
subq %r15, %rbx
testq %rbx, %rbx
js 0x1ac376
shlq $0x20, %rbx
orq %rcx, %rbx
movq (%rsp), %rax
movq 0xe0(%rsp), %rcx
movq %rbx, (%rcx,%rax,8)
incq %rax
movq %rax, (%rsp)
jmp 0x1ac379
movq %r9, %r10
movq %r10, %r9
cmpq $0x1, %r8
jg 0x1ac1fc
cmpq $0x0, (%rsp)
jle 0x1ac581
movq 0x20(%rsp), %rax
leaq -0x4(%rax), %rdx
leaq 0x18(%rax), %rcx
movq %rcx, 0x18(%rsp)
addq $-0x1c, %rax
movq %rax, 0x10(%rsp)
xorl %r12d, %r12d
movl $0x3fffffff, %r8d       # imm = 0x3FFFFFFF
xorl %r9d, %r9d
movq 0xe0(%rsp), %rax
movq (%rax,%r9,8), %rcx
movl %ecx, %r15d
addq %r12, %r15
movq %rcx, %rax
shrq $0x20, %rax
movq (%r13), %rdi
leaq (%r9,%r9,8), %rsi
leaq (%rsi,%rsi,2), %r11
addq %r9, %r11
movl %eax, (%rdi,%r11)
movl %r12d, 0x10(%rdi,%r11)
movl %r15d, 0x14(%rdi,%r11)
movl %ecx, %r13d
shrl %r13d
movl $0xffffffff, 0x4(%rdi,%r11) # imm = 0xFFFFFFFF
leaq (%r12,%r12,8), %rax
leaq (%rax,%rax,2), %rsi
leaq (%rsi,%r12), %r10
movq 0x20(%rsp), %rbx
movl 0x8(%rbx,%r10), %eax
movl %eax, 0x8(%rdi,%r11)
testl %r13d, %r13d
je 0x1ac4f7
leaq (,%r13,8), %rax
addq %r13, %rax
leaq (%rax,%rax,2), %rbp
addq %r13, %rbp
addq 0x18(%rsp), %r12
addq %rsi, %r12
leaq (%r15,%r15,8), %rax
leaq (%rax,%rax,2), %rcx
movq 0x10(%rsp), %rax
addq %r15, %rax
addq %rax, %rcx
xorl %ebx, %ebx
movups -0x18(%r12,%rbx), %xmm0
movups -0xc(%r12,%rbx), %xmm1
movups %xmm1, 0x7c(%rsp)
movaps %xmm0, 0x70(%rsp)
movups (%rcx), %xmm0
movups 0xc(%rcx), %xmm1
movups %xmm1, -0xc(%r12,%rbx)
movups %xmm0, -0x18(%r12,%rbx)
movups 0x7c(%rsp), %xmm0
movups %xmm0, 0xc(%rcx)
movapd 0x70(%rsp), %xmm0
movupd %xmm0, (%rcx)
movq 0x8(%rsp), %rax
movq (%rax), %rax
leaq (%rax,%r11), %rsi
addq $0x4, %rsi
movl (%rsi), %edi
movl -0x14(%r12,%rbx), %eax
cmpl %eax, %edi
jbe 0x1ac4ab
movl %eax, (%rsi)
movl %eax, %edi
movl 0x4(%rcx), %eax
cmpl %eax, %edi
jbe 0x1ac4b4
movl %eax, (%rsi)
movl 0x18(%rcx), %eax
movl %eax, %esi
shrl $0x1e, %esi
andl $0x1, %esi
btl $0x1e, (%r12,%rbx)
adcl $0x0, %esi
orl %r8d, %eax
movl %eax, 0x18(%rcx)
orl %r8d, (%r12,%rbx)
subq %rsi, %r14
addq $0x1c, %rbx
addq $-0x1c, %rcx
cmpq %rbx, %rbp
jne 0x1ac450
movq 0xe0(%rsp), %rax
movq (%rax,%r9,8), %rcx
movq 0x20(%rsp), %rbx
addq %rbx, %r10
testb $0x1, %cl
je 0x1ac544
movq 0x8(%rsp), %rax
movq (%rax), %rsi
leaq (,%r13,8), %rax
addq %r13, %rax
leaq (%rax,%rax,2), %rcx
addq %r13, %rcx
movl 0x4(%r10,%rcx), %eax
cmpl %eax, 0x4(%rsi,%r11)
jbe 0x1ac52e
addq %r11, %rsi
addq $0x4, %rsi
movl %eax, (%rsi)
addq %r10, %rcx
movl 0x18(%rcx), %eax
btl $0x1e, %eax
sbbq $0x0, %r14
orl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
movl %eax, 0x18(%rcx)
testb $0x40, 0x1b(%r10)
movq 0x8(%rsp), %r13
je 0x1ac5bd
leaq (%r15,%r15,8), %rax
leaq (%rax,%rax,2), %rax
addq %r15, %rax
testb $0x40, 0x3(%rdx,%rax)
je 0x1ac5bd
incq %r9
movq %r15, %r12
cmpq (%rsp), %r9
jne 0x1ac3b8
jmp 0x1ac584
xorl %r15d, %r15d
jmp 0x1ac5a8
movq $0x0, (%rsp)
xorl %r15d, %r15d
testq %r14, %r14
jne 0x1ac5dc
movq (%rsp), %rcx
movq %rcx, 0x8(%r13)
movq (%r13), %rdi
leaq (%rcx,%rcx,8), %rax
leaq (%rax,%rax,2), %rsi
addq %rcx, %rsi
addq %rdi, %rsi
callq 0x19ead4
movq %r15, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x94155(%rip), %rdi     # 0x240719
leaq 0x93690(%rip), %rsi     # 0x23fc5b
leaq 0x94163(%rip), %rcx     # 0x240735
movl $0xf0e, %edx            # imm = 0xF0E
callq 0x2110
leaq 0x9422b(%rip), %rdi     # 0x24080e
leaq 0x93671(%rip), %rsi     # 0x23fc5b
leaq 0x94144(%rip), %rcx     # 0x240735
movl $0xf15, %edx            # imm = 0xF15
callq 0x2110