// File: /workspace/github_cpp_makefile_star2_O2/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, 0x18(%rsp)
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0x163ea7
movq %rdi, %rbp
movq %rsi, 0x10(%rsp)
movq (%rdi), %rdi
imulq $0x1c, %rax, %rsi
addq %rdi, %rsi
callq 0x156f5c
pushq $0x1
popq %rbx
pushq $0x1c
popq %r14
xorl %eax, %eax
movq 0x8(%rbp), %rcx
cmpq %rcx, %rbx
jg 0x163872
je 0x163841
movq (%rbp), %rcx
movl 0x8(%rcx,%r14), %edx
imulq $0x1c, %rax, %rsi
cmpl 0x8(%rcx,%rsi), %edx
jne 0x163841
movq %rax, %rcx
jmp 0x163866
movq %rbx, %rdx
subq %rax, %rdx
movq %rbx, %rcx
cmpq $0x2, %rdx
jl 0x163866
movq (%rbp), %rsi
imulq $0x1c, %rax, %rdi
addq %rsi, %rdi
addq %r14, %rsi
callq 0x1571fa
movq %rbx, %rcx
incq %rbx
addq $0x1c, %r14
movq %rcx, %rax
jmp 0x16381e
incq 0x38(%rsp)
xorl %r15d, %r15d
movq $0x0, 0x20(%rsp)
movq %rbp, 0x28(%rsp)
cmpq %rcx, %r15
jge 0x163b2c
movq (%rbp), %r12
imulq $0x1c, %r15, %rbx
movl 0xc(%r12,%rbx), %eax
movl 0x18(%r12,%rbx), %r14d
shrdl $0x1f, %eax, %r14d
cmpq $0x0, 0xf8(%rsp)
je 0x1638c9
movl %r14d, %esi
xorl $0x1, %esi
movq 0x48(%rsp), %rdi
callq 0x15d49a
movq (%rbp), %rsi
jmp 0x1638e3
movq 0x18(%rsp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rdi
movl %r14d, %esi
xorl $0x1, %esi
callq 0x15d450
movq %r12, %rsi
addq %rbx, %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 %r15d, %edi
callq 0x160717
movl %eax, %r13d
movl 0x18(%r12), %eax
btl $0x1e, %eax
movq %r15, 0x60(%rsp)
jb 0x163947
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
imulq 0xf0(%rsp), %rax
jmp 0x163981
movl 0xc(%r12), %esi
movl 0x10(%r12), %ecx
movl 0x14(%r12), %r8d
cmpq $0x0, 0xf8(%rsp)
je 0x163972
movq 0x18(%rsp), %rdi
xorl %edx, %edx
xorl %r9d, %r9d
callq 0xa397
jmp 0x163981
movq 0x18(%rsp), %rdi
xorl %edx, %edx
xorl %r9d, %r9d
callq 0xa240
movslq %r13d, %rbp
movl %r14d, 0x8(%rsp)
xorl $0x1, %r14d
movl %r14d, 0x34(%rsp)
imulq $0x1c, %rbp, %rbx
movq %rax, 0x40(%rsp)
movq %rax, (%rsp)
pushq $-0x1
popq %r14
testq %rbp, %rbp
js 0x163ab6
movq 0x28(%rsp), %rax
movq (%rax), %r15
movl 0x8(%r15,%rbx), %ecx
subl $-0x80, %ecx
movl 0x4(%r12), %eax
cmpl %eax, %ecx
jbe 0x163ab6
cmpl %eax, 0x4(%r15,%rbx)
jae 0x163aaa
leaq (%r15,%rbx), %rsi
movl 0xc(%r15,%rbx), %eax
movl 0x18(%r15,%rbx), %r13d
shrdl $0x1f, %eax, %r13d
movq %r12, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
movq 0x100(%rsp), %r8
movq 0x108(%rsp), %r9
callq 0x3d261
cmpl %r13d, 0x8(%rsp)
je 0x163aaa
xorl $0x1, %r13d
movq 0x18(%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 0x1631f5
popq %rcx
popq %rdx
testq %rax, %rax
je 0x163aaa
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)
je 0x163a97
testb $0x40, 0x1b(%r15,%rbx)
je 0x163a97
movq 0x68(%rsp), %rcx
movq 0x40(%rsp), %rdx
cmpq %rdx, %rcx
cmovgeq %rdx, %rcx
subq %rcx, %rax
movq (%rsp), %rcx
cmpq %rcx, %rax
cmovgq %rax, %rcx
movq %rcx, (%rsp)
cmovgq %rbp, %r14
decq %rbp
addq $-0x1c, %rbx
jmp 0x1639a3
movq (%rsp), %rdx
movl %edx, %eax
movl $0x80000000, %ecx       # imm = 0x80000000
orl %ecx, %eax
movl %edx, %ecx
negl %ecx
testq %rdx, %rdx
cmovnsq %rax, %rcx
shlq $0x20, %rcx
testq %r14, %r14
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmovsq %rax, %r14
orq %rcx, %r14
movq 0xe8(%rsp), %rax
movq 0x60(%rsp), %r15
movq %r14, (%rax,%r15,8)
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
andq %rax, %r14
orq %r15, %r14
movq 0xd8(%rsp), %rax
movq %r14, (%rax,%r15,8)
btl $0x1e, 0x18(%r12)
adcq $0x0, 0x20(%rsp)
incq %r15
movq 0x28(%rsp), %rbp
movq 0x8(%rbp), %rcx
jmp 0x163888
movq 0xd8(%rsp), %rdi
leaq (%rdi,%rcx,8), %rsi
callq 0x156b0d
movq 0x8(%rbp), %r12
movq 0x10(%rsp), %rax
leaq -0x4(%rax), %rcx
movq %rcx, (%rsp)
xorl %r8d, %r8d
pushq $-0x1
popq %rdx
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
movq $0x0, 0x8(%rsp)
imulq $0x1c, %r8, %r10
addq %rax, %r10
testq %r12, %r12
jle 0x163cdb
movq %r12, %rbx
movq 0xd8(%rsp), %rax
movl -0x8(%rax,%r12,8), %r14d
movq (%rbp), %rax
imulq $0x1c, %r14, %rcx
testb $0x40, 0x1b(%rax,%rcx)
jne 0x163b99
movq %r8, %r11
jmp 0x163c30
movq %r10, %r15
movq %r8, %r11
movq %rdx, %r9
testq %r14, %r14
js 0x163c2d
movq 0xe8(%rsp), %rax
testb $-0x80, 0x3(%rax,%r14,8)
jne 0x163c30
movq (%rbp), %r12
imulq $0x1c, %r14, %r13
testb $0x40, 0x1b(%r12,%r13)
jne 0x163bdf
cmpq %r8, %r11
jle 0x163be2
testb $0x40, -0x1(%r15)
cmovneq %r14, %r9
cmovneq %r11, %rdi
jmp 0x163be2
movq %rdx, %r9
incq %r11
movupd (%r12,%r13), %xmm0
movups 0xc(%r12,%r13), %xmm1
movups %xmm1, 0xc(%r15)
movupd %xmm0, (%r15)
movq 0xe8(%rsp), %r12
movq (%r12,%r14,8), %rax
movq %rax, %rcx
movl $0x80000000, %r13d      # imm = 0x80000000
orq %r13, %rcx
movq %rcx, (%r12,%r14,8)
andq %rsi, %rax
cmpq %rsi, %rax
cmoveq %rdx, %rax
addq $0x1c, %r15
movq %rax, %r14
jmp 0x163ba2
movq %rdx, %r14
leaq -0x1(%rbx), %r12
cmpq %r11, %r8
je 0x163b69
testq %r9, %r9
cmovnsq %r9, %r14
cmovnsq %rdi, %r11
movq %r11, %r15
subq %r8, %r15
je 0x163b69
movq 0xd8(%rsp), %rax
movq -0x8(%rax,%rbx,8), %rax
movq %rax, %rbx
shrq $0x20, %rbx
leaq -0x80000000(%rbx), %rcx
negq %rbx
testq %rax, %rax
cmovsq %rcx, %rbx
testq %r14, %r14
js 0x163ca5
movq 0xe8(%rsp), %rax
movq (%rax,%r14,8), %rax
movq %rax, %rcx
shrq $0x20, %rcx
leaq -0x80000000(%rcx), %r14
negq %rcx
testq %rax, %rax
cmovsq %r14, %rcx
subq %rcx, %rbx
testq %rbx, %rbx
js 0x163b69
shlq $0x20, %rbx
orq %r15, %rbx
movq 0xe0(%rsp), %rax
movq 0x8(%rsp), %rcx
movq %rbx, (%rax,%rcx,8)
incq %rcx
movq %rcx, 0x8(%rsp)
movq %r11, %r8
movq 0x10(%rsp), %rax
jmp 0x163b62
movq 0x10(%rsp), %rax
leaq -0x1c(%rax), %rdx
leaq 0x18(%rax), %rsi
xorl %edi, %edi
movl $0x3fffffff, %r8d       # imm = 0x3FFFFFFF
xorl %r14d, %r14d
cmpq 0x8(%rsp), %rdi
je 0x163e84
movq 0xe0(%rsp), %rax
movq (%rax,%rdi,8), %rax
movl %eax, %r9d
addq %r14, %r9
movq %rax, %rcx
shrq $0x20, %rcx
movq (%rbp), %r10
imulq $0x1c, %rdi, %rbx
movl %ecx, (%r10,%rbx)
movl %r14d, 0x10(%r10,%rbx)
movl %r9d, 0x14(%r10,%rbx)
shrl %eax
orl $-0x1, 0x4(%r10,%rbx)
imulq $0x1c, %r14, %r12
movq 0x10(%rsp), %rcx
leaq (%rcx,%r12), %r11
movl 0x8(%rcx,%r12), %ecx
movl %ecx, 0x8(%r10,%rbx)
imulq $0x1c, %rax, %r14
imulq $0x1c, %r9, %r10
leaq (%rdx,%r10), %r13
addq %rsi, %r12
xorl %r15d, %r15d
cmpq %r15, %r14
je 0x163e08
movups -0x18(%r12,%r15), %xmm0
movups -0xc(%r12,%r15), %xmm1
movups %xmm1, 0x7c(%rsp)
movaps %xmm0, 0x70(%rsp)
movups (%r13), %xmm0
movups 0xc(%r13), %xmm1
movups %xmm1, -0xc(%r12,%r15)
movups %xmm0, -0x18(%r12,%r15)
movups 0x7c(%rsp), %xmm0
movups %xmm0, 0xc(%r13)
movapd 0x70(%rsp), %xmm0
movupd %xmm0, (%r13)
movq (%rbp), %rax
leaq (%rax,%rbx), %rbp
addq $0x4, %rbp
movl (%rbp), %ecx
movl -0x14(%r12,%r15), %eax
cmpl %eax, %ecx
jbe 0x163dc6
movl %eax, (%rbp)
movl %eax, %ecx
movl 0x4(%r13), %eax
cmpl %eax, %ecx
jbe 0x163dd1
movl %eax, (%rbp)
movl 0x18(%r13), %eax
movl %eax, %ecx
shrl $0x1e, %ecx
andl $0x1, %ecx
btl $0x1e, (%r12,%r15)
adcl $0x0, %ecx
orl %r8d, %eax
movl %eax, 0x18(%r13)
orl %r8d, (%r12,%r15)
subq %rcx, 0x20(%rsp)
addq $0x1c, %r15
addq $-0x1c, %r13
movq 0x28(%rsp), %rbp
jmp 0x163d5e
movq 0xe0(%rsp), %rax
testb $0x1, (%rax,%rdi,8)
je 0x163e48
movq (%rbp), %rcx
movl 0x4(%r11,%r14), %eax
cmpl %eax, 0x4(%rcx,%rbx)
jbe 0x163e2e
addq %rbx, %rcx
addq $0x4, %rcx
movl %eax, (%rcx)
addq %r11, %r14
movl 0x18(%r14), %eax
btl $0x1e, %eax
sbbq $0x0, 0x20(%rsp)
orl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
movl %eax, 0x18(%r14)
testb $0x40, 0x1b(%r11)
je 0x163e65
incq %rdi
movq (%rsp), %rax
testb $0x40, 0x3(%rax,%r10)
movq %r9, %r14
jne 0x163cf3
leaq 0x8e775(%rip), %rdi     # 0x1f25e1
leaq 0x8dcb0(%rip), %rsi     # 0x1f1b23
leaq 0x8e783(%rip), %rcx     # 0x1f25fd
movl $0xf0e, %edx            # imm = 0xF0E
callq 0x2110
cmpq $0x0, 0x20(%rsp)
jne 0x163ebf
movq 0x8(%rsp), %rax
movq %rax, 0x8(%rbp)
movq (%rbp), %rdi
imulq $0x1c, %rax, %rsi
addq %rdi, %rsi
callq 0x15775d
jmp 0x163eaa
xorl %r14d, %r14d
movq %r14, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8e810(%rip), %rdi     # 0x1f26d6
leaq 0x8dc56(%rip), %rsi     # 0x1f1b23
leaq 0x8e729(%rip), %rcx     # 0x1f25fd
movl $0xf15, %edx            # imm = 0xF15
callq 0x2110