// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/ecovlp.cpp
// Function: h_ec_lchain_re2(ha_abuf_s*, unsigned int, UC_Read*, UC_Read*, unsigned long, unsigned long, All_reads*, overlap_region_alloc*, Candidates_list*, bit_extz_t*, asg16_v*, asg64_v*, double, int, kvec_t_u8_warp*, kvec_t_u64_warp*, st_mt_t*, unsigned int*, unsigned int*, unsigned int, unsigned int, long, double, unsigned int, ma_hit_t_alloc*, ma_hit_t_alloc*)
overlap_region* h_ec_lchain_re2(ha_abuf_t *ab, uint32_t rid, UC_Read *qu, UC_Read *tu, uint64_t mz_w, uint64_t mz_k, All_reads *rref, overlap_region_alloc *ol, Candidates_list *cl, bit_extz_t *exz, asg16_v *buf, asg64_v *srt_i, double bw_thres, 
								 int apend_be, kvec_t_u8_warp* k_flag, kvec_t_u64_warp* dbg_ct, st_mt_t *sp, uint32_t *high_occ, uint32_t *low_occ, uint32_t is_accurate, uint32_t gen_off, int64_t enable_mcopy, double mcopy_rate, uint32_t mcopy_khit_cut, ma_hit_t_alloc *in0, ma_hit_t_alloc *in1)
{
    // fprintf(stderr, "-0-[M::%s]\tnew_n::%lu\told_n::%u\n", __func__, ol->length, in0->length + in1->length);
    // fprintf(stderr, "-mm-[M::%s]\tchain_cutoff::%u\n", __func__, chain_cutoff);
    uint64_t on = 0, k, l, i, one = 0, ol0, wl = (asm_opt.is_ont)?(WINDOW_OHC):(WINDOW_HC), m, m0, tid, trev, max_cnt = UINT32_MAX, min_cnt = 0; ma_hit_t *oa = NULL, *p = NULL; overlap_region *aux_o = NULL, *z = NULL, t; Window_Pool w; double err = asm_opt.max_ov_diff_ec; tiny_queue_t tq; memset(&tq, 0, sizeof(tiny_queue_t));
    char* rs = qu->seq; uint64_t rl = qu->length; int64_t n, zn, om;
    int64_t max_skip, max_iter, max_dis, quick_check; double chn_pen_gap, chn_pen_skip; 
	set_lchain_dp_op(is_accurate, mz_k, &max_skip, &max_iter, &max_dis, &chn_pen_gap, &chn_pen_skip, &quick_check);
    init_Window_Pool(&w, rl, wl, (int)(1.0/err));
    
    ///cutoff
    if(high_occ) {
        max_cnt = (*high_occ);
        if(max_cnt < 2) max_cnt = 2;
    }
    if(low_occ) {
        min_cnt = (*low_occ);
        if(min_cnt < 2) min_cnt = 2;
    }
    
    ///memory
    ol->length = 0; on = in0->length + in1->length + 1;
    if(on > ol->size) {
        REALLOC(ol->list, on);
        memset(ol->list+ol->size, 0, sizeof(overlap_region)*(on-ol->size));
        ol->size = on;   
    }
    aux_o = &(ol->list[on-1]); ol->mapped_overlaps_length = 0; on = in0->length + in1->length;
    
    ///overlap idx
    srt_i->n = 0;
    oa = in0->buffer; on = in0->length; m0 = 0;
    for (k = 0; k < on; k++) {
        if(oa[k].el) {
            one++; continue;
        }
        m = oa[k].tn; m <<= 1; m |= ((uint64_t)oa[k].rev); m <<= 32; m |= (k<<1); m |= m0;
        kv_push(uint64_t, *srt_i, m);
    }
    oa = in1->buffer; on = in1->length; m0 = 1;
    for (k = 0; k < on; k++) {
        // if(oa[k].el) continue;
        m = oa[k].tn; m <<= 1; m |= ((uint64_t)oa[k].rev); m <<= 32; m |= (k<<1); m |= m0;
        kv_push(uint64_t, *srt_i, m);
    }
    radix_sort_ec64(srt_i->a, srt_i->a + srt_i->n);

    // get the list of anchors
    get_mz1(rs, rl, mz_w, mz_k, 0, !(asm_opt.flag & HA_F_NO_HPC), ab, ha_flt_tab, NULL/**ha_idx**/, asm_opt.mz_sample_dist, k_flag, dbg_ct, NULL, -1, asm_opt.dp_min_len, -1, sp, asm_opt.mz_rewin, 0, NULL, 0);

    h_ec_lchain_re_gen_srt(ab, ha_idx, ol, cl);

    k = 1; l = 0; i = 0; n = zn = 0;
    while(h_ec_lchain_re_gen_qry(ab, &k, &l, &i, srt_i->a, srt_i->n, &tid, &trev)) {
        
        if(trev) recover_UC_Read_RC(tu, rref, tid);
        else recover_UC_Read(tu, rref, tid);

        ol0 = ol->length; om = 0;
        if(h_ec_lchain_re_chn(ab, l, k, rid, rs, rl, tid, tu->seq, tu->length, trev, mz_w, mz_k, ol, cl, bw_thres, apend_be, max_cnt, min_cnt, gen_off, enable_mcopy, mcopy_rate, mcopy_khit_cut, max_skip, max_iter, max_dis, quick_check, chn_pen_gap, chn_pen_skip, &tq, scb.a, &n, &zn)) {
            assert(ol->length - ol0 == 1);
            ol->list[ol0].y_pos_strand = 0;
            if(gen_hc_r_alin_re(&(ol->list[ol0]), cl, rs, rl, tu->seq, tu->length, exz, aux_o, asm_opt.max_ov_diff_ec, w.window_length, rid, E_KHIT, 1, buf)) {
                ol->list[ol0].y_pos_strand = trev; om = 1;
            } else {///unmatch
                clear_fake_cigar(&(ol->list[ol0].f_cigar));
                clear_window_list_alloc(&(ol->list[ol0].w_list));
                clear_window_list_alloc(&(ol->list[ol0].boundary_cigars));
                ol->length--;
            }
        }

        if(om) {
            srt_i->a[i] >>= 32; srt_i->a[i] <<= 32; srt_i->a[i] |= ((uint64_t)((uint32_t)-1));
        }

        l = k; k++; 
    }

    for (k = m = 0; k < srt_i->n; k++) {
        if(((uint32_t)srt_i->a[k]) == ((uint32_t)-1)) continue;
        srt_i->a[m++] = srt_i->a[k];
    }
    // fprintf(stderr, "[M::%s]\ttot::%lu\tremain::%lu\n", __func__, (uint64_t)srt_i->n, m);
    srt_i->n = m;
    


    oa = in0->buffer; on = in0->length;
    for (k = 0; k < on; k++) {
        if(oa[k].el) {
            z = &(ol->list[ol->length++]);
            z->x_id = rid; z->y_id = oa[k].tn;
            z->x_pos_strand = 0; z->y_pos_strand = oa[k].rev;
            z->x_pos_s = (uint32_t)oa[k].qns;
            z->x_pos_e = oa[k].qe - 1;
            z->y_pos_s = oa[k].ts;
            z->y_pos_e = oa[k].te - 1;

            z->is_match = 1;
            z->align_length = z->overlapLen = z->shared_seed = z->x_pos_e + 1 - z->x_pos_s;
            z->non_homopolymer_errors = z->strong = 0;

            set_exact_exz(exz, z->x_pos_s, z->x_pos_e + 1, z->y_pos_s, z->y_pos_e + 1); push_alnw(z, exz);

            // if(oa[k].tn == 1945) fprintf(stderr, "-em-[M::%s]\tqn::%u\ttn::%u\terr::%u\n", __func__, rid, oa[k].tn, ol->list[ol->length-1].non_homopolymer_errors);
        }
    }
    m = ol->length;


    clear_Candidates_list(cl);
    for (k = 0; k < srt_i->n; k++) {
        ol0 = ol->length;
        if(srt_i->a[k]&1) {
            p = &(in1->buffer[((uint32_t)srt_i->a[k])>>1]);
        } else {
            p = &(in0->buffer[((uint32_t)srt_i->a[k])>>1]);
        }
        
        if(p->rev) recover_UC_Read_RC(tu, rref, p->tn);
        else recover_UC_Read(tu, rref, p->tn);

        get_pi_ec_chain(ab, rid, rl, p->tn, tu->seq, tu->length, mz_w, mz_k, ol, cl, bw_thres, apend_be, k_flag, dbg_ct, sp, high_occ, low_occ, gen_off, enable_mcopy, mcopy_rate, mcopy_khit_cut, max_skip, max_iter, max_dis, quick_check, chn_pen_gap, chn_pen_skip);
        assert(ol->length - ol0 <= 1);
        if((ol->length > ol0) && (gen_hc_r_alin_re(&(ol->list[ol0]), cl, rs, rl, tu->seq, tu->length, exz, aux_o, asm_opt.max_ov_diff_ec, w.window_length, rid, E_KHIT, 1, buf))) {
            ol->list[ol0].y_pos_strand = p->rev;
            // if(oa[k].tn == 15382) fprintf(stderr, "-mm-[M::%s]\tqn::%u\ttn::%u\terr::%u\n", __func__, rid, oa[k].tn, ol->list[ol->length-1].non_homopolymer_errors);
        } 

        if((ol->length <= ol0) || (ol->list[ol0].is_match != 1)) continue;

        if(m != ol0) {
            t = ol->list[m];
            ol->list[m] = ol->list[ol0];
            ol->list[ol0] = t;
        }

        m++;
    }
    
    ol->length = m;
    
    // fprintf(stderr, "[M::%s]\tnew_n::%lu\told_n::%lu\n", __func__, ol->length, m0);
    // fprintf(stderr, "-1-[M::%s]\tnew_n::%lu\told_n::%u\n", __func__, ol->length, in0->length + in1->length);
    assert(ol->length <= (in0->length + in1->length));


    // dbg_overlap_region_cigar(ol->list, ol->length, rs, rref, tu);

    return aux_o;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x298, %rsp            # imm = 0x298
movsd %xmm1, 0xa0(%rsp)
movsd %xmm0, 0x98(%rsp)
movq %r9, %r15
movq %r8, %r12
movq %rcx, 0x20(%rsp)
movq %rdx, %rbx
movl %esi, 0x10(%rsp)
movq %rdi, 0x40(%rsp)
movq 0x328(%rsp), %r13
movq 0x320(%rsp), %rbp
movl 0x330(%rsp), %r14d
leaq 0x105319(%rip), %rax    # 0x28a758
cmpq $0x0, 0x2a8(%rax)
movl $0x307, %eax            # imm = 0x307
movl $0x177, %ecx            # imm = 0x177
cmoveq %rax, %rcx
movq %rcx, 0x90(%rsp)
leaq 0xe8(%rsp), %rdi
movl $0x108, %edx            # imm = 0x108
xorl %esi, %esi
callq 0x20e0
movq (%rbx), %rax
movq %rax, 0x38(%rsp)
movq 0x8(%rbx), %rax
movq %rax, 0x30(%rsp)
leaq 0xb8(%rsp), %rax
leaq 0xa8(%rsp), %r10
leaq 0xd0(%rsp), %rdx
leaq 0xc8(%rsp), %rcx
leaq 0xc0(%rsp), %r8
leaq 0xb0(%rsp), %r9
movl %r14d, %edi
movl %r15d, %esi
pushq %rax
pushq %r10
callq 0x129a8a
addq $0x10, %rsp
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, 0x88(%rsp)
testq %rbp, %rbp
je 0x1854ec
movl (%rbp), %eax
cmpl $0x3, %eax
movl $0x2, %ecx
cmovael %eax, %ecx
movq %rcx, 0x88(%rsp)
movq 0x2d8(%rsp), %rbx
testq %r13, %r13
je 0x185512
movl (%r13), %eax
cmpl $0x3, %eax
movl $0x2, %ecx
cmovael %eax, %ecx
movq %rcx, 0x80(%rsp)
jmp 0x18551e
movq $0x0, 0x80(%rsp)
movq %r12, 0x60(%rsp)
movq %r15, 0x68(%rsp)
movq 0x2f8(%rsp), %r13
movq $0x0, 0x10(%rbx)
movq 0x350(%rsp), %rax
movl 0xc(%rax), %eax
movq 0x358(%rsp), %rcx
movl 0xc(%rcx), %ecx
leal (%rax,%rcx), %r14d
incl %r14d
cmpq %r14, 0x8(%rbx)
jae 0x185593
movq (%rbx), %rdi
imulq $0xa8, %r14, %rsi
callq 0x2370
movq %rax, (%rbx)
movq 0x8(%rbx), %rcx
imulq $0xa8, %rcx, %rdi
addq %rax, %rdi
movq %r14, %rax
subq %rcx, %rax
imulq $0xa8, %rax, %rdx
xorl %esi, %esi
callq 0x20e0
movq %r14, 0x8(%rbx)
movq %r14, 0x58(%rsp)
movq (%rbx), %rax
movq %rax, 0x28(%rsp)
xorl %eax, %eax
movq %rax, 0x18(%rbx)
movq %rax, (%r13)
movq 0x350(%rsp), %rcx
movq (%rcx), %rbp
movl 0xc(%rcx), %ebx
movq %rax, 0x8(%rsp)
testq %rbx, %rbx
je 0x185666
xorl %r12d, %r12d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
leaq 0x1(%rax), %rsi
movq %rsi, 0x18(%rsp)
leaq (%r12,%r12,4), %rax
cmpb $0x0, 0x20(%rbp,%rax,8)
jne 0x185650
leaq (,%rax,8), %rax
addq %rbp, %rax
movl 0xc(%rax), %r15d
movq 0x18(%rax), %r14
movq 0x8(%r13), %rax
cmpq %rax, (%r13)
jne 0x185629
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%r13)
movq 0x10(%r13), %rdi
shlq $0x3, %rsi
callq 0x2370
movq 0x18(%rsp), %rsi
movq %rax, 0x10(%r13)
shlq $0x21, %r15
addq %r14, %r14
andq %rsi, %r14
orq %r15, %r14
addq %r12, %r12
orq %r14, %r12
movq (%r13), %rax
movq 0x10(%r13), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%r13)
movq %r12, (%rcx,%rax,8)
movq 0x8(%rsp), %r12
incq %r12
movq %r12, 0x8(%rsp)
cmpq %rbx, %r12
jb 0x1855d7
imulq $0xa8, 0x58(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x358(%rsp), %rax
movq (%rax), %r14
movl 0xc(%rax), %esi
movq $0x0, 0x8(%rsp)
testq %rsi, %rsi
je 0x185723
xorl %r12d, %r12d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
leaq 0x1(%rax), %rbx
movq %rsi, 0x18(%rsp)
leaq (%r12,%r12,4), %rax
movl 0xc(%r14,%rax,8), %ebp
movq 0x18(%r14,%rax,8), %r15
movq 0x8(%r13), %rax
cmpq %rax, (%r13)
jne 0x1856e7
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%r13)
movq 0x10(%r13), %rdi
shlq $0x3, %rsi
callq 0x2370
movq 0x18(%rsp), %rsi
movq %rax, 0x10(%r13)
shlq $0x21, %rbp
addq %r15, %r15
andq %rbx, %r15
orq %rbp, %r15
addq %r12, %r12
orq %r15, %r12
incq %r12
movq (%r13), %rax
movq 0x10(%r13), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%r13)
movq %r12, (%rcx,%rax,8)
movq 0x8(%rsp), %r12
incq %r12
movq %r12, 0x8(%rsp)
cmpq %rsi, %r12
jb 0x1856a5
movq 0x28(%rsp), %rax
movq 0x58(%rsp), %rcx
addq %rcx, %rax
addq $-0xa8, %rax
movq %rax, 0x28(%rsp)
movq (%r13), %rax
movq 0x10(%r13), %rdi
leaq (%rdi,%rax,8), %rsi
callq 0x178fc2
leaq 0x105005(%rip), %rsi    # 0x28a758
movl (%rsi), %r9d
movl 0xa0(%rsi), %eax
notl %r9d
andl $0x1, %r9d
leaq 0x105cc6(%rip), %rcx    # 0x28b430
movq (%rcx), %rcx
movl 0xa8(%rsi), %edx
movl 0x1f8(%rsi), %esi
subq $0x70, %rsp
xorps %xmm0, %xmm0
movups %xmm0, 0x60(%rsp)
movl %eax, 0x50(%rsp)
movq 0x388(%rsp), %rax
movq %rax, 0x48(%rsp)
movl %esi, 0x40(%rsp)
xorl %ebx, %ebx
movq %rbx, 0x30(%rsp)
movq 0x380(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x378(%rsp), %rax
movq %rax, 0x20(%rsp)
movl %edx, 0x18(%rsp)
movq %rbx, 0x10(%rsp)
movq %rcx, 0x8(%rsp)
movq 0xb0(%rsp), %r14
movq %r14, (%rsp)
movl $0x0, 0x58(%rsp)
movl $0xffffffff, 0x38(%rsp) # imm = 0xFFFFFFFF
movss 0xa91b3(%rip), %xmm0    # 0x22e9a0
movq 0xa8(%rsp), %rdi
movq 0xa0(%rsp), %rsi
movq 0xd0(%rsp), %rdx
movq 0xd8(%rsp), %rcx
xorl %r8d, %r8d
callq 0x12e247
addq $0x70, %rsp
leaq 0x105c18(%rip), %rax    # 0x28b438
movq (%rax), %rsi
movq %r14, %rdi
movq 0x2d8(%rsp), %r12
movq %r12, %rdx
movq 0x2e0(%rsp), %rcx
callq 0x12db5f
leaq 0x8(%rsp), %rsi
movq $0x1, (%rsi)
leaq 0x78(%rsp), %rdx
movq %rbx, (%rdx)
leaq 0x50(%rsp), %rcx
movq %rbx, (%rcx)
movq %rbx, 0xd8(%rsp)
movq %rbx, 0xe0(%rsp)
movq (%r13), %r9
movq 0x10(%r13), %r8
leaq 0x48(%rsp), %rax
leaq 0x70(%rsp), %r10
movq %r14, %rdi
movq %r12, %r14
pushq %rax
pushq %r10
callq 0x12dd51
addq $0x10, %rsp
movl 0x10(%rsp), %ecx
movq %rcx, 0x18(%rsp)
testq %rax, %rax
leaq 0xe8(%rsp), %r15
je 0x185ba6
leaq 0x50(%rsp), %rbx
cmpq $0x0, 0x48(%rsp)
movq 0x70(%rsp), %rdx
je 0x1858d1
movq 0x20(%rsp), %r14
movq %r14, %rdi
movq 0x2d0(%rsp), %rsi
callq 0x33dc3
jmp 0x1858e6
movq 0x20(%rsp), %r14
movq %r14, %rdi
movq 0x2d0(%rsp), %rsi
callq 0x33cf8
movq 0x2d8(%rsp), %rcx
movq 0x10(%rcx), %rbp
movq 0x78(%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0x70(%rsp), %rax
movups (%r14), %xmm0
movq %rcx, %r14
movq 0x48(%rsp), %rcx
movq 0xd0(%rsp), %rdi
movq 0xc8(%rsp), %r8
movq 0xc0(%rsp), %r9
movq 0xb8(%rsp), %r10
movsd 0xb0(%rsp), %xmm2
movsd 0xa8(%rsp), %xmm3
movq 0x105c22(%rip), %r11    # 0x28b568
subq $0xb0, %rsp
movq %r11, 0x98(%rsp)
movq %r10, 0x88(%rsp)
movq %r9, 0x80(%rsp)
movq %r8, 0x78(%rsp)
movq %rdi, 0x70(%rsp)
leaq 0x188(%rsp), %rdi
movq %rdi, 0xa8(%rsp)
leaq 0x190(%rsp), %rdi
movq %rdi, 0xa0(%rsp)
movq %r15, 0x90(%rsp)
movl 0x3f8(%rsp), %edi
movl %edi, 0x68(%rsp)
movq 0x3f0(%rsp), %rdi
movq %rdi, 0x60(%rsp)
movl 0x3e8(%rsp), %edi
movl %edi, 0x58(%rsp)
movq 0x130(%rsp), %rdi
movq %rdi, 0x50(%rsp)
movq 0x138(%rsp), %rdi
movq %rdi, 0x48(%rsp)
movl 0x3b0(%rsp), %edi
movl %edi, 0x40(%rsp)
movq 0x390(%rsp), %rdi
movq %rdi, 0x38(%rsp)
movq %r14, 0x30(%rsp)
movq 0x118(%rsp), %rdi
movq %rdi, 0x28(%rsp)
movq 0x110(%rsp), %rdi
movq %rdi, 0x20(%rsp)
movq %rcx, 0x18(%rsp)
movups %xmm0, 0x8(%rsp)
movq %rax, (%rsp)
movq 0xf0(%rsp), %rdi
movl 0xc0(%rsp), %ecx
movq 0xe8(%rsp), %r8
movq 0xe0(%rsp), %r9
movsd 0x148(%rsp), %xmm0
movsd 0x150(%rsp), %xmm1
callq 0x12de4f
addq $0xb0, %rsp
testq %rax, %rax
je 0x185b5c
movq 0x10(%r14), %rax
subq %rbp, %rax
cmpq $0x1, %rax
jne 0x185fb2
movq (%r14), %rdi
movq %r14, %r12
imulq $0xa8, %rbp, %r14
movl $0x0, 0x1c(%rdi,%r14)
addq %r14, %rdi
movq 0x20(%rsp), %rax
movq (%rax), %r8
movq 0x8(%rax), %r9
leaq 0x104cbc(%rip), %rax    # 0x28a758
movsd 0xc0(%rax), %xmm0
subq $0x8, %rsp
movq 0x2e8(%rsp), %rsi
movq 0x40(%rsp), %rdx
movq 0x38(%rsp), %rcx
pushq 0x2f8(%rsp)
pushq $0x1
pushq $0x1f
pushq 0x38(%rsp)
pushq 0xb8(%rsp)
pushq 0x58(%rsp)
pushq 0x320(%rsp)
callq 0x85133
addq $0x40, %rsp
testq %rax, %rax
je 0x185b21
movl 0x48(%rsp), %eax
movq (%r12), %rcx
movl %eax, 0x1c(%rcx,%r14)
movq 0x10(%r13), %rax
movq 0x50(%rsp), %rcx
movl 0x4(%rax,%rcx,8), %edx
movq %rdx, (%rax,%rcx,8)
movq 0x50(%rsp), %rcx
shlq $0x20, (%rax,%rcx,8)
movq 0x50(%rsp), %rcx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
orq %rdx, (%rax,%rcx,8)
jmp 0x185b59
movq (%r12), %rax
leaq (%rax,%r14), %rdi
addq $0x38, %rdi
callq 0x3db73
movq (%r12), %rax
leaq (%rax,%r14), %rdi
addq $0x48, %rdi
callq 0x3db7b
movq (%r12), %rax
leaq (%rax,%r14), %rdi
addq $0x78, %rdi
callq 0x3db7b
decq 0x10(%r12)
movq %r12, %r14
movq 0x8(%rsp), %rax
movq %rax, 0x78(%rsp)
incq %rax
movq %rax, 0x8(%rsp)
movq (%r13), %r9
movq 0x10(%r13), %r8
movq 0x40(%rsp), %rdi
leaq 0x8(%rsp), %rsi
leaq 0x78(%rsp), %rdx
movq %rbx, %rcx
leaq 0x48(%rsp), %rax
pushq %rax
leaq 0x78(%rsp), %rax
pushq %rax
callq 0x12dd51
addq $0x10, %rsp
testq %rax, %rax
jne 0x1858ad
movq $0x0, 0x8(%rsp)
cmpq $0x0, (%r13)
je 0x185be3
movq 0x10(%r13), %rcx
xorl %eax, %eax
xorl %edx, %edx
movq (%rcx,%rdx,8), %rdx
cmpl $-0x1, %edx
je 0x185bce
movq %rdx, (%rcx,%rax,8)
incq %rax
movq 0x8(%rsp), %rdx
incq %rdx
movq %rdx, 0x8(%rsp)
cmpq (%r13), %rdx
jb 0x185bbe
jmp 0x185be5
xorl %eax, %eax
movq %rax, (%r13)
movq 0x350(%rsp), %rax
movq (%rax), %r12
movl 0xc(%rax), %ebp
movq $0x0, 0x8(%rsp)
testq %rbp, %rbp
je 0x185cdd
xorl %eax, %eax
leaq (%rax,%rax,4), %r8
cmpb $0x0, 0x20(%r12,%r8,8)
je 0x185cc7
movq (%r14), %rax
movq 0x10(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x10(%r14)
imulq $0xa8, %rcx, %rdi
leaq (%rax,%rdi), %rbx
movl 0x10(%rsp), %ecx
movl %ecx, (%rax,%rdi)
movl 0xc(%r12,%r8,8), %ecx
movl %ecx, 0x10(%rax,%rdi)
xorl %r11d, %r11d
movl %r11d, 0xc(%rax,%rdi)
movl 0x18(%r12,%r8,8), %ecx
shrl $0x1f, %ecx
movl %ecx, 0x1c(%rax,%rdi)
movq (%r12,%r8,8), %r9
movl %r9d, %esi
movl %r9d, 0x4(%rax,%rdi)
movl 0x8(%r12,%r8,8), %edx
leal -0x1(%rdx), %ecx
movl %ecx, 0x8(%rax,%rdi)
movl 0x10(%r12,%r8,8), %ecx
movl %ecx, 0x14(%rax,%rdi)
movl 0x14(%r12,%r8,8), %r8d
leal -0x1(%r8), %r10d
movl %r10d, 0x18(%rax,%rdi)
movb $0x1, 0x2c(%rax,%rdi)
movl %edx, %r10d
subl %r9d, %r10d
movl %r10d, 0x24(%rax,%rdi)
movl %r10d, 0x20(%rax,%rdi)
movl %r10d, 0x28(%rax,%rdi)
movb $0x0, 0x2e(%rax,%rdi)
movl %r11d, 0x30(%rax,%rdi)
movq 0x2e8(%rsp), %r15
movq %r15, %rdi
callq 0x666da
movq %rbx, %rdi
movq %r15, %rsi
callq 0x65d35
movq 0x8(%rsp), %rax
incq %rax
movq %rax, 0x8(%rsp)
cmpq %rbp, %rax
jb 0x185c0b
movq 0x10(%r14), %rax
movq %rax, 0x10(%rsp)
movq 0x2e0(%rsp), %rdi
callq 0x3fd1c
movq $0x0, 0x8(%rsp)
cmpq $0x0, (%r13)
je 0x185f58
xorl %eax, %eax
movq 0x20(%rsp), %r12
movq 0x10(%r14), %rbp
movq 0x10(%r13), %rcx
movq (%rcx,%rax,8), %rax
movl %eax, %ecx
shrl %ecx
testb $0x1, %al
movq 0x358(%rsp), %rax
cmoveq 0x350(%rsp), %rax
movq (%rax), %rbx
leaq (%rcx,%rcx,4), %r14
testb $-0x80, 0x1b(%rbx,%r14,8)
movl 0xc(%rbx,%r14,8), %edx
movq %r12, %rdi
movq 0x2d0(%rsp), %rsi
jne 0x185d57
callq 0x33cf8
jmp 0x185d5c
callq 0x33dc3
leaq (%rbx,%r14,8), %rbx
movl 0xc(%rbx), %ecx
movq (%r12), %r8
movq 0x8(%r12), %r9
movsd 0xb0(%rsp), %xmm2
movsd 0xa8(%rsp), %xmm3
subq $0x8, %rsp
movq 0x48(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x38(%rsp), %rdx
movsd 0xa0(%rsp), %xmm0
movsd 0xa8(%rsp), %xmm1
pushq 0xc0(%rsp)
pushq 0xd0(%rsp)
pushq 0xe0(%rsp)
pushq 0xf0(%rsp)
movl 0x370(%rsp), %eax
pushq %rax
pushq 0x370(%rsp)
movl 0x370(%rsp), %eax
pushq %rax
pushq 0x368(%rsp)
pushq 0x368(%rsp)
pushq 0x368(%rsp)
pushq 0x368(%rsp)
pushq 0x368(%rsp)
movl 0x368(%rsp), %eax
pushq %rax
pushq 0x350(%rsp)
movq 0x350(%rsp), %r14
pushq %r14
pushq 0xe8(%rsp)
pushq 0xe8(%rsp)
callq 0x12e398
addq $0x90, %rsp
movq 0x10(%r14), %rax
movq %rax, %rcx
subq %rbp, %rcx
cmpq $0x2, %rcx
jae 0x185f93
cmpq %rbp, %rax
movq 0x2d8(%rsp), %r14
jbe 0x185ec5
imulq $0xa8, %rbp, %r15
movq (%r14), %rdi
addq %r15, %rdi
movq (%r12), %r8
movq 0x8(%r12), %r9
leaq 0x1048ee(%rip), %rax    # 0x28a758
movsd 0xc0(%rax), %xmm0
subq $0x8, %rsp
movq 0x2e8(%rsp), %rsi
movq 0x40(%rsp), %rdx
movq 0x38(%rsp), %rcx
pushq 0x2f8(%rsp)
pushq $0x1
pushq $0x1f
pushq 0x38(%rsp)
pushq 0xb8(%rsp)
pushq 0x58(%rsp)
pushq 0x320(%rsp)
callq 0x85133
addq $0x40, %rsp
testq %rax, %rax
je 0x185ec5
movl 0x18(%rbx), %eax
shrl $0x1f, %eax
movq (%r14), %rcx
movl %eax, 0x1c(%rcx,%r15)
cmpq %rbp, 0x10(%r14)
jbe 0x185f41
movq (%r14), %r12
imulq $0xa8, %rbp, %rbx
cmpb $0x1, 0x2c(%r12,%rbx)
jne 0x185f3c
movq 0x10(%rsp), %rax
cmpq %rbp, %rax
je 0x185f34
imulq $0xa8, %rax, %rbp
addq %r12, %rbp
movl $0xa8, %edx
leaq 0x1f0(%rsp), %r15
movq %r15, %rdi
movq %rbp, %rsi
callq 0x2160
addq %rbx, %r12
movl $0xa8, %edx
movq %rbp, %rdi
movq %r12, %rsi
callq 0x2160
addq (%r14), %rbx
movl $0xa8, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2160
movq 0x10(%rsp), %rax
incq %rax
movq %rax, 0x10(%rsp)
movq 0x20(%rsp), %r12
movq 0x8(%rsp), %rax
incq %rax
movq %rax, 0x8(%rsp)
cmpq (%r13), %rax
jb 0x185d0e
movq 0x10(%rsp), %rdx
movq %rdx, 0x10(%r14)
movq 0x358(%rsp), %rax
movl 0xc(%rax), %eax
movq 0x350(%rsp), %rcx
addl 0xc(%rcx), %eax
cmpq %rax, %rdx
ja 0x185fd1
movq 0x28(%rsp), %rax
addq $0x298, %rsp            # imm = 0x298
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xac7b5(%rip), %rdi     # 0x23274f
leaq 0xabe4a(%rip), %rsi     # 0x231deb
leaq 0xacc92(%rip), %rcx     # 0x232c3a
movl $0x12de, %edx           # imm = 0x12DE
callq 0x2110
leaq 0xacc6b(%rip), %rdi     # 0x232c24
leaq 0xabe2b(%rip), %rsi     # 0x231deb
leaq 0xacc73(%rip), %rcx     # 0x232c3a
movl $0x129e, %edx           # imm = 0x129E
callq 0x2110
leaq 0xac8ed(%rip), %rdi     # 0x2328c5
leaq 0xabe0c(%rip), %rsi     # 0x231deb
leaq 0xacc54(%rip), %rcx     # 0x232c3a
movl $0x12f3, %edx           # imm = 0x12F3
callq 0x2110