// File: /workspace/github_cpp_makefile_star2_O2/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 $0x288, %rsp            # imm = 0x288
movsd %xmm1, 0x80(%rsp)
movsd %xmm0, 0x78(%rsp)
movq %r9, %r15
movq %r8, 0x40(%rsp)
movq %rcx, 0xc0(%rsp)
movq %rdx, %rbx
movl %esi, 0x8(%rsp)
movq %rdi, 0x30(%rsp)
movq 0x318(%rsp), %r12
movq 0x310(%rsp), %r13
movl 0x320(%rsp), %r14d
leaq 0x10ba1e(%rip), %rax    # 0x253758
cmpq $0x0, 0x2a8(%rax)
movl $0x307, %eax            # imm = 0x307
movl $0x177, %ecx            # imm = 0x177
cmoveq %rax, %rcx
movq %rcx, 0x70(%rsp)
leaq 0xd8(%rsp), %rdi
movl $0x108, %edx            # imm = 0x108
xorl %esi, %esi
callq 0x20e0
movq (%rbx), %rax
movq %rax, 0x28(%rsp)
movq 0x8(%rbx), %rax
movq %rax, 0x18(%rsp)
leaq 0x98(%rsp), %rax
leaq 0x88(%rsp), %r10
leaq 0xb0(%rsp), %rdx
leaq 0xa8(%rsp), %rcx
leaq 0xa0(%rsp), %r8
leaq 0x90(%rsp), %r9
movl %r14d, %edi
movq %r15, 0x48(%rsp)
movl %r15d, %esi
pushq %rax
pushq %r10
callq 0xea117
addq $0x10, %rsp
pushq $0x2
popq %rcx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, 0x68(%rsp)
testq %r13, %r13
je 0x147de2
movl (%r13), %eax
cmpl $0x3, %eax
cmovbl %ecx, %eax
movq %rax, 0x68(%rsp)
movq 0x340(%rsp), %r15
movq 0x2c8(%rsp), %rdx
testq %r12, %r12
je 0x147e08
movl (%r12), %eax
cmpl $0x3, %eax
cmovael %eax, %ecx
movq %rcx, 0x60(%rsp)
jmp 0x147e11
movq $0x0, 0x60(%rsp)
andq $0x0, 0x10(%rdx)
movq 0x2e8(%rsp), %rbx
movl 0xc(%r15), %eax
movq 0x348(%rsp), %rcx
movl 0xc(%rcx), %ecx
leal (%rax,%rcx), %r14d
incl %r14d
movq %rdx, %r12
movq (%rdx), %r13
cmpq %r14, 0x8(%rdx)
jae 0x147e82
imulq $0xa8, %r14, %rsi
movq %r13, %rdi
callq 0x2370
movq %rax, %r13
movq %rax, (%r12)
movq 0x8(%r12), %rax
imulq $0xa8, %rax, %rdi
addq %r13, %rdi
movq %r14, %rcx
subq %rax, %rcx
imulq $0xa8, %rcx, %rdx
xorl %esi, %esi
callq 0x20e0
movq %r14, 0x8(%r12)
movl 0xc(%r15), %eax
imulq $0xa8, %r14, %rcx
addq %r13, %rcx
movq %rcx, 0x20(%rsp)
andq $0x0, 0x18(%r12)
andq $0x0, (%rbx)
movq (%r15), %rbp
movl %eax, %r13d
xorl %r14d, %r14d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
leaq 0x1(%rax), %rsi
movq %rsi, 0x10(%rsp)
movq %r14, (%rsp)
cmpq %r13, %r14
jae 0x147f2f
imulq $0x28, %r14, %rax
cmpb $0x0, 0x20(%rbp,%rax)
jne 0x147f2a
addq %rbp, %rax
movl 0xc(%rax), %r12d
movq 0x18(%rax), %r15
movq (%rbx), %rcx
movq 0x10(%rbx), %rax
cmpq 0x8(%rbx), %rcx
jne 0x147f08
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
pushq $0x2
popq %rcx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%rbx)
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x2370
movq 0x10(%rsp), %rsi
movq %rax, 0x10(%rbx)
movq (%rbx), %rcx
shlq $0x21, %r12
addq %r15, %r15
andq %rsi, %r15
orq %r12, %r15
addq %r14, %r14
orq %r15, %r14
leaq 0x1(%rcx), %rdx
movq %rdx, (%rbx)
movq %r14, (%rax,%rcx,8)
movq (%rsp), %r14
incq %r14
jmp 0x147eb2
movq 0x348(%rsp), %rax
movq (%rax), %r14
movl 0xc(%rax), %r13d
xorl %ebp, %ebp
movq %rbp, (%rsp)
cmpq %r13, %rbp
jae 0x147fb8
imulq $0x28, %rbp, %rax
movl 0xc(%r14,%rax), %r12d
movq 0x18(%r14,%rax), %r15
movq (%rbx), %rcx
movq 0x10(%rbx), %rax
cmpq 0x8(%rbx), %rcx
jne 0x147f8e
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
pushq $0x2
popq %rcx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%rbx)
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x2370
movq 0x10(%rsp), %rsi
movq %rax, 0x10(%rbx)
movq (%rbx), %rcx
shlq $0x21, %r12
addq %r15, %r15
andq %rsi, %r15
orq %r12, %r15
addq %rbp, %rbp
orq %r15, %rbp
incq %rbp
leaq 0x1(%rcx), %rdx
movq %rdx, (%rbx)
movq %rbp, (%rax,%rcx,8)
movq (%rsp), %rbp
incq %rbp
jmp 0x147f40
addq $-0xa8, 0x20(%rsp)
movq (%rbx), %rax
movq 0x10(%rbx), %rdi
leaq (%rdi,%rax,8), %rsi
callq 0x13d044
leaq 0x10b780(%rip), %rsi    # 0x253758
movl (%rsi), %r9d
movl 0xa0(%rsi), %eax
notl %r9d
andl $0x1, %r9d
leaq 0x10c441(%rip), %rcx    # 0x254430
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 0x378(%rsp), %rax
movq %rax, 0x48(%rsp)
movl %esi, 0x40(%rsp)
movq 0x370(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x368(%rsp), %rax
movq %rax, 0x20(%rsp)
andl $0x0, 0x58(%rsp)
movl %edx, 0x18(%rsp)
orl $-0x1, 0x38(%rsp)
movq %rcx, 0x8(%rsp)
andq $0x0, 0x30(%rsp)
movq 0xa0(%rsp), %r14
movq %r14, (%rsp)
andq $0x0, 0x10(%rsp)
movss 0xa4a34(%rip), %xmm0    # 0x1ecaa0
movq 0x98(%rsp), %rdi
movq 0x88(%rsp), %rsi
movq 0xb0(%rsp), %rdx
movq 0xb8(%rsp), %rcx
xorl %r8d, %r8d
callq 0xedd3f
addq $0x70, %rsp
leaq 0x10c399(%rip), %rax    # 0x254438
movq (%rax), %rsi
movq %r14, %rdi
movq 0x2c8(%rsp), %rdx
movq 0x2d0(%rsp), %rcx
callq 0xed6bd
movq %rsp, %rax
leaq 0x58(%rsp), %rcx
andq $0x0, (%rcx)
leaq 0x38(%rsp), %rcx
andq $0x0, (%rcx)
leaq 0xc8(%rsp), %rcx
andq $0x0, (%rcx)
leaq 0xd0(%rsp), %rcx
andq $0x0, (%rcx)
movq $0x1, (%rax)
movl 0x8(%rsp), %eax
movq %rax, 0x10(%rsp)
leaq 0x50(%rsp), %rbp
leaq 0xb8(%rsp), %r12
movq 0xc0(%rsp), %r15
movq (%rbx), %r9
movq 0x10(%rbx), %r8
movq 0x30(%rsp), %rdi
movq %rsp, %rsi
leaq 0x58(%rsp), %rdx
leaq 0x38(%rsp), %rcx
pushq %rbp
pushq %r12
callq 0xed88b
popq %rcx
popq %rdx
testq %rax, %rax
je 0x1483e3
cmpq $0x0, 0x50(%rsp)
movq 0xb8(%rsp), %rdx
movq %r15, %rdi
movq 0x2c0(%rsp), %rsi
je 0x14815a
callq 0x7215
jmp 0x14815f
callq 0x715e
movq 0x2c8(%rsp), %r13
movq 0x10(%r13), %r14
movq 0x58(%rsp), %rsi
movq (%rsp), %rdx
movq 0xb8(%rsp), %rax
movups (%r15), %xmm0
movq 0x50(%rsp), %rcx
movq 0xb0(%rsp), %rdi
movq 0xa8(%rsp), %r8
movq 0xa0(%rsp), %r9
movq 0x98(%rsp), %r10
movsd 0x90(%rsp), %xmm2
movsd 0x88(%rsp), %xmm3
movq 0x10c3aa(%rip), %r11    # 0x254568
subq $0xb0, %rsp
movq %r11, 0x98(%rsp)
movq %r10, 0x88(%rsp)
movq %r9, 0x80(%rsp)
movq %r8, 0x78(%rsp)
movq %rdi, 0x70(%rsp)
leaq 0x178(%rsp), %rdi
movq %rdi, 0xa8(%rsp)
leaq 0x180(%rsp), %rdi
movq %rdi, 0xa0(%rsp)
leaq 0x188(%rsp), %rdi
movq %rdi, 0x90(%rsp)
movl 0x3e8(%rsp), %edi
movl %edi, 0x68(%rsp)
movq 0x3e0(%rsp), %rdi
movq %rdi, 0x60(%rsp)
movl 0x3d8(%rsp), %edi
movl %edi, 0x58(%rsp)
movq 0x110(%rsp), %rdi
movq %rdi, 0x50(%rsp)
movq 0x118(%rsp), %rdi
movq %rdi, 0x48(%rsp)
movl 0x3a0(%rsp), %edi
movl %edi, 0x40(%rsp)
movq 0x380(%rsp), %rdi
movq %rdi, 0x38(%rsp)
movq %r13, 0x30(%rsp)
movq 0xf8(%rsp), %rdi
movq %rdi, 0x28(%rsp)
movq 0xf0(%rsp), %rdi
movq %rdi, 0x20(%rsp)
movq %rcx, 0x18(%rsp)
movups %xmm0, 0x8(%rsp)
movq %rax, (%rsp)
movq 0xe0(%rsp), %rdi
movl 0xb8(%rsp), %ecx
movq 0xd8(%rsp), %r8
movq 0xc8(%rsp), %r9
movsd 0x128(%rsp), %xmm0
movsd 0x130(%rsp), %xmm1
callq 0xed941
addq $0xb0, %rsp
testq %rax, %rax
je 0x1483ce
movq 0x10(%r13), %rax
subq %r14, %rax
cmpq $0x1, %rax
jne 0x1487c2
movq (%r13), %rdi
imulq $0xa8, %r14, %r14
andl $0x0, 0x1c(%rdi,%r14)
addq %r14, %rdi
movq (%r15), %r8
movq 0x8(%r15), %r9
leaq 0x10b446(%rip), %rax    # 0x253758
movsd 0xc0(%rax), %xmm0
subq $0x8, %rsp
movq 0x2d8(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq 0x20(%rsp), %rcx
pushq 0x2e8(%rsp)
pushq $0x1
pushq $0x1f
pushq 0x30(%rsp)
pushq 0x98(%rsp)
pushq 0x50(%rsp)
pushq 0x310(%rsp)
callq 0x510f1
addq $0x40, %rsp
testq %rax, %rax
je 0x148397
movl 0x50(%rsp), %eax
movq (%r13), %rcx
movl %eax, 0x1c(%rcx,%r14)
movq 0x10(%rbx), %rax
movq 0x38(%rsp), %rcx
movl 0x4(%rax,%rcx,8), %edx
movq %rdx, (%rax,%rcx,8)
movq 0x38(%rsp), %rcx
shlq $0x20, (%rax,%rcx,8)
movq 0x38(%rsp), %rcx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
orq %rdx, (%rax,%rcx,8)
jmp 0x1483ce
movq (%r13), %rax
leaq (%rax,%r14), %rdi
addq $0x38, %rdi
callq 0x11976
movq (%r13), %rax
leaq (%rax,%r14), %rdi
addq $0x48, %rdi
callq 0x1197b
movq (%r13), %rax
leaq (%rax,%r14), %rdi
addq $0x78, %rdi
callq 0x1197b
decq 0x10(%r13)
movq (%rsp), %rax
movq %rax, 0x58(%rsp)
incq %rax
movq %rax, (%rsp)
jmp 0x14810c
xorl %ecx, %ecx
xorl %eax, %eax
movq 0x340(%rsp), %rdi
movq 0x2c8(%rsp), %r13
movq %rcx, (%rsp)
cmpq (%rbx), %rcx
jae 0x14841d
movq 0x10(%rbx), %rdx
movq (%rdx,%rcx,8), %rsi
cmpl $-0x1, %esi
je 0x148418
movq %rsi, (%rdx,%rax,8)
incq %rax
movq (%rsp), %rcx
incq %rcx
jmp 0x1483f7
movq %rax, (%rbx)
movq (%rdi), %r12
movl 0xc(%rdi), %ebp
xorl %eax, %eax
movq %rax, (%rsp)
cmpq %rbp, %rax
jae 0x148503
imulq $0x28, %rax, %r8
cmpb $0x0, 0x20(%r12,%r8)
je 0x1484fb
movq (%r13), %rax
movq 0x10(%r13), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x10(%r13)
imulq $0xa8, %rcx, %rdi
leaq (%rax,%rdi), %r13
movl 0x8(%rsp), %ecx
movl %ecx, (%rax,%rdi)
movl 0xc(%r12,%r8), %ecx
movl %ecx, 0x10(%rax,%rdi)
andl $0x0, 0xc(%rax,%rdi)
movl 0x18(%r12,%r8), %ecx
shrl $0x1f, %ecx
movl %ecx, 0x1c(%rax,%rdi)
movq (%r12,%r8), %r9
movl %r9d, %esi
movl %r9d, 0x4(%rax,%rdi)
movl 0x8(%r12,%r8), %edx
leal -0x1(%rdx), %ecx
movl %ecx, 0x8(%rax,%rdi)
movl 0x10(%r12,%r8), %ecx
movl %ecx, 0x14(%rax,%rdi)
movl 0x14(%r12,%r8), %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)
andl $0x0, 0x30(%rax,%rdi)
movq 0x2d8(%rsp), %r14
movq %r14, %rdi
callq 0x352b9
movq %r13, %rdi
movq 0x2c8(%rsp), %r13
movq %r14, %rsi
callq 0x34955
movq (%rsp), %rax
incq %rax
jmp 0x148428
movq 0x10(%r13), %rax
movq %rax, 0x8(%rsp)
movq 0x2d0(%rsp), %rdi
callq 0x13d24
xorl %eax, %eax
movq %rax, (%rsp)
cmpq (%rbx), %rax
jae 0x148768
movq 0x10(%r13), %rbp
movq 0x10(%rbx), %rcx
movq (%rcx,%rax,8), %rax
movl %eax, %ecx
shrl %ecx
testb $0x1, %al
movq 0x348(%rsp), %rax
cmoveq 0x340(%rsp), %rax
movq (%rax), %r12
imulq $0x28, %rcx, %r14
testb $-0x80, 0x1b(%r12,%r14)
movl 0xc(%r12,%r14), %edx
movq %r15, %rdi
movq 0x2c0(%rsp), %rsi
jne 0x148571
callq 0x715e
jmp 0x148576
callq 0x7215
addq %r14, %r12
movl 0xc(%r12), %ecx
movq (%r15), %r8
movq 0x8(%r15), %r9
movsd 0x90(%rsp), %xmm2
movsd 0x88(%rsp), %xmm3
subq $0x8, %rsp
movq 0x38(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
movsd 0x80(%rsp), %xmm0
movsd 0x88(%rsp), %xmm1
pushq 0xa0(%rsp)
pushq 0xb0(%rsp)
pushq 0xc0(%rsp)
pushq 0xd0(%rsp)
movl 0x360(%rsp), %eax
pushq %rax
pushq 0x360(%rsp)
movl 0x360(%rsp), %eax
pushq %rax
pushq 0x358(%rsp)
pushq 0x358(%rsp)
pushq 0x358(%rsp)
pushq 0x358(%rsp)
pushq 0x358(%rsp)
movl 0x358(%rsp), %eax
pushq %rax
pushq 0x340(%rsp)
pushq %r13
pushq 0xc8(%rsp)
pushq 0xc8(%rsp)
callq 0xede81
addq $0x90, %rsp
movq 0x10(%r13), %rax
movq %rax, %rcx
subq %rbp, %rcx
cmpq $0x2, %rcx
jae 0x1487a3
cmpq %rbp, %rax
jbe 0x1486d0
imulq $0xa8, %rbp, %r14
movq (%r13), %rdi
addq %r14, %rdi
movq (%r15), %r8
movq 0x8(%r15), %r9
leaq 0x10b0e6(%rip), %rax    # 0x253758
movsd 0xc0(%rax), %xmm0
subq $0x8, %rsp
movq 0x2d8(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq 0x20(%rsp), %rcx
pushq 0x2e8(%rsp)
pushq $0x1
pushq $0x1f
pushq 0x30(%rsp)
pushq 0x98(%rsp)
pushq 0x50(%rsp)
pushq 0x310(%rsp)
callq 0x510f1
addq $0x40, %rsp
testq %rax, %rax
je 0x1486d0
movl 0x18(%r12), %eax
shrl $0x1f, %eax
movq (%r13), %rcx
movl %eax, 0x1c(%rcx,%r14)
cmpq %rbp, 0x10(%r13)
jbe 0x14875c
movq (%r13), %r12
imulq $0xa8, %rbp, %r13
cmpb $0x1, 0x2c(%r12,%r13)
jne 0x148754
movq 0x8(%rsp), %rax
cmpq %rbp, %rax
je 0x14874c
imulq $0xa8, %rax, %rbp
addq %r12, %rbp
movl $0xa8, %edx
leaq 0x1e0(%rsp), %r14
movq %r14, %rdi
movq %rbp, %rsi
callq 0x2160
addq %r13, %r12
movl $0xa8, %edx
movq %rbp, %rdi
movq %r12, %rsi
callq 0x2160
movq 0x2c8(%rsp), %rax
addq (%rax), %r13
movl $0xa8, %edx
movq %r13, %rdi
movq %r14, %rsi
callq 0x2160
movq 0x8(%rsp), %rax
incq %rax
movq %rax, 0x8(%rsp)
movq 0x2c8(%rsp), %r13
movq (%rsp), %rax
incq %rax
jmp 0x14851b
movq 0x8(%rsp), %rdx
movq %rdx, 0x10(%r13)
movq 0x348(%rsp), %rax
movl 0xc(%rax), %eax
movq 0x340(%rsp), %rcx
addl 0xc(%rcx), %eax
cmpq %rax, %rdx
ja 0x1487e1
movq 0x20(%rsp), %rax
addq $0x288, %rsp            # imm = 0x288
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xa80b5(%rip), %rdi     # 0x1f085f
leaq 0xa774a(%rip), %rsi     # 0x1efefb
leaq 0xa8592(%rip), %rcx     # 0x1f0d4a
movl $0x12de, %edx           # imm = 0x12DE
callq 0x2110
leaq 0xa856b(%rip), %rdi     # 0x1f0d34
leaq 0xa772b(%rip), %rsi     # 0x1efefb
leaq 0xa8573(%rip), %rcx     # 0x1f0d4a
movl $0x129e, %edx           # imm = 0x129E
callq 0x2110
leaq 0xa81ed(%rip), %rdi     # 0x1f09d5
leaq 0xa770c(%rip), %rsi     # 0x1efefb
leaq 0xa8554(%rip), %rcx     # 0x1f0d4a
movl $0x12f3, %edx           # imm = 0x12F3
callq 0x2110