// File: medvedevgroup[P]varmatch/src/wholegenome.cpp
// Function: WholeGenome::WholeGenome(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool)
WholeGenome::WholeGenome(int thread_num_,
    string output_dir_,
    bool pr_curves){

    thread_num = thread_num_;
    chrom_num = 24;

    output_dir = output_dir_;

    //thread_num = thread_num_;
    //dout << "WholeGenome() Thread Number: " << thread_num << endl;

    ref_variant_by_chrid = new vector<DiploidVariant>*[chrom_num];

	for (int j = 0; j < chrom_num; j++) {
		ref_variant_by_chrid[j] = new vector<DiploidVariant>;
	}

    que_variant_by_chrid = new vector<DiploidVariant>*[chrom_num];
    for (int j = 0; j < chrom_num; j++) {
        que_variant_by_chrid[j] = new vector<DiploidVariant>;
    }

    // chr_id starts from 0
	for(int j = 1; j <= 22; j++){
        string chr_name = to_string(j);
        chrname_dict[chr_name] = j-1;
        chr_name = "chr"+chr_name;
        chrname_dict[chr_name] = j-1;
	}
	chrname_dict["X"] = 22;
	chrname_dict["chrX"] = 22;
	chrname_dict["Y"] = 23;
	chrname_dict["chrY"] = 23;

    if(pr_curves){
        per_list = {0.0, 0.1, 0.2, 0.3, 0.9};
    }else{
        per_list = {0.0};
    }

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2a0, %rsp            # imm = 0x2A0
movq %rdx, -0x160(%rbp)
movb %cl, %al
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
andb $0x1, %al
movb %al, -0x19(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x170(%rbp)
addq $0x8, %rdi
movq %rdi, -0x1f0(%rbp)
callq 0x65e0
movq -0x170(%rbp), %rdi
addq $0x28, %rdi
movq %rdi, -0x1e8(%rbp)
callq 0x65e0
movq -0x170(%rbp), %rdi
addq $0x50, %rdi
movq %rdi, -0x1e0(%rbp)
callq 0x12d30
movq -0x170(%rbp), %rdi
addq $0x68, %rdi
movq %rdi, -0x1d8(%rbp)
callq 0x12d30
movq -0x170(%rbp), %rdi
addq $0x88, %rdi
movq %rdi, -0x1d0(%rbp)
callq 0x32210
movq -0x170(%rbp), %rdi
addq $0xb8, %rdi
movq %rdi, -0x1c8(%rbp)
callq 0x32230
movq -0x170(%rbp), %rdi
addq $0xe8, %rdi
movq %rdi, -0x1c0(%rbp)
callq 0x32210
movq -0x170(%rbp), %rdi
addq $0x118, %rdi            # imm = 0x118
movq %rdi, -0x1b8(%rbp)
callq 0x32230
movq -0x170(%rbp), %rdi
addq $0x160, %rdi            # imm = 0x160
movq %rdi, -0x1b0(%rbp)
callq 0x32250
movq -0x170(%rbp), %rdi
addq $0x1a0, %rdi            # imm = 0x1A0
movq %rdi, -0x1a8(%rbp)
callq 0x65e0
movq -0x170(%rbp), %rdi
addq $0x1c0, %rdi            # imm = 0x1C0
movq %rdi, -0x168(%rbp)
callq 0x65e0
movq -0x170(%rbp), %rdi
addq $0x1f0, %rdi            # imm = 0x1F0
movq %rdi, -0x1a0(%rbp)
callq 0x32270
movq -0x170(%rbp), %rdi
addq $0x208, %rdi            # imm = 0x208
movq %rdi, -0x198(%rbp)
callq 0x32270
movq -0x170(%rbp), %rdi
addq $0x220, %rdi            # imm = 0x220
movq %rdi, -0x190(%rbp)
callq 0x32270
movq -0x170(%rbp), %rdi
addq $0x238, %rdi            # imm = 0x238
movq %rdi, -0x188(%rbp)
callq 0x32270
movq -0x170(%rbp), %rdi
addq $0x250, %rdi            # imm = 0x250
movq %rdi, -0x180(%rbp)
callq 0x32290
movq -0x170(%rbp), %rdi
addq $0x270, %rdi            # imm = 0x270
movq %rdi, -0x178(%rbp)
callq 0x322b0
movq -0x170(%rbp), %rax
movq -0x168(%rbp), %rdi
movq -0x160(%rbp), %rsi
movl -0xc(%rbp), %ecx
movl %ecx, 0x4(%rax)
movl $0x18, (%rax)
callq 0x6070
jmp 0x1ae6e
movq -0x170(%rbp), %rax
movslq (%rax), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x6040
movq %rax, -0x1f8(%rbp)
jmp 0x1ae9c
movq -0x170(%rbp), %rax
movq -0x1f8(%rbp), %rcx
movq %rcx, 0x148(%rax)
movl $0x0, -0x30(%rbp)
movq -0x170(%rbp), %rcx
movl -0x30(%rbp), %eax
cmpl (%rcx), %eax
jge 0x1af1e
movl $0x18, %edi
callq 0x6430
movq %rax, -0x200(%rbp)
jmp 0x1aed9
movq -0x200(%rbp), %rdi
callq 0x322d0
movq -0x170(%rbp), %rax
movq -0x200(%rbp), %rdx
movq 0x148(%rax), %rax
movslq -0x30(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x1aeb8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x1b45e
movq -0x170(%rbp), %rax
movslq (%rax), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x6040
movq %rax, -0x208(%rbp)
jmp 0x1af4c
movq -0x170(%rbp), %rax
movq -0x208(%rbp), %rcx
movq %rcx, 0x150(%rax)
movl $0x0, -0x34(%rbp)
movq -0x170(%rbp), %rcx
movl -0x34(%rbp), %eax
cmpl (%rcx), %eax
jge 0x1afbd
movl $0x18, %edi
callq 0x6430
movq %rax, -0x210(%rbp)
jmp 0x1af89
movq -0x210(%rbp), %rdi
callq 0x322d0
movq -0x170(%rbp), %rax
movq -0x210(%rbp), %rdx
movq 0x150(%rax), %rax
movslq -0x34(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x1af68
movl $0x1, -0x38(%rbp)
cmpl $0x16, -0x38(%rbp)
jg 0x1b0c1
movl -0x38(%rbp), %esi
leaq -0x58(%rbp), %rdi
callq 0xb190
jmp 0x1afdc
movq -0x170(%rbp), %rdi
movl -0x38(%rbp), %eax
decl %eax
movl %eax, -0x21c(%rbp)
addq $0xe8, %rdi
leaq -0x58(%rbp), %rsi
callq 0x322f0
movq %rax, -0x218(%rbp)
jmp 0x1b007
movq -0x218(%rbp), %rax
movl -0x21c(%rbp), %ecx
movl %ecx, (%rax)
leaq 0x3a297(%rip), %rsi     # 0x552b4
leaq -0x78(%rbp), %rdi
leaq -0x58(%rbp), %rdx
callq 0x10610
jmp 0x1b02c
leaq -0x58(%rbp), %rdi
movq %rdi, -0x238(%rbp)
leaq -0x78(%rbp), %rsi
movq %rsi, -0x240(%rbp)
callq 0x6530
movq -0x240(%rbp), %rdi
callq 0x6828
movq -0x170(%rbp), %rdi
movq -0x238(%rbp), %rsi
movl -0x38(%rbp), %eax
decl %eax
movl %eax, -0x22c(%rbp)
addq $0xe8, %rdi
callq 0x322f0
movq %rax, -0x228(%rbp)
jmp 0x1b081
movq -0x228(%rbp), %rax
movl -0x22c(%rbp), %ecx
movl %ecx, (%rax)
leaq -0x58(%rbp), %rdi
callq 0x6828
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x1afc4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x6828
jmp 0x1b45e
movq -0x170(%rbp), %rax
addq $0xe8, %rax
movq %rax, -0x250(%rbp)
leaq -0x99(%rbp), %rdi
movq %rdi, -0x248(%rbp)
callq 0x6760
movq -0x248(%rbp), %rdx
leaq 0x3a1c5(%rip), %rsi     # 0x552bb
leaq -0x98(%rbp), %rdi
callq 0x9680
jmp 0x1b104
movq -0x250(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x323d0
movq %rax, -0x258(%rbp)
jmp 0x1b120
movq -0x258(%rbp), %rax
movl $0x16, (%rax)
leaq -0x98(%rbp), %rdi
callq 0x6828
leaq -0x99(%rbp), %rdi
callq 0x64b0
movq -0x170(%rbp), %rax
addq $0xe8, %rax
movq %rax, -0x268(%rbp)
leaq -0xc1(%rbp), %rdi
movq %rdi, -0x260(%rbp)
callq 0x6760
movq -0x260(%rbp), %rdx
leaq 0x3a13e(%rip), %rsi     # 0x552b8
leaq -0xc0(%rbp), %rdi
callq 0x9680
jmp 0x1b188
movq -0x268(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x323d0
movq %rax, -0x270(%rbp)
jmp 0x1b1a4
movq -0x270(%rbp), %rax
movl $0x16, (%rax)
leaq -0xc0(%rbp), %rdi
callq 0x6828
leaq -0xc1(%rbp), %rdi
callq 0x64b0
movq -0x170(%rbp), %rax
addq $0xe8, %rax
movq %rax, -0x280(%rbp)
leaq -0xe9(%rbp), %rdi
movq %rdi, -0x278(%rbp)
callq 0x6760
movq -0x278(%rbp), %rdx
leaq 0x3a0c2(%rip), %rsi     # 0x552c0
leaq -0xe8(%rbp), %rdi
callq 0x9680
jmp 0x1b20c
movq -0x280(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x323d0
movq %rax, -0x288(%rbp)
jmp 0x1b228
movq -0x288(%rbp), %rax
movl $0x17, (%rax)
leaq -0xe8(%rbp), %rdi
callq 0x6828
leaq -0xe9(%rbp), %rdi
callq 0x64b0
movq -0x170(%rbp), %rax
addq $0xe8, %rax
movq %rax, -0x298(%rbp)
leaq -0x111(%rbp), %rdi
movq %rdi, -0x290(%rbp)
callq 0x6760
movq -0x290(%rbp), %rdx
leaq 0x3a03b(%rip), %rsi     # 0x552bd
leaq -0x110(%rbp), %rdi
callq 0x9680
jmp 0x1b290
movq -0x298(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x323d0
movq %rax, -0x2a0(%rbp)
jmp 0x1b2ac
movq -0x2a0(%rbp), %rax
movl $0x17, (%rax)
leaq -0x110(%rbp), %rdi
callq 0x6828
leaq -0x111(%rbp), %rdi
callq 0x64b0
testb $0x1, -0x19(%rbp)
je 0x1b40d
movq -0x170(%rbp), %rdi
movups 0x3a81f(%rip), %xmm0    # 0x55b08
movaps %xmm0, -0x140(%rbp)
movl $0x3f666666, -0x130(%rbp) # imm = 0x3F666666
leaq -0x140(%rbp), %rax
movq %rax, -0x128(%rbp)
movq $0x5, -0x120(%rbp)
addq $0x270, %rdi            # imm = 0x270
movq -0x128(%rbp), %rsi
movq -0x120(%rbp), %rdx
callq 0x324b0
jmp 0x1b32f
jmp 0x1b455
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x1b35a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x6828
leaq -0x99(%rbp), %rdi
callq 0x64b0
jmp 0x1b45e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x1b391
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x6828
leaq -0xc1(%rbp), %rdi
callq 0x64b0
jmp 0x1b45e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x1b3c8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x6828
leaq -0xe9(%rbp), %rdi
callq 0x64b0
jmp 0x1b45e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x1b3ff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x6828
leaq -0x111(%rbp), %rdi
callq 0x64b0
jmp 0x1b45e
movq -0x170(%rbp), %rdi
movl $0x0, -0x154(%rbp)
leaq -0x154(%rbp), %rax
movq %rax, -0x150(%rbp)
movq $0x1, -0x148(%rbp)
addq $0x270, %rdi            # imm = 0x270
movq -0x150(%rbp), %rsi
movq -0x148(%rbp), %rdx
callq 0x324b0
jmp 0x1b453
jmp 0x1b455
addq $0x2a0, %rsp            # imm = 0x2A0
popq %rbp
retq
movq -0x178(%rbp), %rdi
callq 0x32500
movq -0x180(%rbp), %rdi
callq 0x32560
movq -0x188(%rbp), %rdi
callq 0xbca0
movq -0x190(%rbp), %rdi
callq 0xbca0
movq -0x198(%rbp), %rdi
callq 0xbca0
movq -0x1a0(%rbp), %rdi
callq 0xbca0
movq -0x168(%rbp), %rdi
callq 0x6828
movq -0x1a8(%rbp), %rdi
callq 0x6828
movq -0x1b0(%rbp), %rdi
callq 0x325c0
movq -0x1b8(%rbp), %rdi
callq 0x32620
movq -0x1c0(%rbp), %rdi
callq 0x32640
movq -0x1c8(%rbp), %rdi
callq 0x32620
movq -0x1d0(%rbp), %rdi
callq 0x32640
movq -0x1d8(%rbp), %rdi
callq 0x13370
movq -0x1e0(%rbp), %rdi
callq 0x13370
movq -0x1e8(%rbp), %rdi
callq 0x6828
movq -0x1f0(%rbp), %rdi
callq 0x6828
movq -0x28(%rbp), %rdi
callq 0x6750
nopw %cs:(%rax,%rax)