// File: medvedevgroup[P]varmatch/src/vm.cpp
// Function: main
int main(int argc, char* argv[])
{
//	dout << "Debug Mode" << endl;
//    WholeGenome wg(1);
//    wg.test();
//    return 0;

    Args args;
    TclapParser(args, argc, argv);

    //return 0;
    WholeGenome wg(args.thread_num,
                   args.output_dir,
                   args.pr_curves);

    // if(args.direct_match){
    //     for(int i = 0; i < args.query_file_list.size(); i++){
    //         string query_filename = args.query_file_list[i];
    //         wg.DirectMatch(args.ref_vcf_filename, query_filename, args.match_mode);
    //     }
    //     return 0;
    // }
    if(args.score_scheme == 3){
        wg.ReadDirectRef(args.genome_seq_filename, 
            args.ref_vcf_filename);
    }else{
        wg.ReadRef(args.genome_seq_filename, 
            args.ref_vcf_filename);
    }

    // use a loop 
    for(int i = 0; i < args.query_file_list.size(); i++){
        string query_filename = args.query_file_list[i];

        wg.Compare(query_filename,
            "query"+to_string(i+1),
            args.detail_results,
            args.score_unit,
            args.match_mode,
            args.score_scheme);
    }

    return 0;

//
//    if(args.remove_duplicates){
//        RemoveDuplicate rd(args.thread_num);
//        rd.Deduplicate(args.single_vcf_filename,
//            args.genome_seq_filename,
//            args.direct_search,
//            args.output_filename);
//        return 0;
//	}
//
//	DiploidVCF dv(args.thread_num);
//    dv.Compare(args.ref_vcf_filename,
//		args.que_vcf_filename,
//		args.genome_seq_filename,
//		args.direct_search,
//		args.output_filename,
//		args.match_genotype,
//		args.normalization,
//		args.score_basepair,
//		args.overlap_match,
//		args.variant_check);
//	return 0;
//
//	VCF vcf(args.thread_num);
//	vcf.Compare(args.ref_vcf_filename,
//			args.que_vcf_filename,
//			args.genome_seq_filename,
//			args.direct_search,
//            args.output_filename,
//            args.match_genotype,
//			args.normalization);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x4d0, %rsp            # imm = 0x4D0
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0xe8(%rbp), %rdi
movq %rdi, -0x4b0(%rbp)
callq 0xbe90
movq -0x4b0(%rbp), %rdi
movl -0x8(%rbp), %esi
movq -0x10(%rbp), %rdx
callq 0x69f0
jmp 0x8a81
movl -0x48(%rbp), %eax
movl %eax, -0x4b4(%rbp)
leaq -0x88(%rbp), %rsi
leaq -0x3a0(%rbp), %rdi
callq 0x61b0
jmp 0x8a9f
movl -0x4b4(%rbp), %esi
movzbl -0x18(%rbp), %ecx
andl $0x1, %ecx
leaq -0x380(%rbp), %rdi
leaq -0x3a0(%rbp), %rdx
callq 0x1ac70
jmp 0x8ac1
leaq -0x3a0(%rbp), %rdi
callq 0x6828
cmpl $0x3, -0x3c(%rbp)
jne 0x8bce
leaq -0xa8(%rbp), %rsi
leaq -0x3c0(%rbp), %rdi
callq 0x61b0
jmp 0x8aec
leaq -0x3e0(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x61b0
jmp 0x8b01
leaq -0x380(%rbp), %rdi
leaq -0x3c0(%rbp), %rsi
leaq -0x3e0(%rbp), %rdx
callq 0x30e10
jmp 0x8b1d
leaq -0x3e0(%rbp), %rdi
callq 0x6828
leaq -0x3c0(%rbp), %rdi
callq 0x6828
jmp 0x8c71
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xf0(%rbp)
movl %eax, -0xf4(%rbp)
jmp 0x8e45
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xf0(%rbp)
movl %eax, -0xf4(%rbp)
leaq -0x3a0(%rbp), %rdi
callq 0x6828
jmp 0x8e45
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xf0(%rbp)
movl %eax, -0xf4(%rbp)
jmp 0x8e39
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xf0(%rbp)
movl %eax, -0xf4(%rbp)
jmp 0x8bbd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xf0(%rbp)
movl %eax, -0xf4(%rbp)
leaq -0x3e0(%rbp), %rdi
callq 0x6828
leaq -0x3c0(%rbp), %rdi
callq 0x6828
jmp 0x8e39
leaq -0xa8(%rbp), %rsi
leaq -0x400(%rbp), %rdi
callq 0x61b0
jmp 0x8be3
leaq -0x420(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x61b0
jmp 0x8bf8
leaq -0x380(%rbp), %rdi
leaq -0x400(%rbp), %rsi
leaq -0x420(%rbp), %rdx
callq 0x30d30
jmp 0x8c14
leaq -0x420(%rbp), %rdi
callq 0x6828
leaq -0x400(%rbp), %rdi
callq 0x6828
jmp 0x8c71
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xf0(%rbp)
movl %eax, -0xf4(%rbp)
jmp 0x8c60
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xf0(%rbp)
movl %eax, -0xf4(%rbp)
leaq -0x420(%rbp), %rdi
callq 0x6828
leaq -0x400(%rbp), %rdi
callq 0x6828
jmp 0x8e39
movl $0x0, -0x424(%rbp)
movslq -0x424(%rbp), %rax
movq %rax, -0x4c0(%rbp)
leaq -0xe8(%rbp), %rdi
addq $0xb8, %rdi
callq 0xbf00
movq %rax, %rcx
movq -0x4c0(%rbp), %rax
cmpq %rcx, %rax
jae 0x8e0e
leaq -0x30(%rbp), %rdi
movslq -0x424(%rbp), %rsi
callq 0x9080
movq %rax, %rsi
leaq -0x448(%rbp), %rdi
callq 0x61b0
jmp 0x8cd0
leaq -0x468(%rbp), %rdi
leaq -0x448(%rbp), %rsi
callq 0x61b0
jmp 0x8ce5
movl -0x424(%rbp), %esi
incl %esi
leaq -0x4a8(%rbp), %rdi
callq 0xb190
jmp 0x8cfb
leaq 0x4b3de(%rip), %rsi     # 0x540e0
leaq -0x488(%rbp), %rdi
leaq -0x4a8(%rbp), %rdx
callq 0xb140
jmp 0x8d17
movl -0x44(%rbp), %r8d
movl -0x40(%rbp), %r9d
movl -0x3c(%rbp), %edx
movzbl -0x38(%rbp), %ecx
movq %rsp, %rax
movl %edx, (%rax)
andl $0x1, %ecx
leaq -0x380(%rbp), %rdi
leaq -0x468(%rbp), %rsi
leaq -0x488(%rbp), %rdx
callq 0x311a0
jmp 0x8d4a
leaq -0x488(%rbp), %rdi
callq 0x6828
leaq -0x4a8(%rbp), %rdi
callq 0x6828
leaq -0x468(%rbp), %rdi
callq 0x6828
leaq -0x448(%rbp), %rdi
callq 0x6828
movl -0x424(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x424(%rbp)
jmp 0x8c7b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xf0(%rbp)
movl %eax, -0xf4(%rbp)
jmp 0x8e00
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xf0(%rbp)
movl %eax, -0xf4(%rbp)
jmp 0x8df4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xf0(%rbp)
movl %eax, -0xf4(%rbp)
jmp 0x8de8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xf0(%rbp)
movl %eax, -0xf4(%rbp)
leaq -0x488(%rbp), %rdi
callq 0x6828
leaq -0x4a8(%rbp), %rdi
callq 0x6828
leaq -0x468(%rbp), %rdi
callq 0x6828
leaq -0x448(%rbp), %rdi
callq 0x6828
jmp 0x8e39
movl $0x0, -0x4(%rbp)
leaq -0x380(%rbp), %rdi
callq 0x1b540
leaq -0xe8(%rbp), %rdi
callq 0xbf20
movl -0x4(%rbp), %eax
addq $0x4d0, %rsp            # imm = 0x4D0
popq %rbp
retq
leaq -0x380(%rbp), %rdi
callq 0x1b540
leaq -0xe8(%rbp), %rdi
callq 0xbf20
movq -0xf0(%rbp), %rdi
callq 0x6750
nopl (%rax)