// File: chhylp123[P]hifiasm/Correct.cpp
// Function: generate_haplotypes_naive_HiFi(haplotype_evdience_alloc*, overlap_region_alloc*, double, UC_Read*, unsigned long, double, unsigned long)
void generate_haplotypes_naive_HiFi(haplotype_evdience_alloc* hap, overlap_region_alloc* overlap_list, double up, UC_Read* g_read, uint64_t multi_check, double st_rate, uint64_t st_max)
{
    // fprintf(stderr, "[M::%s::] Done\n", __func__);
    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;

    // for (k = 0; k < hap->snp_stat.n; k++) {
    //     s = &(hap->snp_stat.a[k]); if(s->site != 1502) continue;
    //     fprintf(stderr, "[M::%s] site::%u, occ_0::%u, occ_1::%u, occ_2::%u, is_homopolymer::%u\n", __func__, s->site, s->occ_0, s->occ_1, s->occ_2, s->is_homopolymer);
    //     prt_sub_read(g_read->seq, g_read->length, s->site, 25);
    //     for (i = 0; i < overlap_list->length; i++) {
    //         if(/**overlap_list->list[i].is_match == 1 &&**/ overlap_list->list[i].x_pos_s <= s->site && s->site <= overlap_list->list[i].x_pos_e) {
    //             fprintf(stderr, "%.*s\tis_match::%u\tid::%u\n", (int)Get_NAME_LENGTH(R_INF, overlap_list->list[i].y_id), Get_NAME(R_INF, overlap_list->list[i].y_id), overlap_list->list[i].is_match, overlap_list->list[i].y_id);
    //         }   
    //     }
    // }
    

    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(hh_tp(hap->list[i])!=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(is_st_bs((*s), st_rate, st_max)) continue;
                if(s->occ_0 >= asm_opt.s_hap_cov && s->occ_1 >= asm_opt.infor_cov) o++;///allels must be real
            }

            // if(overlap_list->list[hap->list[l].overlapID].y_id == 4378830 || overlap_list->list[hap->list[l].overlapID].y_id == 4378829 || overlap_list->list[hap->list[l].overlapID].y_id == 4378799) {
            //     fprintf(stderr, "[M::%s-id::%u] o->%lu(%c), l::%lu\n", __func__, overlap_list->list[hap->list[l].overlapID].y_id, o, "+-"[overlap_list->list[hap->list[l].overlapID].y_pos_strand], l);
            //     for (i = l; i < k; i++) {
            //         if(hh_tp(hap->list[i])!=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(is_st_bs((*s), st_rate, st_max)) continue;
            //         if(s->occ_0 >= asm_opt.s_hap_cov && s->occ_1 >= asm_opt.infor_cov) {
            //             fprintf(stderr, "[M::%s] site::%u, occ_0::%u, occ_1::%u, occ_2::%u, is_homopolymer::%u\n", __func__, s->site, s->occ_0, s->occ_1, s->occ_1, s->is_homopolymer);
            //             prt_sub_read(g_read->seq, g_read->length, s->site, 50);
            //         }
            //     }
            // } 
            // else {
            //     for (i = l, o = 0; i < k; i++) {
            //         if(hh_tp(hap->list[i])!=0) 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) {
            //             if(s->site == 7878 || s->site == 9682) {
                        
            //                 fprintf(stderr, "***[M::%s] site::%u, rid::%u\t%.*s\n", __func__, s->site, overlap_list->list[hap->list[l].overlapID].y_id, (int)Get_NAME_LENGTH(R_INF, overlap_list->list[hap->list[l].overlapID].y_id), 
            //                     Get_NAME(R_INF, overlap_list->list[hap->list[l].overlapID].y_id));
            //                 prt_sub_cigar(&(overlap_list->list[hap->list[l].overlapID]), g_read->length, s->site, 50);
            //             }
            //             // o++;///allels must be real
            //             // fprintf(stderr, "[M::%s] site::%u, occ_0::%u, occ_1::%u, occ_2::%u, is_homopolymer::%u\n", __func__, s->site, s->occ_0, s->occ_1, s->occ_1, s->is_homopolymer);
            //             // prt_sub_read(g_read->seq, g_read->length, s->site, 50);
            //         }
            //     }
            // }

            // if(overlap_list->list[hap->list[l].overlapID].y_id == 20835) {
            //     fprintf(stderr, "***0***[M::%s-id::%u] o->%lu\n", __func__, overlap_list->list[hap->list[l].overlapID].y_id, o);
            // }

            if(o > 0) {
                o = ((uint32_t)-1) - o;
                o <<= 32; o += l; 
                kv_push(uint64_t, hap->snp_srt, o);
            }
            l = k;
        }
    }

    // fprintf(stderr, "[M::%s] snp_srt.n->%lu\n", __func__, ((uint64_t)hap->snp_srt.n));
    
    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(hh_tp(hap->list[i])!=1) continue;
                s = &(hap->snp_stat.a[hap->list[i].overlapSite]);
                if(s->occ_0 < 2 || s->occ_1 < 2) continue;
                if(is_st_bs((*s), st_rate, st_max)) continue;
                if(s->occ_0 >= asm_opt.s_hap_cov && s->occ_1 >= asm_opt.infor_cov) {
                    o++;
                    // if(overlap_list->list[hap->list[l].overlapID].y_id == 20835) {
                    //     fprintf(stderr, "[M::%s-id::%u] occ_0->%u, occ_1->%u, occ_2->%u, site->%u\n", __func__, overlap_list->list[hap->list[l].overlapID].y_id, s->occ_0, s->occ_1, s->occ_2, s->site);
                    // }
                }
            }
            // if(overlap_list->list[hap->list[l].overlapID].y_id == 4378830 || overlap_list->list[hap->list[l].overlapID].y_id == 4378829) {
            //  fprintf(stderr, "***1***[M::%s-id::%u] o->%lu, l->%lu\n", __func__, overlap_list->list[hap->list[l].overlapID].y_id, o, l);
            // }
            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(hh_tp(hap->list[i])==1){
                    s = &(hap->snp_stat.a[hap->list[i].overlapSite]);
                    s->score = 1; 
                } ///else if((hh_tp(hap->list[i])==0) && (o>=(overlap_list->list[ii].align_length*up))) {
                else if(hh_tp(hap->list[i])==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;
                        // if(t->site == 14217) {
                        //     fprintf(stderr, "[M::%s]\tsite::%u\tn0::%u\tn1::%u\to::%lu\t%.*s\n", __func__, t->site, t->occ_0, t->occ_1, o, (int)Get_NAME_LENGTH(R_INF, overlap_list->list[ii].y_id), Get_NAME(R_INF, overlap_list->list[ii].y_id));
                        // }
                        t->occ_0 -= hap->list[i].cov;
                        assert(t->occ_0 >= 1);
                        if((st_max != ((uint64_t)-1)) && (overlap_list->list[ii].y_pos_strand == 0)) {
                            t->overlap_num -= hap->list[i].cov;
                            assert(t->overlap_num >= 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(hh_tp(hap->list[i])!=1) continue;
                s = &(hap->snp_stat.a[hap->list[i].overlapSite]);
                if(s->occ_0 < 2 || s->occ_1 < 2) continue;
                if(is_st_bs((*s), st_rate, st_max)) 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(hh_tp(hap->list[i])==1) {
                            hap->snp_stat.a[hap->list[i].overlapSite].score = -1;
                        }
                    }
                }
                l = k;
            }
        } 
    }

    
    if(multi_check) {
        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(hh_tp(hap->list[i])!=1) continue;
                    s = &(hap->snp_stat.a[hap->list[i].overlapSite]);
                    if(s->occ_0 < 2 || s->occ_1 < 2) continue;
                    if(is_st_bs((*s), st_rate, st_max)) continue;
                    if(s->occ_0 >= asm_opt.s_hap_cov && s->occ_1 >= asm_opt.infor_cov) continue;
                    if(s->score == 1) continue;
                    o++; 
                    kv_push(uint64_t, hap->snp_srt, hap->list[i].overlapSite);
                }
                // if(overlap_list->list[hap->list[l].overlapID].y_id == 317 || overlap_list->list[hap->list[l].overlapID].y_id == 287) {
                //     fprintf(stderr, "***2***[M::%s-id::%u] o->%lu\n", __func__, overlap_list->list[hap->list[l].overlapID].y_id, o);
                // }
                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(hh_tp(hap->list[i])==1 || hh_tp(hap->list[i])==0) {
                        s = &(hap->snp_stat.a[hap->list[i].overlapSite]);
                        if(s->score == 1 && (!(s->occ_0 < 2 || s->occ_1 < 2)) && (!(is_st_bs((*s), st_rate, st_max)))) {
                            overlap_list->list[ii].strong = 1;
                            if(hh_tp(hap->list[i])==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
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movsd %xmm0, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movsd %xmm1, -0x30(%rbp)
movq %r8, -0x38(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jne 0x41f28
jmp 0x43693
movq $0x0, -0x90(%rbp)
movq $0x0, -0x98(%rbp)
movq $0x1, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x78(%rbp)
movq $0x0, -0x70(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x40(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x220(%rcx), %rax
ja 0x422e9
movq -0x40(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x220(%rcx), %rax
je 0x41fbe
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rax
imulq $0x28, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0x20(%rax), %eax
movq -0x8(%rbp), %rcx
movq 0x218(%rcx), %rcx
imulq $0x28, -0x48(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x20(%rcx), %eax
je 0x422d6
cmpq $0x0, -0x48(%rbp)
jbe 0x4200c
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rax
imulq $0x28, -0x48(%rbp), %rcx
addq %rcx, %rax
movl 0x20(%rax), %eax
movq -0x8(%rbp), %rcx
movq 0x218(%rcx), %rcx
movq -0x48(%rbp), %rdx
subq $0x1, %rdx
imulq $0x28, %rdx, %rdx
addq %rdx, %rcx
movl 0x20(%rcx), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jne 0x4200c
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x422d8
movq -0x40(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x220(%rcx), %rax
jae 0x4205b
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rax
imulq $0x28, -0x48(%rbp), %rcx
addq %rcx, %rax
movl 0x20(%rax), %eax
addl $0x1, %eax
movq -0x8(%rbp), %rcx
movq 0x218(%rcx), %rcx
imulq $0x28, -0x40(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x20(%rcx), %eax
jne 0x4205b
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x422d8
jmp 0x4205d
movq -0x50(%rbp), %rcx
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, %edx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x99(%rbp)
jae 0x420a7
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x50(%rbp), %rcx
addq %rcx, %rax
movl (%rax), %eax
movq -0x8(%rbp), %rcx
movq 0x218(%rcx), %rcx
imulq $0x28, -0x48(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x20(%rcx), %eax
setne %al
movb %al, -0x99(%rbp)
movb -0x99(%rbp), %al
testb $0x1, %al
jne 0x420b3
jmp 0x420c3
jmp 0x420b5
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x4205d
movq -0x50(%rbp), %rcx
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, %edx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x9a(%rbp)
jae 0x4210d
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x50(%rbp), %rcx
addq %rcx, %rax
movl (%rax), %eax
movq -0x8(%rbp), %rcx
movq 0x218(%rcx), %rcx
imulq $0x28, -0x48(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x20(%rcx), %eax
sete %al
movb %al, -0x9a(%rbp)
movb -0x9a(%rbp), %al
testb $0x1, %al
jne 0x42119
jmp 0x4211b
jmp 0x4213a
leaq 0x3407ae(%rip), %rdi    # 0x3828d0
leaq 0x3401f2(%rip), %rsi    # 0x38231b
movl $0x229f, %edx           # imm = 0x229F
leaq 0x3407db(%rip), %rcx    # 0x382910
callq 0x2130
movq -0x48(%rbp), %rax
subq -0x70(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x50(%rbp), %rcx
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, %edx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x9b(%rbp)
jae 0x42190
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x50(%rbp), %rcx
addq %rcx, %rax
movl (%rax), %eax
movq -0x8(%rbp), %rcx
movq 0x218(%rcx), %rcx
imulq $0x28, -0x48(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x20(%rcx), %eax
sete %al
movb %al, -0x9b(%rbp)
movb -0x9b(%rbp), %al
testb $0x1, %al
jne 0x4219f
jmp 0x4227c
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x50(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, %ecx
xorl %eax, %eax
cmpq -0x48(%rbp), %rcx
movb %al, -0x9c(%rbp)
jb 0x421e0
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x50(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
cmpq -0x40(%rbp), %rax
setb %al
movb %al, -0x9c(%rbp)
movb -0x9c(%rbp), %al
testb $0x1, %al
jne 0x421ec
jmp 0x421ee
jmp 0x4220d
leaq 0x3407a2(%rip), %rdi    # 0x382997
leaq 0x34011f(%rip), %rsi    # 0x38231b
movl $0x22a2, %edx           # imm = 0x22A2
leaq 0x340708(%rip), %rcx    # 0x382910
callq 0x2130
movq -0x8(%rbp), %rax
movq (%rax), %rcx
imulq $0x18, -0x50(%rbp), %rax
addq %rax, %rcx
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x78(%rbp), %rdx
addq %rdx, %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rcx
movq %rcx, 0x10(%rax)
movq -0x80(%rbp), %rdx
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x78(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x78(%rbp)
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %ecx
subq %rdx, %rcx
movl %ecx, 0x8(%rax)
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x42146
jmp 0x4227e
movq -0x48(%rbp), %rax
cmpq -0x40(%rbp), %rax
jae 0x422d4
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rsi
imulq $0x28, -0x48(%rbp), %rax
addq %rax, %rsi
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rdi
movq -0x70(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x70(%rbp)
imulq $0x28, %rax, %rax
addq %rax, %rdi
movl $0x28, %edx
callq 0x2180
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x4227e
jmp 0x422d6
jmp 0x422d8
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x41f66
movq -0x70(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x220(%rax)
movq -0x78(%rbp), %rax
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x220(%rax)
je 0x4231d
movq -0x8(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jne 0x42322
jmp 0x43693
movq -0x8(%rbp), %rax
movq $0x0, 0x238(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rsi
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
imulq $0x18, %rax, %rax
addq %rax, %rsi
callq 0x2e440
movq $0x1, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x40(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x10(%rcx), %ecx
cmpq %rcx, %rax
ja 0x4261f
movq -0x40(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x10(%rcx), %ecx
cmpq %rcx, %rax
je 0x423b0
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x48(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x4(%rcx), %eax
je 0x4260c
movq -0x48(%rbp), %rax
movq %rax, -0x50(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x40(%rbp), %rax
jae 0x4251c
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x50(%rbp), %rcx
addq %rcx, %rax
movzbl 0xc(%rax), %eax
andl $0x1, %eax
cmpl $0x1, %eax
je 0x423ee
jmp 0x4250b
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x50(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rax
movl 0x20(%rax), %eax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x50(%rbp), %rdx
addq %rdx, %rcx
cmpl (%rcx), %eax
jne 0x42438
jmp 0x42457
leaq 0x340594(%rip), %rdi    # 0x3829d3
leaq 0x33fed5(%rip), %rsi    # 0x38231b
movl $0x22c0, %edx           # imm = 0x22C0
leaq 0x3404be(%rip), %rcx    # 0x382910
callq 0x2130
movq -0x90(%rbp), %rax
cmpl $0x2, 0x8(%rax)
jb 0x42471
movq -0x90(%rbp), %rax
cmpl $0x2, 0xc(%rax)
jae 0x42476
jmp 0x4250b
cmpq $-0x1, -0x38(%rbp)
je 0x424c9
movq -0x90(%rbp), %rax
movl 0x4(%rax), %eax
addq -0x38(%rbp), %rax
movq -0x90(%rbp), %rcx
movl 0x8(%rcx), %ecx
cmpq %rcx, %rax
jb 0x424c9
movq -0x90(%rbp), %rcx
movl 0x4(%rcx), %eax
movl 0x8(%rcx), %ecx
cvtsi2sd %rcx, %xmm1
movsd -0x30(%rbp), %xmm3
cvtsi2sd %rax, %xmm2
movaps %xmm1, %xmm0
mulsd %xmm3, %xmm0
addsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jb 0x424c9
jmp 0x4250b
movq -0x90(%rbp), %rax
movl 0x8(%rax), %eax
leaq 0x38231e(%rip), %rcx    # 0x3c47f8
cmpq 0x218(%rcx), %rax
jl 0x42509
movq -0x90(%rbp), %rax
movl 0xc(%rax), %eax
leaq 0x382304(%rip), %rcx    # 0x3c47f8
cmpq 0x210(%rcx), %rax
jl 0x42509
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x4250b
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x423c0
cmpq $0x0, -0x58(%rbp)
jbe 0x42604
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
subq -0x58(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
shlq $0x20, %rax
movq %rax, -0x58(%rbp)
movq -0x48(%rbp), %rax
addq -0x58(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rax
movq 0x238(%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0x240(%rcx), %rax
jne 0x425d6
movq -0x8(%rbp), %rax
cmpq $0x0, 0x240(%rax)
je 0x42589
movq -0x8(%rbp), %rax
movq 0x240(%rax), %rax
shlq %rax
movq %rax, -0xa8(%rbp)
jmp 0x42597
movl $0x2, %eax
movq %rax, -0xa8(%rbp)
jmp 0x42597
movq -0xa8(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x240(%rax)
movq -0x8(%rbp), %rax
movq 0x248(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x240(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x248(%rax)
movq -0x58(%rbp), %rdx
movq -0x8(%rbp), %rax
movq 0x248(%rax), %rax
movq -0x8(%rbp), %rsi
movq 0x238(%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, 0x238(%rsi)
movq %rdx, (%rax,%rcx,8)
jmp 0x42604
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x4260e
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x42362
movq -0x8(%rbp), %rax
cmpq $0x0, 0x238(%rax)
jbe 0x42dc3
movq -0x8(%rbp), %rax
movq 0x248(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x248(%rax), %rsi
movq -0x8(%rbp), %rax
movq 0x238(%rax), %rax
shlq $0x3, %rax
addq %rax, %rsi
callq 0x2da20
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x238(%rcx), %rax
jae 0x42aca
movq $0x0, -0x58(%rbp)
movq -0x8(%rbp), %rax
movq 0x248(%rax), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rcx
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, %edx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0xa9(%rbp)
jae 0x426eb
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x50(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x48(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x4(%rcx), %eax
sete %al
movb %al, -0xa9(%rbp)
movb -0xa9(%rbp), %al
testb $0x1, %al
jne 0x426fa
jmp 0x4280a
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x50(%rbp), %rcx
addq %rcx, %rax
movzbl 0xc(%rax), %eax
andl $0x1, %eax
cmpl $0x1, %eax
je 0x4271a
jmp 0x427f9
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x50(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rax
cmpl $0x2, 0x8(%rax)
jb 0x4275f
movq -0x90(%rbp), %rax
cmpl $0x2, 0xc(%rax)
jae 0x42764
jmp 0x427f9
cmpq $-0x1, -0x38(%rbp)
je 0x427b7
movq -0x90(%rbp), %rax
movl 0x4(%rax), %eax
addq -0x38(%rbp), %rax
movq -0x90(%rbp), %rcx
movl 0x8(%rcx), %ecx
cmpq %rcx, %rax
jb 0x427b7
movq -0x90(%rbp), %rcx
movl 0x4(%rcx), %eax
movl 0x8(%rcx), %ecx
cvtsi2sd %rcx, %xmm1
movsd -0x30(%rbp), %xmm3
cvtsi2sd %rax, %xmm2
movaps %xmm1, %xmm0
mulsd %xmm3, %xmm0
addsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jb 0x427b7
jmp 0x427f9
movq -0x90(%rbp), %rax
movl 0x8(%rax), %eax
leaq 0x382030(%rip), %rcx    # 0x3c47f8
cmpq 0x218(%rcx), %rax
jl 0x427f7
movq -0x90(%rbp), %rax
movl 0xc(%rax), %eax
leaq 0x382016(%rip), %rcx    # 0x3c47f8
cmpq 0x210(%rcx), %rax
jl 0x427f7
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x427f9
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x426a4
cmpq $0x0, -0x58(%rbp)
jne 0x42816
jmp 0x42ab9
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x48(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x68(%rbp), %rcx
addq %rcx, %rax
movzbl 0x2c(%rax), %eax
cmpl $0x1, %eax
jne 0x4285d
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x68(%rbp), %rcx
addq %rcx, %rax
movb $0x2, 0x2c(%rax)
movq -0x48(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rcx
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, %edx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0xaa(%rbp)
jae 0x428ac
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x50(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x48(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x4(%rcx), %eax
sete %al
movb %al, -0xaa(%rbp)
movb -0xaa(%rbp), %al
testb $0x1, %al
jne 0x428bb
jmp 0x42ab7
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x50(%rbp), %rcx
addq %rcx, %rax
movzbl 0xc(%rax), %eax
andl $0x1, %eax
cmpl $0x1, %eax
jne 0x42914
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x50(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rax
movl $0x1, 0x1c(%rax)
jmp 0x42aa4
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x50(%rbp), %rcx
addq %rcx, %rax
movzbl 0xc(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x42aa2
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x50(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq %rax, -0x88(%rbp)
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rax
imulq $0x28, -0x88(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x90(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x50(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq %rax, -0x88(%rbp)
cmpq $0x0, -0x88(%rbp)
jl 0x42aa0
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rax
imulq $0x28, -0x88(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x98(%rbp)
movq -0x90(%rbp), %rax
movl 0x20(%rax), %eax
movq -0x98(%rbp), %rcx
cmpl 0x20(%rcx), %eax
je 0x429c8
jmp 0x42aa0
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x50(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %edx
movq -0x98(%rbp), %rax
movl 0x8(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x8(%rax)
movq -0x98(%rbp), %rax
cmpl $0x1, 0x8(%rax)
jb 0x429f8
jmp 0x42a17
leaq 0x33fe13(%rip), %rdi    # 0x382812
leaq 0x33f915(%rip), %rsi    # 0x38231b
movl $0x231d, %edx           # imm = 0x231D
leaq 0x33fefe(%rip), %rcx    # 0x382910
callq 0x2130
cmpq $-0x1, -0x38(%rbp)
je 0x42a87
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x68(%rbp), %rcx
addq %rcx, %rax
cmpl $0x0, 0x1c(%rax)
jne 0x42a87
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x50(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %edx
movq -0x98(%rbp), %rax
movl 0x4(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x4(%rax)
movq -0x98(%rbp), %rax
cmpl $0x1, 0x4(%rax)
jb 0x42a66
jmp 0x42a85
leaq 0x33ff83(%rip), %rdi    # 0x3829f0
leaq 0x33f8a7(%rip), %rsi    # 0x38231b
movl $0x2320, %edx           # imm = 0x2320
leaq 0x33fe90(%rip), %rcx    # 0x382910
callq 0x2130
jmp 0x42a87
jmp 0x42a89
movq -0x88(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x88(%rbp)
jmp 0x42982
jmp 0x42aa2
jmp 0x42aa4
jmp 0x42aa6
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x42865
jmp 0x42ab9
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x42666
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x238(%rcx), %rax
jae 0x42cad
movq $0x0, -0x58(%rbp)
movq -0x8(%rbp), %rax
movq 0x248(%rax), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rcx
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, %edx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0xab(%rbp)
jae 0x42b57
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x50(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x48(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x4(%rcx), %eax
sete %al
movb %al, -0xab(%rbp)
movb -0xab(%rbp), %al
testb $0x1, %al
jne 0x42b66
jmp 0x42c4c
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x50(%rbp), %rcx
addq %rcx, %rax
movzbl 0xc(%rax), %eax
andl $0x1, %eax
cmpl $0x1, %eax
je 0x42b86
jmp 0x42c3b
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x50(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rax
cmpl $0x2, 0x8(%rax)
jb 0x42bcb
movq -0x90(%rbp), %rax
cmpl $0x2, 0xc(%rax)
jae 0x42bcd
jmp 0x42c3b
cmpq $-0x1, -0x38(%rbp)
je 0x42c20
movq -0x90(%rbp), %rax
movl 0x4(%rax), %eax
addq -0x38(%rbp), %rax
movq -0x90(%rbp), %rcx
movl 0x8(%rcx), %ecx
cmpq %rcx, %rax
jb 0x42c20
movq -0x90(%rbp), %rcx
movl 0x4(%rcx), %eax
movl 0x8(%rcx), %ecx
cvtsi2sd %rcx, %xmm1
movsd -0x30(%rbp), %xmm3
cvtsi2sd %rax, %xmm2
movaps %xmm1, %xmm0
mulsd %xmm3, %xmm0
addsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jb 0x42c20
jmp 0x42c3b
movq -0x90(%rbp), %rax
cmpl $0x1, 0x1c(%rax)
jne 0x42c39
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x42c3b
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x42b10
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x48(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x68(%rbp), %rcx
addq %rcx, %rax
movzbl 0x2c(%rax), %eax
cmpl $0x1, %eax
jne 0x42c9a
cmpq $0x0, -0x58(%rbp)
jbe 0x42c9a
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x68(%rbp), %rcx
addq %rcx, %rax
movb $0x2, 0x2c(%rax)
jmp 0x42c9c
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x42ad2
movq $0x1, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x40(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x10(%rcx), %ecx
cmpq %rcx, %rax
ja 0x42dc1
movq -0x40(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x10(%rcx), %ecx
cmpq %rcx, %rax
je 0x42d0b
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x48(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x4(%rcx), %eax
je 0x42dae
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x48(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x68(%rbp), %rcx
addq %rcx, %rax
movzbl 0x2c(%rax), %eax
cmpl $0x1, %eax
jne 0x42da6
movq -0x48(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x40(%rbp), %rax
jae 0x42da4
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x50(%rbp), %rcx
addq %rcx, %rax
movzbl 0xc(%rax), %eax
andl $0x1, %eax
cmpl $0x1, %eax
jne 0x42d94
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x50(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl $0xffffffff, 0x1c(%rax) # imm = 0xFFFFFFFF
jmp 0x42d96
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x42d44
jmp 0x42da6
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x42db0
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x42cbd
jmp 0x42dc3
cmpq $0x0, -0x28(%rbp)
je 0x433c8
movq -0x8(%rbp), %rax
movq $0x0, 0x238(%rax)
movq $0x1, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x40(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x10(%rcx), %ecx
cmpq %rcx, %rax
ja 0x432d5
movq -0x40(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x10(%rcx), %ecx
cmpq %rcx, %rax
je 0x42e3b
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x48(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x4(%rcx), %eax
je 0x432c2
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x48(%rbp), %rdx
addq %rdx, %rcx
movl 0x4(%rcx), %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movzbl 0x2c(%rax), %eax
cmpl $0x2, %eax
jne 0x42e74
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x432c4
movq -0x48(%rbp), %rax
movq %rax, -0x50(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x40(%rbp), %rax
jae 0x43082
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x50(%rbp), %rcx
addq %rcx, %rax
movzbl 0xc(%rax), %eax
andl $0x1, %eax
cmpl $0x1, %eax
je 0x42eb2
jmp 0x43071
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x50(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rax
cmpl $0x2, 0x8(%rax)
jb 0x42ef7
movq -0x90(%rbp), %rax
cmpl $0x2, 0xc(%rax)
jae 0x42efc
jmp 0x43071
cmpq $-0x1, -0x38(%rbp)
je 0x42f52
movq -0x90(%rbp), %rax
movl 0x4(%rax), %eax
addq -0x38(%rbp), %rax
movq -0x90(%rbp), %rcx
movl 0x8(%rcx), %ecx
cmpq %rcx, %rax
jb 0x42f52
movq -0x90(%rbp), %rcx
movl 0x4(%rcx), %eax
movl 0x8(%rcx), %ecx
cvtsi2sd %rcx, %xmm1
movsd -0x30(%rbp), %xmm3
cvtsi2sd %rax, %xmm2
movaps %xmm1, %xmm0
mulsd %xmm3, %xmm0
addsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jb 0x42f52
jmp 0x43071
movq -0x90(%rbp), %rax
movl 0x8(%rax), %eax
leaq 0x381895(%rip), %rcx    # 0x3c47f8
cmpq 0x218(%rcx), %rax
jl 0x42f8b
movq -0x90(%rbp), %rax
movl 0xc(%rax), %eax
leaq 0x38187b(%rip), %rcx    # 0x3c47f8
cmpq 0x210(%rcx), %rax
jl 0x42f8b
jmp 0x43071
movq -0x90(%rbp), %rax
cmpl $0x1, 0x1c(%rax)
jne 0x42f9d
jmp 0x43071
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rax
movq 0x238(%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0x240(%rcx), %rax
jne 0x43033
movq -0x8(%rbp), %rax
cmpq $0x0, 0x240(%rax)
je 0x42fe6
movq -0x8(%rbp), %rax
movq 0x240(%rax), %rax
shlq %rax
movq %rax, -0xb8(%rbp)
jmp 0x42ff4
movl $0x2, %eax
movq %rax, -0xb8(%rbp)
jmp 0x42ff4
movq -0xb8(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x240(%rax)
movq -0x8(%rbp), %rax
movq 0x248(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x240(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x248(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x50(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, %edx
movq -0x8(%rbp), %rax
movq 0x248(%rax), %rax
movq -0x8(%rbp), %rsi
movq 0x238(%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, 0x238(%rsi)
movq %rdx, (%rax,%rcx,8)
jmp 0x43071
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x42e84
movq -0x58(%rbp), %rdx
movq -0x8(%rbp), %rax
movq 0x238(%rax), %rcx
subq %rdx, %rcx
movq %rcx, 0x238(%rax)
movaps 0x33ef6e(%rip), %xmm1   # 0x382010
movq -0x58(%rbp), %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x33ef6d(%rip), %xmm1   # 0x382020
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
movq -0x48(%rbp), %rdx
leaq (%rdx,%rdx,2), %rdx
movl 0x4(%rcx,%rdx,8), %ecx
imulq $0xa8, %rcx, %rcx
movl 0x28(%rax,%rcx), %eax
cvtsi2sd %rax, %xmm1
mulsd -0x18(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jb 0x432ba
movq -0x8(%rbp), %rax
movq 0x248(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x238(%rax), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq -0x8(%rbp), %rax
movq 0x248(%rax), %rsi
movq -0x8(%rbp), %rax
movq 0x238(%rax), %rax
shlq $0x3, %rax
addq %rax, %rsi
movq -0x58(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
callq 0x2da20
movq -0x8(%rbp), %rax
movq 0x248(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x238(%rcx), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq $0x0, -0x88(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x58(%rbp), %rax
jae 0x43295
cmpq $0x0, -0x50(%rbp)
jbe 0x431b4
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rax
movq -0x60(%rbp), %rcx
movq -0x50(%rbp), %rdx
subq $0x1, %rdx
imulq $0x28, (%rcx,%rdx,8), %rcx
addq %rcx, %rax
movq %rax, -0x90(%rbp)
movq -0x50(%rbp), %rax
addq $0x1, %rax
cmpq -0x58(%rbp), %rax
jae 0x431e5
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rax
movq -0x60(%rbp), %rcx
movq -0x50(%rbp), %rdx
imulq $0x28, 0x8(%rcx,%rdx,8), %rcx
addq %rcx, %rax
movq %rax, -0x98(%rbp)
cmpq $0x0, -0x90(%rbp)
je 0x4321e
movq -0x90(%rbp), %rax
movl 0x20(%rax), %eax
addl $0x20, %eax
movq -0x8(%rbp), %rcx
movq 0x218(%rcx), %rcx
movq -0x60(%rbp), %rdx
movq -0x50(%rbp), %rsi
imulq $0x28, (%rdx,%rsi,8), %rdx
addq %rdx, %rcx
cmpl 0x20(%rcx), %eax
jbe 0x4321e
jmp 0x43284
cmpq $0x0, -0x98(%rbp)
je 0x43257
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rax
movq -0x60(%rbp), %rcx
movq -0x50(%rbp), %rdx
imulq $0x28, (%rcx,%rdx,8), %rcx
addq %rcx, %rax
movl 0x20(%rax), %eax
addl $0x20, %eax
movq -0x98(%rbp), %rcx
cmpl 0x20(%rcx), %eax
jbe 0x43257
jmp 0x43284
movq -0x60(%rbp), %rax
movq -0x50(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movq -0x60(%rbp), %rax
movq -0x88(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x88(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x88(%rbp)
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x43179
cmpq $0x2, -0x88(%rbp)
jl 0x432b8
movq -0x88(%rbp), %rcx
movq -0x8(%rbp), %rax
addq 0x238(%rax), %rcx
movq %rcx, 0x238(%rax)
jmp 0x432ba
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x432c4
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x42ded
movq -0x8(%rbp), %rax
cmpq $0x0, 0x238(%rax)
jbe 0x433c6
movq -0x8(%rbp), %rax
movq 0x248(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x248(%rax), %rsi
movq -0x8(%rbp), %rax
movq 0x238(%rax), %rax
shlq $0x3, %rax
addq %rax, %rsi
callq 0x2da20
movq $0x1, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x40(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x238(%rcx), %rax
ja 0x433c4
movq -0x40(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x238(%rcx), %rax
je 0x43372
movq -0x8(%rbp), %rax
movq 0x248(%rax), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x8(%rbp), %rcx
movq 0x248(%rcx), %rcx
movq -0x48(%rbp), %rdx
cmpq (%rcx,%rdx,8), %rax
je 0x433ab
movq -0x40(%rbp), %rax
subq -0x48(%rbp), %rax
cmpq $0x2, %rax
jb 0x433a9
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x248(%rcx), %rcx
movq -0x48(%rbp), %rdx
imulq $0x28, (%rcx,%rdx,8), %rcx
addq %rcx, %rax
movl $0x1, 0x1c(%rax)
jmp 0x433ab
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x43324
jmp 0x433c6
jmp 0x433c8
movq $0x1, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x40(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x10(%rcx), %ecx
cmpq %rcx, %rax
ja 0x43693
movq -0x40(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x10(%rcx), %ecx
cmpq %rcx, %rax
je 0x43426
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x48(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x4(%rcx), %eax
je 0x43680
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x48(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x68(%rbp), %rcx
addq %rcx, %rax
movzbl 0x2c(%rax), %eax
cmpl $0x2, %eax
jne 0x434b2
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x68(%rbp), %rcx
addq %rcx, %rax
movb $0x1, 0x2e(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x68(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
addl $0x1, %eax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
imulq $0xa8, -0x68(%rbp), %rdx
addq %rdx, %rcx
subl 0x4(%rcx), %eax
movl %eax, %eax
movl %eax, %edx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rcx
subq %rdx, %rcx
movq %rcx, 0x18(%rax)
jmp 0x43678
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x68(%rbp), %rcx
addq %rcx, %rax
movzbl 0x2c(%rax), %eax
cmpl $0x1, %eax
jne 0x43676
movq -0x48(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x40(%rbp), %rax
jae 0x43674
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x50(%rbp), %rcx
addq %rcx, %rax
movzbl 0xc(%rax), %eax
andl $0x1, %eax
cmpl $0x1, %eax
je 0x43521
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x50(%rbp), %rcx
addq %rcx, %rax
movzbl 0xc(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x43661
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x50(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rax
cmpl $0x1, 0x1c(%rax)
jne 0x4365f
movq -0x90(%rbp), %rax
cmpl $0x2, 0x8(%rax)
jb 0x4365f
movq -0x90(%rbp), %rax
cmpl $0x2, 0xc(%rax)
jb 0x4365f
cmpq $-0x1, -0x38(%rbp)
je 0x435d4
movq -0x90(%rbp), %rax
movl 0x4(%rax), %eax
addq -0x38(%rbp), %rax
movq -0x90(%rbp), %rcx
movl 0x8(%rcx), %ecx
cmpq %rcx, %rax
jb 0x435d4
movq -0x90(%rbp), %rcx
movl 0x4(%rcx), %eax
movl 0x8(%rcx), %ecx
cvtsi2sd %rcx, %xmm1
movsd -0x30(%rbp), %xmm3
cvtsi2sd %rax, %xmm2
movaps %xmm1, %xmm0
mulsd %xmm3, %xmm0
addsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jae 0x4365f
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x68(%rbp), %rcx
addq %rcx, %rax
movb $0x1, 0x2e(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x50(%rbp), %rcx
addq %rcx, %rax
movzbl 0xc(%rax), %eax
andl $0x1, %eax
cmpl $0x1, %eax
jne 0x4365d
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x68(%rbp), %rcx
addq %rcx, %rax
movb $0x2, 0x2c(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x68(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
addl $0x1, %eax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
imulq $0xa8, -0x68(%rbp), %rdx
addq %rdx, %rcx
subl 0x4(%rcx), %eax
movl %eax, %eax
movl %eax, %edx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rcx
subq %rdx, %rcx
movq %rcx, 0x18(%rax)
jmp 0x43674
jmp 0x4365f
jmp 0x43661
jmp 0x43663
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x434d9
jmp 0x43676
jmp 0x43678
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x43682
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x433d8
addq $0xc0, %rsp
popq %rbp
retq
nopl (%rax)