// File: chhylp123[P]hifiasm/Correct.cpp
// Function: rphase_hc_back(overlap_region_alloc*, All_reads*, haplotype_evdience_alloc*, UC_Read*, UC_Read*, kv_ul_ov_t*, asg64_v*, asg64_v*, long, long, long, unsigned char, unsigned long, unsigned long, unsigned long)
void rphase_hc_back(overlap_region_alloc* ol, All_reads *rref, haplotype_evdience_alloc* hp, UC_Read* qu, UC_Read* tu, kv_ul_ov_t *c_idx, asg64_v* idx, asg64_v* buf, int64_t bd, int64_t wl, int64_t ql, uint8_t occ_thres/**, uint8_t is_dbg**/, uint64_t rid, uint64_t hpc_len, uint64_t std_bs)
{   
    int64_t on = ol->length, k, i, zwn, q[2]; 
    uint64_t m, l0, wi, wl0, si, ei, fi; overlap_region *z; ul_ov_t *cp;
    kv_resize(uint64_t, *idx, (ol->length)); 
    kv_resize(ul_ov_t, *c_idx, ol->length);

    for (k = idx->n = c_idx->n = 0; k < on; k++) {
        z = &(ol->list[k]); zwn = z->w_list.n; 
        // z->align_length = 0; z->overlapLen = (uint32_t)-1; z->non_homopolymer_errors = 0;
        if(!zwn) continue;
        for (i = 0; i < zwn; i++) {
            if(is_ualn_win(z->w_list.a[i])) continue;
            q[0] = z->w_list.a[i].x_start; q[1] = z->w_list.a[i].x_end;
            q[0] += bd; q[1] -= bd;
            if(q[1] >= q[0]) {
                m = ((uint64_t)q[0]); m <<= 32; 
                m += c_idx->n; kv_push(uint64_t, *idx, m);

                kv_pushp(ul_ov_t, *c_idx, &cp);
                ovlp_id(*cp) = k; ///ovlp id
                // ovlp_min_wid(*cp) = i; ///beg id of windows
                // ovlp_max_wid(*cp) = i; ///end id of windows
                ovlp_cur_wid(*cp) = i; ///cur id of windows
                ovlp_cur_xoff(*cp) = z->w_list.a[i].x_start; ///cur xpos
                ovlp_cur_yoff(*cp) = z->w_list.a[i].y_start; ///cur xpos
                ovlp_cur_ylen(*cp) = 0;
                ovlp_cur_coff(*cp) = 0; ///cur cigar off in cur window
                ovlp_bd(*cp) = bd;
            }
            // if(rid == 19350) {
            //     fprintf(stderr, "#########[M::%s] tid::%u\t%.*s\twid::%ld\tq::[%u, %u)\terr::%d\toerr::%u#########\n", __func__, z->y_id, (int)Get_NAME_LENGTH(R_INF, z->y_id), Get_NAME(R_INF, z->y_id),
            //             i, z->w_list.a[i].x_start, z->w_list.a[i].x_end+1, z->w_list.a[i].error, z->non_homopolymer_errors);
            // }
        }
    }

    int64_t srt_n = idx->n, s, e, t, os, oe, rm_n, rr; i = 0;
    radix_sort_bc64(idx->a, idx->a+idx->n);
    for (k = 1, i = 0; k < srt_n; k++) {
        if (k == srt_n || (idx->a[k]>>32) != (idx->a[i]>>32)) {
            if(k - i > 1) {
                for (t = i; t < k; t++) {
                    cp = &(c_idx->a[(uint32_t)idx->a[t]]);
                    // s = ol->list[ovlp_id(*cp)].w_list.a[ovlp_cur_wid(*cp)].x_start+ovlp_bd(*cp);
                    // assert(s == (int64_t)(idx->a[i]>>32));
                    m = ol->list[ovlp_id(*cp)].w_list.a[ovlp_cur_wid(*cp)].x_end+1-ovlp_bd(*cp);
                    m <<= 32; m += ((uint32_t)idx->a[t]); idx->a[t] = m;
                    // fprintf(stderr, "[M::%s] s::%ld\tsi::%lu\n", __func__, s, (idx->a[i]>>32));
                }
                radix_sort_bc64(idx->a + i, idx->a + k);
            }
            i = k;
        }
    }
    
    ResizeInitHaplotypeEvdience(hp);
    // if(is_dbg) fprintf(stderr, "[M::%s] ******\n", __func__);
    // fprintf(stderr, "[M::%s] ig_hpc::%lu\n", __func__, ig_hpc);
    i = 0; s = 0; e = wl; e = ((e<=ql)?e:ql); rr = 0;
    for (; s < ql; ) {
        // if(is_dbg) fprintf(stderr, "-0-[M::%s]\ts::%ld\te::%ld\n", __func__, s, e);
        if(rr) {
            // rr = 0;
            for (m = rm_n = srt_n; m < idx->n; m++) {
                cp = &(c_idx->a[idx->a[m]]);
                q[0] = ol->list[ovlp_id(*cp)].w_list.a[ovlp_cur_wid(*cp)].x_start+ovlp_bd(*cp);
                q[1] = ol->list[ovlp_id(*cp)].w_list.a[ovlp_cur_wid(*cp)].x_end+1-ovlp_bd(*cp);
                os = MAX(q[0], s); oe = MIN(q[1], e);
                if(oe > os) {
                    idx->a[rm_n++] = idx->a[m];
                    // if(q[1] <= e) rr = 1;
                }
            }
            idx->n = rm_n;
        }

        for (; i < srt_n; ++i) {
            cp = &(c_idx->a[(uint32_t)idx->a[i]]);
            q[0] = ol->list[ovlp_id(*cp)].w_list.a[ovlp_cur_wid(*cp)].x_start+ovlp_bd(*cp);
            q[1] = ol->list[ovlp_id(*cp)].w_list.a[ovlp_cur_wid(*cp)].x_end+1-ovlp_bd(*cp);
            if(q[0] >= e) break;
            os = MAX(q[0], s); oe = MIN(q[1], e);
            if(oe > os) {
                kv_push(uint64_t, *idx, ((uint32_t)idx->a[i]));
                // if(q[1] <= e) rr = 1;
            }
        }

        // fprintf(stderr, "[M::%s] s::%ld, e::%ld, srt_n::%ld, idx->n::%ld\n", __func__, s, e, srt_n, (int64_t)idx->n);
        // debug_inter(ol, c_idx, idx->a, srt_n, idx->a + srt_n, idx->n - srt_n, s, e);
        l0 = hp->length;
        // if(is_dbg) fprintf(stderr, "-1-[M::%s]\ts::%ld\te::%ld\n", __func__, s, e);
        rr = hc_phase_robust_rr(ol->list, rref, hp, qu->seq, qu->length, tu, idx->a + srt_n, idx->n - srt_n, s, e, c_idx->a, 1, occ_thres, hpc_len/**, is_dbg**/);
        /**
        for (wi = fi = ei = 0, si = ((uint64_t)-1), wl0 = e - s; wi < wl0; wi++) {
            if(hp->flag[wi] > 0) {
                if((hp->flag[wi] > occ_thres) && ((!hpc_len) || (!hpc_mask_ff(qu->seq, qu->length, wi + s, hpc_len, HPC_RR, hp->flag, e - s, s, HPC_CC)))) {
                    fi = 1; hp->nn_snp++;
                }
                ei = wi + 1; if(si == ((uint64_t)-1)) si = wi;
            }
        }
        **/
       for (wi = fi = ei = 0, si = ((uint64_t)-1), wl0 = e - s; wi < wl0; wi++) {
            if(hp->flag[wi] > 0) {
                if(hp->flag[wi] > occ_thres) {
                    fi = 1; hp->nn_snp++; hp->flag[wi] = 1;
                    if((hpc_len) && (hpc_mask_ff(qu->seq, qu->length, wi + s, hpc_len, HPC_RR, NULL, 0, 0, HPC_CC))) hp->flag[wi] = 3;
                    ei = wi + 1; if(si == ((uint64_t)-1)) si = wi;
                } else {
                    hp->flag[wi] = 0;
                }
            } 
        }

        if(fi) {
            // if(is_dbg) fprintf(stderr, "-2-[M::%s]\ts::%ld\te::%ld\n", __func__, s, e);
            rr = hc_phase_robust_rr(ol->list, rref, hp, qu->seq, qu->length, tu, idx->a + srt_n, idx->n - srt_n, s, e, c_idx->a, 0, occ_thres, hpc_len/**, is_dbg**/);
            if(hp->length > l0) radix_sort_haplotype_evdience_srt(hp->list + l0, hp->list + hp->length);
        }

        if(ei > si) memset(hp->flag + si, 0, (ei-si)*sizeof((*(hp->flag))));
        // if(is_dbg) fprintf(stderr, "-3-[M::%s]\ts::%ld\te::%ld\n", __func__, s, e);

        s += wl; e += wl; e = ((e<=ql)?e:ql);
    }

    // debug_snp_site(ol->list, rref, qu, hp->list, hp->length);


    SetSnpMatrix(hp, &(hp->nn_snp), &(ol->length), 0, NULL); 
    srt_n = hp->length; z = ((std_bs)?(ol->list):(NULL));
    for (k = 1, i = t = 0; k <= srt_n; ++k) {  
        if (k == srt_n || hp->list[k].site != hp->list[i].site) {
            t += push_info(hp, hp->list+i, k-i, hp->list+t, z, NULL, sc_wn);
            i = k;
        }
    }
    hp->length = t;

    // generate_haplotypes_naive_advance(hap, overlap_list, NULL);
    generate_haplotypes_naive_HiFi(hp, ol, 0.04, qu, ((std_bs)?(0):(1)), ((std_bs)?(0.05):(0)), ((std_bs)?(2):((uint64_t)-1)));
    // generate_haplotypes_DP(hap, overlap_list, R_INF, g_read->length, force_repeat);
    // generate_haplotypes_naive(hap, overlap_list, R_INF, g_read->length, force_repeat);

    // lable_large_indels(overlap_list, g_read->length, dumy, asm_opt.max_ov_diff_ec);
    

    // for (i = k = 0, dp = old_dp = 0, beg = 0, end = -1; i < srt_n; ++i) {///[beg, end) but coordinates in idx is [, ]
    //     ///if idx->a.a[] is qe
    //     old_dp = dp;
    //     if ((idx->a[i]>>32)&1) {
    //         --dp; end = (idx->a[i]>>33)+1;
    //     }else {
    //         //meet a new overlap; the overlaps are pushed by the x_pos_s
    //         ++dp; end = (idx->a[i]>>33);
    //         kv_push(uint64_t, *idx, ((uint32_t)idx->a[i]));
    //     }
    //     if((end > beg) && (old_dp >= 2)) {
    //         idx->n = srt_n + gen_region_phase_robust_rr(ol->list, idx->a+srt_n, idx->n-srt_n, beg, end, old_dp, c_idx->a, buf, mk);
    //     }
    //     beg = end;
    // }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movq 0x50(%rbp), %rax
movq 0x48(%rbp), %rax
movq 0x40(%rbp), %rax
movb 0x38(%rbp), %al
movq 0x30(%rbp), %rax
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x30(%rbp)
movq %rsi, -0x38(%rbp)
movq %rdx, -0x40(%rbp)
movq %rcx, -0x48(%rbp)
movq %r8, -0x50(%rbp)
movq %r9, -0x58(%rbp)
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x60(%rbp)
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x30(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jae 0x755dc
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rcx
movq 0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x8(%rax)
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rcx
shrq %rcx
movq 0x10(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x2, %rcx
movq 0x10(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x4, %rcx
movq 0x10(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x8, %rcx
movq 0x10(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x10, %rcx
movq 0x10(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x755de
jmp 0x755e0
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x30(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jae 0x756bc
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x58(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x10(%rax)
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rcx
shrq %rcx
movq -0x58(%rbp), %rax
orq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rcx
shrq $0x2, %rcx
movq -0x58(%rbp), %rax
orq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rcx
shrq $0x4, %rcx
movq -0x58(%rbp), %rax
orq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rcx
shrq $0x8, %rcx
movq -0x58(%rbp), %rax
orq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rcx
shrq $0x10, %rcx
movq -0x58(%rbp), %rax
orq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x10(%rax)
movq -0x58(%rbp), %rax
movq (%rax), %rdi
movq -0x58(%rbp), %rax
imulq $0x1c, 0x10(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq -0x58(%rbp), %rax
movq %rcx, (%rax)
jmp 0x756be
movq -0x58(%rbp), %rax
movq $0x0, 0x8(%rax)
movq 0x10(%rbp), %rax
movq $0x0, (%rax)
movq $0x0, -0x68(%rbp)
movq -0x68(%rbp), %rax
cmpq -0x60(%rbp), %rax
jge 0x75a3b
movq -0x30(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x68(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0xd0(%rbp)
movq -0xd0(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x78(%rbp)
cmpq $0x0, -0x78(%rbp)
jne 0x7571f
jmp 0x75a2a
movq $0x0, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpq -0x78(%rbp), %rax
jge 0x75a28
movq -0xd0(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x70(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movswl 0x14(%rax), %eax
cmpl $0x7fff, %eax           # imm = 0x7FFF
jne 0x75796
movq -0xd0(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x70(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpl $0x0, 0x1c(%rax)
jne 0x75796
movq -0xd0(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x70(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movswl 0x12(%rax), %eax
cmpl $0x0, %eax
jge 0x75796
jmp 0x75a17
movq -0xd0(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x70(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq (%rax), %rax
movq %rax, -0x90(%rbp)
movq -0xd0(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x70(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq 0x4(%rax), %rax
movq %rax, -0x88(%rbp)
movq 0x20(%rbp), %rax
addq -0x90(%rbp), %rax
movq %rax, -0x90(%rbp)
movq 0x20(%rbp), %rcx
movq -0x88(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
cmpq -0x90(%rbp), %rax
jl 0x75a15
movq -0x90(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
shlq $0x20, %rax
movq %rax, -0x98(%rbp)
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rax
addq -0x98(%rbp), %rax
movq %rax, -0x98(%rbp)
movq 0x10(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x758b9
movq 0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x75878
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x120(%rbp)
jmp 0x75886
movl $0x2, %eax
movq %rax, -0x120(%rbp)
jmp 0x75886
movq -0x120(%rbp), %rcx
movq 0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x98(%rbp), %rdx
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
jmp 0x758df
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x58(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jne 0x7594c
movq -0x58(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x75910
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rax
shlq %rax
movq %rax, -0x128(%rbp)
jmp 0x7591e
movl $0x2, %eax
movq %rax, -0x128(%rbp)
jmp 0x7591e
movq -0x128(%rbp), %rcx
movq -0x58(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x58(%rbp), %rax
movq (%rax), %rdi
movq -0x58(%rbp), %rax
imulq $0x1c, 0x10(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq -0x58(%rbp), %rax
movq %rcx, (%rax)
movq -0x58(%rbp), %rax
movq (%rax), %rax
movq -0x58(%rbp), %rdx
movq 0x8(%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0x8(%rdx)
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xd8(%rbp)
movq -0x68(%rbp), %rax
movl %eax, %ecx
movq -0xd8(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x70(%rbp), %rax
movl %eax, %ecx
movq -0xd8(%rbp), %rax
movl %ecx, (%rax)
movq -0xd0(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x70(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %ecx
movq -0xd8(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0xd0(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x70(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x8(%rax), %ecx
movq -0xd8(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0xd8(%rbp), %rax
movl $0x0, 0x14(%rax)
movq -0xd8(%rbp), %rax
movl $0x0, 0x8(%rax)
movq 0x20(%rbp), %rax
movl %eax, %edx
movq -0xd8(%rbp), %rax
movl 0x18(%rax), %ecx
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
andl $0xc0000000, %ecx       # imm = 0xC0000000
orl %edx, %ecx
movl %ecx, 0x18(%rax)
jmp 0x75a17
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x75727
jmp 0x75a2a
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
jmp 0x756dd
movq 0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xe0(%rbp)
movq $0x0, -0x70(%rbp)
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rsi
movq 0x10(%rbp), %rax
movq (%rax), %rax
shlq $0x3, %rax
addq %rax, %rsi
callq 0x2da20
movq $0x1, -0x68(%rbp)
movq $0x0, -0x70(%rbp)
movq -0x68(%rbp), %rax
cmpq -0xe0(%rbp), %rax
jge 0x75c27
movq -0x68(%rbp), %rax
cmpq -0xe0(%rbp), %rax
je 0x75ad3
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x68(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movq 0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x70(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
cmpq %rcx, %rax
je 0x75c14
movq -0x68(%rbp), %rax
subq -0x70(%rbp), %rax
cmpq $0x1, %rax
jle 0x75c0c
movq -0x70(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0xf8(%rbp), %rax
cmpq -0x68(%rbp), %rax
jge 0x75be1
movq -0x58(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0xf8(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xd8(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0xd8(%rbp), %rcx
movl 0xc(%rcx), %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movq 0x58(%rax), %rax
movq -0xd8(%rbp), %rcx
movl (%rcx), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
addl $0x1, %eax
movq -0xd8(%rbp), %rcx
movl 0x18(%rcx), %ecx
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
subl %ecx, %eax
cltq
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
shlq $0x20, %rax
movq %rax, -0x98(%rbp)
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0xf8(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
addq -0x98(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rdx
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0xf8(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0xf8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xf8(%rbp)
jmp 0x75af0
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x70(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x68(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
callq 0x2da20
movq -0x68(%rbp), %rax
movq %rax, -0x70(%rbp)
jmp 0x75c16
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
jmp 0x75a84
movq -0x40(%rbp), %rdi
callq 0xa2440
movq $0x0, -0x70(%rbp)
movq $0x0, -0xe8(%rbp)
movq 0x28(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0xf0(%rbp), %rax
cmpq 0x30(%rbp), %rax
jg 0x75c6b
movq -0xf0(%rbp), %rax
movq %rax, -0x130(%rbp)
jmp 0x75c76
movq 0x30(%rbp), %rax
movq %rax, -0x130(%rbp)
movq -0x130(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq $0x0, -0x118(%rbp)
movq -0xe8(%rbp), %rax
cmpq 0x30(%rbp), %rax
jge 0x76450
cmpq $0x0, -0x118(%rbp)
je 0x75e7b
movq -0xe0(%rbp), %rax
movq %rax, -0x110(%rbp)
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
movq 0x10(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x75e6d
movq -0x58(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x98(%rbp), %rdx
imulq $0x1c, (%rcx,%rdx,8), %rcx
addq %rcx, %rax
movq %rax, -0xd8(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0xd8(%rbp), %rcx
movl 0xc(%rcx), %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movq 0x58(%rax), %rax
movq -0xd8(%rbp), %rcx
movl (%rcx), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %eax
movq -0xd8(%rbp), %rcx
movl 0x18(%rcx), %ecx
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
addl %ecx, %eax
cltq
movq %rax, -0x90(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0xd8(%rbp), %rcx
movl 0xc(%rcx), %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movq 0x58(%rax), %rax
movq -0xd8(%rbp), %rcx
movl (%rcx), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
addl $0x1, %eax
movq -0xd8(%rbp), %rcx
movl 0x18(%rcx), %ecx
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
subl %ecx, %eax
cltq
movq %rax, -0x88(%rbp)
movq -0x90(%rbp), %rax
cmpq -0xe8(%rbp), %rax
jl 0x75db8
movq -0x90(%rbp), %rax
movq %rax, -0x138(%rbp)
jmp 0x75dc6
movq -0xe8(%rbp), %rax
movq %rax, -0x138(%rbp)
movq -0x138(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0x88(%rbp), %rax
cmpq -0xf0(%rbp), %rax
jg 0x75df4
movq -0x88(%rbp), %rax
movq %rax, -0x140(%rbp)
jmp 0x75e02
movq -0xf0(%rbp), %rax
movq %rax, -0x140(%rbp)
movq -0x140(%rbp), %rax
movq %rax, -0x108(%rbp)
movq -0x108(%rbp), %rax
cmpq -0x100(%rbp), %rax
jle 0x75e54
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x98(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x110(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x110(%rbp)
movq %rdx, (%rax,%rcx,8)
jmp 0x75e56
movq -0x98(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x98(%rbp)
jmp 0x75cc3
movq -0x110(%rbp), %rcx
movq 0x10(%rbp), %rax
movq %rcx, (%rax)
jmp 0x75e7d
movq -0x70(%rbp), %rax
cmpq -0xe0(%rbp), %rax
jge 0x760ab
movq -0x58(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x70(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xd8(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0xd8(%rbp), %rcx
movl 0xc(%rcx), %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movq 0x58(%rax), %rax
movq -0xd8(%rbp), %rcx
movl (%rcx), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %eax
movq -0xd8(%rbp), %rcx
movl 0x18(%rcx), %ecx
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
addl %ecx, %eax
cltq
movq %rax, -0x90(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0xd8(%rbp), %rcx
movl 0xc(%rcx), %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movq 0x58(%rax), %rax
movq -0xd8(%rbp), %rcx
movl (%rcx), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
addl $0x1, %eax
movq -0xd8(%rbp), %rcx
movl 0x18(%rcx), %ecx
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
subl %ecx, %eax
cltq
movq %rax, -0x88(%rbp)
movq -0x90(%rbp), %rax
cmpq -0xf0(%rbp), %rax
jl 0x75f66
jmp 0x760ab
movq -0x90(%rbp), %rax
cmpq -0xe8(%rbp), %rax
jl 0x75f86
movq -0x90(%rbp), %rax
movq %rax, -0x148(%rbp)
jmp 0x75f94
movq -0xe8(%rbp), %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0x88(%rbp), %rax
cmpq -0xf0(%rbp), %rax
jg 0x75fc2
movq -0x88(%rbp), %rax
movq %rax, -0x150(%rbp)
jmp 0x75fd0
movq -0xf0(%rbp), %rax
movq %rax, -0x150(%rbp)
movq -0x150(%rbp), %rax
movq %rax, -0x108(%rbp)
movq -0x108(%rbp), %rax
cmpq -0x100(%rbp), %rax
jle 0x76098
jmp 0x75ff4
movq 0x10(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x76065
movq 0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x76024
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x158(%rbp)
jmp 0x76032
movl $0x2, %eax
movq %rax, -0x158(%rbp)
jmp 0x76032
movq -0x158(%rbp), %rcx
movq 0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movl %eax, %edx
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
jmp 0x76098
jmp 0x7609a
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x75e7d
movq -0x40(%rbp), %rax
movl 0x10(%rax), %eax
movq %rax, -0xa0(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rdi
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x48(%rbp), %rax
movq (%rax), %rcx
movq -0x48(%rbp), %rax
movq 0x8(%rax), %r8
movq -0x50(%rbp), %r9
movq 0x10(%rbp), %rax
movq 0x10(%rax), %r12
movq -0xe0(%rbp), %rax
shlq $0x3, %rax
addq %rax, %r12
movq 0x10(%rbp), %rax
movq (%rax), %r15
subq -0xe0(%rbp), %r15
movq -0xe8(%rbp), %r14
movq -0xf0(%rbp), %rbx
movq -0x58(%rbp), %rax
movq (%rax), %r11
movb 0x38(%rbp), %r10b
movq 0x48(%rbp), %rax
movq %r12, (%rsp)
movq %r15, 0x8(%rsp)
movq %r14, 0x10(%rsp)
movq %rbx, 0x18(%rsp)
movq %r11, 0x20(%rsp)
movq $0x1, 0x28(%rsp)
movzbl %r10b, %r10d
movl %r10d, 0x30(%rsp)
movq %rax, 0x38(%rsp)
callq 0x71860
movq %rax, -0x118(%rbp)
movq $0x0, -0xc0(%rbp)
movq $0x0, -0xc8(%rbp)
movq $0x0, -0xa8(%rbp)
movq $-0x1, -0xb8(%rbp)
movq -0xf0(%rbp), %rax
subq -0xe8(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0xa8(%rbp), %rax
cmpq -0xb0(%rbp), %rax
jae 0x762cc
movq -0x40(%rbp), %rax
movq -0xa8(%rbp), %rcx
movzbl 0x18(%rax,%rcx), %eax
cmpl $0x0, %eax
jle 0x762b3
movq -0x40(%rbp), %rax
movq -0xa8(%rbp), %rcx
movzbl 0x18(%rax,%rcx), %eax
movzbl 0x38(%rbp), %ecx
cmpl %ecx, %eax
jle 0x762a1
movq $0x1, -0xc8(%rbp)
movq -0x40(%rbp), %rax
movl 0x230(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x230(%rax)
movq -0x40(%rbp), %rax
movq -0xa8(%rbp), %rcx
movb $0x1, 0x18(%rax,%rcx)
cmpq $0x0, 0x48(%rbp)
je 0x76275
movq -0x48(%rbp), %rax
movq (%rax), %rdi
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0xa8(%rbp), %rdx
addq -0xe8(%rbp), %rdx
movq 0x48(%rbp), %rcx
movl $0x4, %r8d
xorl %eax, %eax
movl %eax, %r9d
movq $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
movq $0x2, 0x10(%rsp)
callq 0x499f0
cmpb $0x0, %al
je 0x76275
movq -0x40(%rbp), %rax
movq -0xa8(%rbp), %rcx
movb $0x3, 0x18(%rax,%rcx)
movq -0xa8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xc0(%rbp)
cmpq $-0x1, -0xb8(%rbp)
jne 0x7629f
movq -0xa8(%rbp), %rax
movq %rax, -0xb8(%rbp)
jmp 0x762b1
movq -0x40(%rbp), %rax
movq -0xa8(%rbp), %rcx
movb $0x0, 0x18(%rax,%rcx)
jmp 0x762b3
jmp 0x762b5
movq -0xa8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa8(%rbp)
jmp 0x76198
cmpq $0x0, -0xc8(%rbp)
je 0x763b9
movq -0x30(%rbp), %rax
movq (%rax), %rdi
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x48(%rbp), %rax
movq (%rax), %rcx
movq -0x48(%rbp), %rax
movq 0x8(%rax), %r8
movq -0x50(%rbp), %r9
movq 0x10(%rbp), %rax
movq 0x10(%rax), %r12
movq -0xe0(%rbp), %rax
shlq $0x3, %rax
addq %rax, %r12
movq 0x10(%rbp), %rax
movq (%rax), %r15
subq -0xe0(%rbp), %r15
movq -0xe8(%rbp), %r14
movq -0xf0(%rbp), %rbx
movq -0x58(%rbp), %rax
movq (%rax), %r11
movb 0x38(%rbp), %r10b
movq 0x48(%rbp), %rax
xorl %r13d, %r13d
movq %r12, (%rsp)
movq %r15, 0x8(%rsp)
movq %r14, 0x10(%rsp)
movq %rbx, 0x18(%rsp)
movq %r11, 0x20(%rsp)
movq $0x0, 0x28(%rsp)
movzbl %r10b, %r10d
movl %r10d, 0x30(%rsp)
movq %rax, 0x38(%rsp)
callq 0x71860
movq %rax, -0x118(%rbp)
movq -0x40(%rbp), %rax
movl 0x10(%rax), %eax
cmpq -0xa0(%rbp), %rax
jbe 0x763b7
movq -0x40(%rbp), %rax
movq (%rax), %rdi
imulq $0x18, -0xa0(%rbp), %rax
addq %rax, %rdi
movq -0x40(%rbp), %rax
movq (%rax), %rsi
movq -0x40(%rbp), %rax
movl 0x10(%rax), %eax
imulq $0x18, %rax, %rax
addq %rax, %rsi
callq 0x2df30
jmp 0x763b9
movq -0xc0(%rbp), %rax
cmpq -0xb8(%rbp), %rax
jbe 0x763f1
movq -0x40(%rbp), %rdi
addq $0x18, %rdi
addq -0xb8(%rbp), %rdi
movq -0xc0(%rbp), %rdx
subq -0xb8(%rbp), %rdx
shlq $0x0, %rdx
xorl %esi, %esi
callq 0x2100
movq 0x28(%rbp), %rax
addq -0xe8(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq 0x28(%rbp), %rax
addq -0xf0(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0xf0(%rbp), %rax
cmpq 0x30(%rbp), %rax
jg 0x76432
movq -0xf0(%rbp), %rax
movq %rax, -0x160(%rbp)
jmp 0x7643d
movq 0x30(%rbp), %rax
movq %rax, -0x160(%rbp)
movq -0x160(%rbp), %rax
movq %rax, -0xf0(%rbp)
jmp 0x75c8f
movq -0x40(%rbp), %rdi
movq -0x40(%rbp), %rsi
addq $0x230, %rsi            # imm = 0x230
movq -0x30(%rbp), %rdx
addq $0x10, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
movl %eax, %r8d
callq 0xa24b0
movq -0x40(%rbp), %rax
movl 0x10(%rax), %eax
movq %rax, -0xe0(%rbp)
cmpq $0x0, 0x50(%rbp)
je 0x76498
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x168(%rbp)
jmp 0x764a3
xorl %eax, %eax
movq %rax, -0x168(%rbp)
jmp 0x764a3
movq -0x168(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq $0x1, -0x68(%rbp)
movq $0x0, -0xf8(%rbp)
movq $0x0, -0x70(%rbp)
movq -0x68(%rbp), %rax
cmpq -0xe0(%rbp), %rax
jg 0x7657f
movq -0x68(%rbp), %rax
cmpq -0xe0(%rbp), %rax
je 0x7650e
movq -0x40(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x68(%rbp), %rcx
addq %rcx, %rax
movl (%rax), %eax
movq -0x40(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x70(%rbp), %rdx
addq %rdx, %rcx
cmpl (%rcx), %eax
je 0x7656c
movq -0x40(%rbp), %rdi
movq -0x40(%rbp), %rax
movq (%rax), %rsi
imulq $0x18, -0x70(%rbp), %rax
addq %rax, %rsi
movq -0x68(%rbp), %rdx
subq -0x70(%rbp), %rdx
movq -0x40(%rbp), %rax
movq (%rax), %rcx
imulq $0x18, -0xf8(%rbp), %rax
addq %rax, %rcx
movq -0xd0(%rbp), %r8
xorl %eax, %eax
movl %eax, %r9d
movq $0x5, (%rsp)
callq 0x4a960
cltq
addq -0xf8(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x70(%rbp)
jmp 0x7656e
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
jmp 0x764cc
movq -0xf8(%rbp), %rax
movl %eax, %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x40(%rbp), %rax
movq %rax, -0x198(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x190(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x188(%rbp)
movq 0x50(%rbp), %rdx
movl $0x1, %eax
xorl %ecx, %ecx
cmpq $0x0, %rdx
cmovnel %ecx, %eax
cltq
movq %rax, -0x180(%rbp)
movq 0x50(%rbp), %rax
movsd 0x30bc69(%rip), %xmm0   # 0x382240
xorps %xmm1, %xmm1
movsd %xmm1, -0x178(%rbp)
cmpq $0x0, %rax
movsd %xmm0, -0x170(%rbp)
jne 0x76600
movsd -0x178(%rbp), %xmm0
movsd %xmm0, -0x170(%rbp)
movq -0x180(%rbp), %rcx
movq -0x188(%rbp), %rdx
movq -0x190(%rbp), %rsi
movq -0x198(%rbp), %rdi
movsd -0x170(%rbp), %xmm1
movq 0x50(%rbp), %r9
movq $-0x1, %r8
movl $0x2, %eax
cmpq $0x0, %r9
cmovneq %rax, %r8
movsd 0x3089ec(%rip), %xmm0   # 0x37f030
callq 0x41ef0
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax,%rax)