// File: /workspace/github_cpp_makefile_star2_O2/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 %rbx
subq $0x770, %rsp            # imm = 0x770
movq %rsi, %rbx
leaq 0x20(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movl %edi, 0x4(%rsp)
xorl %ecx, %ecx
leaq 0x60(%rsp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %cl, (%rax)
movb %cl, (%rdx)
leaq 0xd8(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
leaq 0xe72a(%rip), %rsi      # 0x1307f
leaq 0x30(%rsp), %rdi
leaq 0xe8(%rsp), %rdx
callq 0x4c0c
leaq 0xc0(%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 0x4(%rsp), %rdi
leaq 0x90(%rsp), %rdx
movq %rbx, %rsi
callq 0x483c
leaq 0xe8(%rsp), %rsi
movb $0x73, (%rsi)
leaq 0x90(%rsp), %rdi
callq 0x52ea
movq %rax, %rbx
testq %rax, %rax
je 0x4b13
addq $0x10, %rbx
pushq $0xa
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x4c47
cltq
movq %rax, 0x8(%rsp)
leaq 0xc8(%rsp), %rdi
movq %rbx, %rsi
callq 0x4160
leaq 0xe8(%rsp), %rsi
movb $0x69, (%rsi)
leaq 0x90(%rsp), %rdi
callq 0x52ea
testq %rax, %rax
je 0x4b49
addq $0x10, %rax
leaq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x4160
leaq 0xe8(%rsp), %rsi
movb $0x70, (%rsi)
leaq 0x90(%rsp), %rdi
callq 0x52ea
testq %rax, %rax
je 0x4a9f
addq $0x10, %rax
leaq 0x50(%rsp), %rdi
movq %rax, %rsi
callq 0x4160
leaq 0x70(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x120e2
leaq 0xe8(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x4c64
leaq 0xe8(%rsp), %rdi
leaq 0x70(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0xac6a
leaq 0xe8(%rsp), %rdi
callq 0x6150
leaq 0x70(%rsp), %rdi
callq 0x4d4c
jmp 0x4ad0
leaq 0xe8(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x4c64
leaq 0xe8(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x99d2
leaq 0xe8(%rsp), %rdi
callq 0x6150
leaq 0x90(%rsp), %rdi
callq 0x4e04
leaq 0x30(%rsp), %rdi
callq 0x4528
leaq 0xc8(%rsp), %rdi
callq 0x4528
leaq 0x50(%rsp), %rdi
callq 0x4528
leaq 0x10(%rsp), %rdi
callq 0x4528
xorl %eax, %eax
addq $0x770, %rsp            # imm = 0x770
popq %rbx
retq
movq 0x164d6(%rip), %rdi     # 0x1aff0
leaq 0xe616(%rip), %rsi      # 0x13137
callq 0x42a0
movq %rax, %rdi
callq 0x4130
movq 0x164bb(%rip), %rdi     # 0x1aff0
leaq 0x30(%rsp), %rsi
callq 0x4270
movq %rax, %rdi
callq 0x4130
jmp 0x4b7d
movq 0x164a0(%rip), %rdi     # 0x1aff0
leaq 0xe61a(%rip), %rsi      # 0x13171
callq 0x42a0
movq %rax, %rdi
callq 0x4130
movq 0x16485(%rip), %rdi     # 0x1aff0
leaq 0x30(%rsp), %rsi
callq 0x4270
movq %rax, %rdi
callq 0x4130
pushq $0x1
popq %rdi
callq 0x42e0
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0x6150
jmp 0x4bcc
jmp 0x4bc9
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0x6150
jmp 0x4bae
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x4d4c
jmp 0x4bcc
jmp 0x4bc9
jmp 0x4bc9
jmp 0x4bc9
jmp 0x4bc9
jmp 0x4bc9
movq %rax, %rbx
jmp 0x4be3
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x4e04
leaq 0x30(%rsp), %rdi
callq 0x4528
leaq 0xc8(%rsp), %rdi
callq 0x4528
leaq 0x50(%rsp), %rdi
callq 0x4528
leaq 0x10(%rsp), %rdi
callq 0x4528
movq %rbx, %rdi
callq 0x44a0