// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Hash_Table.cpp
// Function: lchain_qdp_mcopy(Candidates_list*, long, long, long, Chain_Data*, overlap_region_alloc*, long, long, long, double, double, double, unsigned int, long, long, long, unsigned int, long, long, double, long, long)
uint64_t lchain_qdp_mcopy(Candidates_list *cl, int64_t a_idx, int64_t a_n, int64_t des_idx, 
              Chain_Data* dp, overlap_region_alloc* res, int64_t max_skip, int64_t max_iter, 
              int64_t max_dis, double chn_pen_gap, double chn_pen_skip, double bw_rate, 
              uint32_t xid, int64_t xl, int64_t yl, int64_t quick_check, uint32_t apend_be, 
              int64_t gen_cigar, int64_t enable_mcopy, double mcopy_rate, int64_t mcopy_khit_cutoff, 
              int64_t khit_n)
{
    if(a_n <= 0) return 0;
    int64_t *p, *t, max_f, n_skip, st, max_j, end_j, sc, msc, msc_i, bw, max_ii, ovl, movl, plus = 0, min_sc, ch_n; 
    int32_t *f, max, tmp, *ii; int64_t i, k, j, cL = 0; k_mer_hit* a; k_mer_hit* des; k_mer_hit *swap; overlap_region *z;
    resize_Chain_Data(dp, a_n, NULL);
    t = dp->tmp; f = dp->score; p = dp->pre; ii = dp->occ;
    bw = ((xl < yl)?xl:yl); bw *= bw_rate;
    msc = msc_i = INT32_MIN; movl = INT32_MAX; ch_n = 1;
    a = cl->list + a_idx; des = cl->list + des_idx;
    // if(a_n && a[0].readID == 0) {
    //     fprintf(stderr, "---[M::%s::utg%.6dl::%c]\n", 
    //                     __func__, (int32_t)a[0].readID+1, "+-"[a[0].strand]);
    // }

    memset(t, 0, (a_n*sizeof((*t))));
    for (i = st = plus = 0, max_ii = -1; i < a_n; ++i) {
        max_f = a[i].cnt&(0xffu); 
        n_skip = 0; max_j = end_j = -1;
        if ((i-st) > max_iter) st = i-max_iter;
        while (a[i].strand != a[st].strand) ++st;

        for (j = i - 1; j >= st; --j) {
            sc = comput_sc_ch(&a[i], &a[j], bw_rate, chn_pen_gap, chn_pen_skip, xl, yl);
            if (sc == INT32_MIN) continue;
            sc += f[j];
            if (sc > max_f) {
                max_f = sc, max_j = j;
                if (n_skip > 0) --n_skip;
            } else if (t[j] == (int32_t)i) {
                if (++n_skip > max_skip)
                    break;
            }
            if (p[j] >= 0) t[p[j]] = i;
        }
        end_j = j;

        if ((max_ii<0) || (a[i].self_offset>a[max_ii].self_offset+max_dis) || (a[i].strand!=a[max_ii].strand)) {
            max = INT32_MIN; max_ii = -1;
            for (j=i-1; (j>=st) && (a[i].self_offset<=max_dis+a[j].self_offset)&&(a[i].strand==a[j].strand); --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]
            tmp = comput_sc_ch(&a[i], &a[max_ii], bw_rate, chn_pen_gap, chn_pen_skip, xl, yl);
            if (tmp != INT32_MIN && max_f < tmp + f[max_ii])
                max_f = tmp + f[max_ii], max_j = max_ii;
        }
        f[i] = max_f; p[i] = max_j;
        if ((max_ii < 0) || ((a[i].self_offset<=max_dis+a[max_ii].self_offset)&&(a[i].strand==a[max_ii].strand)&&(f[max_ii]<f[i]))) {
            max_ii = i;
        }
        if(f[i] >= msc) {
            ovl = get_chainLen(a[i].self_offset, a[i].self_offset, xl, a[i].offset, a[i].offset, yl);
            if(f[i] > msc || ovl < movl) {
                msc = f[i]; msc_i = i; movl = ovl;
            }
        }
        if(f[i] < plus) plus = f[i];
        ii[i] = 0;///for mcopy, not here
        // if(a_n && a[0].readID == 0) {
        //     fprintf(stderr, "i::%ld[M::%s::utg%.6dl::%c] x::%u, y::%u, st::%ld, max_ii::%ld, f[i]::%d, p[i]::%ld, msc_i::%ld, msc::%ld, movl::%ld\n", 
        //                     i, __func__, (int32_t)a[i].readID+1, "+-"[a[i].strand], 
        //                     a[i].self_offset, a[i].offset, st, max_ii, f[i], p[i], msc_i, msc, movl);
        // }
    }

    for (i = msc_i, cL = 0; i >= 0; i = p[i]) { ii[i] = 1; t[cL++] = i;}///label the best chain
    if((movl < xl) && enable_mcopy/**(movl < yl)**/) {
        if(cL >= mcopy_khit_cutoff) {///if there are too few k-mers, disable mcopy
            msc -= plus; min_sc = msc*mcopy_rate/**0.2**/; ii[msc_i] = 0;
            for (i = ch_n = 0; i < a_n; ++i) {///make all f[] positive
                f[i] -= plus; if(i >= ch_n) t[i] = 0;
                if((!(ii[i])) && (f[i] >= min_sc)) {
                    t[ch_n] = ((uint64_t)f[i])<<32; t[ch_n] += (i<<1); ch_n++;
                }
            }
            if(ch_n > 1) {
                int64_t n_v, n_v0, ni, n_u, n_u0 = res->length; 
                radix_sort_hc64i(t, t + ch_n);
                for (k = ch_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; ) {
                        ii[n_v++] = 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 >= min_sc) {
                        kv_pushp_ol(overlap_region, (*res), &z);
                        push_ovlp_chain_qgen(z, xid, xl, yl, sc+plus, &(a[ii[n_v-1]]), &(a[ii[n_v0]]));
                        ///mcopy_khit_cutoff <= 1: disable the mcopy_khit_cutoff filtering, for the realignment
                        if((mcopy_khit_cutoff <= 1) || ((z->x_pos_e+1-z->x_pos_s) <= (movl<<2))) {
                            z->align_length = n_v-n_v0; z->x_id = n_v0;
                            n_u++;
                        } else {///non-best is too long
                            res->length--; n_v = n_v0;
                        }
                    } else {
                        n_v = n_v0;
                    }
                }

                if(n_u > 1) ks_introsort_or_sss(n_u, res->list + n_u0); 
                res->length = n_u0 + filter_non_ovlp_xchains(res->list + n_u0, n_u, &n_v);
                n_u = res->length;
                if(n_u > n_u0 + 1) {
                    kv_resize_cl(k_mer_hit, (*cl), (n_v+cl->length));
                    a = cl->list + a_idx; des = cl->list + des_idx; swap = cl->list + cl->length; 
                    for (k = n_u0, i = n_v0 = n_v = 0; k < n_u; k++) {
                        z = &(res->list[k]);
                        z->non_homopolymer_errors = des_idx + i;
                        n_v0 = z->x_id; ni = z->align_length;
                        for (j = 0; j < ni; j++, i++) {
                            ///k0 + (ni - j - 1)
                            swap[i] = a[ii[n_v0 + (ni- j - 1)]]; 
                            swap[i].readID = k; 
                        }
                        z->x_id = xid; 
                        if(gen_cigar) gen_fake_cigar(&(z->f_cigar), z, apend_be, swap+i-ni, ni);
                        if(!khit_n) z->align_length = 0; 
                    }
                    memcpy(des, swap, i*sizeof((*swap))); //assert(i == ch_n);
                    
                    // fprintf(stderr, "[M::%s::msc->%ld] msc_k_hits::%u, cL::%ld, min_sc::%ld, best_sc::%ld, n_u0_sc::%d, mcopy_rate::%f, # chains::%ld\n", 
                    // __func__, msc, res->list[n_u0].align_length, cL, min_sc, msc+plus, res->list[n_u0].shared_seed,
                    // mcopy_rate, n_u-n_u0);
                } else if(n_u == n_u0 + 1) {
                    z = &(res->list[n_u0]); k = n_u0; i = 0;
                    z->non_homopolymer_errors = des_idx + i;
                    n_v0 = z->x_id; ni = z->align_length;
                    for (j = 0; j < ni; j++, i++) {
                        ///k0 + (ni - j - 1)
                        des[i] = a[ii[n_v0 + (ni- j - 1)]]; 
                        des[i].readID = k; 
                    }
                    z->x_id = xid; 
                    if(gen_cigar) gen_fake_cigar(&(z->f_cigar), z, apend_be, des+i-ni, ni);
                    if(!khit_n) z->align_length = 0; 
                }
                return i;
            } else {
                msc += plus; i = msc_i; cL = 0; 
                while (i >= 0) {t[cL++] = i; i = p[i];}
            }
        }
    }
    ///a[] has been sorted by self_offset
    // i = msc_i; cL = 0; 
    // while (i >= 0) {t[cL++] = i; i = p[i];}
    kv_pushp_ol(overlap_region, (*res), &z);
    push_ovlp_chain_qgen(z, xid, xl, yl, msc, &(a[t[cL-1]]), &(a[t[0]]));
    for (i = 0; i < cL; i++) {des[i] = a[t[cL-i-1]]; des[i].readID = res->length-1;}
    z->non_homopolymer_errors = des_idx;
    if(gen_cigar) gen_fake_cigar(&(z->f_cigar), z, apend_be, des, cL);
    if(khit_n) z->align_length = cL;
    return cL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movsd %xmm2, 0x30(%rsp)
