// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/ecovlp.cpp
// Function: h_ec_lchain_fast(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*, double)
overlap_region* h_ec_lchain_fast(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, double sh)
{
    // 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, is_match; ma_hit_t *oa = NULL, *p = NULL; overlap_region *aux_o = NULL, *z = NULL; 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; uint64_t aq[2], at[2], bq[2], bt[2], ovlp, os, oe;
    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 = trev; om = 1; ol->list[ol0].shared_seed = 0; ol->list[ol0].is_match = 0;
            
            assert(((srt_i->a[i]>>33) == ol->list[ol0].y_id) && (((srt_i->a[i]>>32)&1) == ol->list[ol0].y_pos_strand));
            if(srt_i->a[i]&1) {
                p = &(in1->buffer[((uint32_t)srt_i->a[i])>>1]); is_match = 2;
            } else {
                p = &(in0->buffer[((uint32_t)srt_i->a[i])>>1]); is_match = 1;
            }
            ol->list[ol0].strong = p->ml; ol->list[ol0].without_large_indel = p->no_l_indel;

            aq[0] = (uint32_t)p->qns; aq[1] = p->qe; 
            at[0] = p->ts; at[1] = p->te;

            bq[0] = ol->list[ol0].x_pos_s; bq[1] = ol->list[ol0].x_pos_e + 1;
            bt[0] = ol->list[ol0].y_pos_s; bt[1] = ol->list[ol0].y_pos_e + 1;
            
            os = MAX(aq[0], bq[0]); oe = MIN(aq[1], bq[1]);
            ovlp = ((oe>os)? (oe-os):0);
            if(!((ovlp) && (ovlp >= ((aq[1] - aq[0])*sh)) && ((ovlp >= ((bq[1] - bq[0])*sh))))) om = 0;

            os = MAX(at[0], bt[0]); oe = MIN(at[1], bt[1]);
            ovlp = ((oe>os)? (oe-os):0);
            if(!((ovlp) && (ovlp >= ((at[1] - at[0])*sh)) && ((ovlp >= ((bt[1] - bt[0])*sh))))) om = 0;

            if(om) {
                if(exact_ec_check(rs, rl, tu->seq, tu->length, bq[0], bq[1], bt[0], bt[1])) {
                    if(is_match == 2) {
                        ol->list[ol0].strong = 0; ol->list[ol0].without_large_indel = 1;
                    }
                    is_match = 1; ol->list[ol0].shared_seed = 1;
                }
                ol->list[ol0].is_match = is_match;
            } 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->align_length = z->overlapLen = z->x_pos_e + 1 - z->x_pos_s;
            z->non_homopolymer_errors = 0;

            z->is_match = 1; z->shared_seed = 1;
            z->strong = oa[k].ml; z->without_large_indel = oa[k].no_l_indel;

            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 %xmm2, 0xd0(%rsp)
movsd %xmm1, 0x148(%rsp)
movsd %xmm0, 0x140(%rsp)
movq %r9, %r13
movq %r8, 0x120(%rsp)
movq %rcx, 0xc8(%rsp)
movq %rdx, %r14
movl %esi, %r12d
movq %rdi, 0xd8(%rsp)
movq 0x328(%rsp), %rbx
movq 0x320(%rsp), %r15
movl 0x330(%rsp), %ebp
leaq 0x190(%rsp), %rdi
movl $0x108, %edx            # imm = 0x108
xorl %esi, %esi
callq 0x20e0
movq (%r14), %rax
movq %rax, 0xe8(%rsp)
movq 0x8(%r14), %rax
movq %rax, 0xe0(%rsp)
leaq 0x160(%rsp), %rax
movq %rax, 0x8(%rsp)
leaq 0x150(%rsp), %rax
movq %rax, (%rsp)
leaq 0x178(%rsp), %rdx
leaq 0x170(%rsp), %rcx
leaq 0x168(%rsp), %r8
leaq 0x158(%rsp), %r9
movl %ebp, %edi
movq %r13, 0x128(%rsp)
movl %r13d, %esi
callq 0xea117
pushq $0x2
popq %rcx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, 0x118(%rsp)
testq %r15, %r15
je 0x148900
movl (%r15), %eax
cmpl $0x3, %eax
cmovbl %ecx, %eax
movq %rax, 0x118(%rsp)
movq 0x350(%rsp), %r15
movq 0x2d8(%rsp), %r14
testq %rbx, %rbx
je 0x148927
movl (%rbx), %eax
cmpl $0x3, %eax
cmovael %eax, %ecx
movq %rcx, 0x110(%rsp)
jmp 0x148933
movq $0x0, 0x110(%rsp)
andq $0x0, 0x10(%r14)
movq 0x2f8(%rsp), %rbp
movl 0xc(%r15), %eax
movq 0x358(%rsp), %rcx
movl 0xc(%rcx), %ecx
leal (%rax,%rcx), %ebx
incl %ebx
movq (%r14), %rdi
cmpq %rbx, 0x8(%r14)
movl %r12d, 0xbc(%rsp)
movq %rbx, 0x138(%rsp)
jae 0x1489b0
imulq $0xa8, %rbx, %rsi
callq 0x2370
movq %rax, (%r14)
movq 0x8(%r14), %rdx
imulq $0xa8, %rdx, %rdi
movq %rax, 0x100(%rsp)
addq %rax, %rdi
movq %rbx, %rcx
subq %rdx, %rcx
imulq $0xa8, %rcx, %rdx
xorl %esi, %esi
callq 0x20e0
movq %rbx, 0x8(%r14)
movl 0xc(%r15), %eax
jmp 0x1489b8
movq %rdi, 0x100(%rsp)
andq $0x0, 0x18(%r14)
andq $0x0, (%rbp)
movq (%r15), %rbx
movl %eax, %r13d
xorl %r15d, %r15d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
leaq 0x1(%rax), %rsi
movq %rsi, 0x108(%rsp)
movq %r15, 0xb0(%rsp)
cmpq %r13, %r15
jae 0x148a6e
imulq $0x28, %r15, %rax
cmpb $0x0, 0x20(%rbx,%rax)
jne 0x148a66
addq %rbx, %rax
movl 0xc(%rax), %r12d
movq 0x18(%rax), %r14
movq (%rbp), %rcx
movq 0x10(%rbp), %rax
cmpq 0x8(%rbp), %rcx
jne 0x148a3f
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
pushq $0x2
popq %rcx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%rbp)
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x2370
movq 0x108(%rsp), %rsi
movq %rax, 0x10(%rbp)
movq (%rbp), %rcx
shlq $0x21, %r12
addq %r14, %r14
andq %rsi, %r14
orq %r12, %r14
addq %r15, %r15
orq %r14, %r15
leaq 0x1(%rcx), %rdx
movq %rdx, (%rbp)
movq %r15, (%rax,%rcx,8)
movq 0xb0(%rsp), %r15
incq %r15
jmp 0x1489dc
movq 0x358(%rsp), %rax
movq (%rax), %rbx
movl 0xc(%rax), %r15d
xorl %r13d, %r13d
movq %r13, 0xb0(%rsp)
cmpq %r15, %r13
jae 0x148b09
imulq $0x28, %r13, %rax
movl 0xc(%rbx,%rax), %r12d
movq 0x18(%rbx,%rax), %r14
movq (%rbp), %rcx
movq 0x10(%rbp), %rax
cmpq 0x8(%rbp), %rcx
jne 0x148ad7
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
pushq $0x2
popq %rcx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%rbp)
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x2370
movq 0x108(%rsp), %rsi
movq %rax, 0x10(%rbp)
movq (%rbp), %rcx
shlq $0x21, %r12
addq %r14, %r14
andq %rsi, %r14
orq %r12, %r14
addq %r13, %r13
orq %r14, %r13
incq %r13
leaq 0x1(%rcx), %rdx
movq %rdx, (%rbp)
movq %r13, (%rax,%rcx,8)
movq 0xb0(%rsp), %r13
incq %r13
jmp 0x148a80
movq (%rbp), %rax
movq 0x10(%rbp), %rdi
leaq (%rdi,%rax,8), %rsi
callq 0x13d044
leaq 0x10ac37(%rip), %rax    # 0x253758
movl (%rax), %r9d
movl 0xa0(%rax), %ecx
notl %r9d
andl $0x1, %r9d
leaq 0x10b8f8(%rip), %rdx    # 0x254430
movq (%rdx), %rdx
movl 0xa8(%rax), %esi
movl 0x1f8(%rax), %eax
xorpd %xmm0, %xmm0
movupd %xmm0, 0x60(%rsp)
movl %ecx, 0x50(%rsp)
movq 0x318(%rsp), %rcx
movq %rcx, 0x48(%rsp)
movl %eax, 0x40(%rsp)
movq 0x310(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x308(%rsp), %rax
movq %rax, 0x20(%rsp)
movl %esi, 0x18(%rsp)
andl $0x0, 0x58(%rsp)
movq %rdx, 0x8(%rsp)
orl $-0x1, 0x38(%rsp)
movq 0xd8(%rsp), %r13
movq %r13, (%rsp)
andq $0x0, 0x30(%rsp)
andq $0x0, 0x10(%rsp)
movss 0xa3eed(%rip), %xmm0    # 0x1ecaa0
movq 0xe8(%rsp), %rdi
movq 0xe0(%rsp), %rsi
movq 0x120(%rsp), %rdx
movq 0x128(%rsp), %rcx
xorl %r8d, %r8d
callq 0xedd3f
leaq 0x10b856(%rip), %rax    # 0x254438
movq (%rax), %rsi
movq %r13, %rdi
movq 0x2d8(%rsp), %r15
movq %r15, %rdx
movq 0x2e0(%rsp), %rcx
callq 0xed6bd
leaq 0xb0(%rsp), %rax
movq $0x1, (%rax)
leaq 0xf8(%rsp), %rax
andq $0x0, (%rax)
leaq 0xc0(%rsp), %rax
andq $0x0, (%rax)
leaq 0x180(%rsp), %rax
andq $0x0, (%rax)
leaq 0x188(%rsp), %rax
andq $0x0, (%rax)
movl 0xbc(%rsp), %r14d
movq 0xc8(%rsp), %r12
movq (%rbp), %r9
movq 0x10(%rbp), %r8
leaq 0xf0(%rsp), %rax
movq %rax, 0x8(%rsp)
leaq 0x130(%rsp), %rax
movq %rax, (%rsp)
movq %r13, %rdi
leaq 0xb0(%rsp), %rsi
leaq 0xf8(%rsp), %rdx
leaq 0xc0(%rsp), %rcx
callq 0xed88b
testq %rax, %rax
je 0x14912f
cmpq $0x0, 0xf0(%rsp)
movq 0x130(%rsp), %rdx
movq %r12, %rdi
movq 0x2d0(%rsp), %rsi
je 0x148cbe
callq 0x7215
jmp 0x148cc3
callq 0x715e
movq 0x10(%r15), %rbx
movq 0xf8(%rsp), %rsi
movq 0xb0(%rsp), %rdx
movq 0x130(%rsp), %rax
movups (%r12), %xmm0
movq 0xf0(%rsp), %rcx
movq 0x178(%rsp), %rdi
movq 0x170(%rsp), %r8
movq 0x168(%rsp), %r9
movq 0x160(%rsp), %r10
movsd 0x158(%rsp), %xmm2
movsd 0x150(%rsp), %xmm3
movq 0x10b843(%rip), %r11    # 0x254568
movq %r11, 0x98(%rsp)
movq %r10, 0x88(%rsp)
movq %r9, 0x80(%rsp)
movq %r8, 0x78(%rsp)
movq %rdi, 0x70(%rsp)
leaq 0x180(%rsp), %rdi
movq %rdi, 0xa8(%rsp)
leaq 0x188(%rsp), %rdi
movq %rdi, 0xa0(%rsp)
leaq 0x190(%rsp), %rdi
movq %rdi, 0x90(%rsp)
movl 0x348(%rsp), %edi
movl %edi, 0x68(%rsp)
movq 0x340(%rsp), %rdi
movq %rdi, 0x60(%rsp)
movl 0x338(%rsp), %edi
movl %edi, 0x58(%rsp)
movq 0x110(%rsp), %rdi
movq %rdi, 0x50(%rsp)
movq 0x118(%rsp), %rdi
movq %rdi, 0x48(%rsp)
movl 0x300(%rsp), %edi
movl %edi, 0x40(%rsp)
movq 0x2e0(%rsp), %rdi
movq %rdi, 0x38(%rsp)
movq %r15, 0x30(%rsp)
movq 0x128(%rsp), %rdi
movq %rdi, 0x28(%rsp)
movq 0x120(%rsp), %rdi
movq %rdi, 0x20(%rsp)
movq %rcx, 0x18(%rsp)
movups %xmm0, 0x8(%rsp)
movq %rax, (%rsp)
movq %r13, %rdi
movl %r14d, %ecx
movq 0xe8(%rsp), %r8
movq 0xe0(%rsp), %r9
movsd 0x140(%rsp), %xmm0
movsd 0x148(%rsp), %xmm1
callq 0xed941
testq %rax, %rax
je 0x14907e
movq 0x10(%r15), %rax
subq %rbx, %rax
cmpq $0x1, %rax
jne 0x1492dc
movq 0xf0(%rsp), %rcx
movq (%r15), %rax
imulq $0xa8, %rbx, %r13
movl %ecx, 0x1c(%rax,%r13)
andl $0x0, 0x24(%rax,%r13)
movb $0x0, 0x2c(%rax,%r13)
movq 0x10(%rbp), %rdx
movq 0xc0(%rsp), %rsi
movq (%rdx,%rsi,8), %rbx
movq %rbx, %rdx
shrq $0x21, %rdx
cmpl 0x10(%rax,%r13), %edx
jne 0x1492bd
movl %ecx, %ecx
movq %rbx, %rdx
shrq $0x20, %rdx
andl $0x1, %edx
cmpl %ecx, %edx
jne 0x1492bd
movl %ebx, %r12d
andl $0x1, %r12d
movl %ebx, %esi
shrl %esi
testq %r12, %r12
movq 0x358(%rsp), %rdx
cmoveq 0x350(%rsp), %rdx
leaq (%rax,%r13), %rcx
movq (%rdx), %rdx
imulq $0x28, %rsi, %rsi
movl 0x18(%rdx,%rsi), %edi
shrl $0x1e, %edi
andb $0x1, %dil
movb %dil, 0x2e(%rax,%r13)
movb 0x21(%rdx,%rsi), %dil
movb %dil, 0x2d(%rax,%r13)
movl (%rdx,%rsi), %edi
movl 0x8(%rdx,%rsi), %r10d
movl 0x4(%rcx), %r8d
movl 0x8(%rcx), %r9d
incl %r9d
cmpq %r8, %rdi
movq %r8, %r14
cmovaq %rdi, %r14
cmpq %r9, %r10
movq %r9, %r11
cmovbq %r10, %r11
subq %r14, %r11
jbe 0x148f85
movl $0x0, %r14d
cmovbq %r14, %r11
cvtsi2sd %r11, %xmm0
subq %rdi, %r10
movq %r10, %xmm1
punpckldq 0x9a348(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x9a350(%rip), %xmm1    # 0x1e3280
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
mulsd 0xd0(%rsp), %xmm2
ucomisd %xmm2, %xmm0
jb 0x148f85
movq %r9, %rdi
subq %r8, %rdi
movq %rdi, %xmm1
punpckldq 0x9a312(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x9a31a(%rip), %xmm1    # 0x1e3280
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
mulsd 0xd0(%rsp), %xmm2
ucomisd %xmm2, %xmm0
jae 0x14909e
movb $0x1, %dil
incb %r12b
movl 0x10(%rdx,%rsi), %r11d
movl 0x14(%rdx,%rsi), %edx
movl 0x14(%rcx), %esi
movl 0x18(%rcx), %r10d
incl %r10d
cmpq %rsi, %r11
movq %rsi, %r14
cmovaq %r11, %r14
cmpq %r10, %rdx
movq %r10, %rcx
cmovbq %rdx, %rcx
subq %r14, %rcx
jbe 0x149035
movl $0x0, %r14d
cmovbq %r14, %rcx
cvtsi2sd %rcx, %xmm0
subq %r11, %rdx
movq %rdx, %xmm1
punpckldq 0x9a29a(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x9a2a2(%rip), %xmm1    # 0x1e3280
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
mulsd 0xd0(%rsp), %xmm2
ucomisd %xmm2, %xmm0
jb 0x149035
movq %r10, %rcx
subq %rsi, %rcx
movq %rcx, %xmm1
punpckldq 0x9a264(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x9a26c(%rip), %xmm1    # 0x1e3280
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
mulsd 0xd0(%rsp), %xmm2
ucomisd %xmm2, %xmm0
setb %cl
orb %dil, %cl
je 0x1490a5
leaq (%rax,%r13), %rdi
addq $0x38, %rdi
callq 0x11976
movq (%r15), %rax
leaq (%rax,%r13), %rdi
addq $0x48, %rdi
callq 0x1197b
movq (%r15), %rax
leaq (%rax,%r13), %rdi
addq $0x78, %rdi
callq 0x1197b
decq 0x10(%r15)
movl 0xbc(%rsp), %r14d
movq 0xc8(%rsp), %r12
movq 0xd8(%rsp), %r13
movq 0xb0(%rsp), %rax
movq %rax, 0xf8(%rsp)
incq %rax
movq %rax, 0xb0(%rsp)
jmp 0x148c4f
xorl %edi, %edi
jmp 0x148f88
movq 0xc8(%rsp), %rax
movq (%rax), %rdx
movq 0x8(%rax), %rcx
movq %r10, 0x8(%rsp)
movq %rsi, (%rsp)
movq 0xe8(%rsp), %rdi
movq 0xe0(%rsp), %rsi
callq 0x14f785
movq (%r15), %rcx
testq %rax, %rax
je 0x1490f3
testb $0x1, %bl
je 0x1490e7
movw $0x1, 0x2d(%rcx,%r13)
movl $0x1, 0x24(%rcx,%r13)
movb $0x1, %r12b
movb %r12b, 0x2c(%rcx,%r13)
movq 0x10(%rbp), %rax
movq 0xc0(%rsp), %rcx
movl 0x4(%rax,%rcx,8), %edx
movq %rdx, (%rax,%rcx,8)
movq 0xc0(%rsp), %rcx
shlq $0x20, (%rax,%rcx,8)
movq 0xc0(%rsp), %rcx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
orq %rdx, (%rax,%rcx,8)
jmp 0x149066
xorl %ecx, %ecx
xorl %eax, %eax
movq %rcx, 0xb0(%rsp)
cmpq (%rbp), %rcx
jae 0x149162
movq 0x10(%rbp), %rdx
movq (%rdx,%rcx,8), %rsi
cmpl $-0x1, %esi
je 0x14915d
movq %rsi, (%rdx,%rax,8)
incq %rax
movq 0xb0(%rsp), %rcx
incq %rcx
jmp 0x149133
movq %rax, (%rbp)
movq 0x350(%rsp), %rax
movq (%rax), %rbx
movl 0xc(%rax), %r12d
xorl %ecx, %ecx
movq 0x2e8(%rsp), %r13
movq %rcx, 0xb0(%rsp)
cmpq %r12, %rcx
jae 0x149272
imulq $0x28, %rcx, %rax
cmpb $0x0, 0x20(%rbx,%rax)
je 0x14926a
movq (%r15), %rdi
movq 0x10(%r15), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x10(%r15)
imulq $0xa8, %rcx, %r9
leaq (%rdi,%r9), %r15
movl %r14d, (%rdi,%r9)
movl 0xc(%rbx,%rax), %ecx
movl %ecx, 0x10(%rdi,%r9)
andl $0x0, 0xc(%rdi,%r9)
movl 0x18(%rbx,%rax), %ecx
shrl $0x1f, %ecx
movl %ecx, 0x1c(%rdi,%r9)
movq (%rbx,%rax), %r10
movl %r10d, %esi
movl %r10d, 0x4(%rdi,%r9)
movl 0x8(%rbx,%rax), %edx
leal -0x1(%rdx), %ecx
movl %ecx, 0x8(%rdi,%r9)
movl 0x10(%rbx,%rax), %ecx
movl %ecx, 0x14(%rdi,%r9)
movl 0x14(%rbx,%rax), %r8d
leal -0x1(%r8), %r11d
movl %r11d, 0x18(%rdi,%r9)
movl %edx, %r11d
subl %r10d, %r11d
movl %r11d, 0x20(%rdi,%r9)
movl %r11d, 0x28(%rdi,%r9)
andl $0x0, 0x30(%rdi,%r9)
movb $0x1, 0x2c(%rdi,%r9)
movl $0x1, 0x24(%rdi,%r9)
movl 0x18(%rbx,%rax), %r10d
shrl $0x1e, %r10d
andb $0x1, %r10b
movb %r10b, 0x2e(%rdi,%r9)
movb 0x21(%rbx,%rax), %al
movb %al, 0x2d(%rdi,%r9)
movq %r13, %rdi
callq 0x352b9
movq %r15, %rdi
movq 0x2d8(%rsp), %r15
movq %r13, %rsi
callq 0x34955
movq 0xb0(%rsp), %rcx
incq %rcx
jmp 0x14917f
movq 0x358(%rsp), %rax
movl 0xc(%rax), %eax
movq 0x350(%rsp), %rcx
addl 0xc(%rcx), %eax
cmpq %rax, 0x10(%r15)
ja 0x1492fb
imulq $0xa8, 0x138(%rsp), %rax
movq 0x100(%rsp), %rcx
addq %rcx, %rax
addq $-0xa8, %rax
addq $0x298, %rsp            # imm = 0x298
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xa7d59(%rip), %rdi     # 0x1f101d
leaq 0xa6c30(%rip), %rsi     # 0x1efefb
leaq 0xa7bdd(%rip), %rcx     # 0x1f0eaf
movl $0x133c, %edx           # imm = 0x133C
callq 0x2110
leaq 0xa7a51(%rip), %rdi     # 0x1f0d34
leaq 0xa6c11(%rip), %rsi     # 0x1efefb
leaq 0xa7bbe(%rip), %rcx     # 0x1f0eaf
movl $0x1339, %edx           # imm = 0x1339
callq 0x2110
leaq 0xa76d3(%rip), %rdi     # 0x1f09d5
leaq 0xa6bf2(%rip), %rsi     # 0x1efefb
leaq 0xa7b9f(%rip), %rcx     # 0x1f0eaf
movl $0x13af, %edx           # imm = 0x13AF
callq 0x2110