// File: chhylp123[P]hifiasm/Correct.cpp
// Function: generate_haplotypes_sv(haplotype_evdience_alloc*, overlap_region_alloc*, unsigned long)
void generate_haplotypes_sv(haplotype_evdience_alloc* hap, overlap_region_alloc* overlap_list, uint64_t rid)
{
    uint64_t k, l, i, o, ii;
    int64_t z; SnpStats *s = NULL;
    // fprintf(stderr, "[M::%s] hap->snp_stat.n::%u, hap->length::%u\n", __func__, (uint32_t)hap->snp_stat.n, (uint32_t)hap->length);
    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(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(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; 
                kv_push(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(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(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;
                // fprintf(stderr, "[M::%s] rid::%u\t%.*s\n", __func__, overlap_list->list[ii].y_id, (int)Get_NAME_LENGTH(R_INF, overlap_list->list[ii].y_id), Get_NAME(R_INF, overlap_list->list[ii].y_id));
            }
            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) {
                    ///not real allels
                    z = hap->list[i].overlapSite; 
                    s = &(hap->snp_stat.a[z]);
                    s->occ_0--;
                    // if(!(s->occ_0 >= 1)) {
                    //     fprintf(stderr, "[M::%s] rid::%lu, ssite::%u, lsite::%u, i::%lu, idx::%u\n", __func__, rid, s->site, hap->list[i].site, i, hap->list[i].overlapSite);
                    // }
                    assert(s->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(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(s->score == 1) o++;
            }
            ii = hap->list[l].overlapID;
            if(overlap_list->list[ii].is_match == 1 && o > 0) {
                overlap_list->list[ii].is_match = 2;
                // fprintf(stderr, "[M::%s] rid::%u\t%.*s\n", __func__, overlap_list->list[ii].y_id, (int)Get_NAME_LENGTH(R_INF, overlap_list->list[ii].y_id), Get_NAME(R_INF, overlap_list->list[ii].y_id));
            }
        }


        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;
            }
        } 
    }



    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))) {
                            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;
                                // fprintf(stderr, "[M::%s] rid::%u\t%.*s\n", __func__, overlap_list->list[ii].y_id, (int)Get_NAME_LENGTH(R_INF, overlap_list->list[ii].y_id), Get_NAME(R_INF, overlap_list->list[ii].y_id));
                                break;
                            }
                        }
                    }

                }
            }
            l = k;
        }
    }    
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x220(%rax)
je 0x436d4
movq -0x8(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jne 0x436d9
jmp 0x4417c
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, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x10(%rcx), %ecx
cmpq %rcx, %rax
ja 0x43965
movq -0x20(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x10(%rcx), %ecx
cmpq %rcx, %rax
je 0x43767
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x20(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x28(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x4(%rcx), %eax
je 0x43952
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x4386b
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x30(%rbp), %rcx
addq %rcx, %rax
movzbl 0xc(%rax), %eax
andl $0x1, %eax
cmpl $0x1, %eax
je 0x437a5
jmp 0x4385a
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x30(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movl 0x20(%rax), %eax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x30(%rbp), %rdx
addq %rdx, %rcx
cmpl (%rcx), %eax
jne 0x437e9
jmp 0x43808
leaq 0x33f1e3(%rip), %rdi    # 0x3829d3
leaq 0x33eb24(%rip), %rsi    # 0x38231b
movl $0x23a9, %edx           # imm = 0x23A9
leaq 0x33f201(%rip), %rcx    # 0x382a04
callq 0x2130
movq -0x50(%rbp), %rax
cmpl $0x2, 0x8(%rax)
jb 0x4381c
movq -0x50(%rbp), %rax
cmpl $0x2, 0xc(%rax)
jae 0x4381e
jmp 0x4385a
movq -0x50(%rbp), %rax
movl 0x8(%rax), %eax
leaq 0x380fcc(%rip), %rcx    # 0x3c47f8
cmpq 0x218(%rcx), %rax
jl 0x43858
movq -0x50(%rbp), %rax
movl 0xc(%rax), %eax
leaq 0x380fb5(%rip), %rcx    # 0x3c47f8
cmpq 0x210(%rcx), %rax
jl 0x43858
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x4385a
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x43777
cmpq $0x0, -0x38(%rbp)
jbe 0x4394a
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
subq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
shlq $0x20, %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0x238(%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0x240(%rcx), %rax
jne 0x4391c
movq -0x8(%rbp), %rax
cmpq $0x0, 0x240(%rax)
je 0x438d5
movq -0x8(%rbp), %rax
movq 0x240(%rax), %rax
shlq %rax
movq %rax, -0x58(%rbp)
jmp 0x438e0
movl $0x2, %eax
movq %rax, -0x58(%rbp)
jmp 0x438e0
movq -0x58(%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 -0x38(%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 0x4394a
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x43954
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x43719
movq -0x8(%rbp), %rax
cmpq $0x0, 0x238(%rax)
jbe 0x43f12
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, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x238(%rcx), %rax
jae 0x43c84
movq $0x0, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0x248(%rax), %rax
movq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rcx
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, %edx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x59(%rbp)
jae 0x43a2b
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x30(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x28(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x4(%rcx), %eax
sete %al
movb %al, -0x59(%rbp)
movb -0x59(%rbp), %al
testb $0x1, %al
jne 0x43a37
jmp 0x43adf
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x30(%rbp), %rcx
addq %rcx, %rax
movzbl 0xc(%rax), %eax
andl $0x1, %eax
cmpl $0x1, %eax
je 0x43a54
jmp 0x43ace
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x30(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpl $0x2, 0x8(%rax)
jb 0x43a90
movq -0x50(%rbp), %rax
cmpl $0x2, 0xc(%rax)
jae 0x43a92
jmp 0x43ace
movq -0x50(%rbp), %rax
movl 0x8(%rax), %eax
leaq 0x380d58(%rip), %rcx    # 0x3c47f8
cmpq 0x218(%rcx), %rax
jl 0x43acc
movq -0x50(%rbp), %rax
movl 0xc(%rax), %eax
leaq 0x380d41(%rip), %rcx    # 0x3c47f8
cmpq 0x210(%rcx), %rax
jl 0x43acc
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x43ace
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x439ea
cmpq $0x0, -0x38(%rbp)
jne 0x43aeb
jmp 0x43c73
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x28(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x40(%rbp), %rcx
addq %rcx, %rax
movzbl 0x2c(%rax), %eax
cmpl $0x1, %eax
jne 0x43b32
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x40(%rbp), %rcx
addq %rcx, %rax
movb $0x2, 0x2c(%rax)
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rcx
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, %edx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x5a(%rbp)
jae 0x43b7b
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x30(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x28(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x4(%rcx), %eax
sete %al
movb %al, -0x5a(%rbp)
movb -0x5a(%rbp), %al
testb $0x1, %al
jne 0x43b87
jmp 0x43c71
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x30(%rbp), %rcx
addq %rcx, %rax
movzbl 0xc(%rax), %eax
andl $0x1, %eax
cmpl $0x1, %eax
jne 0x43bda
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x30(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movl $0x1, 0x1c(%rax)
jmp 0x43c5e
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x30(%rbp), %rcx
addq %rcx, %rax
movzbl 0xc(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x43c5c
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x30(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rax
imulq $0x28, -0x48(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movl 0x8(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x8(%rax)
movq -0x50(%rbp), %rax
cmpl $0x1, 0x8(%rax)
jb 0x43c3b
jmp 0x43c5a
leaq 0x33ee1c(%rip), %rdi    # 0x382a5e
leaq 0x33e6d2(%rip), %rsi    # 0x38231b
movl $0x23d7, %edx           # imm = 0x23D7
leaq 0x33edaf(%rip), %rcx    # 0x382a04
callq 0x2130
jmp 0x43c5c
jmp 0x43c5e
jmp 0x43c60
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x43b3a
jmp 0x43c73
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x439ac
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x238(%rcx), %rax
jae 0x43dfc
movq $0x0, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0x248(%rax), %rax
movq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rcx
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, %edx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x5b(%rbp)
jae 0x43d0b
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x30(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x28(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x4(%rcx), %eax
sete %al
movb %al, -0x5b(%rbp)
movb -0x5b(%rbp), %al
testb $0x1, %al
jne 0x43d17
jmp 0x43d9b
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x30(%rbp), %rcx
addq %rcx, %rax
movzbl 0xc(%rax), %eax
andl $0x1, %eax
cmpl $0x1, %eax
je 0x43d34
jmp 0x43d8a
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x30(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpl $0x2, 0x8(%rax)
jb 0x43d70
movq -0x50(%rbp), %rax
cmpl $0x2, 0xc(%rax)
jae 0x43d72
jmp 0x43d8a
movq -0x50(%rbp), %rax
cmpl $0x1, 0x1c(%rax)
jne 0x43d88
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x43d8a
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x43cca
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x28(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x40(%rbp), %rcx
addq %rcx, %rax
movzbl 0x2c(%rax), %eax
cmpl $0x1, %eax
jne 0x43de9
cmpq $0x0, -0x38(%rbp)
jbe 0x43de9
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x40(%rbp), %rcx
addq %rcx, %rax
movb $0x2, 0x2c(%rax)
jmp 0x43deb
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x43c8c
movq $0x1, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x10(%rcx), %ecx
cmpq %rcx, %rax
ja 0x43f10
movq -0x20(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x10(%rcx), %ecx
cmpq %rcx, %rax
je 0x43e5a
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x20(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x28(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x4(%rcx), %eax
je 0x43efd
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x28(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x40(%rbp), %rcx
addq %rcx, %rax
movzbl 0x2c(%rax), %eax
cmpl $0x1, %eax
jne 0x43ef5
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x43ef3
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x30(%rbp), %rcx
addq %rcx, %rax
movzbl 0xc(%rax), %eax
andl $0x1, %eax
cmpl $0x1, %eax
jne 0x43ee3
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x30(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl $0xffffffff, 0x1c(%rax) # imm = 0xFFFFFFFF
jmp 0x43ee5
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x43e93
jmp 0x43ef5
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x43eff
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x43e0c
jmp 0x43f12
movq $0x1, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x10(%rcx), %ecx
cmpq %rcx, %rax
ja 0x4417c
movq -0x20(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x10(%rcx), %ecx
cmpq %rcx, %rax
je 0x43f70
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x20(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x28(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x4(%rcx), %eax
je 0x44169
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x28(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x40(%rbp), %rcx
addq %rcx, %rax
movzbl 0x2c(%rax), %eax
cmpl $0x2, %eax
jne 0x43ffc
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x40(%rbp), %rcx
addq %rcx, %rax
movb $0x1, 0x2e(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
addl $0x1, %eax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
imulq $0xa8, -0x40(%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 0x44161
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x40(%rbp), %rcx
addq %rcx, %rax
movzbl 0x2c(%rax), %eax
cmpl $0x1, %eax
jne 0x4415f
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x4415d
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x30(%rbp), %rcx
addq %rcx, %rax
movzbl 0xc(%rax), %eax
andl $0x1, %eax
cmpl $0x1, %eax
je 0x4406b
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x30(%rbp), %rcx
addq %rcx, %rax
movzbl 0xc(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x4414a
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x18, -0x30(%rbp), %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpl $0x1, 0x1c(%rax)
jne 0x44148
movq -0x50(%rbp), %rax
cmpl $0x2, 0x8(%rax)
jb 0x44148
movq -0x50(%rbp), %rax
cmpl $0x2, 0xc(%rax)
jb 0x44148
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x40(%rbp), %rcx
addq %rcx, %rax
movb $0x1, 0x2e(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x18, -0x30(%rbp), %rcx
addq %rcx, %rax
movzbl 0xc(%rax), %eax
andl $0x1, %eax
cmpl $0x1, %eax
jne 0x44146
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x40(%rbp), %rcx
addq %rcx, %rax
movb $0x2, 0x2c(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rax
imulq $0xa8, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
addl $0x1, %eax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
imulq $0xa8, -0x40(%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 0x4415d
jmp 0x44148
jmp 0x4414a
jmp 0x4414c
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x44023
jmp 0x4415f
jmp 0x44161
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x4416b
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x43f22
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)