// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/Correct.cpp
// Function: rphase_hc(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, Chain_Data*, asg8_v*, asg8_v*, unsigned char)
void rphase_hc(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, Chain_Data *dp, asg8_v *q8, asg8_v *t8, uint8_t lindel)
{   
    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; 
        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_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;
            }
        }
    }

    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);
    i = 0; s = 0; e = wl; e = ((e<=ql)?e:ql); rr = 0;
    for (; s < ql; ) {
        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) {
                    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)||(t8))?(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, t8, sc_wn);
            i = k;
        }
    }
    hp->length = t;

    if(!dp) {
        // 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);
    } else {
        gen_rphase_dp(hp, ol, qu, ((std_bs)?(0.05):(0)), ((std_bs)?(2):((uint64_t)-1)), dp, idx, buf, rid, q8);
        generate_haplotypes_naive_HiFi(hp, ol, 0.04, qu, ((std_bs)?(0):(1)), ((std_bs)?(0.05):(0)), ((std_bs)?(2):((uint64_t)-1)));
    }

    if(lindel) {
        if(rphase_lidel(ol, rref, hp, qu, tu, c_idx, idx, buf, bd, wl, ql, occ_thres, rid, hpc_len, std_bs)) {
            generate_haplotypes_sv(hp, ol, rid);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %r8, 0x68(%rsp)
movq %rcx, 0x40(%rsp)
movq %rdx, %r14
movq %rsi, 0x60(%rsp)
movq %rdi, %r15
movb 0x160(%rsp), %al
movb %al, 0x7(%rsp)
movq 0x158(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0x150(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x148(%rsp), %rax
movq %rax, 0xb0(%rsp)
movq 0x140(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x138(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x130(%rsp), %rax
movq %rax, 0x78(%rsp)
movb 0x128(%rsp), %al
movb %al, 0x70(%rsp)
movq 0x120(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x118(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq 0x110(%rsp), %rbx
movq 0x108(%rsp), %rax
movq %rax, 0x88(%rsp)
movq 0x100(%rsp), %rdi
movq 0x10(%r15), %rax
movq %rax, 0x18(%rsp)
cmpq %rax, 0x8(%rdi)
movq %r9, 0x10(%rsp)
movq %rdi, 0x8(%rsp)
jae 0x73121
movq 0x18(%rsp), %rax
decq %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
leaq 0x1(%rcx), %rax
movq %rax, 0x8(%rdi)
movq 0x10(%rdi), %rdi
leaq 0x8(,%rcx,8), %rsi
callq 0x2370
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %r9
movq %rax, 0x10(%rdi)
movq %r14, 0x20(%rsp)
movq 0x10(%r15), %rax
cmpq %rax, 0x10(%r9)
jae 0x73190
decq %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
leaq 0x1(%rcx), %rax
movq %rax, 0x10(%r9)
movq (%r9), %rdi
leaq (%rax,%rax,8), %rax
leaq (%rax,%rax,2), %rax
leaq (%rcx,%rax), %rsi
incq %rsi
callq 0x2370
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %r9
movq %rax, (%r9)
movq %r15, 0x30(%rsp)
xorl %eax, %eax
movq %rax, 0x8(%r9)
movq %rax, (%rdi)
cmpq $0x0, 0x18(%rsp)
jle 0x7332e
movl %ebx, %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
movl %eax, 0x48(%rsp)
xorl %r8d, %r8d
movq 0x30(%rsp), %rax
movq (%rax), %rax
imulq $0xa8, %r8, %rcx
movq 0x48(%rax,%rcx), %r12
testq %r12, %r12
jle 0x73320
leaq (%rax,%rcx), %r13
addq $0x48, %r13
xorl %r15d, %r15d
xorl %ebp, %ebp
movq %r8, 0x28(%rsp)
movq 0x10(%r13), %rax
cmpw $0x7fff, 0x14(%rax,%r15) # imm = 0x7FFF
jne 0x7320a
cmpl $0x0, 0x1c(%rax,%r15)
jne 0x7320a
cmpw $0x0, 0x12(%rax,%r15)
js 0x73310
movslq (%rax,%r15), %r14
movslq 0x4(%rax,%r15), %rax
addq %rbx, %r14
subq %rbx, %rax
cmpq %r14, %rax
jl 0x73310
shlq $0x20, %r14
addq 0x8(%r9), %r14
movq 0x8(%rdi), %rax
cmpq %rax, (%rdi)
jne 0x73267
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%rdi)
movq 0x10(%rdi), %rdi
shlq $0x3, %rsi
callq 0x2370
movq 0x28(%rsp), %r8
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %r9
movq %rax, 0x10(%rdi)
movq (%rdi), %rax
movq 0x10(%rdi), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%rdi)
movq %r14, (%rcx,%rax,8)
movq 0x10(%r9), %rax
cmpq %rax, 0x8(%r9)
jne 0x732bc
leaq (%rax,%rax), %rcx
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rcx
movq %rcx, 0x10(%r9)
movq (%r9), %rdi
leaq (%rcx,%rcx,8), %rax
leaq (%rax,%rax,2), %rsi
addq %rcx, %rsi
callq 0x2370
movq 0x28(%rsp), %r8
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %r9
movq %rax, (%r9)
movq (%r9), %rax
movq 0x8(%r9), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%r9)
leaq (%rcx,%rcx,8), %rdx
leaq (%rdx,%rdx,2), %rdx
addq %rcx, %rdx
movl %r8d, 0xc(%rax,%rdx)
movl %ebp, (%rax,%rdx)
movq 0x10(%r13), %rcx
movl (%rcx,%r15), %esi
movl %esi, 0x4(%rax,%rdx)
movl 0x8(%rcx,%r15), %ecx
movl %ecx, 0x10(%rax,%rdx)
xorl %ecx, %ecx
movl %ecx, 0x14(%rax,%rdx)
movl %ecx, 0x8(%rax,%rdx)
movl 0x18(%rax,%rdx), %ecx
movl $0xc0000000, %esi       # imm = 0xC0000000
andl %esi, %ecx
addl 0x48(%rsp), %ecx
movl %ecx, 0x18(%rax,%rdx)
incq %rbp
addq $0x20, %r15
cmpq %rbp, %r12
jne 0x731e7
incq %r8
cmpq 0x18(%rsp), %r8
jne 0x731b8
movq (%rdi), %r14
movq 0x10(%rdi), %rdi
leaq (%rdi,%r14,8), %rsi
callq 0x45d47
movq 0x8(%rsp), %r11
testq %r14, %r14
movq 0x20(%rsp), %r15
jle 0x73422
movl $0x1, %ebx
xorl %eax, %eax
movl $0x3fffffff, %ebp       # imm = 0x3FFFFFFF
cmpq %r14, %rbx
je 0x7337c
movq 0x10(%r11), %rcx
movq (%rcx,%rax,8), %rdx
xorq (%rcx,%rbx,8), %rdx
shrq $0x20, %rdx
jne 0x7337c
movq %rax, %rcx
jmp 0x7340f
movq %rbx, %rdx
subq %rax, %rdx
movq %rbx, %rcx
cmpq $0x2, %rdx
jl 0x7340f
cmpq %rax, %rbx
jle 0x733f6
movq 0x10(%rsp), %rcx
movq (%rcx), %rcx
movq 0x10(%r11), %rdx
movq 0x30(%rsp), %rsi
movq (%rsi), %rsi
movq %rax, %rdi
movl (%rdx,%rdi,8), %r8d
leaq (%r8,%r8,8), %r9
leaq (%r9,%r9,2), %r9
addq %r8, %r9
movl (%rcx,%r9), %r8d
movl 0xc(%rcx,%r9), %r10d
imulq $0xa8, %r10, %r10
movq 0x58(%rsi,%r10), %r10
shlq $0x5, %r8
movl 0x4(%r10,%r8), %r8d
movl 0x18(%rcx,%r9), %r9d
andl %ebp, %r9d
negl %r9d
addl %r9d, %r8d
incl %r8d
movl %r8d, 0x4(%rdx,%rdi,8)
incq %rdi
cmpq %rdi, %rbx
jne 0x733ab
movq 0x10(%r11), %rcx
leaq (%rcx,%rax,8), %rdi
leaq (%rcx,%rbx,8), %rsi
callq 0x45d47
movq 0x8(%rsp), %r11
movq %rbx, %rcx
leaq 0x1(%rbx), %rdx
movq %rcx, %rax
cmpq %r14, %rbx
movq %rdx, %rbx
jne 0x7335d
xorl %eax, %eax
movl %eax, 0x230(%r15)
movq %rax, 0x220(%r15)
movl %eax, 0x10(%r15)
movq %rax, 0x8(%r15)
leaq 0x18(%r15), %rdi
movl $0x1ac, %edx            # imm = 0x1AC
movq %rdi, 0x28(%rsp)
xorl %esi, %esi
callq 0x20e0
movq 0x8(%rsp), %r9
cmpq $0x0, 0x58(%rsp)
movq 0x30(%rsp), %rbp
jle 0x73854
movq 0x58(%rsp), %rbx
movq 0xa0(%rsp), %rax
cmpq %rbx, %rax
cmovlq %rax, %rbx
movq $0x0, 0xa8(%rsp)
xorl %eax, %eax
xorl %r13d, %r13d
xorl %r12d, %r12d
movq %r14, 0x18(%rsp)
testq %rax, %rax
je 0x73537
movq %r14, %rax
cmpq (%r9), %r14
jae 0x7352f
movq 0x10(%rsp), %rax
movq (%rax), %rcx
movq 0x10(%r9), %rdx
movq (%rbp), %rsi
movq 0x18(%rsp), %rdi
movq %rdi, %rax
movq (%rdx,%rdi,8), %r8
leaq (%r8,%r8,8), %r9
leaq (%r9,%r9,2), %r9
addq %r8, %r9
movl (%rcx,%r9), %r10d
movl 0xc(%rcx,%r9), %r11d
imulq $0xa8, %r11, %r11
movq 0x58(%rsi,%r11), %r11
shlq $0x5, %r10
movslq (%r11,%r10), %r14
movl 0x18(%rcx,%r9), %r9d
andl $0x3fffffff, %r9d       # imm = 0x3FFFFFFF
addq %r9, %r14
movl 0x4(%r11,%r10), %r10d
subl %r9d, %r10d
incl %r10d
movslq %r10d, %r9
cmpq %r14, %r13
cmovgq %r13, %r14
cmpq %r9, %rbx
cmovlq %rbx, %r9
cmpq %r14, %r9
jle 0x73522
movq %r8, (%rdx,%rax,8)
incq %rax
movq 0x8(%rsp), %r9
incq %rdi
cmpq (%r9), %rdi
jb 0x734bf
movq %rax, (%r9)
movq 0x18(%rsp), %r14
cmpq %r14, %r12
jge 0x7360e
movq 0x10(%rsp), %r10
movq (%r10), %rsi
movq 0x10(%r9), %rdi
movl (%rdi,%r12,8), %eax
leaq (%rax,%rax,8), %rcx
leaq (%rcx,%rcx,2), %r8
addq %rax, %r8
movq (%rbp), %rax
movl (%rsi,%r8), %ecx
movl 0xc(%rsi,%r8), %edx
imulq $0xa8, %rdx, %rdx
movq 0x58(%rax,%rdx), %rdx
shlq $0x5, %rcx
movslq (%rdx,%rcx), %rax
movl 0x18(%rsi,%r8), %esi
andl $0x3fffffff, %esi       # imm = 0x3FFFFFFF
addq %rsi, %rax
cmpq %rax, %rbx
jle 0x73613
addq %rcx, %rdx
movl 0x4(%rdx), %ecx
subl %esi, %ecx
incl %ecx
movslq %ecx, %rcx
cmpq %rax, %r13
cmovgq %r13, %rax
cmpq %rcx, %rbx
cmovlq %rbx, %rcx
cmpq %rax, %rcx
jle 0x735fd
movq 0x8(%r9), %rax
cmpq %rax, (%r9)
jne 0x735e7
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%r9)
shlq $0x3, %rsi
callq 0x2370
movq 0x8(%rsp), %r9
movq 0x10(%rsp), %r10
movq %rax, 0x10(%r9)
movq (%r9), %rax
movq 0x10(%r9), %rcx
movl (%rcx,%r12,8), %edx
leaq 0x1(%rax), %rsi
movq %rsi, (%r9)
movq %rdx, (%rcx,%rax,8)
incq %r12
cmpq %r12, %r14
jne 0x73545
movq %r14, %r12
jmp 0x73613
movq 0x10(%rsp), %r10
movl 0x10(%r15), %eax
movq %rax, 0xc0(%rsp)
movq (%rbp), %rdi
movq 0x40(%rsp), %rax
movq (%rax), %rcx
leaq (,%r14,8), %rdx
movq 0x10(%r9), %rax
movq %rdx, 0xb8(%rsp)
addq %rdx, %rax
movq (%r9), %r8
subq %r14, %r8
movq 0x60(%rsp), %rsi
movq %r15, %rdx
movq 0x68(%rsp), %r9
pushq 0x38(%rsp)
pushq $0x0
pushq $0x1
pushq (%r10)
pushq %rbx
pushq %r13
pushq %r8
pushq %rax
callq 0x6eeed
addq $0x40, %rsp
movq %rax, 0x48(%rsp)
cmpq %r13, %rbx
jne 0x73693
movb $0x1, %al
movq $-0x1, %r14
xorl %edx, %edx
movq 0x10(%rsp), %r8
movq 0x8(%rsp), %r9
jmp 0x73775
movq 0xa8(%rsp), %rcx
leaq (%rbx,%rcx), %rax
cmpq $0x1, %rax
movq %rbx, %r15
adcq %rcx, %r15
movq $-0x1, %r14
xorl %eax, %eax
xorl %edx, %edx
xorl %ebp, %ebp
movq 0x10(%rsp), %r8
movq 0x8(%rsp), %r9
movq 0x28(%rsp), %rsi
movb (%rsi,%rbp), %cl
testb %cl, %cl
je 0x73759
cmpb 0x70(%rsp), %cl
jbe 0x73755
movq 0x20(%rsp), %rax
incl 0x230(%rax)
movb $0x1, 0x18(%rax,%rbp)
cmpq $0x0, 0x38(%rsp)
je 0x73742
movq 0x40(%rsp), %rax
movq (%rax), %rdi
movq 0x8(%rax), %rsi
movq %r13, %rdx
addq %rbp, %rdx
subq $0x20, %rsp
xorps %xmm0, %xmm0
movups %xmm0, (%rsp)
movq $0x2, 0x10(%rsp)
movl $0x4, %r8d
movq 0x58(%rsp), %rcx
xorl %r9d, %r9d
callq 0x575c6
movq 0x48(%rsp), %rsi
movq 0x28(%rsp), %r9
movq 0x30(%rsp), %r8
addq $0x20, %rsp
testb %al, %al
je 0x73742
movb $0x3, (%rsi,%rbp)
leaq 0x1(%rbp), %rdx
cmpq $-0x1, %r14
cmoveq %rbp, %r14
movl $0x1, %eax
jmp 0x73759
movb $0x0, (%rsi,%rbp)
incq %rbp
cmpq %rbp, %r15
jne 0x736c5
testq %rax, %rax
sete %al
movq 0x20(%rsp), %r15
movq 0x30(%rsp), %rbp
testb %al, %al
jne 0x73806
movq %rdx, 0x98(%rsp)
movq (%rbp), %rdi
movq 0x40(%rsp), %rax
movq (%rax), %rcx
movq 0xb8(%rsp), %r10
addq 0x10(%r9), %r10
movq (%r9), %rax
subq 0x18(%rsp), %rax
movq 0x60(%rsp), %rsi
movq %r15, %rdx
movq 0x68(%rsp), %r9
pushq 0x38(%rsp)
pushq $0x0
pushq $0x0
pushq (%r8)
pushq %rbx
pushq %r13
pushq %rax
pushq %r10
callq 0x6eeed
addq $0x40, %rsp
movq %rax, 0x48(%rsp)
movl 0x10(%r15), %eax
movq 0xc0(%rsp), %rdx
cmpl %edx, %eax
jbe 0x737f9
movq (%r15), %rcx
leaq (%rdx,%rdx,2), %rdx
leaq (%rcx,%rdx,8), %rdi
leaq (%rax,%rax,2), %rax
leaq (%rcx,%rax,8), %rsi
callq 0x46007
movq 0x8(%rsp), %r9
movq 0x98(%rsp), %rdx
subq %r14, %rdx
jbe 0x7381f
addq 0x28(%rsp), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x20e0
movq 0x8(%rsp), %r9
movq 0xa0(%rsp), %rcx
addq %rcx, %r13
addq %rcx, %rbx
movq 0x58(%rsp), %rax
cmpq %rax, %rbx
cmovgeq %rax, %rbx
subq %rcx, 0xa8(%rsp)
cmpq %rax, %r13
movq 0x18(%rsp), %r14
movq 0x48(%rsp), %rax
jl 0x73492
movl 0x230(%r15), %eax
cmpq %rax, 0x228(%r15)
jae 0x738c7
decq %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
leaq 0x1(%rcx), %rax
movq %rax, 0x228(%r15)
movq 0x218(%r15), %rdi
leaq 0x8(,%rcx,8), %rax
leaq (%rax,%rax,4), %rsi
callq 0x2370
movq 0x8(%rsp), %r9
movq %rax, 0x218(%r15)
movq $0x0, 0x220(%r15)
movl 0x10(%rbp), %eax
movl %eax, 0x1c8(%r15)
movl $0x0, 0x1c4(%r15)
movl 0x10(%r15), %eax
xorl %ebx, %ebx
movq 0x50(%rsp), %rcx
orq 0x90(%rsp), %rcx
je 0x73902
movq (%rbp), %r14
jmp 0x73905
xorl %r14d, %r14d
testq %rax, %rax
je 0x7399f
shlq $0x3, %rax
leaq (%rax,%rax,2), %r15
leaq (%rax,%rax,2), %r12
addq $-0x18, %r12
movl $0x1, %r13d
xorl %ebp, %ebp
xorl %ebx, %ebx
xorl %eax, %eax
cmpq %rbp, %r12
je 0x73944
movq 0x20(%rsp), %rcx
movq (%rcx), %rcx
movl 0x18(%rcx,%rbp), %edx
leaq (%rax,%rax,2), %rsi
cmpl (%rcx,%rsi,8), %edx
je 0x73989
movq 0x20(%rsp), %rdi
movq (%rdi), %rcx
leaq (%rax,%rax,2), %rdx
leaq (%rcx,%rdx,8), %rsi
movq %r13, %rdx
subq %rax, %rdx
leaq (%rbx,%rbx,2), %rax
leaq (%rcx,%rax,8), %rcx
subq $0x8, %rsp
movq %r14, %r8
movq 0x98(%rsp), %r9
pushq $0x5
callq 0x57d10
movq 0x18(%rsp), %r9
addq $0x10, %rsp
cltq
addq %rax, %rbx
movq %r13, %rax
incq %r13
addq $0x18, %rbp
cmpq %rbp, %r15
jne 0x7392a
movq 0x20(%rsp), %r15
movq 0x30(%rsp), %rbp
movl %ebx, 0x10(%r15)
movq 0xb0(%rsp), %r8
testq %r8, %r8
je 0x739c3
xorl %r14d, %r14d
cmpq $0x0, 0x50(%rsp)
sete %al
jne 0x739d5
xorps %xmm0, %xmm0
jmp 0x739dd
xorl %ecx, %ecx
cmpq $0x0, 0x50(%rsp)
sete %cl
jne 0x73a42
xorps %xmm1, %xmm1
jmp 0x73a4a
movsd 0x1b1aeb(%rip), %xmm0   # 0x2254c8
movq 0x80(%rsp), %rdx
movq 0x78(%rsp), %r10
movb %al, %r14b
movq %r14, %r12
negq %r12
orq $0x2, %r12
subq $0x8, %rsp
movq %r15, %rdi
movq %rbp, %rsi
movsd %xmm0, 0x78(%rsp)
movq %r12, %rcx
pushq %rdx
pushq %r10
pushq 0xa0(%rsp)
callq 0x5505a
addq $0x20, %rsp
movsd 0x1b1ac3(%rip), %xmm0   # 0x2254e8
movq %r15, %rdi
movq %rbp, %rsi
movq %r14, %rcx
movsd 0x70(%rsp), %xmm1
movq %r12, %r8
callq 0x52bf1
movb 0x7(%rsp), %bl
jmp 0x73a6b
movsd 0x1b1a7e(%rip), %xmm1   # 0x2254c8
movb 0x7(%rsp), %bl
movq %rcx, %r8
negq %r8
orq $0x2, %r8
movsd 0x1b1a88(%rip), %xmm0   # 0x2254e8
movq %r15, %rdi
movq %rbp, %rsi
callq 0x52bf1
testb %bl, %bl
movq 0x10(%rsp), %r9
je 0x73aeb
subq $0x50, %rsp
movq 0x88(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0xd8(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x58(%rsp), %rax
movq %rax, (%rsp)
movl $0x0, 0x28(%rsp)
movq %rbp, %rdi
movq 0xb0(%rsp), %rsi
movq %r15, %rdx
movq 0x90(%rsp), %rcx
movq 0xb8(%rsp), %r8
callq 0x72d15
addq $0x50, %rsp
testq %rax, %rax
je 0x73aeb
movq %r15, %rdi
movq %rbp, %rsi
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x53989
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq