// File: /workspace/github_cpp_makefile_star2_O2/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 $0xd8, %rsp
movq %r8, 0x68(%rsp)
movq %rcx, 0x50(%rsp)
movq %rdx, 0x18(%rsp)
movq %rsi, 0x60(%rsp)
movq %rdi, %r13
movb 0x170(%rsp), %al
movb %al, 0xf(%rsp)
movq 0x168(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0x160(%rsp), %rax
movq %rax, 0xb0(%rsp)
movq 0x158(%rsp), %rax
movq %rax, 0x88(%rsp)
movq 0x150(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x148(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x140(%rsp), %rax
movq %rax, 0xa8(%rsp)
movb 0x138(%rsp), %al
movb %al, 0x78(%rsp)
movq 0x130(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq 0x128(%rsp), %rax
movq %rax, 0x98(%rsp)
movq 0x120(%rsp), %rdi
movq 0x118(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x110(%rsp), %r14
leaq 0x10(%r13), %rbx
movq 0x10(%r13), %rcx
movq %rcx, %rax
movq %rcx, %r15
cmpq %rcx, 0x8(%r14)
movq %r9, 0x10(%rsp)
movq %rdi, 0x28(%rsp)
jae 0x40e5b
leaq -0x1(%r15), %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(%r14)
movq 0x10(%r14), %rdi
leaq 0x8(,%rcx,8), %rsi
callq 0x2370
movq 0x28(%rsp), %rdi
movq 0x10(%rsp), %r9
movq %rax, 0x10(%r14)
movq (%rbx), %rax
movq %rbx, 0xc0(%rsp)
cmpq %rax, 0x10(%r9)
jae 0x40ebd
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
incq %rcx
movq %rcx, 0x10(%r9)
movq (%r9), %rdi
imulq $0x1c, %rcx, %rsi
callq 0x2370
movq 0x28(%rsp), %rdi
movq 0x10(%rsp), %r9
movq %rax, (%r9)
andq $0x0, 0x8(%r9)
andq $0x0, (%r14)
movl %edi, %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
movl %eax, 0x70(%rsp)
xorl %eax, %eax
testq %r15, %r15
cmovleq %rax, %r15
movq %r15, 0x48(%rsp)
xorl %r8d, %r8d
movq %r13, 0x38(%rsp)
movq %r14, 0x20(%rsp)
movq 0x20(%rsp), %rbx
cmpq 0x48(%rsp), %r8
je 0x41064
movq (%r13), %rax
imulq $0xa8, %r8, %rcx
movq 0x48(%rax,%rcx), %r13
testq %r13, %r13
je 0x41052
leaq 0x48(%rax,%rcx), %r12
movl $0x0, %eax
cmovleq %rax, %r13
xorl %r14d, %r14d
xorl %r15d, %r15d
movq %r8, 0x30(%rsp)
cmpq %r15, %r13
je 0x41052
movq 0x10(%r12), %rax
cmpw $0x7fff, 0x14(%rax,%r14) # imm = 0x7FFF
jne 0x40f5b
cmpl $0x0, 0x1c(%rax,%r14)
jne 0x40f5b
cmpw $0x0, 0x12(%rax,%r14)
js 0x41046
movslq (%rax,%r14), %rbp
movslq 0x4(%rax,%r14), %rax
addq %rdi, %rbp
subq %rdi, %rax
cmpq %rbp, %rax
jl 0x41046
shlq $0x20, %rbp
addq 0x8(%r9), %rbp
movq (%rbx), %rcx
movq 0x10(%rbx), %rax
cmpq 0x8(%rbx), %rcx
jne 0x40fb2
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
pushq $0x2
popq %rcx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%rbx)
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x2370
movq 0x10(%rsp), %r9
movq %rax, 0x10(%rbx)
movq (%rbx), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%rbx)
movq %rbp, (%rax,%rcx,8)
movq (%r9), %rax
movq 0x8(%r9), %rcx
cmpq 0x10(%r9), %rcx
jne 0x40ff4
leaq (%rcx,%rcx), %rdx
testq %rcx, %rcx
pushq $0x2
popq %rcx
cmoveq %rcx, %rdx
movq %rdx, 0x10(%r9)
imulq $0x1c, %rdx, %rsi
movq %rax, %rdi
callq 0x2370
movq 0x10(%rsp), %r9
movq %rax, (%r9)
movq 0x8(%r9), %rcx
movq 0x28(%rsp), %rdi
movq 0x30(%rsp), %r8
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%r9)
imulq $0x1c, %rcx, %rcx
movl %r8d, 0xc(%rax,%rcx)
movl %r15d, (%rax,%rcx)
movq 0x10(%r12), %rdx
movl (%rdx,%r14), %esi
movl %esi, 0x4(%rax,%rcx)
movl 0x8(%rdx,%r14), %edx
movl %edx, 0x10(%rax,%rcx)
andl $0x0, 0x14(%rax,%rcx)
andl $0x0, 0x8(%rax,%rcx)
movl 0x18(%rax,%rcx), %edx
movl $0xc0000000, %esi       # imm = 0xC0000000
andl %esi, %edx
addl 0x70(%rsp), %edx
movl %edx, 0x18(%rax,%rcx)
incq %r15
addq $0x20, %r14
jmp 0x40f2e
incq %r8
movq 0x38(%rsp), %r13
movq 0x20(%rsp), %r14
jmp 0x40ef1
movq (%r14), %rbp
movq 0x10(%r14), %rdi
leaq (%rdi,%rbp,8), %rsi
callq 0x1905d
xorl %eax, %eax
testq %rbp, %rbp
movl $0x0, %ebx
cmovgq %rbp, %rbx
incq %rbx
pushq $0x1
popq %r14
movl $0x3fffffff, %r15d      # imm = 0x3FFFFFFF
movq 0x18(%rsp), %rsi
cmpq %rbx, %r14
je 0x41152
cmpq %rbp, %r14
je 0x410c1
movq 0x20(%rsp), %rcx
movq 0x10(%rcx), %rcx
movq (%rcx,%rax,8), %rdx
xorq (%rcx,%r14,8), %rdx
shrq $0x20, %rdx
jne 0x410c1
movq %rax, %rcx
jmp 0x41147
movq %r14, %rdx
subq %rax, %rdx
movq %r14, %rcx
cmpq $0x2, %rdx
jl 0x41147
movq %rax, %rcx
movq 0x10(%rsp), %r11
cmpq %r14, %rcx
jge 0x41129
movq (%r11), %rdx
movq 0x20(%rsp), %rsi
movq 0x10(%rsi), %rsi
movl (%rsi,%rcx,8), %edi
imulq $0x1c, %rdi, %rdi
movq (%r13), %r8
movl (%rdx,%rdi), %r9d
movl 0xc(%rdx,%rdi), %r10d
imulq $0xa8, %r10, %r10
movq 0x58(%r8,%r10), %r8
shlq $0x5, %r9
movl 0x4(%r8,%r9), %r8d
movl 0x18(%rdx,%rdi), %edx
andl %r15d, %edx
negl %edx
addl %r8d, %edx
incl %edx
movl %edx, 0x4(%rsi,%rcx,8)
incq %rcx
jmp 0x410d8
movq 0x20(%rsp), %rcx
movq 0x10(%rcx), %rcx
leaq (%rcx,%rax,8), %rdi
leaq (%rcx,%r14,8), %rsi
callq 0x1905d
movq %r14, %rcx
movq 0x18(%rsp), %rsi
incq %r14
movq %rcx, %rax
jmp 0x41094
andl $0x0, 0x230(%rsi)
andq $0x0, 0x220(%rsi)
leaq 0x230(%rsi), %rax
movq %rax, 0xb8(%rsp)
andl $0x0, 0x10(%rsi)
andq $0x0, 0x8(%rsi)
leaq 0x18(%rsi), %rdi
movq $0x0, 0x28(%rsp)
movl $0x1ac, %edx            # imm = 0x1AC
movq %rdi, 0xc8(%rsp)
xorl %esi, %esi
callq 0x20e0
movq 0xa0(%rsp), %rax
movq 0x98(%rsp), %rcx
cmpq %rax, %rcx
movq %rax, %r14
cmovlq %rcx, %r14
xorl %ebx, %ebx
xorl %r12d, %r12d
movq $0x0, 0x30(%rsp)
movq 0x10(%rsp), %r11
movq 0x20(%rsp), %r15
movq %rbp, 0xd0(%rsp)
cmpq %rax, %r12
jge 0x414f7
cmpq $0x0, 0x30(%rsp)
je 0x41263
movq %rbp, %rcx
movq %rbp, %rax
cmpq (%r15), %rcx
jae 0x41260
movq (%r11), %rdi
movq 0x10(%r15), %rdx
movq (%rdx,%rcx,8), %rsi
imulq $0x1c, %rsi, %r8
movq (%r13), %r9
movl (%rdi,%r8), %r10d
movl 0xc(%rdi,%r8), %r11d
imulq $0xa8, %r11, %r11
movq 0x58(%r9,%r11), %r9
shlq $0x5, %r10
movslq (%r9,%r10), %r11
movl 0x18(%rdi,%r8), %edi
andl $0x3fffffff, %edi       # imm = 0x3FFFFFFF
addq %rdi, %r11
movl 0x4(%r9,%r10), %r8d
subl %edi, %r8d
incl %r8d
movslq %r8d, %rdi
cmpq %r11, %r12
cmovgq %r12, %r11
cmpq %rdi, %r14
cmovlq %r14, %rdi
cmpq %r11, %rdi
jle 0x41256
movq %rsi, (%rdx,%rax,8)
incq %rax
incq %rcx
movq 0x10(%rsp), %r11
jmp 0x411eb
movq %rax, (%r15)
movq 0x10(%r15), %rax
movq (%r13), %rdi
movq (%r11), %r8
cmpq %rbp, %rbx
jge 0x4131a
movl (%rax,%rbx,8), %ecx
imulq $0x1c, %rcx, %r10
movl (%r8,%r10), %esi
movl 0xc(%r8,%r10), %edx
imulq $0xa8, %rdx, %rdx
movq 0x58(%rdi,%rdx), %r9
shlq $0x5, %rsi
movslq (%r9,%rsi), %rdx
movl 0x18(%r8,%r10), %r10d
andl $0x3fffffff, %r10d      # imm = 0x3FFFFFFF
addq %r10, %rdx
cmpq %rdx, %r14
jle 0x4131a
addq %rsi, %r9
movl 0x4(%r9), %esi
subl %r10d, %esi
incl %esi
movslq %esi, %rsi
cmpq %rdx, %r12
cmovgq %r12, %rdx
cmpq %rsi, %r14
cmovlq %r14, %rsi
cmpq %rdx, %rsi
jle 0x41312
movq (%r15), %rdx
cmpq 0x8(%r15), %rdx
jne 0x41307
leaq (%rdx,%rdx), %rsi
testq %rdx, %rdx
pushq $0x2
popq %rcx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%r15)
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x2370
movq 0x10(%rsp), %r11
movq %rax, 0x10(%r15)
movl (%rax,%rbx,8), %ecx
movq (%r15), %rdx
leaq 0x1(%rdx), %rsi
movq %rsi, (%r15)
movq %rcx, (%rax,%rdx,8)
incq %rbx
jmp 0x41267
movq 0x18(%rsp), %rdx
movl 0x10(%rdx), %ecx
movq %rcx, 0x70(%rsp)
movq 0x50(%rsp), %rcx
movq (%rcx), %rcx
leaq (%rax,%rbp,8), %rax
movq (%r15), %r10
subq %rbp, %r10
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %r9
pushq 0x40(%rsp)
pushq $0x0
pushq $0x1
pushq %r8
pushq %r14
pushq %r12
pushq %r10
pushq %rax
callq 0x3d11d
addq $0x40, %rsp
movq %rax, 0x30(%rsp)
movq 0x28(%rsp), %rax
leaq (%r14,%rax), %r15
xorl %ebp, %ebp
pushq $-0x1
popq %r13
xorl %edx, %edx
xorl %eax, %eax
cmpq %rbp, %r15
je 0x41409
movq 0x18(%rsp), %rsi
movb 0x18(%rsi,%rbp), %cl
testb %cl, %cl
je 0x41401
cmpb 0x78(%rsp), %cl
jbe 0x413fc
incl 0x230(%rsi)
movb $0x1, 0x18(%rsi,%rbp)
cmpq $0x0, 0x40(%rsp)
je 0x413eb
movq 0x50(%rsp), %rax
movq (%rax), %rdi
movq 0x8(%rax), %rsi
leaq (%r12,%rbp), %rdx
subq $0x20, %rsp
xorps %xmm0, %xmm0
movups %xmm0, (%rsp)
movq $0x2, 0x10(%rsp)
movq 0x60(%rsp), %rcx
pushq $0x4
popq %r8
xorl %r9d, %r9d
callq 0x27ce8
movq 0x38(%rsp), %rcx
addq $0x20, %rsp
testb %al, %al
je 0x413eb
movb $0x3, 0x18(%rcx,%rbp)
leaq 0x1(%rbp), %rdx
cmpq $-0x1, %r13
cmoveq %rbp, %r13
pushq $0x1
popq %rax
jmp 0x41401
movb $0x0, 0x18(%rsi,%rbp)
incq %rbp
jmp 0x41375
testq %rax, %rax
movq 0x10(%rsp), %r11
movq 0xd0(%rsp), %rbp
je 0x414aa
movq %rdx, 0x48(%rsp)
movq 0x38(%rsp), %rax
movq (%rax), %rdi
movq 0x50(%rsp), %rax
movq (%rax), %rcx
leaq (,%rbp,8), %rax
movq 0x20(%rsp), %rdx
addq 0x10(%rdx), %rax
movq (%rdx), %r8
subq %rbp, %r8
movq 0x60(%rsp), %rsi
movq 0x18(%rsp), %r15
movq %r15, %rdx
movq 0x68(%rsp), %r9
pushq 0x40(%rsp)
pushq $0x0
pushq $0x0
pushq (%r11)
pushq %r14
pushq %r12
pushq %r8
pushq %rax
callq 0x3d11d
addq $0x40, %rsp
movq %rax, 0x30(%rsp)
movl 0x10(%r15), %eax
movq 0x70(%rsp), %rdx
cmpl %edx, %eax
jbe 0x414a0
movq (%r15), %rcx
imulq $0x18, %rdx, %rdi
addq %rcx, %rdi
imulq $0x18, %rax, %rsi
addq %rcx, %rsi
callq 0x192d4
movq 0x10(%rsp), %r11
movq 0x48(%rsp), %rdx
subq %r13, %rdx
movq 0x20(%rsp), %r15
jbe 0x414cb
addq 0xc8(%rsp), %r13
movq %r13, %rdi
xorl %esi, %esi
callq 0x20e0
movq 0x10(%rsp), %r11
movq 0x98(%rsp), %rcx
addq %rcx, %r12
addq %rcx, %r14
movq 0xa0(%rsp), %rax
cmpq %rax, %r14
cmovgeq %rax, %r14
subq %rcx, 0x28(%rsp)
movq 0x38(%rsp), %r13
jmp 0x411d4
xorl %r12d, %r12d
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
movq 0xb8(%rsp), %rsi
movq 0xc0(%rsp), %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x53d01
movq %rbx, %rdi
movl 0x10(%rbx), %eax
movq 0x58(%rsp), %rcx
orq 0x90(%rsp), %rcx
je 0x41535
movq (%r13), %r12
imulq $0x18, %rax, %rbx
leaq -0x18(%rbx), %r14
pushq $0x1
popq %r15
xorl %r13d, %r13d
xorl %eax, %eax
xorl %ebp, %ebp
cmpq %r13, %rbx
je 0x415aa
movq (%rdi), %rdi
cmpq %r13, %r14
je 0x41563
movl 0x18(%rdi,%r13), %ecx
imulq $0x18, %rax, %rdx
cmpl (%rdi,%rdx), %ecx
je 0x4159c
imulq $0x18, %rax, %rsi
addq %rdi, %rsi
movq %r15, %rdx
subq %rax, %rdx
imulq $0x18, %rbp, %rcx
addq %rdi, %rcx
subq $0x8, %rsp
movq 0x20(%rsp), %rdi
movq %r12, %r8
movq 0x98(%rsp), %r9
pushq $0x5
callq 0x283d2
popq %rcx
popq %rdx
cltq
addq %rax, %rbp
movq %r15, %rax
incq %r15
addq $0x18, %r13
movq 0x18(%rsp), %rdi
jmp 0x41548
movl %ebp, 0x10(%rdi)
cmpq $0x0, 0x88(%rsp)
je 0x415d0
xorl %r12d, %r12d
cmpq $0x0, 0x58(%rsp)
sete %al
movq 0x20(%rsp), %r15
jne 0x415ec
xorps %xmm0, %xmm0
jmp 0x415f4
xorl %ecx, %ecx
cmpq $0x0, 0x58(%rsp)
sete %cl
movq 0x38(%rsp), %r14
movq 0x20(%rsp), %r15
jne 0x41661
xorps %xmm1, %xmm1
jmp 0x41669
movsd 0x1a1f24(%rip), %xmm0   # 0x1e3518
movb %al, %r12b
movq %r12, %r13
negq %r13
orq $0x2, %r13
subq $0x8, %rsp
movq %rdi, %rbx
movq 0x40(%rsp), %r14
movq %r14, %rsi
movsd %xmm0, 0x80(%rsp)
movq %r13, %rcx
movq 0x90(%rsp), %r8
movq %r15, %r9
pushq 0xb8(%rsp)
pushq 0xb8(%rsp)
pushq 0x98(%rsp)
callq 0x25eb3
addq $0x20, %rsp
movsd 0x1a1eeb(%rip), %xmm0   # 0x1e3538
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rcx
movsd 0x78(%rsp), %xmm1
movq %r13, %r8
jmp 0x4167e
movsd 0x1a1eaf(%rip), %xmm1   # 0x1e3518
movq %rcx, %r8
negq %r8
orq $0x2, %r8
movsd 0x1a1ebd(%rip), %xmm0   # 0x1e3538
movq %r14, %rsi
callq 0x23d9f
cmpb $0x0, 0xf(%rsp)
movq 0x10(%rsp), %r9
je 0x41702
subq $0x50, %rsp
movq 0x90(%rsp), %rax
movq %rax, 0x38(%rsp)
andl $0x0, 0x28(%rsp)
movq 0xd0(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %r15, (%rsp)
movq %r14, %rdi
movq 0xb0(%rsp), %rsi
movq 0x68(%rsp), %rdx
movq 0xa0(%rsp), %rcx
movq 0xb8(%rsp), %r8
callq 0x40a58
addq $0x50, %rsp
testq %rax, %rax
je 0x41702
movq 0x18(%rsp), %rdi
movq %r14, %rsi
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x249a3
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq