// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Correct.cpp
// Function: generate_haplotypes_naive_UL(haplotype_evdience_alloc*, overlap_region_alloc*, double, void*)
void generate_haplotypes_naive_UL(haplotype_evdience_alloc* hap, overlap_region_alloc* overlap_list, double up, void *km)
{
    if(hap->length == 0) return;
    uint64_t k, l, i, o, *a, ii, m_snp_stat, m_list, m_off;
    int64_t z; 
    SnpStats *s = NULL, *t = NULL;

    for (k = 1, l = 0, i = m_snp_stat = m_list = 0; k <= hap->snp_stat.n; ++k) {///filter snps
        if(k == hap->snp_stat.n || hap->snp_stat.a[k].site != hap->snp_stat.a[l].site) {
            if((l > 0) && (hap->snp_stat.a[l].site == (hap->snp_stat.a[l-1].site + 1))) {
                l = k; continue;
            }
            if((k < hap->snp_stat.n) && ((hap->snp_stat.a[l].site+1) == hap->snp_stat.a[k].site)) {
                l = k; continue;
            }

            for (; i < hap->length && hap->list[i].site != hap->snp_stat.a[l].site; i++);
            assert(i < hap->length && hap->list[i].site == hap->snp_stat.a[l].site);
            m_off = l - m_snp_stat; 
            for (; i < hap->length && hap->list[i].site == hap->snp_stat.a[l].site; i++) {
                assert(hap->list[i].overlapSite>=l && hap->list[i].overlapSite < k);
                // assert(hap->snp_stat.a[hap->list[i].overlapSite].site==hap->list[i].site);
                hap->list[m_list] = hap->list[i]; hap->list[m_list++].overlapSite -= m_off;
            }
        
            for (; l < k; l++) hap->snp_stat.a[m_snp_stat++] = hap->snp_stat.a[l];
        }
    }
    hap->snp_stat.n = m_snp_stat; hap->length = m_list;
    if(hap->snp_stat.n == 0 || hap->length == 0) return;

    hap->snp_srt.n = 0;
    radix_sort_haplotype_evdience_id_srt(hap->list, hap->list + hap->length);
    for (k = 1, l = 0; k <= hap->length; ++k) {  
        if (k == hap->length || hap->list[k].overlapID != hap->list[l].overlapID) {
            for (i = l, o = 0; i < k; i++) {
                if(hap->list[i].type!=1) continue;///mismatch
                s = &(hap->snp_stat.a[hap->list[i].overlapSite]); 
                assert(s->site == hap->list[i].site);
                if(s->occ_0 < 2 || s->occ_1 < 2) continue;
                if(s->occ_0 >= asm_opt.s_hap_cov && s->occ_1 >= asm_opt.infor_cov) o++;///allels must be real
            }
            if(o > 0) {
                o = ((uint32_t)-1) - o;
                o <<= 32; o += l; 
                if(!km) kv_push(uint64_t, hap->snp_srt, o);
                else kv_push_km(km, uint64_t, hap->snp_srt, o);
            }
            l = k;
        }
    }
    
    if (hap->snp_srt.n > 0) {
        radix_sort_bc64(hap->snp_srt.a, hap->snp_srt.a + hap->snp_srt.n);///sort by how many snps in one overlap
        for (k = 0; k < hap->snp_srt.n; k++) {
            o = 0; l = (uint32_t)hap->snp_srt.a[k];
            for (i = l; i < hap->length && hap->list[i].overlapID == hap->list[l].overlapID; i++) {
                if(hap->list[i].type!=1) continue;
                s = &(hap->snp_stat.a[hap->list[i].overlapSite]);
                if(s->occ_0 < 2 || s->occ_1 < 2) continue;
                if(s->occ_0 >= asm_opt.s_hap_cov && s->occ_1 >= asm_opt.infor_cov) o++;
            }
            if(o == 0) continue;

            ii = hap->list[l].overlapID;
            if(overlap_list->list[ii].is_match == 1) overlap_list->list[ii].is_match = 2;
            for (i = l; i < hap->length && hap->list[i].overlapID == hap->list[l].overlapID; i++) {
                if(hap->list[i].type==1){
                    s = &(hap->snp_stat.a[hap->list[i].overlapSite]);
                    s->score = 1; 
                } ///else if((hap->list[i].type==0) && (o>=(overlap_list->list[ii].align_length*up))) {
                else if(hap->list[i].type==0) {
                    ///not real allels
                    z = hap->list[i].overlapSite; s = &(hap->snp_stat.a[z]);
                    for (z = hap->list[i].overlapSite; z >= 0; z--) {
                        t = &(hap->snp_stat.a[z]);
                        if(s->site!=t->site) break;
                        t->occ_0 -= hap->list[i].cov;
                        assert(t->occ_0 >= 1);
                    }
                }
            }
        }

        for (k = 0; k < hap->snp_srt.n; k++) {///sorted by how many allels in each overlap; more -> less
            o = 0; l = (uint32_t)hap->snp_srt.a[k];
            for (i = l; i < hap->length && hap->list[i].overlapID == hap->list[l].overlapID; i++) {
                if(hap->list[i].type!=1) continue;
                s = &(hap->snp_stat.a[hap->list[i].overlapSite]);
                if(s->occ_0 < 2 || s->occ_1 < 2) continue;
                if(s->score == 1) o++;
            }
            ii = hap->list[l].overlapID;
            ///for HiFi, do not flip trans to cis
            // if(overlap_list->list[ii].is_match == 2 && o == 0) {
            //     overlap_list->list[ii].is_match = 1;
            // }
            if(overlap_list->list[ii].is_match == 1 && o > 0) {
                overlap_list->list[ii].is_match = 2;
            }
        }


        for (k = 1, l = 0; k <= hap->length; ++k) {  ///reset snp_stat
            if (k == hap->length || hap->list[k].overlapID != hap->list[l].overlapID) {
                ii = hap->list[l].overlapID;
                if(overlap_list->list[ii].is_match==1) {
                    for (i = l; i < k; i++) {
                        if(hap->list[i].type==1) {
                            hap->snp_stat.a[hap->list[i].overlapSite].score = -1;
                        }
                    }
                }
                l = k;
            }
        } 
    }

    

    hap->snp_srt.n = 0;
    for (k = 1, l = 0; k <= hap->length; ++k) {  
        if (k == hap->length || hap->list[k].overlapID != hap->list[l].overlapID) {
            if(overlap_list->list[hap->list[l].overlapID].is_match == 2) {
                l = k;
                continue;
            }
            for (i = l, o = 0; i < k; i++) {
                if(hap->list[i].type!=1) continue;
                s = &(hap->snp_stat.a[hap->list[i].overlapSite]);
                if(s->occ_0 < 2 || s->occ_1 < 2) continue;
                if(s->occ_0 >= asm_opt.s_hap_cov && s->occ_1 >= asm_opt.infor_cov) continue;
                if(s->score == 1) continue;
                o++; 
                if(!km) kv_push(uint64_t, hap->snp_srt, hap->list[i].overlapSite);
                else kv_push_km(km, uint64_t, hap->snp_srt, hap->list[i].overlapSite);
            }
            hap->snp_srt.n -= o;
            ///there are at least two variants at one read
            if(o>=(overlap_list->list[hap->list[l].overlapID].align_length*up)) {
                radix_sort_bc64(hap->snp_srt.a + hap->snp_srt.n, hap->snp_srt.a + hap->snp_srt.n + o);
                a = hap->snp_srt.a + hap->snp_srt.n;
                for (i = z = 0; i < o; i++) {
                    if(i > 0) s = &(hap->snp_stat.a[a[i-1]]);
                    if(i + 1 < o) t = &(hap->snp_stat.a[a[i+1]]);
                    if(s && s->site + 32 > hap->snp_stat.a[a[i]].site) continue;
                    if(t && hap->snp_stat.a[a[i]].site + 32 > t->site) continue;
                    a[z] = a[i];
                    z++;
                }
                if(z >= 2) hap->snp_srt.n += z; 
            }
            l = k;
        }
    }
    if (hap->snp_srt.n > 0) {
        radix_sort_bc64(hap->snp_srt.a, hap->snp_srt.a + hap->snp_srt.n);
        for (k = 1, l = 0; k <= hap->snp_srt.n; ++k) {  
            if(k == hap->snp_srt.n || hap->snp_srt.a[k] != hap->snp_srt.a[l]) {
                if(k - l >= 2) hap->snp_stat.a[hap->snp_srt.a[l]].score = 1;
            }
            l = k;
        }
    }

    for (k = 1, l = 0; k <= hap->length; ++k) {  
        if (k == hap->length || hap->list[k].overlapID != hap->list[l].overlapID) {
            ii = hap->list[l].overlapID;
            if(overlap_list->list[ii].is_match==2) {
                overlap_list->list[ii].strong = 1;
                overlap_list->mapped_overlaps_length -= 
                                            overlap_list->list[ii].x_pos_e + 1 - overlap_list->list[ii].x_pos_s;
            } else if(overlap_list->list[ii].is_match==1) {
                for (i = l; i < k; i++) {
                    if(hap->list[i].type==1 || hap->list[i].type==0) {
                        s = &(hap->snp_stat.a[hap->list[i].overlapSite]);
                        if(s->score == 1 && (!(s->occ_0 < 2 || s->occ_1 < 2))) {
                            overlap_list->list[ii].strong = 1;
                            if(hap->list[i].type==1) {
                                overlap_list->list[ii].is_match = 2;
                                overlap_list->mapped_overlaps_length -= 
                                            overlap_list->list[ii].x_pos_e + 1 - overlap_list->list[ii].x_pos_s;
                                break;
                            }
                        }
                    }

                }
            }
            l = k;
        }
    }    
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, 0x10(%rsp)
movsd %xmm0, 0x20(%rsp)
movq %rsi, (%rsp)
cmpl $0x0, 0x10(%rdi)
je 0x277db
movq %rdi, %r14
pushq $0x1
popq %rcx
xorl %esi, %esi
xorl %edi, %edi
xorl %edx, %edx
xorl %eax, %eax
movq 0x220(%r14), %r8
cmpq %r8, %rcx
ja 0x26f31
je 0x26dff
movq 0x218(%r14), %r9
imulq $0x28, %rcx, %r10
movl 0x20(%r9,%r10), %r10d
imulq $0x28, %rdi, %r11
cmpl 0x20(%r9,%r11), %r10d
je 0x26e44
testq %rdi, %rdi
je 0x26e1e
movq 0x218(%r14), %r9
imulq $0x28, %rdi, %r10
movl -0x8(%r9,%r10), %r11d
incl %r11d
cmpl %r11d, 0x20(%r9,%r10)
je 0x26e41
cmpq %r8, %rcx
jae 0x26e49
movq 0x218(%r14), %r8
imulq $0x28, %rdi, %r9
movl 0x20(%r8,%r9), %r9d
incl %r9d
imulq $0x28, %rcx, %r10
cmpl 0x20(%r8,%r10), %r9d
jne 0x26e49
movq %rcx, %rdi
incq %rcx
jmp 0x26dd2
movl 0x10(%r14), %r15d
imulq $0x18, %rsi, %r9
imulq $0x28, %rdi, %r8
cmpq %r15, %rsi
jae 0x27809
movq (%r14), %r10
movl (%r10,%r9), %r11d
movq 0x218(%r14), %rbx
cmpl 0x20(%rbx,%r8), %r11d
je 0x26e7c
incq %rsi
addq $0x18, %r9
jmp 0x26e55
movl %edx, %r11d
subl %edi, %r11d
imulq $0x18, %rax, %rbx
movl %r15d, %r15d
cmpq %r15, %rsi
jae 0x26eeb
movl (%r10,%r9), %ebp
movq 0x218(%r14), %r15
cmpl 0x20(%r15,%r8), %ebp
jne 0x26eeb
movl 0x8(%r10,%r9), %r15d
cmpq %r15, %rdi
ja 0x27828
cmpq %r15, %rcx
jbe 0x27828
leaq (%r10,%r9), %r15
movq 0x10(%r15), %r12
movq %r12, 0x10(%r10,%rbx)
movupd (%r15), %xmm0
movupd %xmm0, (%r10,%rbx)
movq (%r14), %r10
incq %rax
addl %r11d, 0x8(%r10,%rbx)
incq %rsi
movl 0x10(%r14), %r15d
addq $0x18, %r9
addq $0x18, %rbx
jmp 0x26e86
imulq $0x28, %rdx, %r9
cmpq %rcx, %rdi
jae 0x26e44
movq 0x218(%r14), %r10
incq %rdx
movq 0x20(%r10,%r8), %r11
movq %r11, 0x20(%r10,%r9)
movupd (%r10,%r8), %xmm0
movups 0x10(%r10,%r8), %xmm1
movups %xmm1, 0x10(%r10,%r9)
movupd %xmm0, (%r10,%r9)
incq %rdi
addq $0x28, %r8
addq $0x28, %r9
jmp 0x26eef
movq %rdx, 0x220(%r14)
movl %eax, 0x10(%r14)
testq %rdx, %rdx
je 0x277db
testl %eax, %eax
je 0x277db
andq $0x0, 0x238(%r14)
movq (%r14), %rdi
movl %eax, %eax
imulq $0x18, %rax, %rsi
addq %rdi, %rsi
callq 0x19538
pushq $0x1
popq %rbx
xorl %r15d, %r15d
leaq 0x22c7e5(%rip), %r10    # 0x253758
movabsq $-0x100000000, %r12     # imm = 0xFFFFFFFF00000000
xorl %ebp, %ebp
movl 0x10(%r14), %eax
cmpq %rax, %rbx
ja 0x270e5
je 0x26fa7
movq (%r14), %rax
imulq $0x18, %rbx, %rcx
movl 0x4(%rax,%rcx), %ecx
imulq $0x18, %r15, %rdx
cmpl 0x4(%rax,%rdx), %ecx
je 0x270dd
movq 0x210(%r10), %rax
movq 0x218(%r10), %rcx
imulq $0x18, %r15, %rdx
addq $0xc, %rdx
movq %r15, %rsi
xorl %r13d, %r13d
cmpq %rbx, %rsi
jae 0x27030
movq (%r14), %rdi
cmpb $0x1, (%rdi,%rdx)
jne 0x27027
movq 0x218(%r14), %rbp
movl -0x4(%rdi,%rdx), %r8d
imulq $0x28, %r8, %r8
movl 0x20(%rbp,%r8), %r9d
cmpl -0xc(%rdi,%rdx), %r9d
jne 0x27847
addq %r8, %rbp
movl 0x8(%rbp), %edi
cmpq $0x2, %rdi
jb 0x27027
movl 0xc(%rbp), %r8d
cmpl $0x2, %r8d
setae %r9b
cmpq %rdi, %rcx
setle %dil
movl %r8d, %r8d
cmpq %r8, %rax
setle %r8b
andb %r9b, %dil
andb %r8b, %dil
movzbl %dil, %edi
addq %rdi, %r13
incq %rsi
addq $0x18, %rdx
jmp 0x26fc3
testq %r13, %r13
je 0x270da
movq 0x238(%r14), %rcx
movq 0x240(%r14), %rdx
movq 0x248(%r14), %rax
cmpq $0x0, 0x10(%rsp)
je 0x27083
cmpq %rdx, %rcx
jne 0x270be
leaq (%rcx,%rcx), %rdx
testq %rcx, %rcx
pushq $0x2
popq %rcx
cmoveq %rcx, %rdx
movq %rdx, 0x240(%r14)
shlq $0x3, %rdx
movq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x1a3acc
jmp 0x270a9
cmpq %rdx, %rcx
jne 0x270be
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
pushq $0x2
popq %rcx
cmoveq %rcx, %rsi
movq %rsi, 0x240(%r14)
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x2370
leaq 0x22c6a8(%rip), %r10    # 0x253758
movq %rax, 0x248(%r14)
movq 0x238(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x238(%r14)
leaq (%rax,%rcx,8), %rax
shlq $0x20, %r13
subq %r13, %r15
addq %r12, %r15
movq %r15, (%rax)
movq %rbx, %r15
incq %rbx
jmp 0x26f7f
movq 0x238(%r14), %rcx
testq %rcx, %rcx
je 0x273f6
movq 0x248(%r14), %rdi
leaq (%rdi,%rcx,8), %rsi
callq 0x1905d
leaq 0x22c64c(%rip), %r10    # 0x253758
movq 0x238(%r14), %r15
xorl %eax, %eax
xorl %r13d, %r13d
cmpq %r15, %rax
je 0x272a1
movq %r15, %rcx
movq 0x248(%r14), %rdx
movq %rax, 0x8(%rsp)
movl (%rdx,%rax,8), %edx
movl 0x10(%r14), %esi
movq 0x210(%r10), %rdi
movq 0x218(%r10), %r9
imulq $0x18, %rdx, %r8
leaq 0xc(%r8), %r10
movq %rdx, %rbx
xorl %r11d, %r11d
cmpq %rsi, %rbx
jae 0x271bf
movq (%r14), %r15
movl -0x8(%r15,%r10), %r12d
cmpl 0x4(%r15,%r8), %r12d
jne 0x271bf
cmpb $0x1, (%r15,%r10)
jne 0x271b6
movq 0x218(%r14), %r12
movl -0x4(%r15,%r10), %r15d
imulq $0x28, %r15, %r15
leaq (%r12,%r15), %rbp
movl 0x8(%r12,%r15), %r15d
cmpq $0x2, %r15
jb 0x271b6
movl 0xc(%rbp), %r12d
cmpl $0x2, %r12d
setae %al
cmpq %r15, %r9
setle %r15b
movl %r12d, %r12d
cmpq %r12, %rdi
setle %r12b
andb %al, %r15b
andb %r12b, %r15b
movzbl %r15b, %eax
addq %rax, %r11
incq %rbx
addq $0x18, %r10
jmp 0x27153
testq %r11, %r11
je 0x2728a
movq (%r14), %rdi
movl 0x4(%rdi,%r8), %r8d
movq (%rsp), %rax
movq (%rax), %r9
imulq $0xa8, %r8, %r10
cmpb $0x1, 0x2c(%r9,%r10)
movq %rcx, %r15
jne 0x271f4
leaq (%r9,%r10), %rax
addq $0x2c, %rax
movb $0x2, (%rax)
cmpq %rsi, %rdx
jae 0x2728d
imulq $0x18, %rdx, %r10
cmpl %r8d, 0x4(%rdi,%r10)
jne 0x2728d
leaq (%rdi,%r10), %r9
movzbl 0xc(%r9), %r11d
testl %r11d, %r11d
je 0x2723e
cmpl $0x1, %r11d
jne 0x27282
movq 0x218(%r14), %rax
movl 0x8(%r9), %r9d
imulq $0x28, %r9, %r9
leaq (%rax,%r9), %rbp
movl $0x1, 0x1c(%rax,%r9)
jmp 0x27282
movl 0x8(%r9), %r9d
imulq $0x28, %r9, %rbp
addq 0x218(%r14), %rbp
addq %rdi, %r10
addq $0x10, %r10
incq %r9
movq %rbp, %rbx
decq %r9
js 0x27282
movq %rbx, %r11
movl 0x20(%rbp), %eax
cmpl 0x20(%rbx), %eax
jne 0x2727f
leaq -0x28(%r11), %rbx
movl (%r10), %eax
subl %eax, 0x8(%r11)
movq %r11, %r13
jne 0x2725a
jmp 0x277ea
movq %r11, %r13
incq %rdx
jmp 0x271f4
movq %rcx, %r15
movq 0x8(%rsp), %rax
incq %rax
leaq 0x22c4bc(%rip), %r10    # 0x253758
jmp 0x27118
xorl %ecx, %ecx
cmpq %r15, %rcx
je 0x27357
movq 0x248(%r14), %rax
movl (%rax,%rcx,8), %esi
movl 0x10(%r14), %edi
movq (%r14), %r8
imulq $0x18, %rsi, %r9
leaq (%r8,%r9), %r10
addq $0x4, %r10
leaq (%r8,%r9), %r11
addq $0xc, %r11
xorl %edx, %edx
cmpq %rdi, %rsi
jae 0x2731c
movl (%r10), %ebx
cmpl %ebx, -0x8(%r11)
jne 0x27321
cmpb $0x1, (%r11)
jne 0x27313
movq 0x218(%r14), %rax
movl -0x4(%r11), %ebx
imulq $0x28, %rbx, %rbx
leaq (%rax,%rbx), %rbp
cmpl $0x2, 0x8(%rax,%rbx)
jb 0x27313
cmpl $0x2, 0xc(%rbp)
jb 0x27313
xorl %eax, %eax
cmpl $0x1, 0x1c(%rbp)
sete %al
addq %rax, %rdx
incq %rsi
addq $0x18, %r11
jmp 0x272d3
movl 0x4(%r8,%r9), %ebx
movl %ebx, %eax
movq (%rsp), %rsi
movq (%rsi), %rsi
imulq $0xa8, %rax, %rdi
cmpb $0x1, 0x2c(%rsi,%rdi)
jne 0x27348
testq %rdx, %rdx
je 0x27348
leaq (%rsi,%rdi), %rax
addq $0x2c, %rax
movb $0x2, (%rax)
incq %rcx
leaq 0x22c406(%rip), %r10    # 0x253758
jmp 0x272a3
movl 0x10(%r14), %eax
leaq 0x1(%rax), %rcx
pushq $0x1
popq %rdx
xorl %esi, %esi
cmpq %rcx, %rdx
je 0x273f9
movq (%r14), %rdi
cmpq %rax, %rdx
jne 0x27380
imulq $0x18, %rsi, %r8
movl 0x4(%rdi,%r8), %r8d
jmp 0x27399
imulq $0x18, %rdx, %r9
imulq $0x18, %rsi, %r8
movl 0x4(%rdi,%r8), %r8d
cmpl %r8d, 0x4(%rdi,%r9)
jne 0x27399
movq %rsi, %r8
jmp 0x273eb
movl %r8d, %r8d
movq (%rsp), %r9
movq (%r9), %r9
imulq $0xa8, %r8, %r8
cmpb $0x1, 0x2c(%r9,%r8)
movq %rdx, %r8
jne 0x273eb
imulq $0x18, %rsi, %r8
addq %r8, %rdi
addq $0xc, %rdi
cmpq %rdx, %rsi
jae 0x273e8
cmpb $0x1, (%rdi)
jne 0x273df
movq 0x218(%r14), %r8
movl -0x4(%rdi), %r9d
imulq $0x28, %r9, %r9
orl $-0x1, 0x1c(%r8,%r9)
incq %rsi
addq $0x18, %rdi
jmp 0x273c0
movq %rdx, %r8
incq %rdx
movq %r8, %rsi
jmp 0x27364
xorl %r13d, %r13d
andq $0x0, 0x238(%r14)
pushq $0x1
popq %r15
xorl %r9d, %r9d
movl %eax, %eax
cmpq %rax, %r15
ja 0x276cf
movq (%r14), %rcx
jne 0x27422
imulq $0x18, %r9, %rax
movl 0x4(%rcx,%rax), %eax
jmp 0x27438
imulq $0x18, %r15, %rdx
imulq $0x18, %r9, %rax
movl 0x4(%rcx,%rax), %eax
cmpl %eax, 0x4(%rcx,%rdx)
je 0x276c3
movq (%rsp), %rdx
movq (%rdx), %rdx
movl %eax, %eax
imulq $0xa8, %rax, %rax
cmpb $0x2, 0x2c(%rdx,%rax)
je 0x276c0
imulq $0x18, %r9, %rbx
movq %r9, %r12
xorl %r8d, %r8d
cmpq %r15, %r12
jae 0x2758b
cmpb $0x1, 0xc(%rcx,%rbx)
jne 0x2757f
movq 0x218(%r14), %rax
movl 0x8(%rcx,%rbx), %edx
imulq $0x28, %rdx, %rdx
leaq (%rax,%rdx), %rbp
movl 0x8(%rax,%rdx), %eax
cmpq $0x2, %rax
jb 0x2757f
movl 0xc(%rbp), %edx
cmpq $0x2, %rdx
jb 0x2757f
cmpq %rax, 0x218(%r10)
jg 0x274b5
cmpq %rdx, 0x210(%r10)
jle 0x2757f
cmpl $0x1, 0x1c(%rbp)
je 0x2757f
incq %r8
movq 0x238(%r14), %rdi
movq 0x240(%r14), %rdx
movq 0x248(%r14), %rax
cmpq $0x0, 0x10(%rsp)
je 0x2751a
cmpq %rdx, %rdi
jne 0x2756c
leaq (%rdi,%rdi), %rdx
testq %rdi, %rdi
pushq $0x2
popq %rcx
cmoveq %rcx, %rdx
movq %rdx, 0x240(%r14)
shlq $0x3, %rdx
movq 0x10(%rsp), %rdi
movq %rax, %rsi
movq %r8, 0x8(%rsp)
movq %r9, 0x18(%rsp)
callq 0x1a3acc
jmp 0x2754a
cmpq %rdx, %rdi
jne 0x2756c
leaq (%rdi,%rdi), %rsi
testq %rdi, %rdi
pushq $0x2
popq %rcx
cmoveq %rcx, %rsi
movq %rsi, 0x240(%r14)
shlq $0x3, %rsi
movq %rax, %rdi
movq %r8, 0x8(%rsp)
movq %r9, 0x18(%rsp)
callq 0x2370
movq 0x18(%rsp), %r9
movq 0x8(%rsp), %r8
leaq 0x22c1fd(%rip), %r10    # 0x253758
movq %rax, 0x248(%r14)
movq (%r14), %rcx
movq 0x238(%r14), %rdi
movl 0x8(%rcx,%rbx), %edx
leaq 0x1(%rdi), %rsi
movq %rsi, 0x238(%r14)
movq %rdx, (%rax,%rdi,8)
incq %r12
addq $0x18, %rbx
jmp 0x2745d
movq 0x238(%r14), %rax
movq %rax, %rdx
subq %r8, %rdx
movq %rdx, 0x238(%r14)
movq %r8, %xmm0
punpckldq 0x1bbcc4(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x1bbccc(%rip), %xmm0   # 0x1e3280
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
movq (%rsp), %rsi
movq (%rsi), %rsi
imulq $0x18, %r9, %rdi
movl 0x4(%rcx,%rdi), %ecx
imulq $0xa8, %rcx, %rcx
movl 0x28(%rsi,%rcx), %ecx
cvtsi2sd %rcx, %xmm2
addsd %xmm0, %xmm1
mulsd 0x20(%rsp), %xmm2
ucomisd %xmm2, %xmm1
jb 0x276c0
movq 0x248(%r14), %rcx
leaq (%rcx,%rdx,8), %rdi
leaq (%rcx,%rax,8), %rsi
movq %r8, %rbx
callq 0x1905d
movq %rbx, %r11
leaq 0x22c148(%rip), %r10    # 0x253758
movq 0x238(%r14), %rax
shlq $0x3, %rax
addq 0x248(%r14), %rax
movq %rbx, %rdx
negq %rdx
xorl %esi, %esi
xorl %ecx, %ecx
incq %rsi
leaq (%rdx,%rsi), %rdi
cmpq $0x1, %rdi
je 0x276b3
cmpq $0x1, %rsi
je 0x2764c
imulq $0x28, -0x10(%rax,%rsi,8), %rbp
addq 0x218(%r14), %rbp
cmpq %r11, %rsi
jae 0x2765d
imulq $0x28, (%rax,%rsi,8), %r13
addq 0x218(%r14), %r13
testq %rbp, %rbp
je 0x2767c
movl 0x20(%rbp), %edi
addl $0x20, %edi
movq 0x218(%r14), %r8
imulq $0x28, -0x8(%rax,%rsi,8), %r9
cmpl 0x20(%r8,%r9), %edi
ja 0x2762c
testq %r13, %r13
je 0x276a2
movq 0x218(%r14), %r8
movq -0x8(%rax,%rsi,8), %rdi
imulq $0x28, %rdi, %r9
movl 0x20(%r8,%r9), %r8d
addl $0x20, %r8d
cmpl 0x20(%r13), %r8d
ja 0x2762c
jmp 0x276a7
movq -0x8(%rax,%rsi,8), %rdi
movq %rdi, (%rax,%rcx,8)
incq %rcx
jmp 0x2762c
cmpq $0x2, %rcx
jb 0x276c0
addq %rcx, 0x238(%r14)
movq %r15, %r9
incq %r15
movl 0x10(%r14), %eax
jmp 0x27408
movq 0x238(%r14), %rcx
testq %rcx, %rcx
je 0x276ef
movq 0x248(%r14), %rdi
leaq (%rdi,%rcx,8), %rsi
callq 0x1905d
movl 0x10(%r14), %eax
leaq 0x1(%rax), %rcx
pushq $0x1
popq %rdx
xorl %esi, %esi
cmpq %rcx, %rdx
je 0x277db
movq (%r14), %r11
cmpq %rax, %rdx
jne 0x27714
imulq $0x18, %rsi, %rdi
movl 0x4(%r11,%rdi), %edi
jmp 0x27730
imulq $0x18, %rdx, %r8
imulq $0x18, %rsi, %rdi
movl 0x4(%r11,%rdi), %edi
cmpl %edi, 0x4(%r11,%r8)
jne 0x27730
movq %rsi, %r10
jmp 0x277c8
movl %edi, %edi
movq (%rsp), %r8
movq (%r8), %r8
imulq $0xa8, %rdi, %r9
leaq (%r8,%r9), %rdi
movzbl 0x2c(%r8,%r9), %ebx
cmpl $0x2, %ebx
je 0x277b1
movq %rdx, %r10
cmpl $0x1, %ebx
jne 0x277c8
leaq (%r8,%r9), %r10
addq $0x2e, %r10
imulq $0x18, %rsi, %rbx
addq %rbx, %r11
addq $0xc, %r11
cmpq %rdx, %rsi
jae 0x277c5
movb (%r11), %bl
cmpb $0x1, %bl
ja 0x277a8
movq 0x218(%r14), %r15
movl -0x4(%r11), %r12d
imulq $0x28, %r12, %r12
cmpl $0x1, 0x1c(%r15,%r12)
jne 0x277a8
addq %r12, %r15
cmpl $0x2, 0x8(%r15)
jb 0x277a8
cmpl $0x2, 0xc(%r15)
jb 0x277a8
movb $0x1, (%r10)
cmpb $0x1, %bl
je 0x277d3
incq %rsi
addq $0x18, %r11
jmp 0x2776a
movb $0x1, 0x2e(%rdi)
movl 0x8(%rdi), %esi
subl 0x4(%rdi), %esi
incl %esi
movq (%rsp), %rdi
subq %rsi, 0x18(%rdi)
movq %rdx, %r10
incq %rdx
movq %r10, %rsi
jmp 0x276f8
movb $0x2, 0x2c(%r8,%r9)
jmp 0x277b5
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1bc3a9(%rip), %rdi    # 0x1e3b9a
leaq 0x1bbeab(%rip), %rsi    # 0x1e36a3
leaq 0x1bc7f6(%rip), %rcx    # 0x1e3ff5
movl $0x2706, %edx           # imm = 0x2706
callq 0x2110
leaq 0x1bc448(%rip), %rdi    # 0x1e3c58
leaq 0x1bbe8c(%rip), %rsi    # 0x1e36a3
leaq 0x1bc7d7(%rip), %rcx    # 0x1e3ff5
movl $0x26c9, %edx           # imm = 0x26C9
callq 0x2110
leaq 0x1bc4f0(%rip), %rdi    # 0x1e3d1f
leaq 0x1bbe6d(%rip), %rsi    # 0x1e36a3
leaq 0x1bc7b8(%rip), %rcx    # 0x1e3ff5
movl $0x26cc, %edx           # imm = 0x26CC
callq 0x2110
leaq 0x1bc50d(%rip), %rdi    # 0x1e3d5b
leaq 0x1bbe4e(%rip), %rsi    # 0x1e36a3
leaq 0x1bc799(%rip), %rcx    # 0x1e3ff5
movl $0x26de, %edx           # imm = 0x26DE
callq 0x2110