// File: 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
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4a8, %rsp            # imm = 0x4A8
movq 0x98(%rbp), %rax
movq 0x90(%rbp), %rax
movl 0x88(%rbp), %eax
movq 0x80(%rbp), %rax
movl 0x78(%rbp), %eax
movl 0x70(%rbp), %eax
movq 0x68(%rbp), %rax
movq 0x60(%rbp), %rax
movq 0x58(%rbp), %rax
movq 0x50(%rbp), %rax
movq 0x48(%rbp), %rax
movl 0x40(%rbp), %eax
movq 0x38(%rbp), %rax
movq 0x30(%rbp), %rax
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x30(%rbp)
movl %esi, -0x34(%rbp)
movq %rdx, -0x40(%rbp)
movq %rcx, -0x48(%rbp)
movq %r8, -0x50(%rbp)
movq %r9, -0x58(%rbp)
movsd %xmm0, -0x60(%rbp)
movsd %xmm1, -0x68(%rbp)
movq $0x0, -0x70(%rbp)
movq $0x0, -0x90(%rbp)
leaq 0x165169(%rip), %rax    # 0x3c47f8
movq 0x2a8(%rax), %rdx
movl $0x307, %eax            # imm = 0x307
movl $0x177, %ecx            # imm = 0x177
cmpq $0x0, %rdx
cmovnel %ecx, %eax
cltq
movq %rax, -0xa0(%rbp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, -0xc8(%rbp)
movq $0x0, -0xd0(%rbp)
movq $0x0, -0xd8(%rbp)
movq $0x0, -0xe0(%rbp)
movq $0x0, -0xe8(%rbp)
movq $0x0, -0xf0(%rbp)
leaq 0x1650fe(%rip), %rax    # 0x3c47f8
movsd 0xc0(%rax), %xmm0
movsd %xmm0, -0x1d8(%rbp)
leaq -0x2e0(%rbp), %rdi
xorl %esi, %esi
movl $0x108, %edx            # imm = 0x108
callq 0x2100
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x2e8(%rbp)
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x2f0(%rbp)
movl 0x70(%rbp), %edi
movq -0x58(%rbp), %rax
movl %eax, %esi
leaq -0x310(%rbp), %rdx
leaq -0x318(%rbp), %rcx
leaq -0x320(%rbp), %r8
leaq -0x330(%rbp), %r9
leaq -0x338(%rbp), %r10
leaq -0x328(%rbp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x1aca80
movq -0x2f0(%rbp), %rsi
movq -0xa0(%rbp), %rdx
movsd 0x12286f(%rip), %xmm0   # 0x382000
divsd -0x1d8(%rbp), %xmm0
cvttsd2si %xmm0, %eax
movslq %eax, %rcx
leaq -0x1d0(%rbp), %rdi
callq 0x9f470
cmpq $0x0, 0x60(%rbp)
je 0x25f7d7
movq 0x60(%rbp), %rax
movl (%rax), %eax
movq %rax, -0xc8(%rbp)
cmpq $0x2, -0xc8(%rbp)
jae 0x25f7d5
movq $0x2, -0xc8(%rbp)
jmp 0x25f7d7
cmpq $0x0, 0x68(%rbp)
je 0x25f802
movq 0x68(%rbp), %rax
movl (%rax), %eax
movq %rax, -0xd0(%rbp)
cmpq $0x2, -0xd0(%rbp)
jae 0x25f800
movq $0x2, -0xd0(%rbp)
jmp 0x25f802
movq 0x18(%rbp), %rax
movq $0x0, 0x10(%rax)
movq 0x90(%rbp), %rax
movl 0xc(%rax), %eax
movq 0x98(%rbp), %rcx
addl 0xc(%rcx), %eax
addl $0x1, %eax
movl %eax, %eax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq 0x18(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jbe 0x25f893
movq 0x18(%rbp), %rax
movq (%rax), %rdi
imulq $0xa8, -0x70(%rbp), %rsi
callq 0x2360
movq %rax, %rcx
movq 0x18(%rbp), %rax
movq %rcx, (%rax)
movq 0x18(%rbp), %rax
movq (%rax), %rdi
movq 0x18(%rbp), %rax
imulq $0xa8, 0x8(%rax), %rax
addq %rax, %rdi
movq -0x70(%rbp), %rax
movq 0x18(%rbp), %rcx
subq 0x8(%rcx), %rax
imulq $0xa8, %rax, %rdx
xorl %esi, %esi
callq 0x2100
movq -0x70(%rbp), %rcx
movq 0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x18(%rbp), %rax
movq (%rax), %rax
movq -0x70(%rbp), %rcx
subq $0x1, %rcx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xe8(%rbp)
movq 0x18(%rbp), %rax
movq $0x0, 0x18(%rax)
movq 0x90(%rbp), %rax
movl 0xc(%rax), %eax
movq 0x98(%rbp), %rcx
addl 0xc(%rcx), %eax
movl %eax, %eax
movq %rax, -0x70(%rbp)
movq 0x38(%rbp), %rax
movq $0x0, (%rax)
movq 0x90(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xd8(%rbp)
movq 0x90(%rbp), %rax
movl 0xc(%rax), %eax
movq %rax, -0x70(%rbp)
movq $0x0, -0xb0(%rbp)
movq $0x0, -0x78(%rbp)
movq -0x78(%rbp), %rax
cmpq -0x70(%rbp), %rax
jae 0x25fa89
movq -0xd8(%rbp), %rax
imulq $0x28, -0x78(%rbp), %rcx
addq %rcx, %rax
cmpb $0x0, 0x20(%rax)
je 0x25f950
movq -0x90(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x90(%rbp)
jmp 0x25fa78
movq -0xd8(%rbp), %rax
imulq $0x28, -0x78(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
shlq %rax
movq %rax, -0xa8(%rbp)
movq -0xd8(%rbp), %rax
imulq $0x28, -0x78(%rbp), %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
shrq $0x1f, %rax
andq $0x1, %rax
movl %eax, %eax
orq -0xa8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
shlq $0x20, %rax
movq %rax, -0xa8(%rbp)
movq -0x78(%rbp), %rax
shlq %rax
orq -0xa8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xb0(%rbp), %rax
orq -0xa8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq 0x38(%rbp), %rax
movq (%rax), %rax
movq 0x38(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x25fa52
movq 0x38(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x25fa11
movq 0x38(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x340(%rbp)
jmp 0x25fa1f
movl $0x2, %eax
movq %rax, -0x340(%rbp)
jmp 0x25fa1f
movq -0x340(%rbp), %rcx
movq 0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x38(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x38(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x38(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0xa8(%rbp), %rdx
movq 0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x38(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
jmp 0x25fa78
movq -0x78(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x78(%rbp)
jmp 0x25f916
movq 0x98(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xd8(%rbp)
movq 0x98(%rbp), %rax
movl 0xc(%rax), %eax
movq %rax, -0x70(%rbp)
movq $0x1, -0xb0(%rbp)
movq $0x0, -0x78(%rbp)
movq -0x78(%rbp), %rax
cmpq -0x70(%rbp), %rax
jae 0x25fc02
movq -0xd8(%rbp), %rax
imulq $0x28, -0x78(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
shlq %rax
movq %rax, -0xa8(%rbp)
movq -0xd8(%rbp), %rax
imulq $0x28, -0x78(%rbp), %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
shrq $0x1f, %rax
andq $0x1, %rax
movl %eax, %eax
orq -0xa8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
shlq $0x20, %rax
movq %rax, -0xa8(%rbp)
movq -0x78(%rbp), %rax
shlq %rax
orq -0xa8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xb0(%rbp), %rax
orq -0xa8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq 0x38(%rbp), %rax
movq (%rax), %rax
movq 0x38(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x25fbcb
movq 0x38(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x25fb8a
movq 0x38(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x348(%rbp)
jmp 0x25fb98
movl $0x2, %eax
movq %rax, -0x348(%rbp)
jmp 0x25fb98
movq -0x348(%rbp), %rcx
movq 0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x38(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x38(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x38(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0xa8(%rbp), %rdx
movq 0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x38(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
jmp 0x25fbf1
movq -0x78(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x78(%rbp)
jmp 0x25fabb
movq 0x38(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x38(%rbp), %rax
movq 0x10(%rax), %rsi
movq 0x38(%rbp), %rax
movq (%rax), %rax
shlq $0x3, %rax
addq %rax, %rsi
callq 0x24aba0
movq -0x2e8(%rbp), %rdi
movq -0x2f0(%rbp), %rax
movl %eax, %esi
movq -0x50(%rbp), %rax
movl %eax, %edx
movq -0x58(%rbp), %rax
movl %eax, %ecx
leaq 0x164bb0(%rip), %rax    # 0x3c47f8
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %r9d
movq -0x30(%rbp), %r13
leaq 0x16586a(%rip), %rax    # 0x3c54d0
movq (%rax), %r12
leaq 0x164b88(%rip), %rax    # 0x3c47f8
movl 0xa8(%rax), %r15d
movq 0x48(%rbp), %r14
movq 0x50(%rbp), %rbx
leaq 0x164b72(%rip), %rax    # 0x3c47f8
movl 0x1f8(%rax), %r11d
movq 0x58(%rbp), %r10
leaq 0x164b60(%rip), %rax    # 0x3c47f8
movl 0xa0(%rax), %eax
movl %eax, -0x34c(%rbp)
xorl %r8d, %r8d
xorl %eax, %eax
movl -0x34c(%rbp), %eax
movss 0x11f3b9(%rip), %xmm0   # 0x37f070
movq %r13, (%rsp)
movq %r12, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
movl %r15d, 0x18(%rsp)
movq %r14, 0x20(%rsp)
movq %rbx, 0x28(%rsp)
movq $0x0, 0x30(%rsp)
movl $0xffffffff, 0x38(%rsp) # imm = 0xFFFFFFFF
movl %r11d, 0x40(%rsp)
movq %r10, 0x48(%rsp)
movl %eax, 0x50(%rsp)
movl $0x0, 0x58(%rsp)
movq $0x0, 0x60(%rsp)
movq $0x0, 0x68(%rsp)
callq 0x1b3940
movq -0x30(%rbp), %rdi
leaq 0x1657b7(%rip), %rax    # 0x3c54d8
movq (%rax), %rsi
movq 0x18(%rbp), %rdx
movq 0x20(%rbp), %rcx
callq 0x1b2cc0
movq $0x1, -0x78(%rbp)
movq $0x0, -0x80(%rbp)
movq $0x0, -0x88(%rbp)
movq $0x0, -0x300(%rbp)
movq $0x0, -0x2f8(%rbp)
movq -0x30(%rbp), %rdi
movq 0x38(%rbp), %rax
movq 0x10(%rax), %r8
movq 0x38(%rbp), %rax
movq (%rax), %r9
leaq -0x78(%rbp), %rsi
leaq -0x80(%rbp), %rdx
leaq -0x88(%rbp), %rcx
leaq -0xb8(%rbp), %r10
leaq -0xc0(%rbp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x1b3040
cmpq $0x0, %rax
je 0x260208
cmpq $0x0, -0xc0(%rbp)
je 0x25fdca
movq -0x48(%rbp), %rdi
movq 0x10(%rbp), %rsi
movq -0xb8(%rbp), %rdx
callq 0xa500
jmp 0x25fdde
movq -0x48(%rbp), %rdi
movq 0x10(%rbp), %rsi
movq -0xb8(%rbp), %rdx
callq 0xa380
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x98(%rbp)
movq $0x0, -0x308(%rbp)
movq -0x30(%rbp), %rdi
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
movl -0x34(%rbp), %ecx
movq -0x2e8(%rbp), %r8
movq -0x2f0(%rbp), %r9
movq -0xb8(%rbp), %rax
movq %rax, -0x3c8(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x3c0(%rbp)
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x3b8(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0x3b0(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x3a8(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x3a0(%rbp)
movq 0x18(%rbp), %rax
movq %rax, -0x398(%rbp)
movq 0x20(%rbp), %rax
movq %rax, -0x390(%rbp)
movsd -0x60(%rbp), %xmm0
movl 0x40(%rbp), %eax
movl %eax, -0x384(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x380(%rbp)
movq -0xd0(%rbp), %rax
movq %rax, -0x378(%rbp)
movl 0x78(%rbp), %eax
movl %eax, -0x36c(%rbp)
movq 0x80(%rbp), %rax
movq %rax, -0x368(%rbp)
movsd -0x68(%rbp), %xmm1
movl 0x88(%rbp), %eax
movl %eax, -0x35c(%rbp)
movq -0x310(%rbp), %r13
movq -0x318(%rbp), %r12
movq -0x320(%rbp), %r15
movq -0x328(%rbp), %r14
movsd -0x330(%rbp), %xmm2
movsd -0x338(%rbp), %xmm3
movq 0x165709(%rip), %r11    # 0x3c5608
leaq -0x2e0(%rbp), %rbx
leaq -0x2f8(%rbp), %r10
leaq -0x300(%rbp), %rax
movq %rax, -0x358(%rbp)
movq -0x3c8(%rbp), %rax
movq %rax, (%rsp)
movq -0x3c0(%rbp), %rax
movq %rax, 0x8(%rsp)
movq -0x3b8(%rbp), %rax
movq %rax, 0x10(%rsp)
movq -0x3b0(%rbp), %rax
movq %rax, 0x18(%rsp)
movq -0x3a8(%rbp), %rax
movq %rax, 0x20(%rsp)
movq -0x3a0(%rbp), %rax
movq %rax, 0x28(%rsp)
movq -0x398(%rbp), %rax
movq %rax, 0x30(%rsp)
movq -0x390(%rbp), %rax
movq %rax, 0x38(%rsp)
movl -0x384(%rbp), %eax
movl %eax, 0x40(%rsp)
movq -0x380(%rbp), %rax
movq %rax, 0x48(%rsp)
movq -0x378(%rbp), %rax
movq %rax, 0x50(%rsp)
movl -0x36c(%rbp), %eax
movl %eax, 0x58(%rsp)
movq -0x368(%rbp), %rax
movq %rax, 0x60(%rsp)
movl -0x35c(%rbp), %eax
movl %eax, 0x68(%rsp)
movq -0x358(%rbp), %rax
movq %r13, 0x70(%rsp)
movq %r12, 0x78(%rsp)
movq %r15, 0x80(%rsp)
movq %r14, 0x88(%rsp)
movq %rbx, 0x90(%rsp)
movq %r11, 0x98(%rsp)
movq %r10, 0xa0(%rsp)
movq %rax, 0xa8(%rsp)
callq 0x1b31f0
cmpq $0x0, %rax
je 0x26018e
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rax
subq -0x98(%rbp), %rax
cmpq $0x1, %rax
jne 0x260023
jmp 0x260042
leaq 0x12fa29(%rip), %rdi    # 0x38fa53
leaq 0x12ebda(%rip), %rsi    # 0x38ec0b
movl $0x129e, %edx           # imm = 0x129E
leaq 0x12fa2c(%rip), %rcx    # 0x38fa69
callq 0x2130
movq 0x18(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x98(%rbp), %rcx
addq %rcx, %rax
movl $0x0, 0x1c(%rax)
movq 0x18(%rbp), %rax
movq (%rax), %rdi
imulq $0xa8, -0x98(%rbp), %rax
addq %rax, %rdi
movq 0x20(%rbp), %rsi
movq -0x2e8(%rbp), %rdx
movq -0x2f0(%rbp), %rcx
movq -0x48(%rbp), %rax
movq (%rax), %r8
movq -0x48(%rbp), %rax
movq 0x8(%rax), %r9
movq 0x28(%rbp), %r14
movq -0xe8(%rbp), %rbx
leaq 0x164752(%rip), %rax    # 0x3c47f8
movsd 0xc0(%rax), %xmm0
movq -0x1c8(%rbp), %r11
movl -0x34(%rbp), %eax
movl %eax, %r10d
movq 0x30(%rbp), %rax
movq %r14, (%rsp)
movq %rbx, 0x8(%rsp)
movq %r11, 0x10(%rsp)
movq %r10, 0x18(%rsp)
movq $0x1f, 0x20(%rsp)
movq $0x1, 0x28(%rsp)
movq %rax, 0x30(%rsp)
callq 0x9b8d0
cmpq $0x0, %rax
je 0x260122
movq -0xc0(%rbp), %rax
movl %eax, %ecx
movq 0x18(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x98(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x1c(%rax)
movq $0x1, -0x308(%rbp)
jmp 0x26018c
movq 0x18(%rbp), %rax
movq (%rax), %rdi
imulq $0xa8, -0x98(%rbp), %rax
addq %rax, %rdi
addq $0x38, %rdi
callq 0x1e1d0
movq 0x18(%rbp), %rax
movq (%rax), %rdi
imulq $0xa8, -0x98(%rbp), %rax
addq %rax, %rdi
addq $0x48, %rdi
callq 0x1e1f0
movq 0x18(%rbp), %rax
movq (%rax), %rdi
imulq $0xa8, -0x98(%rbp), %rax
addq %rax, %rdi
addq $0x78, %rdi
callq 0x1e1f0
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x10(%rax)
jmp 0x26018e
cmpq $0x0, -0x308(%rbp)
je 0x2601ef
movq 0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x88(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
shrq $0x20, %rdx
movq %rdx, (%rax,%rcx,8)
movq 0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x88(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
shlq $0x20, %rdx
movq %rdx, (%rax,%rcx,8)
movq 0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x88(%rbp), %rcx
movabsq $0xffffffff, %rdx       # imm = 0xFFFFFFFF
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x78(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x78(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x78(%rbp)
jmp 0x25fd62
movq $0x0, -0xa8(%rbp)
movq $0x0, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq 0x38(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x26027e
movq 0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x78(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpl $-0x1, %eax
jne 0x26023f
jmp 0x260270
movq 0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x78(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movq 0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq -0xa8(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0xa8(%rbp)
movq %rdx, (%rax,%rcx,8)
movq -0x78(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x78(%rbp)
jmp 0x26021b
movq -0xa8(%rbp), %rcx
movq 0x38(%rbp), %rax
movq %rcx, (%rax)
movq 0x90(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xd8(%rbp)
movq 0x90(%rbp), %rax
movl 0xc(%rax), %eax
movq %rax, -0x70(%rbp)
movq $0x0, -0x78(%rbp)
movq -0x78(%rbp), %rax
cmpq -0x70(%rbp), %rax
jae 0x26049a
movq -0xd8(%rbp), %rax
imulq $0x28, -0x78(%rbp), %rcx
addq %rcx, %rax
cmpb $0x0, 0x20(%rax)
je 0x260487
movq 0x18(%rbp), %rax
movq (%rax), %rax
movq 0x18(%rbp), %rdx
movq 0x10(%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0x10(%rdx)
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xf0(%rbp)
movl -0x34(%rbp), %ecx
movq -0xf0(%rbp), %rax
movl %ecx, (%rax)
movq -0xd8(%rbp), %rax
imulq $0x28, -0x78(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %ecx
movq -0xf0(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0xf0(%rbp), %rax
movl $0x0, 0xc(%rax)
movq -0xd8(%rbp), %rax
imulq $0x28, -0x78(%rbp), %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
shrq $0x1f, %rax
andq $0x1, %rax
movl %eax, %ecx
movq -0xf0(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0xd8(%rbp), %rax
imulq $0x28, -0x78(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rax
movl %eax, %ecx
movq -0xf0(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0xd8(%rbp), %rax
imulq $0x28, -0x78(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %ecx
subl $0x1, %ecx
movq -0xf0(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0xd8(%rbp), %rax
imulq $0x28, -0x78(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %ecx
movq -0xf0(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0xd8(%rbp), %rax
imulq $0x28, -0x78(%rbp), %rcx
addq %rcx, %rax
movl 0x14(%rax), %ecx
subl $0x1, %ecx
movq -0xf0(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0xf0(%rbp), %rax
movb $0x1, 0x2c(%rax)
movq -0xf0(%rbp), %rax
movl 0x8(%rax), %ecx
addl $0x1, %ecx
movq -0xf0(%rbp), %rax
subl 0x4(%rax), %ecx
movq -0xf0(%rbp), %rax
movl %ecx, 0x24(%rax)
movq -0xf0(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0xf0(%rbp), %rax
movl %ecx, 0x28(%rax)
movq -0xf0(%rbp), %rax
movb $0x0, 0x2e(%rax)
movq -0xf0(%rbp), %rax
movl $0x0, 0x30(%rax)
movq 0x28(%rbp), %rdi
movq -0xf0(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, %esi
movq -0xf0(%rbp), %rax
movl 0x8(%rax), %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %edx
movq -0xf0(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, %ecx
movq -0xf0(%rbp), %rax
movl 0x18(%rax), %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %r8d
callq 0x61ae0
movq -0xf0(%rbp), %rdi
movq 0x28(%rbp), %rsi
callq 0x60af0
jmp 0x260489
movq -0x78(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x78(%rbp)
jmp 0x2602b3
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0xa8(%rbp)
movq 0x20(%rbp), %rdi
callq 0x23090
movq $0x0, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq 0x38(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x260910
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x98(%rbp)
movq 0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x78(%rbp), %rcx
movq (%rax,%rcx,8), %rax
andq $0x1, %rax
cmpq $0x0, %rax
je 0x260522
movq 0x98(%rbp), %rax
movq (%rax), %rax
movq 0x38(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x78(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
shrl %ecx
movl %ecx, %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xe0(%rbp)
jmp 0x26054e
movq 0x90(%rbp), %rax
movq (%rax), %rax
movq 0x38(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x78(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
shrl %ecx
movl %ecx, %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xe0(%rbp)
movq -0xe0(%rbp), %rax
movq 0x18(%rax), %rax
shrq $0x1f, %rax
andq $0x1, %rax
cmpl $0x0, %eax
je 0x260581
movq -0x48(%rbp), %rdi
movq 0x10(%rbp), %rsi
movq -0xe0(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, %edx
callq 0xa500
jmp 0x26059a
movq -0x48(%rbp), %rdi
movq 0x10(%rbp), %rsi
movq -0xe0(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, %edx
callq 0xa380
movq -0x30(%rbp), %rdi
movl -0x34(%rbp), %eax
movl %eax, %esi
movq -0x2f0(%rbp), %rdx
movq -0xe0(%rbp), %rax
movl 0xc(%rax), %ecx
movq -0x48(%rbp), %rax
movq (%rax), %r8
movq -0x48(%rbp), %rax
movq 0x8(%rax), %r9
movq -0x50(%rbp), %rax
movq %rax, -0x418(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x410(%rbp)
movq 0x18(%rbp), %rax
movq %rax, -0x408(%rbp)
movq 0x20(%rbp), %rax
movq %rax, -0x400(%rbp)
movsd -0x60(%rbp), %xmm0
movl 0x40(%rbp), %eax
movl %eax, -0x3f4(%rbp)
movq 0x48(%rbp), %rax
movq %rax, -0x3f0(%rbp)
movq 0x50(%rbp), %rax
movq %rax, -0x3e8(%rbp)
movq 0x58(%rbp), %rax
movq %rax, -0x3e0(%rbp)
movq 0x60(%rbp), %rax
movq %rax, -0x3d8(%rbp)
movq 0x68(%rbp), %r13
movl 0x78(%rbp), %r12d
movq 0x80(%rbp), %r15
movsd -0x68(%rbp), %xmm1
movl 0x88(%rbp), %r14d
movq -0x310(%rbp), %rbx
movq -0x318(%rbp), %r11
movq -0x320(%rbp), %r10
movq -0x328(%rbp), %rax
movq %rax, -0x3d0(%rbp)
movq -0x418(%rbp), %rax
movsd -0x330(%rbp), %xmm2
movsd -0x338(%rbp), %xmm3
movq %rax, (%rsp)
movq -0x410(%rbp), %rax
movq %rax, 0x8(%rsp)
movq -0x408(%rbp), %rax
movq %rax, 0x10(%rsp)
movq -0x400(%rbp), %rax
movq %rax, 0x18(%rsp)
movl -0x3f4(%rbp), %eax
movl %eax, 0x20(%rsp)
movq -0x3f0(%rbp), %rax
movq %rax, 0x28(%rsp)
movq -0x3e8(%rbp), %rax
movq %rax, 0x30(%rsp)
movq -0x3e0(%rbp), %rax
movq %rax, 0x38(%rsp)
movq -0x3d8(%rbp), %rax
movq %rax, 0x40(%rsp)
movq -0x3d0(%rbp), %rax
movq %r13, 0x48(%rsp)
movl %r12d, 0x50(%rsp)
movq %r15, 0x58(%rsp)
movl %r14d, 0x60(%rsp)
movq %rbx, 0x68(%rsp)
movq %r11, 0x70(%rsp)
movq %r10, 0x78(%rsp)
movq %rax, 0x80(%rsp)
callq 0x1b3b90
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rax
subq -0x98(%rbp), %rax
cmpq $0x1, %rax
ja 0x26072e
jmp 0x26074d
leaq 0x12ee49(%rip), %rdi    # 0x38f57e
leaq 0x12e4cf(%rip), %rsi    # 0x38ec0b
movl $0x12de, %edx           # imm = 0x12DE
leaq 0x12f321(%rip), %rcx    # 0x38fa69
callq 0x2130
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rax
cmpq -0x98(%rbp), %rax
jbe 0x260825
movq 0x18(%rbp), %rax
movq (%rax), %rdi
imulq $0xa8, -0x98(%rbp), %rax
addq %rax, %rdi
movq 0x20(%rbp), %rsi
movq -0x2e8(%rbp), %rdx
movq -0x2f0(%rbp), %rcx
movq -0x48(%rbp), %rax
movq (%rax), %r8
movq -0x48(%rbp), %rax
movq 0x8(%rax), %r9
movq 0x28(%rbp), %r14
movq -0xe8(%rbp), %rbx
leaq 0x16404e(%rip), %rax    # 0x3c47f8
movsd 0xc0(%rax), %xmm0
movq -0x1c8(%rbp), %r11
movl -0x34(%rbp), %eax
movl %eax, %r10d
movq 0x30(%rbp), %rax
movq %r14, (%rsp)
movq %rbx, 0x8(%rsp)
movq %r11, 0x10(%rsp)
movq %r10, 0x18(%rsp)
movq $0x1f, 0x20(%rsp)
movq $0x1, 0x28(%rsp)
movq %rax, 0x30(%rsp)
callq 0x9b8d0
cmpq $0x0, %rax
je 0x260825
movq -0xe0(%rbp), %rax
movq 0x18(%rax), %rax
shrq $0x1f, %rax
andq $0x1, %rax
movl %eax, %ecx
movq 0x18(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x98(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x1c(%rax)
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rax
cmpq -0x98(%rbp), %rax
jbe 0x260854
movq 0x18(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x98(%rbp), %rcx
addq %rcx, %rax
movzbl 0x2c(%rax), %eax
cmpl $0x1, %eax
je 0x260859
jmp 0x2608ff
movq -0xa8(%rbp), %rax
cmpq -0x98(%rbp), %rax
je 0x2608ed
movq 0x18(%rbp), %rax
movq (%rax), %rsi
imulq $0xa8, -0xa8(%rbp), %rax
addq %rax, %rsi
leaq -0x198(%rbp), %rdi
movl $0xa8, %edx
callq 0x2180
movq 0x18(%rbp), %rax
movq (%rax), %rsi
imulq $0xa8, -0x98(%rbp), %rax
addq %rax, %rsi
movq 0x18(%rbp), %rax
movq (%rax), %rdi
imulq $0xa8, -0xa8(%rbp), %rax
addq %rax, %rdi
movl $0xa8, %edx
callq 0x2180
movq 0x18(%rbp), %rax
movq (%rax), %rdi
imulq $0xa8, -0x98(%rbp), %rax
addq %rax, %rdi
leaq -0x198(%rbp), %rsi
movl $0xa8, %edx
callq 0x2180
movq -0xa8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa8(%rbp)
movq -0x78(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x78(%rbp)
jmp 0x2604ba
movq -0xa8(%rbp), %rcx
movq 0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x90(%rbp), %rcx
movl 0xc(%rcx), %ecx
movq 0x98(%rbp), %rdx
addl 0xc(%rdx), %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
ja 0x260944
jmp 0x260963
leaq 0x12eda9(%rip), %rdi    # 0x38f6f4
leaq 0x12e2b9(%rip), %rsi    # 0x38ec0b
movl $0x12f3, %edx           # imm = 0x12F3
leaq 0x12f10b(%rip), %rcx    # 0x38fa69
callq 0x2130
movq -0xe8(%rbp), %rax
addq $0x4a8, %rsp            # imm = 0x4A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)