// File: /workspace/github_cpp_makefile_star2_O2/tplinderoth[P]introDist/introDist.cpp
// Function: distAnalysis(int, char**)
int distAnalysis(int argc, char** argv) {

	int rv = 0;
	std::string dist_t(argv[1]);
	std::fstream freqfile;
	std::fstream genofile;
	std::string genofname;
	unsigned int window = 1;
	unsigned int step = 1;
	int useAvg = 1; // whether to use genome or window average for comp2Dist
	int avgtype = 0;
	double distance = -1;

	if ((rv = parseArgs(argc, argv, freqfile, genofile, window, step, &genofname, useAvg, avgtype, distance, &dist_t)) == 0) {
		if (dist_t.compare("comp2Dist") == 0) {
			double* dptr = distance >= 0 ? &distance : NULL;
			rv = comp2Dist(freqfile, genofile, window, step, useAvg, &genofname, dptr);
		}
		else if (dist_t.compare("comp3Dist") == 0) {
			rv = comp3Dist(freqfile, genofile, window, step);
		}
		else if (dist_t.compare("avgDist") == 0) {
			rv = avgDist(freqfile, genofile, avgtype);
		}
		else {
			rv = -1;
			std::cerr << "\n" << dist_t << " is an invalid function\n";
		}
	} else if (rv == 1) {
		rv = 0;
	}

	if (freqfile.is_open())
		freqfile.close();
	if (genofile.is_open())
		genofile.close();

	return rv;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x480, %rsp            # imm = 0x480
movq %rsi, %r14
movl %edi, %r15d
movq 0x8(%rsi), %rsi
leaq -0x58(%rbp), %rbx
leaq -0x288(%rbp), %rdx
movq %rbx, %rdi
callq 0x6d1c
leaq -0x288(%rbp), %rdi
callq 0x3260
leaq -0x498(%rbp), %rdi
callq 0x3260
leaq -0x68(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
pushq $0x1
popq %rax
leaq -0x28(%rbp), %r8
movl %eax, (%r8)
leaq -0x24(%rbp), %r9
movl %eax, (%r9)
leaq -0x30(%rbp), %r10
leaq -0x2c(%rbp), %r11
andl $0x0, (%r11)
movl %eax, (%r10)
movabsq $-0x4010000000000000, %rax # imm = 0xBFF0000000000000
leaq -0x38(%rbp), %r12
movq %rax, (%r12)
subq $0x8, %rsp
leaq -0x78(%rbp), %rax
leaq -0x288(%rbp), %rdx
leaq -0x498(%rbp), %rcx
movl %r15d, %edi
movq %r14, %rsi
pushq %rbx
pushq %r12
pushq %r11
pushq %r10
pushq %rax
callq 0x3912
addq $0x30, %rsp
testl %eax, %eax
je 0x3776
xorl %ebx, %ebx
cmpl $0x1, %eax
cmovnel %eax, %ebx
jmp 0x385d
leaq 0x58f3(%rip), %rsi      # 0x9070
leaq -0x58(%rbp), %rdi
callq 0x30e0
testl %eax, %eax
je 0x37ed
leaq 0x58e9(%rip), %rsi      # 0x907a
leaq -0x58(%rbp), %rdi
callq 0x30e0
testl %eax, %eax
je 0x382a
leaq 0x58db(%rip), %rsi      # 0x9084
leaq -0x58(%rbp), %rdi
callq 0x30e0
testl %eax, %eax
je 0x3845
movq 0x982f(%rip), %rdi      # 0xcff0
leaq 0x63ea(%rip), %rsi      # 0x9bb2
callq 0x3220
leaq -0x58(%rbp), %rsi
movq %rax, %rdi
callq 0x31f0
leaq 0x58ac(%rip), %rsi      # 0x908c
movq %rax, %rdi
callq 0x3220
pushq $-0x1
popq %rbx
jmp 0x385d
movsd -0x38(%rbp), %xmm0
xorl %eax, %eax
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
cmovaeq %r12, %rax
movl -0x28(%rbp), %edx
movl -0x24(%rbp), %ecx
movl -0x30(%rbp), %r8d
subq $0x8, %rsp
leaq -0x288(%rbp), %rdi
leaq -0x498(%rbp), %rsi
leaq -0x78(%rbp), %r9
pushq %rax
callq 0x3c23
popq %rcx
popq %rdx
jmp 0x385b
movl -0x28(%rbp), %edx
movl -0x24(%rbp), %ecx
leaq -0x288(%rbp), %rdi
leaq -0x498(%rbp), %rsi
callq 0x3d0f
jmp 0x385b
movl -0x2c(%rbp), %edx
leaq -0x288(%rbp), %rdi
leaq -0x498(%rbp), %rsi
callq 0x448d
movl %eax, %ebx
leaq -0x208(%rbp), %rdi
callq 0x30a0
testb %al, %al
je 0x3879
leaq -0x288(%rbp), %rdi
callq 0x3050
leaq -0x418(%rbp), %rdi
callq 0x30a0
testb %al, %al
je 0x3895
leaq -0x498(%rbp), %rdi
callq 0x3050
leaq -0x78(%rbp), %rdi
callq 0x3120
leaq -0x498(%rbp), %rdi
callq 0x3090
leaq -0x288(%rbp), %rdi
callq 0x3090
leaq -0x58(%rbp), %rdi
callq 0x3120
movl %ebx, %eax
addq $0x480, %rsp            # imm = 0x480
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x38dd
movq %rax, %rbx
jmp 0x38f5
movq %rax, %rbx
jmp 0x3901
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x3120
leaq -0x498(%rbp), %rdi
callq 0x3090
leaq -0x288(%rbp), %rdi
callq 0x3090
leaq -0x58(%rbp), %rdi
callq 0x3120
movq %rbx, %rdi
callq 0x33a0