// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/inter.cpp
// Function: gl_chain_lin(kv_ul_ov_t*, overlap_region*, ul_ov_t*, ul_idx_t const*, ug_opt_t const*, long, double, long, long, long, long, Chain_Data*, long, unsigned long, All_reads*, ma_ug_t*, long, long)
int64_t gl_chain_lin(kv_ul_ov_t *res, overlap_region *ol, 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, int64_t max_iter, int64_t max_dis, Chain_Data* dp, int64_t trans_sc, 
uint64_t mode, All_reads *ridx, ma_ug_t *ug, int64_t need_srt, int64_t debug_i)
{
	if(res->n == 0) return 0;
	uint32_t rev_n; int32_t *f, *c_n, *c_sc; int64_t *p, *t, res_n = res->n, st, max_ii, max; rtrace_iter tc;
    int64_t mm_ovlp, x, i, j, k, sc, csc, mm_sc, mm_idx, n_skip, end_j, plus; ul_ov_t *li, *lj, rev_t; 
	resize_Chain_Data(dp, res_n, NULL); memset(&tc, 0, sizeof(tc));
	t = dp->tmp; f = dp->score; p = dp->pre; c_n = dp->occ; c_sc = dp->self_length;
	if(need_srt) {
		radix_sort_ul_ov_srt_qe(res->a, res->a + res_n);
		for (i = 1, j = 0; i <= res_n; i++) {
			if (i == 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;
			}
		}
	}
	
	memset(t, 0, (res_n*sizeof((*t))));
	for (i = st = plus = 0, max_ii = -1; i < res_n; ++i) {
		li = &(res->a[i]); 
        mm_ovlp = mode?max_ovlp_src(uopt, ((li->tn<<1)|li->rev)^1):max_ovlp(uref->ug->g, ((li->tn<<1)|li->rev)^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); 
		csc = aln_sc(ol[(*li).qn], trans_sc, UG_TRANS_ERR_W);
		// fprintf(stderr, "[M::%s::utg%.6dl] i::%ld, csc::%ld, q::[%u, %u), aln::%u, ol::%u, sec_e::%u\n", 
		// 						__func__, (int32_t)li->tn+1, i, csc, li->qs, li->qe, 
		// 						(ol[(*li).qn]).align_length, (ol[(*li).qn]).overlapLen, 
		// 						(ol[(*li).qn]).non_homopolymer_errors);
		mm_sc = csc; mm_idx = -1; 
		n_skip = 0; end_j = -1; tc.k = INT32_MAX;
		if ((x-st) > max_iter) st = x-max_iter;
		for (j = x; j >= st; --j) { // collect potential destination vertices
			lj = &(res->a[j]); 
			if(lj->qe+G_CHAIN_INDEL <= li->qs) break;//even this pair has a overlap, its length will be very small; just ignore
			sc = cal_gl_chain_lin_sc(res->a, i, j, &tc, ol, ridx, ug, uref, uopt, bw, diff_ec_ul, mode, trans_sc, UG_TRANS_ERR_W, f, debug_i);
			// char *as = NULL; 
			// asprintf(&as, "-3-[M::%s::] i::%ld(utg%.6dl), j::%ld(utg%.6dl), sc::%ld\n", 
			// __func__, i, (int32_t)li->tn+1, j, (int32_t)lj->tn+1, sc);
			// push_vlog(&(overall_zdbg->a[debug_i]), as); free(as); as = NULL;

			if(sc == INT32_MIN) continue;
			if(sc > mm_sc) {
				mm_sc = sc, mm_idx = j;
				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 || (res->a[i].qe>(res->a[max_ii].qe+max_dis))) {//too long
			max = INT32_MIN; max_ii = -1;
            for (j = i - 1; (j >= st) && (res->a[i].qe<=(max_dis+res->a[j].qe)); --j) {
                if (max < f[j]) {
                    max = f[j], max_ii = j;
                }
            }
		}
		
        if (max_ii >= 0 && max_ii < end_j) {///just have a try with a[i]<->a[max_ii]
			lj = &(res->a[max_ii]); 
			if(lj->qe+G_CHAIN_INDEL > li->qs && lj->qs < li->qs) {
				sc = cal_gl_chain_lin_sc(res->a, i, max_ii, &tc, ol, ridx, ug, uref, uopt, bw, diff_ec_ul, mode, trans_sc, UG_TRANS_ERR_W, f, debug_i);
				if(sc != INT32_MIN) {
					if(sc > mm_sc) {
						mm_sc = sc; mm_idx = max_ii;
					}
				}
			}
		}
        if(mm_sc < 0) {
			mm_sc = csc; mm_idx = -1; 
		}
		f[i] = mm_sc; p[i] = mm_idx;
        if ((max_ii < 0) || ((res->a[i].qe<=max_dis+res->a[max_ii].qe) && (f[max_ii]<f[i]))) {
            max_ii = i;
        }
		if(mm_sc < plus) plus = mm_sc;//minmun negative
		// fprintf(stderr, "-5-[M::%s::utg%.6dl] i::%ld, res_n::%ld, csc::%ld, f[i]::%d, p[i]::%ld, q::[%u, %u)\n", 
		// 						__func__, (int32_t)li->tn+1, i, res_n, csc, f[i], p[i], li->qs, li->qe);
		// char *as = NULL; 
		// asprintf(&as, "-5-[M::%s::utg%.6dl] i::%ld, csc::%ld, f[i]::%d, p[i]::%ld, q::[%u, %u)\n", __func__, (int32_t)li->tn+1, i, csc, f[i], p[i], li->qs, li->qe);
        // push_vlog(&(overall_zdbg->a[debug_i]), as); free(as); as = NULL;
	}
	for (i = 0; i < res_n; ++i) {///make all f[] positive
		f[i] -= plus; t[i] = ((uint64_t)f[i])<<32; t[i] += (i<<1);
	}

	int64_t n_v, n_u, n_v0; 
	radix_sort_gfa64i(t, t + res_n); plus = 0;
	for (k = res_n-1, n_v = n_u = 0; k >= 0; --k) {
		n_v0 = n_v;
		for (i = ((uint32_t)t[k])>>1; i >= 0 && (t[i]&1) == 0; ) {
			ex[n_v++] = res->a[i]; t[i] |= 1; i = p[i];
		}
		if(n_v0 == n_v) continue;
		sc = (i<0?(t[k]>>32):((t[k]>>32)-f[i]));
		// fprintf(stderr, "[M::%s::] n_v::%ld, n_v0::%ld, t[k]::%ld, sc::%ld\n", 
		// 						__func__, n_v, n_v0, t[k]>>32, sc);
		c_n[n_u] = n_v-n_v0; c_sc[n_u] = sc; n_u++; if(sc < plus) plus = sc;
	}
	// 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 += c_n[k];
		res->a[k].qn = c_sc[k]-plus;//score
        res->a[k].ts = n_v0; res->a[k].te = n_v;///idx
		// fprintf(stderr, "[M::%s] k:%ld, c_sc:%d\n", __func__, k, c_sc[k]);

		rev_n = c_n[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;
            ex[n_v0+i].sec = ex[n_v-i-1].sec = SEC_MODE; 
        }
        if(c_n[k]&1) {
            if(res->a[k].qs > ex[n_v0+i].qs) res->a[k].qs = ex[n_v0+i].qs;
            ex[n_v0+i].sec = SEC_MODE; 
        }
	}
	res->n = n_u;
    radix_sort_ul_ov_srt_qn(res->a, res->a + res->n);//sort by score
    return n_v;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movsd %xmm0, 0x58(%rsp)
movq %r9, 0x50(%rsp)
movq %r8, 0x40(%rsp)
movq %rcx, 0x38(%rsp)
movq %rsi, 0x48(%rsp)
movq %rdi, (%rsp)
movq 0x8(%rdi), %r13
testq %r13, %r13
je 0x1ac1df
movq %rdx, 0x20(%rsp)
movq 0x1e8(%rsp), %rbx
movq 0x1c0(%rsp), %r14
movq %r14, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x3f828
leaq 0xd0(%rsp), %rdi
movl $0x98, %edx
xorl %esi, %esi
callq 0x20e0
movq 0x28(%r14), %r12
movq (%r14), %rbp
movq 0x8(%r14), %rax
movq %rax, 0x30(%rsp)
movq 0x20(%r14), %rax
movq %rax, 0x60(%rsp)
movq 0x18(%r14), %rax
movq %rax, 0x78(%rsp)
testq %rbx, %rbx
je 0x1abbda
movq (%rsp), %rax
movq (%rax), %rdi
leaq (,%r13,8), %rax
addq %r13, %rax
leaq (%rax,%rax,2), %rsi
addq %rdi, %rsi
addq %r13, %rsi
callq 0x195511
testq %r13, %r13
jle 0x1abbda
movq %r13, %rbx
negq %rbx
movl $0x1, %r14d
movl $0x1c, %r15d
xorl %eax, %eax
movq %rbx, %rcx
addq %r14, %rcx
je 0x1abb94
movq (%rsp), %rcx
movq (%rcx), %rcx
movl 0x8(%rcx,%r15), %edx
leaq (%rax,%rax,8), %rsi
leaq (%rsi,%rsi,2), %rsi
addq %rax, %rsi
cmpl 0x8(%rcx,%rsi), %edx
jne 0x1abb94
movq %rax, %rcx
jmp 0x1abbc3
movq %r14, %rdx
subq %rax, %rdx
movq %r14, %rcx
cmpq $0x2, %rdx
jl 0x1abbc3
movq (%rsp), %rcx
movq (%rcx), %rsi
leaq (%rax,%rax,8), %rcx
leaq (%rcx,%rcx,2), %rdi
addq %rax, %rdi
addq %rsi, %rdi
addq %r15, %rsi
callq 0x1957bd
movq %r14, %rcx
leaq (%rbx,%r14), %rdx
incq %rdx
incq %r14
addq $0x1c, %r15
movq %rcx, %rax
cmpq $0x1, %rdx
jne 0x1abb6a
leaq (,%r13,8), %rdx
movq %r12, %rdi
xorl %esi, %esi
callq 0x20e0
testq %r13, %r13
movl $0x0, %esi
jle 0x1ac0ea
movq 0x1a0(%rsp), %rax
incq %rax
movq %rax, 0x90(%rsp)
movq $-0x14, 0x70(%rsp)
xorl %esi, %esi
movq $-0x1, 0x68(%rsp)
xorl %r15d, %r15d
xorl %r9d, %r9d
movq $-0x1, %r14
movq %r13, 0x98(%rsp)
movq %rbp, 0x80(%rsp)
leaq (%r9,%r9,8), %rax
leaq (%rax,%rax,2), %rcx
addq %r9, %rcx
movq (%rsp), %rax
movq (%rax), %rbx
movq %rcx, 0x28(%rsp)
addq %rcx, %rbx
cmpq $0x0, 0x1d0(%rsp)
movq %r9, 0x8(%rsp)
movq %rsi, 0xa8(%rsp)
je 0x1abc8e
movl 0xc(%rbx), %eax
movl 0x18(%rbx), %esi
shrdl $0x1f, %eax, %esi
xorl $0x1, %esi
movq 0x40(%rsp), %rdi
callq 0x19c00f
movq 0x8(%rsp), %r9
jmp 0x1abd00
movq 0x38(%rsp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rax
movl 0xc(%rbx), %ecx
movl 0x18(%rbx), %edx
shrdl $0x1f, %ecx, %edx
xorl $0x1, %edx
movq 0x28(%rax), %rcx
movq (%rcx,%rdx,8), %rcx
movq %rcx, %rdx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
andq %rsi, %rdx
je 0x1abcfe
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 0x1abcdc
movl %esi, %eax
jmp 0x1abd00
xorl %eax, %eax
movl 0x4(%rbx), %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 0x90(%rsp), %rax
cmpq %rax, %rdx
cmovgeq %rax, %rdx
movq (%rsp), %rax
movq (%rax), %rsi
subl $-0x80, %edx
movl %r9d, %edi
callq 0x19f679
movslq %eax, %r13
movq %rbx, 0x88(%rsp)
movl (%rbx), %eax
imulq $0xa8, %rax, %rax
movq 0x48(%rsp), %rdx
movl 0x20(%rdx,%rax), %ecx
movl 0x28(%rdx,%rax), %esi
subl %esi, %ecx
imulq 0x1c8(%rsp), %rcx
movl 0x30(%rdx,%rax), %eax
shlq $0x6, %rax
addq %rcx, %rax
subq %rax, %rsi
movq $0x7fffffff, 0xd0(%rsp) # imm = 0x7FFFFFFF
movq %r13, %rax
subq %r15, %rax
movq %r15, %rdx
movq %r13, %r15
movq 0x1b0(%rsp), %rcx
subq %rcx, %r15
cmpq %rcx, %rax
cmovleq %rdx, %r15
cmpq %r13, %r15
movq %rsi, 0xa0(%rsp)
jle 0x1abdd2
movq $-0x1, 0x18(%rsp)
movq %r13, %rax
movq %rsi, 0x10(%rsp)
movq 0x8(%rsp), %r9
jmp 0x1abeec
leaq (,%r13,8), %rax
addq %r13, %rax
leaq (%rax,%rax,2), %rax
leaq (%rax,%r13), %rbx
addq $0x8, %rbx
movq $-0x1, 0x18(%rsp)
xorl %ebp, %ebp
movq %rsi, 0x10(%rsp)
movq 0x8(%rsp), %r9
movq (%rsp), %rax
movq (%rax), %rdi
movl (%rdi,%rbx), %eax
subl $-0x80, %eax
movq 0x88(%rsp), %rcx
cmpl 0x4(%rcx), %eax
jbe 0x1abee9
subq $0x10, %rsp
movl %r9d, %esi
movl %r13d, %edx
leaq 0xe0(%rsp), %rcx
movq 0x58(%rsp), %r8
movq 0x1e8(%rsp), %r9
movsd 0x68(%rsp), %xmm0
pushq 0x90(%rsp)
pushq $0x40
pushq 0x1e8(%rsp)
pushq 0x1f8(%rsp)
pushq 0x80(%rsp)
pushq 0x78(%rsp)
pushq 0x78(%rsp)
pushq 0x228(%rsp)
callq 0x1ab879
addq $0x50, %rsp
cmpq $-0x80000000, %rax      # imm = 0x80000000
jne 0x1abe86
movq 0x8(%rsp), %r9
jmp 0x1abed3
cmpq 0x10(%rsp), %rax
jle 0x1abea9
xorl %ecx, %ecx
testq %rbp, %rbp
setg %cl
subq %rcx, %rbp
movq %rax, 0x10(%rsp)
movq %r13, 0x18(%rsp)
movq 0x8(%rsp), %r9
jmp 0x1abec1
movq 0x8(%rsp), %r9
cmpq %r9, (%r12,%r13,8)
jne 0x1abec1
cmpq 0x1a8(%rsp), %rbp
jge 0x1abee9
incq %rbp
movq 0x30(%rsp), %rax
movq (%rax,%r13,8), %rax
testq %rax, %rax
js 0x1abed3
movq %r9, (%r12,%rax,8)
leaq -0x1(%r13), %rax
addq $-0x1c, %rbx
cmpq %r15, %r13
movq %rax, %r13
jg 0x1abdfe
jmp 0x1abeec
movq %r13, %rax
testq %r14, %r14
movq 0x98(%rsp), %r13
movq 0x80(%rsp), %rbp
movq 0x1b8(%rsp), %rbx
js 0x1abf30
movq (%rsp), %rcx
movq (%rcx), %rcx
movq 0x28(%rsp), %rdx
movl 0x8(%rcx,%rdx), %edx
leaq (%r14,%r14,8), %rsi
leaq (%rsi,%rsi,2), %rsi
addq %r14, %rsi
movl 0x8(%rcx,%rsi), %ecx
addq %rbx, %rcx
cmpq %rdx, %rcx
jge 0x1abf88
movq $-0x1, %r14
cmpq %r15, %r9
jle 0x1abf88
movq (%rsp), %rcx
movq (%rcx), %rcx
movq 0x28(%rsp), %rdx
movl 0x8(%rcx,%rdx), %edx
addq 0x70(%rsp), %rcx
movq $-0x80000000, %rsi      # imm = 0x80000000
movq 0x68(%rsp), %rdi
movl (%rcx), %r8d
addq %rbx, %r8
cmpq %rdx, %r8
jl 0x1abf88
movslq (%rbp,%rdi,4), %r8
cmpq %r8, %rsi
cmovleq %r8, %rsi
cmovlq %rdi, %r14
leaq -0x1(%rdi), %r8
addq $-0x1c, %rcx
cmpq %r15, %rdi
movq %r8, %rdi
jg 0x1abf5d
testq %r14, %r14
js 0x1ac059
cmpq %rax, %r14
jge 0x1ac059
movq (%rsp), %rax
movq (%rax), %rdi
leaq (%r14,%r14,8), %rax
leaq (%rax,%rax,2), %rax
addq %r14, %rax
movl 0x8(%rdi,%rax), %edx
subl $-0x80, %edx
movq 0x88(%rsp), %rcx
movl 0x4(%rcx), %ecx
cmpl %ecx, %edx
jbe 0x1ac059
addq %rdi, %rax
cmpl %ecx, 0x4(%rax)
jae 0x1ac059
subq $0x10, %rsp
movl %r9d, %esi
movl %r14d, %edx
leaq 0xe0(%rsp), %rcx
movq 0x58(%rsp), %r8
movq 0x1e8(%rsp), %r9
movsd 0x68(%rsp), %xmm0
pushq %rbp
pushq $0x40
pushq 0x1e8(%rsp)
pushq 0x1f8(%rsp)
pushq 0x80(%rsp)
pushq 0x78(%rsp)
pushq 0x78(%rsp)
pushq 0x228(%rsp)
callq 0x1ab879
movq 0x58(%rsp), %r9
addq $0x50, %rsp
cmpq $-0x80000000, %rax      # imm = 0x80000000
setne %cl
movq 0x10(%rsp), %rsi
cmpq %rsi, %rax
setg %dl
testb %dl, %cl
cmovneq %rax, %rsi
movq %rsi, 0x10(%rsp)
movq 0x18(%rsp), %rax
cmovneq %r14, %rax
movq %rax, 0x18(%rsp)
movq 0x10(%rsp), %rax
testq %rax, %rax
movq 0xa0(%rsp), %rcx
cmovnsq %rax, %rcx
movq $-0x1, %rax
movq 0x18(%rsp), %rdx
cmovsq %rax, %rdx
movq %rcx, %rdi
movl %ecx, (%rbp,%r9,4)
movq 0x30(%rsp), %rax
movq %rdx, (%rax,%r9,8)
testq %r14, %r14
movq 0xa8(%rsp), %rsi
js 0x1ac0c9
movq (%rsp), %rax
movq (%rax), %rax
movq 0x28(%rsp), %rcx
movl 0x8(%rax,%rcx), %ecx
leaq (%r14,%r14,8), %rdx
leaq (%rdx,%rdx,2), %rdx
addq %r14, %rdx
movl 0x8(%rax,%rdx), %eax
addq %rbx, %rax
cmpq %rcx, %rax
jl 0x1ac0cc
cmpl %edi, (%rbp,%r14,4)
jge 0x1ac0cc
movq %r9, %r14
cmpq %rsi, %rdi
cmovlq %rdi, %rsi
incq %r9
incq 0x68(%rsp)
addq $0x1c, 0x70(%rsp)
cmpq %r13, %r9
jne 0x1abc3e
testq %r13, %r13
jle 0x1ac112
xorl %eax, %eax
movq %r13, %rcx
movl (%rbp,%rax,2), %edx
subl %esi, %edx
movl %edx, (%rbp,%rax,2)
shlq $0x20, %rdx
addq %rax, %rdx
movq %rdx, (%r12,%rax,4)
addq $0x2, %rax
decq %rcx
jne 0x1ac0f4
leaq (%r12,%r13,8), %rsi
movq %r12, %rdi
callq 0x19525e
testq %r13, %r13
movq 0x20(%rsp), %rbx
movq 0x60(%rsp), %r15
movq 0x30(%rsp), %r14
jle 0x1ac1e7
xorl %eax, %eax
xorl %edx, %edx
xorl %ecx, %ecx
movq %rdx, %rdi
movq %r13, %rsi
decq %r13
movl -0x8(%r12,%rsi,8), %r8d
shrl %r8d
leaq (%rdx,%rdx,8), %r9
leaq (%r9,%r9,2), %r9
addq %rbx, %r9
addq %rdx, %r9
testb $0x1, (%r12,%r8,8)
jne 0x1ac19f
movq (%rsp), %r10
movq (%r10), %r10
leaq (%r8,%r8,8), %r11
leaq (%r11,%r11,2), %r11
addq %r8, %r11
movupd (%r10,%r11), %xmm0
movups 0xc(%r10,%r11), %xmm1
movups %xmm1, 0xc(%r9)
movupd %xmm0, (%r9)
orb $0x1, (%r12,%r8,8)
incq %rdx
movq (%r14,%r8,8), %r8
addq $0x1c, %r9
testq %r8, %r8
jns 0x1ac15b
cmpq %rdi, %rdx
je 0x1ac1d3
movslq 0x4(%r12,%r13,8), %r9
testq %r8, %r8
js 0x1ac1b6
movslq (%rbp,%r8,4), %r8
subq %r8, %r9
movl %edx, %r8d
subl %edi, %r8d
movl %r8d, (%r15,%rax,4)
movq 0x78(%rsp), %rdi
movl %r9d, (%rdi,%rax,4)
incq %rax
cmpq %rcx, %r9
cmovlq %r9, %rcx
cmpq $0x1, %rsi
jg 0x1ac13c
jmp 0x1ac1eb
xorl %r14d, %r14d
jmp 0x1ac398
xorl %ecx, %ecx
xorl %eax, %eax
testq %rax, %rax
jle 0x1ac377
leaq -0x1c(%rbx), %rdx
xorl %r8d, %r8d
movl $0x3fffffff, %esi       # imm = 0x3FFFFFFF
xorl %edi, %edi
movslq (%r15,%rdi,4), %r14
addq %r8, %r14
movq 0x78(%rsp), %r9
movl (%r9,%rdi,4), %r10d
subl %ecx, %r10d
movq (%rsp), %r9
movq (%r9), %rbx
leaq (%rdi,%rdi,8), %r9
leaq (%r9,%r9,2), %r9
addq %rdi, %r9
movl %r10d, (%rbx,%r9)
movl %r8d, 0x10(%rbx,%r9)
movl %r14d, 0x14(%rbx,%r9)
movl (%r15,%rdi,4), %r11d
movl $0xffffffff, 0x4(%rbx,%r9) # imm = 0xFFFFFFFF
leaq (%r8,%r8,8), %r10
leaq (%r10,%r10,2), %r10
leaq (%r10,%r8), %r15
movq 0x20(%rsp), %r12
movl 0x8(%r12,%r15), %ebp
movl %ebp, 0x8(%rbx,%r9)
cmpl $0x2, %r11d
jae 0x1ac26a
xorl %ebx, %ebx
jmp 0x1ac31f
sarl %r11d
leaq (%r12,%r8), %r15
addq %r10, %r15
cmpl $0x1, %r11d
adcl $0x0, %r11d
leaq (%r14,%r14,8), %rbx
leaq (%rbx,%rbx,2), %r12
addq %rdx, %r12
addq %r14, %r12
xorl %ebx, %ebx
movups (%r15), %xmm0
movups 0xc(%r15), %xmm1
movups %xmm1, 0xbc(%rsp)
movaps %xmm0, 0xb0(%rsp)
movups (%r12), %xmm0
movups 0xc(%r12), %xmm1
movups %xmm1, 0xc(%r15)
movups %xmm0, (%r15)
movups 0xbc(%rsp), %xmm0
movups %xmm0, 0xc(%r12)
movapd 0xb0(%rsp), %xmm0
movupd %xmm0, (%r12)
movq (%rsp), %r13
movq (%r13), %r13
addq %r9, %r13
addq $0x4, %r13
movl 0x4(%r15), %ebp
cmpl %ebp, (%r13)
jbe 0x1ac2f3
movl %ebp, (%r13)
movl 0x4(%r12), %ebp
cmpl %ebp, (%r13)
jbe 0x1ac302
movl %ebp, (%r13)
orl %esi, 0x18(%r12)
orl %esi, 0x18(%r15)
incq %rbx
addq $0x1c, %r15
addq $-0x1c, %r12
cmpq %rbx, %r11
jne 0x1ac28c
movq 0x60(%rsp), %r15
testb $0x1, (%r15,%rdi,4)
je 0x1ac366
movq (%rsp), %r11
movq (%r11), %r11
addq 0x20(%rsp), %r8
addq %r10, %r8
leaq (%rbx,%rbx,8), %r10
leaq (%r10,%r10,2), %r10
addq %rbx, %r10
movl 0x4(%r8,%r10), %ebx
cmpl %ebx, 0x4(%r11,%r9)
jbe 0x1ac35b
addq %r11, %r9
addq $0x4, %r9
movl %ebx, (%r9)
addq %r10, %r8
orl $0x3fffffff, 0x18(%r8)  # imm = 0x3FFFFFFF
incq %rdi
movq %r14, %r8
cmpq %rax, %rdi
jne 0x1ac202
jmp 0x1ac37a
xorl %r14d, %r14d
movq (%rsp), %rcx
movq %rax, 0x8(%rcx)
movq (%rcx), %rdi
leaq (%rax,%rax,8), %rcx
leaq (%rcx,%rcx,2), %rsi
addq %rax, %rsi
addq %rdi, %rsi
callq 0x195d3d
movq %r14, %rax
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq