// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/ecovlp.cpp
// Function: h_ec_lchain_re1(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_re1(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, "-mm-[M::%s]\tchain_cutoff::%u\n", __func__, chain_cutoff);
    uint64_t on = 0, k, one = 0, ol0, wl = (asm_opt.is_ont)?(WINDOW_OHC):(WINDOW_HC), m, m0, tid, trev; 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;
    char* rs = qu->seq; uint64_t rl = qu->length; 
    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));

    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(ab, rid, rs, rl, mz_w, mz_k, ha_idx, rref, 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, tu, srt_i, scb.a);

    
    ///max size
    on = ol->length + one + srt_i->n + 1; m0 = on - 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 = ol->length;

    // fprintf(stderr, "-0-[M::%s]\n", __func__);

    gen_hc_r_alin(ol, cl, rref, qu, tu, exz, aux_o, asm_opt.max_ov_diff_ec, w.window_length, rid, E_KHIT, 1, buf, 0, -1, -1); rs = qu->seq; 

    // fprintf(stderr, "-1-[M::%s]\n", __func__);

    ///handle unmatched chain
    for (k = m = ol->length; k < on; k++) {
        clear_fake_cigar(&(ol->list[k].f_cigar));
        clear_window_list_alloc(&(ol->list[k].w_list));
        clear_window_list_alloc(&(ol->list[k].boundary_cigars));

        ol0 = ol->length;

        tid = ol->list[k].y_id; trev = ol->list[k].y_pos_strand;
        if(trev) recover_UC_Read_RC(tu, rref, tid);
        else recover_UC_Read(tu, rref, tid);

        get_pi_ec_chain(ab, rid, rl, tid, 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 = trev;
            // 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;

    for (k = ol->length; k < on; k++) {
        clear_fake_cigar(&(ol->list[k].f_cigar));
        clear_window_list_alloc(&(ol->list[k].w_list));
        clear_window_list_alloc(&(ol->list[k].boundary_cigars));
    }

    // fprintf(stderr, "[M::%s]\tnew::%lu\told::%lu\n", __func__, ol->length, ol0);
    
    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;

    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, "[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 $0x148, %rsp            # imm = 0x148
movsd %xmm1, 0x60(%rsp)
movsd %xmm0, 0x58(%rsp)
movq %r9, %r11
movq %r8, 0x48(%rsp)
movq %rcx, 0x8(%rsp)
movl %esi, (%rsp)
movq %rdi, 0x40(%rsp)
movq 0x200(%rsp), %rbx
movq 0x1a8(%rsp), %r14
movl 0x1e0(%rsp), %edi
leaq 0x109a0c(%rip), %rax    # 0x295758
cmpq $0x0, 0x2a8(%rax)
movl $0x307, %eax            # imm = 0x307
movl $0x177, %ecx            # imm = 0x177
cmoveq %rax, %rcx
movq %rcx, 0x38(%rsp)
movq (%rdx), %rax
movq %rax, 0x10(%rsp)
movq %rdx, 0x20(%rsp)
movq 0x8(%rdx), %rax
movq %rax, 0x18(%rsp)
leaq 0x78(%rsp), %rax
leaq 0x68(%rsp), %r10
leaq 0x90(%rsp), %rdx
leaq 0x88(%rsp), %rcx
leaq 0x80(%rsp), %r8
leaq 0x70(%rsp), %r9
movq %r11, 0x50(%rsp)
movl %r11d, %esi
pushq %rax
pushq %r10
callq 0x12fb4d
movq %r14, %r8
addq $0x10, %rsp
movq $0x0, (%r14)
movl 0xc(%rbx), %r15d
testq %r15, %r15
je 0x18be66
movq (%rbx), %r13
addq %r15, %r15
addq $0x20, %r13
xorl %ebp, %ebp
xorl %r12d, %r12d
cmpb $0x0, (%r13)
je 0x18bdea
incq %r12
jmp 0x18be53
movl -0x14(%r13), %ebx
movq -0x8(%r13), %r14
movq (%r8), %rcx
movq 0x10(%r8), %rax
cmpq 0x8(%r8), %rcx
jne 0x18be2e
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
movl $0x2, %ecx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%r8)
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x2370
movq 0x1a8(%rsp), %r8
movq %rax, 0x10(%r8)
movq (%r8), %rcx
shlq $0x21, %rbx
addq %r14, %r14
movabsq $0x100000000, %rdx      # imm = 0x100000000
andq %rdx, %r14
orq %rbx, %r14
orq %rbp, %r14
leaq 0x1(%rcx), %rdx
movq %rdx, (%r8)
movq %r14, (%rax,%rcx,8)
addq $0x2, %rbp
addq $0x28, %r13
cmpq %rbp, %r15
jne 0x18bdde
jmp 0x18be69
xorl %r12d, %r12d
movq 0x208(%rsp), %rax
movl 0xc(%rax), %r15d
testq %r15, %r15
je 0x18bf06
movq (%rax), %r14
movq 0x10(%r8), %rdi
addq %r15, %r15
addq $0xc, %r14
xorl %r13d, %r13d
movl (%r14), %ebx
movq 0xc(%r14), %rbp
movq (%r8), %rax
cmpq 0x8(%r8), %rax
jne 0x18bece
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%r8)
shlq $0x3, %rsi
callq 0x2370
movq 0x1a8(%rsp), %r8
movq %rax, %rdi
movq %rax, 0x10(%r8)
movq (%r8), %rax
shlq $0x21, %rbx
addq %rbp, %rbp
movabsq $0x100000000, %rcx      # imm = 0x100000000
andq %rcx, %rbp
orq %rbx, %rbp
orq %r13, %rbp
orq $0x1, %rbp
leaq 0x1(%rax), %rcx
movq %rcx, (%r8)
movq %rbp, (%rdi,%rax,8)
addq $0x2, %r13
addq $0x28, %r14
cmpq %r13, %r15
jne 0x18be8f
jmp 0x18bf0a
movq 0x10(%r8), %rdi
movq (%r8), %rax
leaq (%rdi,%rax,8), %rsi
callq 0x17fc92
leaq 0x10983b(%rip), %rsi    # 0x295758
movl (%rsi), %r9d
movl 0xa0(%rsi), %eax
notl %r9d
andl $0x1, %r9d
leaq 0x10a4fc(%rip), %rcx    # 0x296430
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 0x238(%rsp), %rbp
movq %rbp, 0x48(%rsp)
movl %esi, 0x40(%rsp)
xorl %eax, %eax
movq %rax, 0x30(%rsp)
movq 0x230(%rsp), %rbp
movq %rbp, 0x28(%rsp)
movq 0x228(%rsp), %rsi
movq %rsi, 0x20(%rsp)
movl %edx, 0x18(%rsp)
movq %rax, 0x10(%rsp)
movq %rcx, 0x8(%rsp)
movq 0xb0(%rsp), %r15
movq %r15, (%rsp)
movl $0x0, 0x58(%rsp)
movl $0xffffffff, 0x38(%rsp) # imm = 0xFFFFFFFF
movss 0xaebf9(%rip), %xmm0    # 0x23abb0
movq 0x80(%rsp), %rbp
movq %rbp, %rdi
movq 0x88(%rsp), %r13
movl %r13d, %esi
movq 0xb8(%rsp), %r14
movl %r14d, %edx
movq 0xc0(%rsp), %rbx
movl %ebx, %ecx
xorl %r8d, %r8d
callq 0x13444e
addq $0x70, %rsp
leaq 0x10a443(%rip), %rax    # 0x296438
movsd 0x70(%rsp), %xmm2
movsd 0x68(%rsp), %xmm3
movq %r15, %rdi
movl (%rsp), %esi
movq %rbp, %rdx
movq %r13, %rcx
movq %r14, %r8
movq %rbx, %r9
movsd 0x58(%rsp), %xmm0
movsd 0x60(%rsp), %xmm1
pushq 0x10a543(%rip)          # 0x296568
pushq 0x1b0(%rsp)
movq 0x18(%rsp), %r13
pushq %r13
pushq 0x90(%rsp)
pushq 0xa0(%rsp)
pushq 0xb0(%rsp)
pushq 0xc0(%rsp)
movl 0x230(%rsp), %r10d
pushq %r10
pushq 0x230(%rsp)
movl 0x230(%rsp), %r10d
pushq %r10
pushq 0x228(%rsp)
pushq 0x228(%rsp)
pushq 0x228(%rsp)
pushq 0x228(%rsp)
pushq 0x228(%rsp)
movl 0x228(%rsp), %r10d
pushq %r10
pushq 0x210(%rsp)
movq 0x210(%rsp), %rbp
pushq %rbp
pushq 0x210(%rsp)
pushq (%rax)
callq 0x132a6d
addq $0xa0, %rsp
movq (%rbp), %rbx
movq 0x10(%rbp), %rax
movq %rax, %r15
addq %rax, %r12
movq 0x1a8(%rsp), %rax
movq (%rax), %rax
leaq (%r12,%rax), %r14
addq %rax, %r12
incq %r12
cmpq 0x8(%rbp), %r12
jbe 0x18c125
imulq $0xa8, %r12, %rsi
movq %rbx, %rdi
callq 0x2370
movq %rax, %rbx
movq %rax, (%rbp)
movq 0x8(%rbp), %rax
imulq $0xa8, %rax, %rdi
addq %rbx, %rdi
movq %r12, %rcx
subq %rax, %rcx
imulq $0xa8, %rcx, %rdx
xorl %esi, %esi
callq 0x20e0
movq %r12, 0x8(%rbp)
movq 0x10(%rbp), %r15
imulq $0xa8, %r14, %r10
addq %rbx, %r10
movq $0x0, 0x18(%rbp)
leaq 0x10961a(%rip), %rax    # 0x295758
movsd 0xc0(%rax), %xmm0
movl (%rsp), %eax
movsd 0xa54e7(%rip), %xmm1    # 0x231638
movq %rbp, %rdi
movq 0x190(%rsp), %rsi
movq 0x180(%rsp), %rdx
movq 0x20(%rsp), %rbx
movq %rbx, %rcx
movq %r13, %r8
movq 0x198(%rsp), %r9
pushq $-0x1
pushq $0x0
pushq 0x1b0(%rsp)
pushq $0x1
pushq $0x1f
movq %rax, 0x38(%rsp)
pushq %rax
pushq 0x68(%rsp)
movq %r10, 0x68(%rsp)
pushq %r10
callq 0x840d4
addq $0x40, %rsp
movq (%rbx), %rax
movq %rax, 0x20(%rsp)
movq 0x10(%rbp), %rax
movq %r15, 0x98(%rsp)
movq %r15, %r14
subq %rax, %r14
movq %rbp, %rbx
movq %rax, 0x28(%rsp)
jbe 0x18c422
imulq $0xa8, %rax, %rbp
addq $0x48, %rbp
movq (%rbx), %rax
leaq (%rax,%rbp), %rdi
addq $-0x10, %rdi
callq 0x3d054
movq (%rbx), %rdi
addq %rbp, %rdi
callq 0x3d05c
movq (%rbx), %rax
leaq (%rax,%rbp), %rdi
addq $0x30, %rdi
callq 0x3d05c
movq (%rbx), %rax
movq 0x10(%rbx), %r13
movl -0x38(%rax,%rbp), %r12d
movl -0x2c(%rax,%rbp), %r15d
testl %r15d, %r15d
je 0x18c22e
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq 0x180(%rsp), %rsi
movq %r12, %rdx
callq 0x334a6
jmp 0x18c246
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq 0x180(%rsp), %rsi
movq %r12, %rdx
callq 0x333e0
movq (%rbx), %r8
movq 0x8(%rbx), %r9
movsd 0x70(%rsp), %xmm2
movsd 0x68(%rsp), %xmm3
subq $0x8, %rsp
movq 0x48(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
movl %r12d, %ecx
movsd 0x60(%rsp), %xmm0
movsd 0x68(%rsp), %xmm1
pushq 0x80(%rsp)
pushq 0x90(%rsp)
pushq 0xa0(%rsp)
pushq 0xb0(%rsp)
movl 0x220(%rsp), %eax
pushq %rax
pushq 0x220(%rsp)
movl 0x220(%rsp), %eax
pushq %rax
pushq 0x218(%rsp)
pushq 0x218(%rsp)
pushq 0x218(%rsp)
pushq 0x218(%rsp)
pushq 0x218(%rsp)
movl 0x218(%rsp), %eax
pushq %rax
pushq 0x200(%rsp)
movq 0x200(%rsp), %rbx
pushq %rbx
pushq 0xd0(%rsp)
pushq 0xd0(%rsp)
callq 0x1345a7
addq $0x90, %rsp
movq 0x10(%rbx), %rax
movq %rax, %rcx
subq %r13, %rcx
cmpq $0x2, %rcx
jae 0x18c83b
cmpq %r13, %rax
jbe 0x18c38e
imulq $0xa8, %r13, %r12
movq (%rbx), %rdi
addq %r12, %rdi
movq 0x8(%rsp), %rax
movq (%rax), %r8
movq 0x8(%rax), %r9
leaq 0x10941c(%rip), %rax    # 0x295758
movsd 0xc0(%rax), %xmm0
subq $0x8, %rsp
movq 0x198(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq 0x20(%rsp), %rcx
pushq 0x1a8(%rsp)
pushq $0x1
pushq $0x1f
pushq 0x30(%rsp)
pushq 0x60(%rsp)
pushq 0x60(%rsp)
pushq 0x1d0(%rsp)
callq 0x84832
addq $0x40, %rsp
testq %rax, %rax
je 0x18c38e
movq (%rbx), %rax
movl %r15d, 0x1c(%rax,%r12)
cmpq %r13, 0x10(%rbx)
jbe 0x18c412
movq (%rbx), %rbx
imulq $0xa8, %r13, %r12
cmpb $0x1, 0x2c(%rbx,%r12)
jne 0x18c40a
movq 0x28(%rsp), %r15
cmpq %r13, %r15
je 0x18c402
imulq $0xa8, %r15, %r13
addq %rbx, %r13
movl $0xa8, %edx
leaq 0xa0(%rsp), %rdi
movq %r13, %rsi
callq 0x2160
addq %r12, %rbx
movl $0xa8, %edx
movq %r13, %rdi
movq %rbx, %rsi
callq 0x2160
movq 0x188(%rsp), %rax
addq (%rax), %r12
movl $0xa8, %edx
movq %r12, %rdi
leaq 0xa0(%rsp), %rsi
callq 0x2160
incq %r15
movq %r15, 0x28(%rsp)
movq 0x188(%rsp), %rbx
addq $0xa8, %rbp
decq %r14
jne 0x18c1d3
movq 0x28(%rsp), %rax
movq %rax, 0x10(%rbx)
movq 0x98(%rsp), %r15
subq %rax, %r15
jbe 0x18c47d
movq %rbx, %r14
imulq $0xa8, %rax, %rbx
addq $0x78, %rbx
movq (%r14), %rax
leaq (%rax,%rbx), %rdi
addq $-0x40, %rdi
callq 0x3d054
movq (%r14), %rax
leaq (%rax,%rbx), %rdi
addq $-0x30, %rdi
callq 0x3d05c
movq (%r14), %rdi
addq %rbx, %rdi
callq 0x3d05c
addq $0xa8, %rbx
decq %r15
jne 0x18c446
movq 0x200(%rsp), %rbp
movl 0xc(%rbp), %eax
testq %rax, %rax
movq 0x1a8(%rsp), %rcx
je 0x18c57c
movq (%rbp), %rbx
shlq $0x3, %rax
leaq (%rax,%rax,4), %r14
xorl %r13d, %r13d
cmpb $0x0, 0x20(%rbx,%r13)
je 0x18c56f
movq 0x188(%rsp), %rsi
movq (%rsi), %rax
movq 0x10(%rsi), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x10(%rsi)
imulq $0xa8, %rcx, %rdi
leaq (%rax,%rdi), %r12
movl (%rsp), %ecx
movl %ecx, (%rax,%rdi)
movl 0xc(%rbx,%r13), %ecx
movl %ecx, 0x10(%rax,%rdi)
xorl %r11d, %r11d
movl %r11d, 0xc(%rax,%rdi)
movl 0x18(%rbx,%r13), %ecx
shrl $0x1f, %ecx
movl %ecx, 0x1c(%rax,%rdi)
movq (%rbx,%r13), %r9
movl %r9d, %esi
movl %r9d, 0x4(%rax,%rdi)
movl 0x8(%rbx,%r13), %edx
leal -0x1(%rdx), %ecx
movl %ecx, 0x8(%rax,%rdi)
movl 0x10(%rbx,%r13), %ecx
movl %ecx, 0x14(%rax,%rdi)
movl 0x14(%rbx,%r13), %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 0x198(%rsp), %r15
movq %r15, %rdi
callq 0x663fa
movq %r12, %rdi
movq %r15, %rsi
callq 0x65a71
movq 0x1a8(%rsp), %rcx
addq $0x28, %r13
cmpq %r13, %r14
jne 0x18c4a8
movq 0x188(%rsp), %r14
movq 0x10(%r14), %rax
movq %rax, (%rsp)
cmpq $0x0, (%rcx)
je 0x18c7fd
xorl %r15d, %r15d
movq 0x10(%r14), %r13
movq 0x10(%rcx), %rax
movq (%rax,%r15,8), %rax
movl %eax, %ecx
shrl %ecx
testb $0x1, %al
movq 0x208(%rsp), %rax
cmoveq %rbp, %rax
movq (%rax), %rbx
leaq (%rcx,%rcx,4), %r12
testb $-0x80, 0x1b(%rbx,%r12,8)
movl 0xc(%rbx,%r12,8), %edx
jne 0x18c5e2
movq 0x8(%rsp), %rbp
movq %rbp, %rdi
movq 0x180(%rsp), %rsi
callq 0x333e0
jmp 0x18c5f7
movq 0x8(%rsp), %rbp
movq %rbp, %rdi
movq 0x180(%rsp), %rsi
callq 0x334a6
leaq (%rbx,%r12,8), %rbx
movl 0xc(%rbx), %ecx
movq (%rbp), %r8
movq 0x8(%rbp), %r9
movsd 0x70(%rsp), %xmm2
movsd 0x68(%rsp), %xmm3
subq $0x8, %rsp
movq 0x48(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
movsd 0x60(%rsp), %xmm0
movsd 0x68(%rsp), %xmm1
pushq 0x80(%rsp)
pushq 0x90(%rsp)
pushq 0xa0(%rsp)
pushq 0xb0(%rsp)
movl 0x220(%rsp), %eax
pushq %rax
pushq 0x220(%rsp)
movl 0x220(%rsp), %eax
pushq %rax
pushq 0x218(%rsp)
pushq 0x218(%rsp)
pushq 0x218(%rsp)
pushq 0x218(%rsp)
pushq 0x218(%rsp)
movl 0x218(%rsp), %eax
pushq %rax
pushq 0x200(%rsp)
movq 0x200(%rsp), %r14
pushq %r14
pushq 0xd0(%rsp)
pushq 0xd0(%rsp)
callq 0x1345a7
addq $0x90, %rsp
movq 0x10(%r14), %rax
movq %rax, %rcx
subq %r13, %rcx
cmpq $0x2, %rcx
jae 0x18c81c
cmpq %r13, %rax
movq 0x200(%rsp), %rbp
movq 0x188(%rsp), %r14
jbe 0x18c75b
imulq $0xa8, %r13, %r12
movq (%r14), %rdi
addq %r12, %rdi
movq 0x8(%rsp), %rax
movq (%rax), %r8
movq 0x8(%rax), %r9
leaq 0x109055(%rip), %rax    # 0x295758
movsd 0xc0(%rax), %xmm0
subq $0x8, %rsp
movq 0x198(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq 0x20(%rsp), %rcx
pushq 0x1a8(%rsp)
pushq $0x1
pushq $0x1f
pushq 0x30(%rsp)
pushq 0x60(%rsp)
pushq 0x60(%rsp)
pushq 0x1d0(%rsp)
callq 0x84832
addq $0x40, %rsp
testq %rax, %rax
je 0x18c75b
movl 0x18(%rbx), %eax
shrl $0x1f, %eax
movq (%r14), %rcx
movl %eax, 0x1c(%rcx,%r12)
cmpq %r13, 0x10(%r14)
movq 0x1a8(%rsp), %rcx
jbe 0x18c7f1
movq (%r14), %rbx
imulq $0xa8, %r13, %r12
cmpb $0x1, 0x2c(%rbx,%r12)
jne 0x18c7e9
movq (%rsp), %r14
cmpq %r13, %r14
je 0x18c7e2
imulq $0xa8, %r14, %r13
addq %rbx, %r13
movl $0xa8, %edx
leaq 0xa0(%rsp), %rdi
movq %r13, %rsi
callq 0x2160
addq %r12, %rbx
movl $0xa8, %edx
movq %r13, %rdi
movq %rbx, %rsi
callq 0x2160
movq 0x188(%rsp), %rax
addq (%rax), %r12
movl $0xa8, %edx
movq %r12, %rdi
leaq 0xa0(%rsp), %rsi
callq 0x2160
movq 0x1a8(%rsp), %rcx
incq %r14
movq %r14, (%rsp)
movq 0x188(%rsp), %r14
incq %r15
cmpq (%rcx), %r15
jb 0x18c599
movq (%rsp), %rax
movq %rax, 0x10(%r14)
movq 0x30(%rsp), %rax
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xb217c(%rip), %rdi     # 0x23e99f
leaq 0xb1811(%rip), %rsi     # 0x23e03b
leaq 0xb230e(%rip), %rcx     # 0x23eb3f
movl $0x122d, %edx           # imm = 0x122D
callq 0x2110
leaq 0xb215d(%rip), %rdi     # 0x23e99f
leaq 0xb17f2(%rip), %rsi     # 0x23e03b
leaq 0xb22ef(%rip), %rcx     # 0x23eb3f
movl $0x11f1, %edx           # imm = 0x11F1
callq 0x2110