// File: /workspace/github_cpp_makefile_star2_O3/tonymugen[P]sampleSNPs/sampleLD.cpp
// Function: main
int main(int argc, char *argv[]){
	string inFileStub;  // input file name stub (without extension)
	string popFileName; // population index file name
	string nSampTxt;    // string version of the number of samples
	uint64_t n;         // number of samples
	bool pop = false;   // are we stratifying by population?

	// set usage message
	string cliHelp = "Command line flags required (in any order):\n  -s NNN (number of samples)\n  -i fileStub (input file name, without extension)\n  -p popIndexFile (optional file with the population index)";
	unordered_map <char, string> clInfo;
	parseCL(argc, argv, clInfo);
	auto clIter = clInfo.begin(); // iterator of the command line flags

	// processing CL input
	clIter = clInfo.find('s');
	if (clIter == clInfo.end()) { // if not there, complain
		cerr << "ERROR: specification of the number of samples is required" << endl;
		cerr << cliHelp << endl;
		exit(1);
	} else {
		n        = stoi(clIter->second);
		nSampTxt = clIter->second;
	}
	clIter = clInfo.find('i');
	if (clIter == clInfo.end()) { // if not there, complain
		cerr << "ERROR: specification of the input file name is required" << endl;
		cerr << cliHelp << endl;
		exit(1);
	} else {
		inFileStub = clIter->second;
	}

	clIter = clInfo.find('p');
	if (clIter != clInfo.end()) {
		pop         = true;
		popFileName = clIter->second;
	}
	if (pop) { // stratify by population
		PopIndex popIdx(popFileName);
		BedFileI inBed(inFileStub);
		inBed.sampleLD(popIdx, n);
	} else {
		BedFileI inBed(inFileStub);
		inBed.sampleLD(n);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x778, %rsp            # imm = 0x778
movq %rsi, %rbx
movl %edi, 0xc(%rsp)
leaq 0x48(%rsp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x68(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x88(%rsp), %r13
movq %r13, -0x10(%r13)
movq %rax, -0x8(%r13)
movb %al, (%r13)
leaq 0x20(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x11f6f(%rip), %rsi     # 0x1707f
leaq 0x1201f(%rip), %rdx     # 0x17136
leaq 0x10(%rsp), %rdi
callq 0x5998
leaq 0xc8(%rsp), %rax
movq %rax, -0x30(%rax)
movq $0x1, -0x28(%rax)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax)
movl $0x3f800000, -0x10(%rax) # imm = 0x3F800000
movups %xmm0, -0x8(%rax)
leaq 0xc(%rsp), %rdi
leaq 0x98(%rsp), %rdx
movq %rbx, %rsi
callq 0x4f4c
movq 0x98(%rsp), %rsi
movq 0xa0(%rsp), %rdi
movl $0x73, %eax
xorl %edx, %edx
divq %rdi
movq %rdx, %rcx
movl %ecx, %eax
movq (%rsi,%rax,8), %rax
testq %rax, %rax
je 0x542c
movq (%rax), %rbx
cmpb $0x73, 0x8(%rbx)
je 0x51b9
movq (%rbx), %rbx
testq %rbx, %rbx
je 0x542c
movsbq 0x8(%rbx), %rsi
movq %rsi, %rax
xorl %edx, %edx
divq %rdi
cmpq %rcx, %rdx
jne 0x542c
cmpb $0x73, %sil
jne 0x5191
movq 0x10(%rbx), %r15
callq 0x4050
movq %rax, %r14
movl (%rax), %ebp
movl $0x0, (%rax)
leaq 0xf0(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
movl $0xa, %edx
callq 0x4390
cmpq %r15, (%r12)
je 0x54bc
movslq %eax, %rcx
cmpq %rax, %rcx
jne 0x54c8
movl (%r14), %ecx
cmpl $0x22, %ecx
je 0x54c8
addq $0x10, %rbx
testl %ecx, %ecx
jne 0x5212
movl %ebp, (%r14)
movq %rax, 0x30(%rsp)
leaq 0x78(%rsp), %rdi
movq %rbx, %rsi
leaq 0x20(%rsp), %r14
callq 0x4140
movq 0x98(%rsp), %rsi
movq 0xa0(%rsp), %r8
movl $0x69, %eax
xorl %edx, %edx
divq %r8
movq %rdx, %rcx
movl %ecx, %eax
movq (%rsi,%rax,8), %rax
testq %rax, %rax
je 0x5470
movq (%rax), %rsi
cmpb $0x69, 0x8(%rsi)
je 0x5286
movq (%rsi), %rsi
testq %rsi, %rsi
je 0x5470
movsbq 0x8(%rsi), %rdi
movq %rdi, %rax
xorl %edx, %edx
divq %r8
cmpq %rcx, %rdx
jne 0x5470
cmpb $0x69, %dil
jne 0x525e
addq $0x10, %rsi
leaq 0x38(%rsp), %rdi
callq 0x4140
movq 0x98(%rsp), %rsi
movq 0xa0(%rsp), %r8
movl $0x70, %eax
xorl %edx, %edx
divq %r8
movq %rdx, %rcx
movl %ecx, %eax
movq (%rsi,%rax,8), %rax
testq %rax, %rax
je 0x5363
movq (%rax), %rsi
cmpb $0x70, 0x8(%rsi)
je 0x52ed
movq (%rsi), %rsi
testq %rsi, %rsi
je 0x5363
movsbq 0x8(%rsi), %rdi
movq %rdi, %rax
xorl %edx, %edx
divq %r8
cmpq %rcx, %rdx
jne 0x5363
cmpb $0x70, %dil
jne 0x52c9
addq $0x10, %rsi
leaq 0x58(%rsp), %rdi
callq 0x4140
leaq 0xd0(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x15b5a
leaq 0xf0(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x6abe
leaq 0x1969a(%rip), %rax     # 0x1e9c0
addq $0x10, %rax
leaq 0xf0(%rsp), %rdi
movq %rax, (%rdi)
leaq 0xd0(%rsp), %rsi
leaq 0x30(%rsp), %rdx
callq 0xc7f6
leaq 0xf0(%rsp), %rdi
callq 0x6c6e
leaq 0xd0(%rsp), %rdi
callq 0x55b4
jmp 0x53a2
leaq 0xf0(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x6abe
leaq 0x19644(%rip), %rax     # 0x1e9c0
addq $0x10, %rax
leaq 0xf0(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x30(%rsp), %rsi
callq 0xaf02
leaq 0xf0(%rsp), %rdi
callq 0x6c6e
leaq 0x98(%rsp), %rdi
callq 0x5608
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0x53c6
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x42b0
movq 0x78(%rsp), %rdi
cmpq %r13, %rdi
je 0x53e0
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x42b0
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x53fc
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x42b0
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x5418
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x42b0
xorl %eax, %eax
addq $0x778, %rsp            # imm = 0x778
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x19bbd(%rip), %rdi     # 0x1eff0
leaq 0x11cfd(%rip), %rsi     # 0x17137
movl $0x39, %edx
callq 0x42d0
movq 0x19ba5(%rip), %rdi     # 0x1eff0
callq 0x4110
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x19b8f(%rip), %rdi     # 0x1eff0
callq 0x42d0
movq %rax, %rdi
callq 0x4110
jmp 0x54b2
movq 0x19b79(%rip), %rdi     # 0x1eff0
leaq 0x11cf3(%rip), %rsi     # 0x17171
movl $0x37, %edx
callq 0x42d0
movq 0x19b61(%rip), %rdi     # 0x1eff0
callq 0x4110
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x19b4b(%rip), %rdi     # 0x1eff0
callq 0x42d0
movq %rax, %rdi
callq 0x4110
movl $0x1, %edi
callq 0x42f0
leaq 0x11ce6(%rip), %rdi     # 0x171a9
callq 0x4160
leaq 0x11cda(%rip), %rdi     # 0x171a9
callq 0x43b0
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
callq 0x6c6e
jmp 0x54e9
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x55b4
jmp 0x5521
jmp 0x5528
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
callq 0x6c6e
jmp 0x552b
jmp 0x5528
jmp 0x5528
movq %rax, %rbx
jmp 0x554f
movq %rax, %rbx
cmpl $0x0, (%r14)
jne 0x5521
movl %ebp, (%r14)
leaq 0x20(%rsp), %r14
jmp 0x552b
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x5608
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0x554f
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x42b0
movq 0x78(%rsp), %rdi
cmpq %r13, %rdi
je 0x5569
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x42b0
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x5585
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x42b0
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x55a1
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x42b0
movq %rbx, %rdi
callq 0x44c0