// File: chhylp123[P]hifiasm/CommandLines.cpp
// Function: check_option(hifiasm_opt_t*)
int check_option(hifiasm_opt_t* asm_opt)
{
    if(asm_opt->read_file_names == NULL || asm_opt->num_reads == 0)
    {
        fprintf(stderr, "[ERROR] missing input: please specify a read file\n");
        return 0;
    }

    if(asm_opt->output_file_name == NULL)
    {
        fprintf(stderr, "[ERROR] missing output: please specify the output name (-o)\n");
        return 0;
    }

    if(asm_opt->thread_num < 1)
    {
        fprintf(stderr, "[ERROR] the number of threads must be > 0 (-t)\n");
        return 0;
    }


    if(asm_opt->number_of_round < 1)
    {
        fprintf(stderr, "[ERROR] the number of rounds for correction must be > 0 (-r)\n");
        return 0;
    }

    if(asm_opt->clean_round < 1)
    {
        fprintf(stderr, "[ERROR] the number of rounds for assembly cleaning must be > 0 (-a)\n");
        return 0;
    }

    if(asm_opt->adapterLen < 0)
    {
        fprintf(stderr, "[ERROR] the length of removed adapters must be >= 0 (-z)\n");
        return 0;
    }


    if(asm_opt->k_mer_length >= 64)
    {
        fprintf(stderr, "[ERROR] the length of k_mer must be < 64 (-k)\n");
        return 0;
    }


    if(asm_opt->max_drop_rate < 0 || asm_opt->max_drop_rate >= 1 ) 
    {
        fprintf(stderr, "[ERROR] max overlap drop ratio must be [0.0, 1.0) (-x)\n");
        return 0;
    }

    
    if(asm_opt->min_drop_rate < 0 || asm_opt->min_drop_rate >= 1)
    {
        fprintf(stderr, "[ERROR] min overlap drop ratio must be [0.0, 1.0) (-y)\n");
        return 0;
    }

    if(asm_opt->max_drop_rate <= asm_opt->min_drop_rate)
    {
        fprintf(stderr, "[ERROR] min overlap drop ratio must be less than max overlap drop ratio (-x/-y)\n");
        return 0;
    }

    if(asm_opt->small_pop_bubble_size < 0)
    {
        fprintf(stderr, "[ERROR] the size of popped small bubbles must be >= 0 (-p)\n");
        return 0;
    }

    if(asm_opt->large_pop_bubble_size < 0)
    {
        fprintf(stderr, "[ERROR] the size of popped large bubbles must be >= 0 (-m)\n");
        return 0;
    }

    if(asm_opt->max_hang_Len < 0)
    {
        fprintf(stderr, "[ERROR] max_hang_Len must be >= 0\n");
        return 0;
    }

    if(asm_opt->max_hang_rate < 0)
    {
        fprintf(stderr, "[ERROR] max_hang_rate must be >= 0\n");
        return 0;
    }

    if(asm_opt->gap_fuzz < 0)
    {
        fprintf(stderr, "[ERROR] gap_fuzz must be >= 0\n");
        return 0;
    }

    if(asm_opt->min_overlap_Len < 0)
    {
        fprintf(stderr, "[ERROR] min_overlap_Len must be >= 0\n");
        return 0;
    }

    if(asm_opt->min_overlap_coverage < 0)
    {
        fprintf(stderr, "[ERROR] min_overlap_coverage must be >= 0\n");
        return 0;
    }

	if (asm_opt->max_ov_diff_ec < asm_opt->max_ov_diff_final) {
		fprintf(stderr, "[ERROR] max_ov_diff_ec shouldn't be smaller than max_ov_diff_final\n");
		return 0;
	}

	if (asm_opt->max_ov_diff_ec < HA_MIN_OV_DIFF) {
		fprintf(stderr, "[ERROR] max_ov_diff_ec shouldn't be smaller than %g\n", HA_MIN_OV_DIFF);
		return 0;
	}

    if(asm_opt->max_short_tip < 0)
    {
        fprintf(stderr, "[ERROR] the length of removal tips must be >= 0 (-n)\n");
        return 0;
    }

    if(asm_opt->purge_level_primary < 0 || asm_opt->purge_level_primary > 3)
    {
        fprintf(stderr, "[ERROR] the level of purge-dup should be [0, 3] (-l)\n");
        return 0;
    }

    if(ha_opt_triobin(asm_opt) && ((asm_opt->purge_level_trio < 0 || asm_opt->purge_level_trio > 1)))
    {
        fprintf(stderr, "[ERROR] the level of purge-dup for trio should be [0, 1] (-l)\n");
        return 0;
    }

    if(asm_opt->hom_global_coverage < 0 && asm_opt->hom_global_coverage != -1)
    {
        fprintf(stderr, "[ERROR] homozygous read coverage should be >= 0 (--hom-cov)\n");
        return 0;
    }

    if(asm_opt->pur_global_coverage < 0 && asm_opt->pur_global_coverage != -1)
    {
        fprintf(stderr, "[ERROR] purge duplication coverage threshold should be >= 0 (--purge-max)\n");
        return 0;
    }

    if(asm_opt->bed_inconsist_rate < 0 || asm_opt->bed_inconsist_rate > 100)
    {
        fprintf(stderr, "[ERROR] inconsistency rate should be [0, 100] (--lowQ)\n");
        return 0;
    }


    if(asm_opt->fn_bin_yak[0] != NULL && check_file(asm_opt->fn_bin_yak[0], "YAK1") == 0) return 0;
    if(asm_opt->fn_bin_yak[1] != NULL && check_file(asm_opt->fn_bin_yak[1], "YAK2") == 0) return 0;
    if(asm_opt->fn_bin_list[0] != NULL && check_file(asm_opt->fn_bin_list[0], "LIST1") == 0) return 0;
    if(asm_opt->fn_bin_list[1] != NULL && check_file(asm_opt->fn_bin_list[1], "LIST2") == 0) return 0;
    if(asm_opt->required_read_name != NULL && check_file(asm_opt->required_read_name, "b") == 0) return 0;
    
    if(asm_opt->hic_reads[0] != NULL && check_hic_reads(asm_opt->hic_reads[0], "HIC1") == 0) return 0;
    if(asm_opt->hic_reads[1] != NULL && check_hic_reads(asm_opt->hic_reads[1], "HIC2") == 0) return 0;
    if(asm_opt->hic_reads[0] != NULL && asm_opt->hic_reads[1] == NULL)
    {
        fprintf(stderr, "[ERROR] lack r2 of HiC reads (--h2)\n");
        return 0;
    }
    if(asm_opt->hic_reads[1] != NULL && asm_opt->hic_reads[0] == NULL)
    {
        fprintf(stderr, "[ERROR] lack r1 of HiC reads (--h1)\n");
        return 0;
    }

    if(asm_opt->hic_reads[0] != NULL && asm_opt->hic_reads[1] != NULL && 
                            asm_opt->hic_reads[0]->n != asm_opt->hic_reads[1]->n)
    {
        fprintf(stderr, "[ERROR] wrong r1 and r2 of HiC reads (--h1 && --h2)\n");
        return 0;
    }

    if(asm_opt->hic_enzymes != NULL && asm_opt->hic_enzymes->n == 0)
    {
        fprintf(stderr, "[ERROR] wrong HiC enzymes (--enzyme)\n");
        return 0;
    }

    if(asm_opt->hic_reads[0] != NULL && asm_opt->hic_reads[0]->n == 0)
    {
        fprintf(stderr, "[ERROR] wrong r1 of HiC reads (--h1)\n");
        return 0;
    }

    if(asm_opt->hic_reads[1] != NULL && asm_opt->hic_reads[1]->n == 0)
    {
        fprintf(stderr, "[ERROR] wrong r2 of HiC reads (--h2)\n");
        return 0;
    }

    if(asm_opt->ar != NULL && check_fq_files(asm_opt->ar, "--ul", asm_opt->ul_mod) == 0) return 0;
    if(asm_opt->ar != NULL && asm_opt->ar->n == 0)
    {
        fprintf(stderr, "[ERROR] wrong UL reads (--ul)\n");
        return 0;
    }

    if(asm_opt->b_low_cov < 0)
    {
        fprintf(stderr, "[ERROR] must >= 0 (--b-cov)\n");
        return 0;
    }

    if(asm_opt->b_high_cov != -1 && asm_opt->b_high_cov < 0)
    {
        fprintf(stderr, "[ERROR] must >= 0 (--h-cov)\n");
        return 0;
    }

    if(asm_opt->m_rate < 0)
    {
        fprintf(stderr, "[ERROR] must >= 0 (--m-rate)\n");
        return 0;
    }

    if(asm_opt->b_high_cov != -1 && asm_opt->b_high_cov <= asm_opt->b_low_cov)
    {
        fprintf(stderr, "[ERROR] [--h-cov] must >= [--b-cov]\n");
        return 0;
    }

    if(asm_opt->purge_simi_thres < 0)
    {
        fprintf(stderr, "[ERROR] [-s] must >= 0\n");
        return 0;
    }

    if(asm_opt->max_kmer_cnt < 0)
    {
        fprintf(stderr, "[ERROR] [--max-kocc] must >= 0\n");
        return 0;
    }

    if(asm_opt->hg_size < -1)
    {
        fprintf(stderr, "[ERROR] [--hg-size] wrong genome size\n");
        return 0;
    }

    if(asm_opt->ul_mod != 0 && asm_opt->ul_mod != 1) {
        fprintf(stderr, "[ERROR] must be 0 or 1 (--ul-m)\n");
        return 0;
    }

    if(asm_opt->telo_motif) {
        uint64_t k, tlen = strlen((asm_opt->telo_motif)); char c;
        if(tlen > 32) {
            fprintf(stderr, "[ERROR] [--telo-m] must be no longer than 32\n");
            return 0;
        }
        for (k = 0; k < tlen; k++) {
            c = asm_opt->telo_motif[k];
            if(c != 'A' && c != 'C' && c != 'G' && c != 'T' &&
                c != 'a' && c != 'c' && c != 'g' && c != 't') {
                fprintf(stderr, "[ERROR] [--telo-m] must be A/C/G/T\n");
                return 0;
            }
        }
    }

    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x3cb1
movq -0x10(%rbp), %rax
cmpl $0x0, 0x4(%rax)
jne 0x3cd5
movq 0x3c0328(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37cb6e(%rip), %rsi    # 0x380830
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x3d04
movq 0x3c02f9(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37cb72(%rip), %rsi    # 0x380863
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpl $0x1, 0x7c(%rax)
jge 0x3d32
movq 0x3c02cb(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37cb81(%rip), %rsi    # 0x3808a0
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpl $0x1, 0xf8(%rax)
jge 0x3d63
movq 0x3c029a(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37cb80(%rip), %rsi    # 0x3808d0
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpl $0x1, 0x104(%rax)
jge 0x3d94
movq 0x3c0269(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37cb8d(%rip), %rsi    # 0x38090e
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpl $0x0, 0x100(%rax)
jge 0x3dc5
movq 0x3c0238(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37cba1(%rip), %rsi    # 0x380953
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpl $0x40, 0x80(%rax)
jl 0x3df6
movq 0x3c0207(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37cbaa(%rip), %rsi    # 0x38098d
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
xorps %xmm0, %xmm0
ucomiss 0x160(%rax), %xmm0
ja 0x3e1f
movq -0x10(%rbp), %rax
movss 0x160(%rax), %xmm0
movss 0x37b272(%rip), %xmm1   # 0x37f08c
ucomiss %xmm1, %xmm0
jb 0x3e43
movq 0x3c01ba(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37cb8c(%rip), %rsi    # 0x3809bc
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
xorps %xmm0, %xmm0
ucomiss 0x15c(%rax), %xmm0
ja 0x3e6c
movq -0x10(%rbp), %rax
movss 0x15c(%rax), %xmm0
movss 0x37b225(%rip), %xmm1   # 0x37f08c
ucomiss %xmm1, %xmm0
jb 0x3e90
movq 0x3c016d(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37cb77(%rip), %rsi    # 0x3809f4
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
movss 0x160(%rax), %xmm1
movq -0x10(%rbp), %rax
movss 0x15c(%rax), %xmm0
ucomiss %xmm1, %xmm0
jb 0x3ed1
movq 0x3c012c(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37cb6e(%rip), %rsi    # 0x380a2c
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpq $0x0, 0x180(%rax)
jge 0x3f03
movq 0x3c00fa(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37cb8d(%rip), %rsi    # 0x380a7d
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpq $0x0, 0x188(%rax)
jge 0x3f35
movq 0x3c00c8(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37cb97(%rip), %rsi    # 0x380ab9
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpl $0x0, 0x10c(%rax)
jge 0x3f66
movq 0x3c0097(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37cba2(%rip), %rsi    # 0x380af5
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
xorps %xmm0, %xmm0
ucomiss 0x158(%rax), %xmm0
jbe 0x3f9a
movq 0x3c0063(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37cb91(%rip), %rsi    # 0x380b18
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpl $0x0, 0x110(%rax)
jge 0x3fcb
movq 0x3c0032(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37cb84(%rip), %rsi    # 0x380b3c
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpl $0x0, 0x114(%rax)
jge 0x3ffc
movq 0x3c0001(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37cb72(%rip), %rsi    # 0x380b5b
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpl $0x0, 0x118(%rax)
jge 0x402d
movq 0x3bffd0(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37cb67(%rip), %rsi    # 0x380b81
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
movsd 0xc0(%rax), %xmm1
movq -0x10(%rbp), %rax
movsd 0xc8(%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x406f
movq 0x3bff8e(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37cb50(%rip), %rsi    # 0x380bac
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
movsd 0x37afcd(%rip), %xmm0   # 0x37f048
ucomisd 0xc0(%rax), %xmm0
jbe 0x40b1
movq 0x3bff54(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37cb5a(%rip), %rsi    # 0x380bf0
movsd 0x37afaa(%rip), %xmm0   # 0x37f048
movb $0x1, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpl $0x0, 0x11c(%rax)
jge 0x40e2
movq 0x3bff1b(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37cb56(%rip), %rsi    # 0x380c25
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpl $0x0, 0x130(%rax)
jl 0x40fc
movq -0x10(%rbp), %rax
cmpl $0x3, 0x130(%rax)
jle 0x4120
movq 0x3bfedd(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37cb4e(%rip), %rsi    # 0x380c5b
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rdi
callq 0x4840
cmpl $0x0, %eax
je 0x416c
movq -0x10(%rbp), %rax
cmpl $0x0, 0x134(%rax)
jl 0x4148
movq -0x10(%rbp), %rax
cmpl $0x1, 0x134(%rax)
jle 0x416c
movq 0x3bfe91(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37cb38(%rip), %rsi    # 0x380c91
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpl $0x0, 0x144(%rax)
jge 0x41aa
movq -0x10(%rbp), %rax
cmpl $-0x1, 0x144(%rax)
je 0x41aa
movq 0x3bfe53(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37cb39(%rip), %rsi    # 0x380cd0
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpl $0x0, 0x14c(%rax)
jge 0x41e8
movq -0x10(%rbp), %rax
cmpl $-0x1, 0x14c(%rax)
je 0x41e8
movq 0x3bfe15(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37cb38(%rip), %rsi    # 0x380d0d
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpl $0x0, 0x150(%rax)
jl 0x4202
movq -0x10(%rbp), %rax
cmpl $0x64, 0x150(%rax)
jle 0x4226
movq 0x3bfdd7(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37cb45(%rip), %rsi    # 0x380d58
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x4256
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
leaq 0x37cb50(%rip), %rsi    # 0x380d90
callq 0x48a0
cmpl $0x0, %eax
jne 0x4256
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x4286
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
leaq 0x37cb25(%rip), %rsi    # 0x380d95
callq 0x48a0
cmpl $0x0, %eax
jne 0x4286
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x42b6
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdi
leaq 0x37cafa(%rip), %rsi    # 0x380d9a
callq 0x48a0
cmpl $0x0, %eax
jne 0x42b6
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpq $0x0, 0x38(%rax)
je 0x42e6
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
leaq 0x37cad0(%rip), %rsi    # 0x380da0
callq 0x48a0
cmpl $0x0, %eax
jne 0x42e6
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x4316
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0x396c1b(%rip), %rsi    # 0x39af1b
callq 0x48a0
cmpl $0x0, %eax
jne 0x4316
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpq $0x0, 0x50(%rax)
je 0x4346
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rdi
leaq 0x37ca76(%rip), %rsi    # 0x380da6
callq 0x4950
cmpl $0x0, %eax
jne 0x4346
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpq $0x0, 0x58(%rax)
je 0x4376
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rdi
leaq 0x37ca4b(%rip), %rsi    # 0x380dab
callq 0x4950
cmpl $0x0, %eax
jne 0x4376
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpq $0x0, 0x50(%rax)
je 0x43b0
movq -0x10(%rbp), %rax
cmpq $0x0, 0x58(%rax)
jne 0x43b0
movq 0x3bfc4d(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37ca13(%rip), %rsi    # 0x380db0
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpq $0x0, 0x58(%rax)
je 0x43ea
movq -0x10(%rbp), %rax
cmpq $0x0, 0x50(%rax)
jne 0x43ea
movq 0x3bfc13(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37c9fe(%rip), %rsi    # 0x380dd5
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpq $0x0, 0x50(%rax)
je 0x443c
movq -0x10(%rbp), %rax
cmpq $0x0, 0x58(%rax)
je 0x443c
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movl 0x8(%rax), %eax
movq -0x10(%rbp), %rcx
movq 0x58(%rcx), %rcx
cmpl 0x8(%rcx), %eax
je 0x443c
movq 0x3bfbc1(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37c9d1(%rip), %rsi    # 0x380dfa
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpq $0x0, 0x60(%rax)
je 0x4479
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
cmpl $0x0, 0x8(%rax)
jne 0x4479
movq 0x3bfb84(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37c9c9(%rip), %rsi    # 0x380e2f
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpq $0x0, 0x50(%rax)
je 0x44b6
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
cmpl $0x0, 0x8(%rax)
jne 0x44b6
movq 0x3bfb47(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37c9b2(%rip), %rsi    # 0x380e55
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpq $0x0, 0x58(%rax)
je 0x44f3
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
cmpl $0x0, 0x8(%rax)
jne 0x44f3
movq 0x3bfb0a(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37c99b(%rip), %rsi    # 0x380e7b
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpq $0x0, 0x68(%rax)
je 0x452d
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rdi
movq -0x10(%rbp), %rax
movl 0x244(%rax), %edx
leaq 0x37c98a(%rip), %rsi    # 0x380ea1
callq 0x49c0
cmpl $0x0, %eax
jne 0x452d
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpq $0x0, 0x68(%rax)
je 0x456a
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rax
cmpl $0x0, 0x8(%rax)
jne 0x456a
movq 0x3bfa93(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37c94f(%rip), %rsi    # 0x380ea6
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpl $0x0, 0xd8(%rax)
jge 0x459b
movq 0x3bfa62(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37c93d(%rip), %rsi    # 0x380ec5
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpl $-0x1, 0xdc(%rax)
je 0x45d9
movq -0x10(%rbp), %rax
cmpl $0x0, 0xdc(%rax)
jge 0x45d9
movq 0x3bfa24(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37c91c(%rip), %rsi    # 0x380ee2
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
xorps %xmm0, %xmm0
ucomisd 0xe0(%rax), %xmm0
jbe 0x460e
movq 0x3bf9ef(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37c904(%rip), %rsi    # 0x380eff
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpl $-0x1, 0xdc(%rax)
je 0x4655
movq -0x10(%rbp), %rax
movl 0xdc(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0xd8(%rcx), %eax
jg 0x4655
movq 0x3bf9a8(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37c8db(%rip), %rsi    # 0x380f1d
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
xorps %xmm0, %xmm0
ucomiss 0x16c(%rax), %xmm0
jbe 0x4689
movq 0x3bf974(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37c8cc(%rip), %rsi    # 0x380f42
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpl $0x0, 0xb0(%rax)
jge 0x46ba
movq 0x3bf943(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37c8b3(%rip), %rsi    # 0x380f5a
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpq $-0x1, 0x200(%rax)
jge 0x46ec
movq 0x3bf911(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37c8a1(%rip), %rsi    # 0x380f7a
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpl $0x0, 0x244(%rax)
je 0x472a
movq -0x10(%rbp), %rax
cmpl $0x1, 0x244(%rax)
je 0x472a
movq 0x3bf8d3(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37c88a(%rip), %rsi    # 0x380fa1
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq -0x10(%rbp), %rax
cmpq $0x0, 0x288(%rax)
je 0x4824
movq -0x10(%rbp), %rax
movq 0x288(%rax), %rdi
callq 0x20a0
movq %rax, -0x20(%rbp)
cmpq $0x20, -0x20(%rbp)
jbe 0x477b
movq 0x3bf882(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37c85a(%rip), %rsi    # 0x380fc2
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
movq $0x0, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x4822
movq -0x10(%rbp), %rax
movq 0x288(%rax), %rax
movq -0x18(%rbp), %rcx
movb (%rax,%rcx), %al
movb %al, -0x21(%rbp)
movsbl -0x21(%rbp), %eax
cmpl $0x41, %eax
je 0x480f
movsbl -0x21(%rbp), %eax
cmpl $0x43, %eax
je 0x480f
movsbl -0x21(%rbp), %eax
cmpl $0x47, %eax
je 0x480f
movsbl -0x21(%rbp), %eax
cmpl $0x54, %eax
je 0x480f
movsbl -0x21(%rbp), %eax
cmpl $0x61, %eax
je 0x480f
movsbl -0x21(%rbp), %eax
cmpl $0x63, %eax
je 0x480f
movsbl -0x21(%rbp), %eax
cmpl $0x67, %eax
je 0x480f
movsbl -0x21(%rbp), %eax
cmpl $0x74, %eax
je 0x480f
movq 0x3bf7eb(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x37c7f1(%rip), %rsi    # 0x380ff0
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x4(%rbp)
jmp 0x482b
jmp 0x4811
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x4783
jmp 0x4824
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)