// File: chhylp123[P]hifiasm/inter.cpp
// Function: gl_chain_linear(ul_idx_t const*, ma_ug_t const*, vec_mg_lchain_t*, vec_mg_lchain_t*, long, ug_opt_t const*, long, double, st_mt_t*, long, long, long, int*, long*, long*, long, unsigned long)
int64_t gl_chain_linear(const ul_idx_t *uref, const ma_ug_t *ug, vec_mg_lchain_t *lc, 
vec_mg_lchain_t *sw, int64_t qlen, const ug_opt_t *uopt, int64_t bw, double ng_diff_thre, 
st_mt_t *bf, int64_t max_skip, int64_t max_iter, int64_t max_dis, int32_t *p, int64_t *f, 
int64_t *t, int64_t n_ext, uint64_t id)
{
	int64_t i, j, lc_n = lc->n, mm_ovlp, x, m_idx, m_sc, qo, n_skip, k, k0, n_u, n_v, ni;
    int64_t max_f, st, max_ii, sc, csc, mm_sc, mm_idx, end_j, max, n_v0;
    mg_lchain_t *li, *lj; asg_t *g = ug->g; uint64_t *u, ff; ul_ov_t ui, uj;

	memset(t, 0, (n_ext*sizeof((*t))));
	for (i = st = 0, max_ii = -1; i < n_ext; ++i) { // core loop
        li = &lc->a[i]; set_ul_ov_t_by_mg_lchain_t(&ui, li);
        mm_ovlp = max_ovlp(g, li->v^1);
        x = (li->qs + mm_ovlp)*ng_diff_thre; if(x < bw) x = bw; 
        x += li->qs + mm_ovlp;
        if (x > qlen+1) x = qlen+1;
        x = find_mg_lchain_max(i, lc->a, x+G_CHAIN_INDEL);
		csc = li->score;
		mm_sc = csc; mm_idx = -1; 
		n_skip = 0; end_j = -1;
		if ((x-st) > max_iter) st = x-max_iter;
		// if(id == 123/** || id == 192**/) {
		// 	fprintf(stderr, "[M::id->%lu::i->%ld::utg%.6d%c] q::[%u, %u); t::[%u, %u); st->%ld; x->%ld\n", id, i, (li->v>>1)+1, "lc"[ug->u.a[li->v>>1].circ], li->qs, li->qe, li->rs, li->re, st, x);
		// }
		for (j = x; j >= st; --j) { // collect potential destination vertices
			lj = &lc->a[j];
			if(lj->qe+G_CHAIN_INDEL <= li->qs) break;
			if(lj->qs >= li->qs) continue;
			set_ul_ov_t_by_mg_lchain_t(&uj, lj);
			qo = infer_rovlp(&ui, &uj, NULL, NULL, NULL, (ma_ug_t *)ug); ///overlap length in query (UL read)
			// if(id == 123/** || id == 192**/) {
			// 	fprintf(stderr, "[M::id->%lu::j->%ld] qo->%ld\n", id, j, qo);
			// }
			if(/**li->v!=lj->v &&**/get_ecov_adv(uref, uopt, li->v^1, lj->v^1, bw, ng_diff_thre, qo, 0, NULL)) {
				sc = csc + f[j];
                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 || (lc->a[i].qe>(lc->a[max_ii].qe+max_dis))) {//too long
			max = INT32_MIN; max_ii = -1;
            for (j = i - 1; (j >= st) && (lc->a[i].qe<=(max_dis+lc->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 = &(lc->a[max_ii]); 
			if(lj->qe+G_CHAIN_INDEL > li->qs && lj->qs < li->qs) {
				set_ul_ov_t_by_mg_lchain_t(&uj, lj);
				qo = infer_rovlp(&ui, &uj, NULL, NULL, NULL, (ma_ug_t *)ug);///overlap length in query (UL read)
				if(/**li->v!=lj->v &&**/get_ecov_adv(uref, uopt, li->v^1, lj->v^1, bw, ng_diff_thre, qo, 0, NULL)) {
					sc = csc + f[max_ii];
					if(sc > mm_sc) {
						mm_sc = sc; mm_idx = max_ii;
					}
				}
			}
		}

		f[i] = mm_sc; p[i] = mm_idx;
        if ((max_ii < 0) || ((lc->a[i].qe<=max_dis+lc->a[max_ii].qe) && (f[max_ii]<f[i]))) {
            max_ii = i;
        }

		li->dist_pre = mm_idx<0?-1:g_adjacent_dis(g, li->v^1, lc->a[mm_idx].v^1); li->inner_pre = 0;
		li->hash_pre = mm_idx<0?0:(__ac_Wang_hash((li->v^1))+__ac_Wang_hash((lc->a[mm_idx].v^1))); 
    }

	for (; i < lc_n; i++) {
		li = &lc->a[i];
		max_f = li->score; f[i] = max_f; p[i] = -1;
        ///same time for gchain
        li->dist_pre = -1;
        li->hash_pre = 0;
        li->inner_pre = 0;
	}
	
	for (i = 0; i < lc_n; ++i) {///all sc are positive
		t[i] = f[i]<<32; t[i] += (i<<1);
	}

	sw->n = 0; kv_resize(mg_lchain_t, *sw, (uint64_t)lc_n);
	kv_resize(uint64_t, *bf, (uint64_t)lc_n); u = bf->a;
	n_u = n_v = 0; radix_sort_gfa64i(t, t + lc_n); 
	for (k = lc_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; ) {
            sw->a[n_v++] = lc->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]));
		if(sc >= 0) {
			ff = ((uint64_t)(0x8000000000000000));
		} else {
			ff = 0; sc = -sc;
		}
		u[n_u++] = (((uint64_t)sc)<<32)|((uint64_t)(n_v-n_v0))|ff;
    }
	
	m_idx = m_sc = -1; 
	for (i = 0, k = 0; i < n_u; ++i) {
		if((u[i]&((uint64_t)(0x8000000000000000)))) {
			u[i] -= ((uint64_t)(0x8000000000000000)); sc = u[i]>>32;
		} else {
			sc = u[i]>>32; sc = -sc; 
		}
		u[i] <<= 32; u[i] >>= 32; u[i] |= (((uint64_t)sc)<<32);

        k0 = k, ni = (uint32_t)u[i];
        for (j = 0; j < ni; ++j) {
            lc->a[k++] = sw->a[k0 + (ni - j - 1)];
        }
        if(m_idx < 0 || m_sc < ((int64_t)(u[i]>>32))) {
            m_idx = i; m_sc = ((int64_t)(u[i]>>32));
        }
    }
    assert(k == n_v); bf->n = n_u;
	return m_idx;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x190, %rsp            # imm = 0x190
movq 0x58(%rbp), %rax
movq 0x50(%rbp), %rax
movq 0x48(%rbp), %rax
movq 0x40(%rbp), %rax
movq 0x38(%rbp), %rax
movq 0x30(%rbp), %rax
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movsd %xmm0, -0x38(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x110(%rbp)
movq 0x48(%rbp), %rdi
movq 0x50(%rbp), %rdx
shlq $0x3, %rdx
xorl %esi, %esi
callq 0x2100
movq $0x0, -0xb8(%rbp)
movq $0x0, -0x40(%rbp)
movq $-0x1, -0xc0(%rbp)
movq -0x40(%rbp), %rax
cmpq 0x50(%rbp), %rax
jge 0x2a46d2
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x100(%rbp)
movq -0x100(%rbp), %rsi
leaq -0x13c(%rbp), %rdi
callq 0x2a3930
movq -0x110(%rbp), %rdi
movq -0x100(%rbp), %rax
movl 0x8(%rax), %esi
xorl $0x1, %esi
callq 0x287d20
movq %rax, -0x58(%rbp)
movq -0x100(%rbp), %rax
movslq 0x14(%rax), %rax
addq -0x58(%rbp), %rax
cvtsi2sd %rax, %xmm0
mulsd -0x38(%rbp), %xmm0
cvttsd2si %xmm0, %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
cmpq 0x10(%rbp), %rax
jge 0x2a4094
movq 0x10(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x100(%rbp), %rax
movslq 0x14(%rax), %rax
addq -0x58(%rbp), %rax
addq -0x60(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq -0x28(%rbp), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
jle 0x2a40c8
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
movq -0x40(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
movq -0x60(%rbp), %rax
addq $0x80, %rax
movl %eax, %edx
callq 0x2a39b0
movq %rax, -0x60(%rbp)
movq -0x100(%rbp), %rax
movslq 0x1c(%rax), %rax
movq %rax, -0xd0(%rbp)
movq -0xd0(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq $-0x1, -0xe0(%rbp)
movq $0x0, -0x80(%rbp)
movq $-0x1, -0xe8(%rbp)
movq -0x60(%rbp), %rax
subq -0xb8(%rbp), %rax
cmpq 0x28(%rbp), %rax
jle 0x2a4146
movq -0x60(%rbp), %rax
subq 0x28(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq -0xb8(%rbp), %rax
jl 0x2a42f7
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x48(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x108(%rbp)
movq -0x108(%rbp), %rax
movl 0x18(%rax), %eax
addl $0x80, %eax
movq -0x100(%rbp), %rcx
cmpl 0x14(%rcx), %eax
jg 0x2a4195
jmp 0x2a42f7
movq -0x108(%rbp), %rax
movl 0x14(%rax), %eax
movq -0x100(%rbp), %rcx
cmpl 0x14(%rcx), %eax
jl 0x2a41b0
jmp 0x2a42e6
movq -0x108(%rbp), %rsi
leaq -0x158(%rbp), %rdi
callq 0x2a3930
movq -0x10(%rbp), %r9
leaq -0x13c(%rbp), %rdi
leaq -0x158(%rbp), %rsi
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rdx
movq %r8, %rcx
callq 0x71a90
movq %rax, -0x78(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x100(%rbp), %rax
movl 0x8(%rax), %edx
xorl $0x1, %edx
movq -0x108(%rbp), %rax
movl 0x8(%rax), %ecx
xorl $0x1, %ecx
movq 0x10(%rbp), %r8
movsd -0x38(%rbp), %xmm0
movq -0x78(%rbp), %r9
xorl %eax, %eax
movq $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
callq 0x292000
cmpq $0x0, %rax
je 0x2a42e4
movq -0xd0(%rbp), %rax
movq 0x40(%rbp), %rcx
movq -0x48(%rbp), %rdx
addq (%rcx,%rdx,8), %rax
movq %rax, -0xc8(%rbp)
movq -0xc8(%rbp), %rax
cmpq -0xd8(%rbp), %rax
jle 0x2a4292
movq -0xc8(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0xe0(%rbp)
cmpq $0x0, -0x80(%rbp)
jle 0x2a4290
movq -0x80(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x80(%rbp)
jmp 0x2a42bc
movq 0x48(%rbp), %rax
movq -0x48(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpq -0x40(%rbp), %rax
jne 0x2a42ba
movq -0x80(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x80(%rbp)
cmpq 0x20(%rbp), %rax
jle 0x2a42b8
jmp 0x2a42f7
jmp 0x2a42ba
jmp 0x2a42bc
movq 0x38(%rbp), %rax
movq -0x48(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jl 0x2a42e2
movq -0x40(%rbp), %rdx
movq 0x48(%rbp), %rax
movq 0x38(%rbp), %rcx
movq -0x48(%rbp), %rsi
movslq (%rcx,%rsi,4), %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x2a42e4
jmp 0x2a42e6
movq -0x48(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x2a414e
movq -0x48(%rbp), %rax
movq %rax, -0xe8(%rbp)
cmpq $0x0, -0xc0(%rbp)
jl 0x2a4342
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rcx
addq %rcx, %rax
movslq 0x18(%rax), %rax
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x28, -0xc0(%rbp), %rdx
addq %rdx, %rcx
movslq 0x18(%rcx), %rcx
addq 0x30(%rbp), %rcx
cmpq %rcx, %rax
jle 0x2a4406
movq $-0x80000000, -0xf0(%rbp) # imm = 0x80000000
movq $-0x1, -0xc0(%rbp)
movq -0x40(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rcx
xorl %eax, %eax
cmpq -0xb8(%rbp), %rcx
movb %al, -0x159(%rbp)
jl 0x2a43b2
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rcx
addq %rcx, %rax
movslq 0x18(%rax), %rax
movq 0x30(%rbp), %rcx
movq -0x18(%rbp), %rdx
movq (%rdx), %rdx
imulq $0x28, -0x48(%rbp), %rsi
addq %rsi, %rdx
movslq 0x18(%rdx), %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
setle %al
movb %al, -0x159(%rbp)
movb -0x159(%rbp), %al
testb $0x1, %al
jne 0x2a43be
jmp 0x2a4404
movq -0xf0(%rbp), %rax
movq 0x40(%rbp), %rcx
movq -0x48(%rbp), %rdx
cmpq (%rcx,%rdx,8), %rax
jge 0x2a43f1
movq 0x40(%rbp), %rax
movq -0x48(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xf0(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0xc0(%rbp)
jmp 0x2a43f3
movq -0x48(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x2a4364
jmp 0x2a4406
cmpq $0x0, -0xc0(%rbp)
jl 0x2a454f
movq -0xc0(%rbp), %rax
cmpq -0xe8(%rbp), %rax
jge 0x2a454f
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0xc0(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x108(%rbp)
movq -0x108(%rbp), %rax
movl 0x18(%rax), %eax
addl $0x80, %eax
movq -0x100(%rbp), %rcx
cmpl 0x14(%rcx), %eax
jle 0x2a454d
movq -0x108(%rbp), %rax
movl 0x14(%rax), %eax
movq -0x100(%rbp), %rcx
cmpl 0x14(%rcx), %eax
jge 0x2a454d
movq -0x108(%rbp), %rsi
leaq -0x158(%rbp), %rdi
callq 0x2a3930
movq -0x10(%rbp), %r9
leaq -0x13c(%rbp), %rdi
leaq -0x158(%rbp), %rsi
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rdx
movq %r8, %rcx
callq 0x71a90
movq %rax, -0x78(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x100(%rbp), %rax
movl 0x8(%rax), %edx
xorl $0x1, %edx
movq -0x108(%rbp), %rax
movl 0x8(%rax), %ecx
xorl $0x1, %ecx
movq 0x10(%rbp), %r8
movsd -0x38(%rbp), %xmm0
movq -0x78(%rbp), %r9
xorl %eax, %eax
movq $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
callq 0x292000
cmpq $0x0, %rax
je 0x2a454b
movq -0xd0(%rbp), %rax
movq 0x40(%rbp), %rcx
movq -0xc0(%rbp), %rdx
addq (%rcx,%rdx,8), %rax
movq %rax, -0xc8(%rbp)
movq -0xc8(%rbp), %rax
cmpq -0xd8(%rbp), %rax
jle 0x2a4549
movq -0xc8(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0xe0(%rbp)
jmp 0x2a454b
jmp 0x2a454d
jmp 0x2a454f
movq -0xd8(%rbp), %rdx
movq 0x40(%rbp), %rax
movq -0x40(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0xe0(%rbp), %rax
movl %eax, %edx
movq 0x38(%rbp), %rax
movq -0x40(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
cmpq $0x0, -0xc0(%rbp)
jl 0x2a45d2
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rcx
addq %rcx, %rax
movslq 0x18(%rax), %rax
movq 0x30(%rbp), %rcx
movq -0x18(%rbp), %rdx
movq (%rdx), %rdx
imulq $0x28, -0xc0(%rbp), %rsi
addq %rsi, %rdx
movslq 0x18(%rdx), %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
jg 0x2a45dd
movq 0x40(%rbp), %rax
movq -0xc0(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x40(%rbp), %rcx
movq -0x40(%rbp), %rdx
cmpq (%rcx,%rdx,8), %rax
jge 0x2a45dd
movq -0x40(%rbp), %rax
movq %rax, -0xc0(%rbp)
cmpq $0x0, -0xe0(%rbp)
jge 0x2a45f7
movq $-0x1, %rax
movq %rax, -0x168(%rbp)
jmp 0x2a462f
movq -0x110(%rbp), %rdi
movq -0x100(%rbp), %rax
movl 0x8(%rax), %esi
xorl $0x1, %esi
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0xe0(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %edx
xorl $0x1, %edx
callq 0x298410
movq %rax, -0x168(%rbp)
movq -0x168(%rbp), %rax
movl %eax, %ecx
movq -0x100(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x100(%rbp), %rax
movl 0x4(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x0, %ecx
movl %ecx, 0x4(%rax)
cmpq $0x0, -0xe0(%rbp)
jge 0x2a466c
xorl %eax, %eax
movl %eax, -0x16c(%rbp)
jmp 0x2a46b1
movq -0x100(%rbp), %rax
movl 0x8(%rax), %edi
xorl $0x1, %edi
callq 0x286f50
movl %eax, -0x170(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0xe0(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %edi
xorl $0x1, %edi
callq 0x286f50
movl %eax, %ecx
movl -0x170(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x16c(%rbp)
movl -0x16c(%rbp), %ecx
movq -0x100(%rbp), %rax
movl %ecx, 0x24(%rax)
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x2a400c
jmp 0x2a46d4
movq -0x40(%rbp), %rax
cmpq -0x50(%rbp), %rax
jge 0x2a476f
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x40(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x100(%rbp)
movq -0x100(%rbp), %rax
movslq 0x1c(%rax), %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rdx
movq 0x40(%rbp), %rax
movq -0x40(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x38(%rbp), %rax
movq -0x40(%rbp), %rcx
movl $0xffffffff, (%rax,%rcx,4) # imm = 0xFFFFFFFF
movq -0x100(%rbp), %rax
movl $0xffffffff, 0x20(%rax) # imm = 0xFFFFFFFF
movq -0x100(%rbp), %rax
movl $0x0, 0x24(%rax)
movq -0x100(%rbp), %rax
movl 0x4(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x0, %ecx
movl %ecx, 0x4(%rax)
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x2a46d4
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x50(%rbp), %rax
jge 0x2a47c2
movq 0x40(%rbp), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
shlq $0x20, %rdx
movq 0x48(%rbp), %rax
movq -0x40(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x40(%rbp), %rdx
shlq %rdx
movq 0x48(%rbp), %rax
movq -0x40(%rbp), %rcx
addq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x2a4777
movq -0x20(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
cmpq -0x50(%rbp), %rax
jae 0x2a48a2
movq -0x50(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rcx
shrq %rcx
movq -0x20(%rbp), %rax
orq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rcx
shrq $0x2, %rcx
movq -0x20(%rbp), %rax
orq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rcx
shrq $0x4, %rcx
movq -0x20(%rbp), %rax
orq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rcx
shrq $0x8, %rcx
movq -0x20(%rbp), %rax
orq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rcx
shrq $0x10, %rcx
movq -0x20(%rbp), %rax
orq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rax
imulq $0x28, 0x10(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
jmp 0x2a48a4
jmp 0x2a48a6
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rax
cmpq -0x50(%rbp), %rax
jae 0x2a497f
movq -0x50(%rbp), %rcx
movq 0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x8(%rax)
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rcx
shrq %rcx
movq 0x18(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x2, %rcx
movq 0x18(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x4, %rcx
movq 0x18(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x8, %rcx
movq 0x18(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x10, %rcx
movq 0x18(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x2a4981
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x118(%rbp)
movq $0x0, -0xa0(%rbp)
movq $0x0, -0x98(%rbp)
movq 0x48(%rbp), %rdi
movq 0x48(%rbp), %rsi
movq -0x50(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
callq 0x27ae10
movq -0x50(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x88(%rbp)
movq $0x0, -0x98(%rbp)
movq $0x0, -0xa0(%rbp)
cmpq $0x0, -0x88(%rbp)
jl 0x2a4bb1
movq -0xa0(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq 0x48(%rbp), %rax
movq -0x88(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shrl %eax
movl %eax, %eax
movq %rax, -0x40(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x40(%rbp)
movb %al, -0x171(%rbp)
jl 0x2a4a42
movq 0x48(%rbp), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rax
andq $0x1, %rax
cmpq $0x0, %rax
sete %al
movb %al, -0x171(%rbp)
movb -0x171(%rbp), %al
testb $0x1, %al
jne 0x2a4a4e
jmp 0x2a4ab3
movq -0x18(%rbp), %rax
movq (%rax), %rsi
imulq $0x28, -0x40(%rbp), %rax
addq %rax, %rsi
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movq -0xa0(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0xa0(%rbp)
imulq $0x28, %rax, %rax
addq %rax, %rdi
movl $0x28, %edx
callq 0x2180
movq 0x48(%rbp), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
orq $0x1, %rdx
movq %rdx, (%rax,%rcx,8)
movq 0x38(%rbp), %rax
movq -0x40(%rbp), %rcx
movslq (%rax,%rcx,4), %rax
movq %rax, -0x40(%rbp)
jmp 0x2a4a16
movq -0xf8(%rbp), %rax
cmpq -0xa0(%rbp), %rax
jne 0x2a4ac8
jmp 0x2a4b9a
cmpq $0x0, -0x40(%rbp)
jge 0x2a4aeb
movq 0x48(%rbp), %rax
movq -0x88(%rbp), %rcx
movq (%rax,%rcx,8), %rax
sarq $0x20, %rax
movq %rax, -0x180(%rbp)
jmp 0x2a4b11
movq 0x48(%rbp), %rax
movq -0x88(%rbp), %rcx
movq (%rax,%rcx,8), %rax
sarq $0x20, %rax
movq 0x40(%rbp), %rcx
movq -0x40(%rbp), %rdx
subq (%rcx,%rdx,8), %rax
movq %rax, -0x180(%rbp)
movq -0x180(%rbp), %rax
movq %rax, -0xc8(%rbp)
cmpq $0x0, -0xc8(%rbp)
jl 0x2a4b3c
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, -0x120(%rbp)
jmp 0x2a4b57
movq $0x0, -0x120(%rbp)
xorl %eax, %eax
subq -0xc8(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0xc8(%rbp), %rdx
shlq $0x20, %rdx
movq -0xa0(%rbp), %rax
subq -0xf8(%rbp), %rax
orq %rax, %rdx
orq -0x120(%rbp), %rdx
movq -0x118(%rbp), %rax
movq -0x98(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x98(%rbp)
movq %rdx, (%rax,%rcx,8)
movq -0x88(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x88(%rbp)
jmp 0x2a49e3
movq $-0x1, -0x70(%rbp)
movq $-0x1, -0x68(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x88(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x98(%rbp), %rax
jge 0x2a4da8
movq -0x118(%rbp), %rcx
movq -0x40(%rbp), %rdx
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
andq (%rcx,%rdx,8), %rax
cmpq $0x0, %rax
je 0x2a4c40
movq -0x118(%rbp), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
subq %rsi, %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x118(%rbp), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movq %rax, -0xc8(%rbp)
jmp 0x2a4c6a
movq -0x118(%rbp), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movq %rax, -0xc8(%rbp)
xorl %eax, %eax
subq -0xc8(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0x118(%rbp), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
shlq $0x20, %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x118(%rbp), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
shrq $0x20, %rdx
movq %rdx, (%rax,%rcx,8)
movq -0xc8(%rbp), %rdx
shlq $0x20, %rdx
movq -0x118(%rbp), %rax
movq -0x40(%rbp), %rcx
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x88(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x118(%rbp), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0xa8(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq -0xa8(%rbp), %rax
jge 0x2a4d53
movq -0x20(%rbp), %rax
movq (%rax), %rsi
movq -0x90(%rbp), %rax
movq -0xa8(%rbp), %rcx
subq -0x48(%rbp), %rcx
subq $0x1, %rcx
addq %rcx, %rax
imulq $0x28, %rax, %rax
addq %rax, %rsi
movq -0x18(%rbp), %rax
movq (%rax), %rdi
movq -0x88(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x88(%rbp)
imulq $0x28, %rax, %rax
addq %rax, %rdi
movl $0x28, %edx
callq 0x2180
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x2a4ce4
cmpq $0x0, -0x68(%rbp)
jl 0x2a4d76
movq -0x70(%rbp), %rax
movq -0x118(%rbp), %rcx
movq -0x40(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
cmpq %rcx, %rax
jge 0x2a4d95
movq -0x40(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x118(%rbp), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movq %rax, -0x70(%rbp)
jmp 0x2a4d97
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x2a4bd4
movq -0x88(%rbp), %rax
cmpq -0xa0(%rbp), %rax
jne 0x2a4dba
jmp 0x2a4dd9
leaq 0xebc84(%rip), %rdi     # 0x390a45
leaq 0xeba67(%rip), %rsi     # 0x39082f
movl $0x1695, %edx           # imm = 0x1695
leaq 0xed098(%rip), %rcx     # 0x391e6c
callq 0x2130
movq -0x98(%rbp), %rcx
movq 0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x68(%rbp), %rax
addq $0x190, %rsp            # imm = 0x190
popq %rbp
retq
nopw %cs:(%rax,%rax)