movsd %xmm1, 0x20(%rsp)
movsd %xmm0, 0xa0(%rsp)
movq %rcx, 0x80(%rsp)
testq %rdx, %rdx
jle 0x15659
movq %r8, %r14
movq %rdx, %r15
movq %rsi, %rbx
movsd %xmm3, 0xc8(%rsp)
movq %r9, 0x10(%rsp)
movq %rdi, %rbp
movq %r8, %rdi
movq %rdx, %rsi
xorl %edx, %edx
callq 0x1383e
movq 0x28(%r14), %r13
movq (%r14), %rax
movq %rax, 0x60(%rsp)
movq 0x8(%r14), %rax
movq %rax, 0x58(%rsp)
movq 0x20(%r14), %r12
movq %rbx, %r14
movq %rbp, 0xb8(%rsp)
movq (%rbp), %rbx
shlq $0x4, %r14
leaq (%rbx,%r14), %rax
movq %rax, 0x50(%rsp)
leaq (,%r15,8), %rdx
movq %r13, %rdi
xorl %esi, %esi
callq 0x20e0
xorl %esi, %esi
movq 0x138(%rsp), %rcx
movq %rcx, %rax
notq %rax
movq %rax, 0xd8(%rsp)
movq %rcx, %rax
negq %rax
movq %rax, 0xd0(%rsp)
leaq (%rbx,%r14), %r9
addq $-0x10, %r9
movq %rbx, 0x78(%rsp)
movq %r14, 0xc0(%rsp)
leaq -0x8(%rbx,%r14), %rax
movq %rax, 0xa8(%rsp)
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq %rax, 0x68(%rsp)
pushq $-0x1
popq %rax
movq $-0x80000000, 0x88(%rsp) # imm = 0x80000000
movq $-0x80000000, %rbp      # imm = 0x80000000
movq %rax, 0x70(%rsp)
xorl %ebx, %ebx
xorl %r8d, %r8d
movq %r15, 0x18(%rsp)
movq %r12, 0x38(%rsp)
movq %r13, 0x40(%rsp)
cmpq %r15, %r8
movq %rsi, 0x90(%rsp)
je 0x15479
movq %rbp, 0xe8(%rsp)
movq %r8, %rax
shlq $0x4, %rax
movq 0x50(%rsp), %rsi
leaq (%rsi,%rax), %rdi
movzbl 0xc(%rsi,%rax), %r11d
movl (%rsi,%rax), %eax
movq %r8, %rcx
subq %rbx, %rcx
movq 0x138(%rsp), %rdx
cmpq %rcx, %rdx
cmovgq %rdx, %rcx
movq 0xd8(%rsp), %rdx
addq %rbx, %rdx
addq %rcx, %rdx
addq 0xd0(%rsp), %rbx
addq %rcx, %rbx
shlq $0x4, %rbx
addq %rsi, %rbx
movq %rbx, %rcx
movq %rdx, %rbx
incq %rbx
movl (%rcx), %edx
addq $0x10, %rcx
xorl %eax, %edx
js 0x15120
leaq -0x1(%r8), %rbp
movq %r8, 0x28(%rsp)
movslq %r8d, %rax
movq %rax, 0xf0(%rsp)
movq %r9, 0xe0(%rsp)
movq %r9, %r13
pushq $-0x1
popq %rax
movq %rax, 0x98(%rsp)
movq $0x0, 0x48(%rsp)
movq %rbp, %r12
cmpq %rbx, %r12
jl 0x15241
movq %r11, %r14
movq %rdi, %r15
movq %r13, %rsi
movsd 0x30(%rsp), %xmm0
movsd 0xa0(%rsp), %xmm1
movsd 0x20(%rsp), %xmm2
movq 0x150(%rsp), %rdx
movq 0x158(%rsp), %rcx
callq 0x17d1a
movl %eax, %ecx
negl %ecx
jno 0x151b0
movq %r14, %rax
movq %r15, %rdi
jmp 0x15232
movslq %eax, %rcx
movq 0x60(%rsp), %rax
movslq (%rax,%r12,4), %rax
addq %rcx, %rax
cmpq %r14, %rax
jle 0x151e6
xorl %ecx, %ecx
movq 0x48(%rsp), %rdx
testq %rdx, %rdx
setg %cl
subq %rcx, %rdx
movq %rdx, 0x48(%rsp)
movq %r12, 0x98(%rsp)
movq %r15, %rdi
jmp 0x15216
movq %r14, %r11
movq 0x40(%rsp), %rax
movq 0xf0(%rsp), %rcx
cmpq %rcx, (%rax,%r12,8)
movq %r15, %rdi
jne 0x15213
movq 0x48(%rsp), %rax
cmpq 0x130(%rsp), %rax
jge 0x15241
incq 0x48(%rsp)
movq %r11, %rax
movq 0x58(%rsp), %rcx
movq (%rcx,%r12,8), %rcx
testq %rcx, %rcx
js 0x15232
movq 0x40(%rsp), %rdx
movq 0x28(%rsp), %rsi
movq %rsi, (%rdx,%rcx,8)
decq %r12
addq $-0x10, %r13
movq %rax, %r11
jmp 0x15163
movq 0x70(%rsp), %r13
testq %r13, %r13
movq 0x50(%rsp), %r14
js 0x152eb
movl 0x8(%rdi), %ecx
movq %r13, %rax
shlq $0x4, %rax
movl 0x8(%r14,%rax), %edx
addq 0x140(%rsp), %rdx
cmpq %rcx, %rdx
jl 0x152eb
addq %r14, %rax
movl (%rax), %eax
xorl (%rdi), %eax
js 0x152eb
testq %r13, %r13
sets %al
cmpq %r12, %r13
setge %cl
orb %al, %cl
jne 0x15340
movq %r11, %rbp
movq %r13, %rsi
shlq $0x4, %rsi
addq %r14, %rsi
movq %rdi, %r15
movsd 0x30(%rsp), %xmm0
movsd 0xa0(%rsp), %xmm1
movsd 0x20(%rsp), %xmm2
movq 0x150(%rsp), %rdx
movq 0x158(%rsp), %rcx
callq 0x17d1a
movl %eax, %ecx
negl %ecx
movq 0x38(%rsp), %r12
movq 0x60(%rsp), %rsi
jno 0x15370
movq 0x98(%rsp), %rdx
movq %rbp, %r11
jmp 0x1538f
movl $0x80000000, %eax       # imm = 0x80000000
movq 0xa8(%rsp), %rcx
pushq $-0x1
popq %r13
cmpq %rbx, %rbp
jl 0x15279
movl 0x8(%rdi), %edx
movl (%rcx), %esi
addq 0x140(%rsp), %rsi
cmpq %rdx, %rsi
jl 0x15279
movl -0x8(%rcx), %edx
xorl (%rdi), %edx
js 0x15279
movq 0x60(%rsp), %rdx
movl (%rdx,%rbp,4), %edx
cmpl %edx, %eax
cmovlq %rbp, %r13
cmovlel %edx, %eax
decq %rbp
addq $-0x10, %rcx
jmp 0x152fc
movq 0x60(%rsp), %rsi
movq 0x28(%rsp), %rcx
movl %r11d, (%rsi,%rcx,4)
movq 0x58(%rsp), %rax
movq 0x98(%rsp), %rdx
movq %rdx, (%rax,%rcx,8)
movq %rcx, 0x70(%rsp)
testq %r13, %r13
movq 0x38(%rsp), %r12
jns 0x153a4
jmp 0x153d8
movslq (%rsi,%r13,4), %rcx
cltq
addq %rcx, %rax
movq %rbp, %r11
cmpq %rax, %rbp
movq 0x98(%rsp), %rdx
cmovlq %r13, %rdx
cmovleq %rax, %r11
movq 0x28(%rsp), %rcx
movl %r11d, (%rsi,%rcx,4)
movq 0x58(%rsp), %rax
movq %rdx, (%rax,%rcx,8)
movq %r15, %rdi
movl 0x8(%rdi), %ecx
movq %r13, %rax
shlq $0x4, %rax
movl 0x8(%r14,%rax), %edx
addq 0x140(%rsp), %rdx
cmpq %rcx, %rdx
jl 0x153d3
addq %r14, %rax
movl (%rax), %eax
xorl (%rdi), %eax
js 0x153d3
cmpl %r11d, (%rsi,%r13,4)
cmovlq 0x28(%rsp), %r13
movq %r13, 0x70(%rsp)
movslq %r11d, %r14
movq 0xe8(%rsp), %rbp
cmpq %r14, %rbp
jle 0x153f7
movq 0x40(%rsp), %r13
movq 0x90(%rsp), %rsi
jmp 0x15446
movl 0x4(%rdi), %ecx
movl 0x8(%rdi), %edi
movq %rdi, %rsi
movq 0x150(%rsp), %rdx
movq %rcx, %r8
movq 0x158(%rsp), %r9
callq 0x12ff0
cmpq %r14, %rbp
movq 0x40(%rsp), %r13
movq 0x90(%rsp), %rsi
jl 0x15431
cmpq 0x68(%rsp), %rax
jge 0x15446
movq 0x28(%rsp), %rcx
movq %rcx, 0x88(%rsp)
movq %r14, %rbp
movq %rax, 0x68(%rsp)
cmpq %r14, %rsi
cmovgeq %r14, %rsi
movq 0x28(%rsp), %r8
andl $0x0, (%r12,%r8,4)
incq %r8
movq 0xe0(%rsp), %r9
addq $0x10, %r9
addq $0x10, 0xa8(%rsp)
movq 0x18(%rsp), %r15
jmp 0x150b3
xorl %r14d, %r14d
movq 0x88(%rsp), %rax
movq 0x10(%rsp), %rdx
movq 0x78(%rsp), %rbx
movsd 0xc8(%rsp), %xmm1
movq 0x58(%rsp), %rcx
testq %rax, %rax
js 0x154b7
movl $0x1, (%r12,%rax,4)
movq %rax, (%r13,%r14,8)
incq %r14
movq (%rcx,%rax,8), %rax
jmp 0x1549c
movq 0x80(%rsp), %r9
shlq $0x4, %r9
addq %r9, %rbx
movq 0x68(%rsp), %rax
cmpq 0x150(%rsp), %rax
setge %al
cmpq $0x0, 0x178(%rsp)
sete %cl
orb %al, %cl
cmpq 0x180(%rsp), %r14
setl %al
orb %cl, %al
je 0x15661
movq (%rdx), %r13
movq 0x10(%rdx), %rax
cmpq 0x8(%rdx), %rax
jne 0x15572
imulq $0x150, %rax, %rcx      # imm = 0x150
testq %rax, %rax
movl $0x150, %esi            # imm = 0x150
cmovneq %rcx, %rsi
movq %r13, %rdi
callq 0x2370
movq %rax, %r13
movq 0x10(%rsp), %rax
movq %r13, (%rax)
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rax
imulq $0xa8, %rax, %rdi
addq %r13, %rdi
movq %rbx, %r15
leaq (%rax,%rax), %rbx
testq %rax, %rax
pushq $0x2
popq %rcx
cmoveq %rcx, %rbx
movq %rbx, %rcx
subq %rax, %rcx
imulq $0xa8, %rcx, %rdx
xorl %esi, %esi
callq 0x20e0
movq 0x10(%rsp), %rdx
movq %rbx, 0x8(%rdx)
movq %r15, %rbx
movq 0x10(%rdx), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x10(%rdx)
imulq $0xa8, %rax, %r15
addq %r13, %r15
movq 0x40(%rsp), %r12
movq -0x8(%r12,%r14,8), %r9
shlq $0x4, %r9
movq 0x50(%rsp), %rcx
addq %rcx, %r9
movq (%r12), %rax
shlq $0x4, %rax
addq %rcx, %rax
movq %rax, (%rsp)
movq %r15, %rdi
movl 0x148(%rsp), %esi
movq 0x150(%rsp), %rdx
movq 0x158(%rsp), %rcx
movq %rbp, %r8
callq 0x14b9c
movq 0x10(%rsp), %r8
movl $0x80000000, %eax       # imm = 0x80000000
movq %rbx, %rcx
movq %r14, %rdx
subq $0x1, %rdx
jb 0x15611
movq (%r12,%rdx,8), %rsi
shlq $0x4, %rsi
movq 0x50(%rsp), %rdi
movupd (%rdi,%rsi), %xmm0
movupd %xmm0, (%rcx)
movl 0x10(%r8), %esi
decl %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
movl (%rcx), %edi
andl %eax, %edi
orl %esi, %edi
movl %edi, (%rcx)
addq $0x10, %rcx
jmp 0x155db
movq 0x80(%rsp), %rax
movl %eax, 0x30(%r15)
cmpq $0x0, 0x170(%rsp)
je 0x15641
leaq 0x38(%r15), %rdi
movl 0x168(%rsp), %edx
movq %r15, %rsi
movq %rbx, %rcx
movq %r14, %r8
callq 0x11a23
cmpq $0x0, 0x188(%rsp)
je 0x15bdd
movl %r14d, 0x28(%r15)
jmp 0x15bdd
xorl %r14d, %r14d
jmp 0x15bdd
movq %rbp, %r8
subq %rsi, %rbp
cvtsi2sd %rbp, %xmm0
mulsd %xmm1, %xmm0
movq 0x88(%rsp), %rax
andl $0x0, (%r12,%rax,4)
cvttsd2si %xmm0, %r15
xorl %ebp, %ebp
xorl %eax, %eax
movq 0x18(%rsp), %r14
movq 0x60(%rsp), %rdi
cmpq %r14, %rax
je 0x156cc
movl (%rdi,%rax,4), %ecx
subl %esi, %ecx
movl %ecx, (%rdi,%rax,4)
cmpq %rbp, %rax
jl 0x156a8
andq $0x0, (%r13,%rax,8)
cmpl $0x0, (%r12,%rax,4)
jne 0x156c7
movslq %ecx, %rcx
cmpq %r15, %rcx
jl 0x156c7
shlq $0x20, %rcx
leaq (%rcx,%rax,2), %rcx
movq %rcx, (%r13,%rbp,8)
incq %rbp
incq %rax
jmp 0x15690
cmpq $0x1, %rbp
jle 0x158d9
movq %r9, 0x28(%rsp)
movq %rbx, 0x78(%rsp)
movq 0x10(%rdx), %rbx
leaq (,%rbp,8), %rsi
addq %r13, %rsi
movq %r13, %rdi
callq 0x110ce
movq %rbx, %rdi
shlq $0x2, 0x68(%rsp)
xorl %eax, %eax
movq $0x0, 0x48(%rsp)
movq %rbx, 0x20(%rsp)
movq %r15, 0xa0(%rsp)
movq %rax, 0x30(%rsp)
leaq (%r12,%rax,4), %rbx
movq 0x10(%rsp), %rdx
testq %rbp, %rbp
jle 0x15903
movq %rbp, %rax
decq %rbp
movq 0x40(%rsp), %rsi
movl -0x8(%rsi,%rax,8), %r14d
shrl %r14d
xorl %r12d, %r12d
testq %r14, %r14
js 0x1576d
movq (%rsi,%r14,8), %rcx
testb $0x1, %cl
jne 0x1576d
movl %r14d, (%rbx,%r12,4)
orq $0x1, %rcx
movq %rcx, (%rsi,%r14,8)
movq 0x58(%rsp), %rcx
movq (%rcx,%r14,8), %r14
incq %r12
jmp 0x15745
testq %r12, %r12
je 0x15726
movq 0x40(%rsp), %rcx
movslq -0x4(%rcx,%rax,8), %r13
testq %r14, %r14
js 0x1578d
movq 0x60(%rsp), %rax
movslq (%rax,%r14,4), %rax
subq %rax, %r13
cmpq %r15, %r13
jl 0x15726
movq %r14, 0x18(%rsp)
movq (%rdx), %rdi
movq 0x10(%rdx), %rax
cmpq 0x8(%rdx), %rax
jne 0x15814
imulq $0x150, %rax, %rsi      # imm = 0x150
testq %rax, %rax
movl $0x150, %eax            # imm = 0x150
cmoveq %rax, %rsi
callq 0x2370
movq %rax, %r15
movq 0x10(%rsp), %rax
movq %r15, (%rax)
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rax
imulq $0xa8, %rax, %rdi
addq %r15, %rdi
leaq (%rax,%rax), %r14
testq %rax, %rax
pushq $0x2
popq %rcx
cmoveq %rcx, %r14
movq %r14, %rcx
subq %rax, %rcx
imulq $0xa8, %rcx, %rdx
xorl %esi, %esi
callq 0x20e0
movq %r15, %rdi
movq 0xa0(%rsp), %r15
movq 0x10(%rsp), %rdx
movq %r14, 0x8(%rdx)
movq 0x10(%rdx), %rax
movq 0x90(%rsp), %rsi
leaq 0x1(%rax), %rcx
movq %rcx, 0x10(%rdx)
imulq $0xa8, %rax, %r14
addq %rdi, %r14
addq %rsi, %r13
movslq -0x4(%rbx,%r12,4), %r9
shlq $0x4, %r9
movq 0x50(%rsp), %rcx
addq %rcx, %r9
movq 0x38(%rsp), %rax
movq 0x30(%rsp), %rdx
movslq (%rax,%rdx,4), %rax
shlq $0x4, %rax
addq %rcx, %rax
movq %rax, (%rsp)
movq %r14, %rdi
movl 0x148(%rsp), %esi
movq 0x150(%rsp), %rdx
movq 0x158(%rsp), %rcx
movq %r13, %r8
callq 0x14b9c
cmpq $0x2, 0x180(%rsp)
jl 0x158b1
movl 0x8(%r14), %eax
subl 0x4(%r14), %eax
incl %eax
cmpq %rax, 0x68(%rsp)
jge 0x158b1
movq 0x10(%rsp), %rdx
decq 0x10(%rdx)
movq 0x18(%rsp), %r14
movq 0x20(%rsp), %rdi
jmp 0x15726
movl %r12d, 0x28(%r14)
movq 0x30(%rsp), %rax
movl %eax, (%r14)
incq 0x48(%rsp)
addq %r12, %rax
movq 0x18(%rsp), %r14
movq 0x38(%rsp), %r12
movq 0x20(%rsp), %rdi
jmp 0x15718
xorl %r14d, %r14d
movq %r8, %rbp
movq 0x88(%rsp), %rcx
movq 0x58(%rsp), %rax
testq %rcx, %rcx
js 0x154f7
movq %rcx, (%r13,%r14,8)
incq %r14
movq (%rax,%rcx,8), %rcx
jmp 0x158ec
movq %r14, 0x18(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0xb0(%rsp)
movq 0x48(%rsp), %rbx
cmpq $0x2, %rbx
jb 0x1593c
imulq $0xa8, %rdi, %rsi
addq (%rdx), %rsi
movq %rbx, %rdi
callq 0x11534
movq 0x20(%rsp), %rdi
movq 0x10(%rsp), %rdx
imulq $0xa8, %rdi, %r12
movq (%rdx), %rdi
addq %r12, %rdi
leaq 0xb0(%rsp), %rdx
movq %rbx, %rsi
callq 0x14e21
movq 0x20(%rsp), %r10
movq 0x10(%rsp), %r9
leaq (%rax,%r10), %rcx
movq %rcx, 0x30(%rsp)
movq %rcx, 0x10(%r9)
cmpq $0x2, %rax
movq 0xc0(%rsp), %r15
jl 0x15afe
movq 0xb8(%rsp), %rdx
movq (%rdx), %rdi
movq 0x8(%rdx), %r14
movq 0xb0(%rsp), %rax
addq %r14, %rax
cmpq %rax, 0x10(%rdx)
jge 0x159fd
decq %rax
movq %rax, %rcx
sarq %rcx
orq %rax, %rcx
movq %rcx, %rax
sarq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
sarq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
sarq $0x8, %rax
orq %rcx, %rax
movq %rax, %rsi
sarq $0x10, %rsi
orq %rax, %rsi
incq %rsi
movq %rsi, 0x10(%rdx)
shlq $0x4, %rsi
movq %rdx, %rbx
callq 0x2370
movq 0x20(%rsp), %r10
movq 0x10(%rsp), %r9
movq %rax, %rdi
movq %rax, (%rbx)
movq 0x8(%rbx), %r14
addq %rdi, %r15
shlq $0x4, %r14
movq %rdi, 0x20(%rsp)
addq %rdi, %r14
addq $-0x4, 0x38(%rsp)
movq $0x0, 0x18(%rsp)
movl $0x80000000, %ebp       # imm = 0x80000000
cmpq 0x30(%rsp), %r10
jge 0x15b78
movq (%r9), %rax
imulq $0xa8, %r10, %rcx
leaq (%rax,%rcx), %r13
movq 0x80(%rsp), %rdx
movq 0x18(%rsp), %rdi
addl %edi, %edx
movl %edx, 0x30(%rax,%rcx)
movl (%rax,%rcx), %esi
movl 0x28(%rax,%rcx), %r8d
movl %r10d, %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq %rdi, %rcx
shlq $0x4, %rcx
addq %r14, %rcx
movq %r8, %rdx
negq %rdx
shlq $0x2, %rsi
leaq (%rsi,%r8,4), %rsi
addq 0x38(%rsp), %rsi
xorl %ebx, %ebx
cmpq %rbx, %rdx
je 0x15aa3
movslq (%rsi,%rbx,4), %rdi
shlq $0x4, %rdi
movupd (%r15,%rdi), %xmm0
movupd %xmm0, (%rcx)
movl (%rcx), %edi
andl %ebp, %edi
orl %eax, %edi
movl %edi, (%rcx)
decq %rbx
addq $0x10, %rcx
jmp 0x15a7b
movl 0x148(%rsp), %eax
movl %eax, (%r13)
cmpq $0x0, 0x170(%rsp)
je 0x15ae1
leaq 0x38(%r13), %rdi
movq %r8, %rax
shlq $0x4, %rax
subq %rax, %rcx
movq %r13, %rsi
movl 0x168(%rsp), %edx
movq %r10, %r12
callq 0x11a23
movq %r12, %r10
movq 0x10(%rsp), %r9
cmpq $0x0, 0x188(%rsp)
jne 0x15af1
andl $0x0, 0x28(%r13)
subq %rbx, 0x18(%rsp)
incq %r10
jmp 0x15a20
cmpq $0x1, %rax
jne 0x15bd8
movq (%r9), %rax
leaq (%rax,%r12), %rbx
movq 0x80(%rsp), %rcx
movl %ecx, 0x30(%rax,%r12)
movl (%rax,%r12), %ecx
movl 0x28(%rax,%r12), %r14d
andl $0x7fffffff, %r10d      # imm = 0x7FFFFFFF
movq 0x38(%rsp), %rax
leaq (%rax,%rcx,4), %rax
addq $-0x4, %rax
movl $0x80000000, %ecx       # imm = 0x80000000
movq 0x78(%rsp), %rdx
movq %r14, %rdi
movq %r14, %rsi
movq 0x50(%rsp), %r8
subq $0x1, %rsi
jb 0x15b95
movslq (%rax,%rdi,4), %rdi
shlq $0x4, %rdi
movupd (%r8,%rdi), %xmm0
movupd %xmm0, (%rdx)
movl (%rdx), %edi
andl %ecx, %edi
orl %r10d, %edi
movl %edi, (%rdx)
addq $0x10, %rdx
movq %rsi, %rdi
jmp 0x15b4e
movq 0x20(%rsp), %rdi
addq 0x28(%rsp), %rdi
movq 0x18(%rsp), %rdx
shlq $0x4, %rdx
movq %r14, %rsi
callq 0x2160
jmp 0x15bd8
movl 0x148(%rsp), %eax
movl %eax, (%rbx)
cmpq $0x0, 0x170(%rsp)
je 0x15bc4
leaq 0x38(%rbx), %rdi
movl 0x168(%rsp), %edx
movq %rbx, %rsi
movq 0x78(%rsp), %rcx
movq %r14, %r8
callq 0x11a23
movq %r14, 0x18(%rsp)
cmpq $0x0, 0x188(%rsp)
jne 0x15bd8
andl $0x0, 0x28(%rbx)
movq 0x18(%rsp), %r14
movq %r14, %rax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq