// File: /workspace/github_cpp_makefile_star2_O3/richardposner[P]BioNetFit2/src/code/Swarm.cpp
// Function: Swarm::setJobOutputDir(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Swarm::setJobOutputDir(string path) {
	options.jobOutputDir = path;

	if (!checkIfFileExists(options.outputDir)) {
		string cmd = "mkdir " + options.outputDir;
		//cout << "running: " << cmd << endl;
		if(runCommand(cmd) != 0) {
			outputError("Error: Couldn't create base output directory with command: " + cmd + ". Quitting.");
		}
	}

	if (checkIfFileExists(options.jobOutputDir)) {
		string input;
		string answer;
		while (1) {

			//Raquel fixing MPI support issues
			if(options.clusterSoftware != "mpi" && options.clusterSoftware != "BNF2mpi"){
				cout << "Warning: Your output directory " << options.jobOutputDir << " already exists. Overwrite? (Y or N) ";
				getline(cin, input);
				stringstream myInp(input);
				myInp >> answer;
			}

			if(options.clusterSoftware == "mpi" || options.clusterSoftware == "BNF2mpi"){
				answer = "Y";
			}

			if (answer == "Y" || answer == "y") {
				string cmd = "rm -r " + options.jobOutputDir;
				if (options.verbosity >= 1) {
					cout << "Deleting old output directory, this may take a few minutes..." << endl;
				}

				if(runCommand(cmd) != 0) {
					outputError("Error: Couldn't delete existing output directory with the command: " + cmd + ". Quitting.");
				}
				break;
			}
			else if (answer == "N" || answer == "n") {
				outputError("Error: Output directory already exists. Quitting.");
			}
		}
	}
	string cmd = "mkdir " + options.jobOutputDir;
	//cout << "else running: " << cmd << endl;
	//int ret = system(cmd.c_str());
	if(runCommand(cmd) != 0) {
		outputError("Error: Couldn't create output directory with command: " + cmd + ". Quitting.");
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x318, %rsp            # imm = 0x318
movq %rdi, %rbx
leaq 0x1520(%rdi), %r15
movq %r15, %rdi
callq 0x22500
leaq 0x140(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x1500(%rbx), %rsi
movq %rbx, (%rsp)
movq 0x1508(%rbx), %rdx
addq %rsi, %rdx
leaq 0x130(%rsp), %rbx
movq %rbx, %rdi
callq 0x3213c
movq %rbx, %rdi
callq 0xbe9a8
movl %eax, %ebx
movq 0x130(%rsp), %rdi
cmpq %r14, %rdi
je 0x7ce63
movq 0x140(%rsp), %rsi
incq %rsi
callq 0x229c0
testl %ebx, %ebx
jne 0x7cf05
movq (%rsp), %rax
leaq 0x1500(%rax), %rdx
leaq 0x7b0ca(%rip), %rsi     # 0xf7f47
leaq 0x190(%rsp), %rbx
movq %rbx, %rdi
callq 0x31944
leaq 0xa0(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq 0x90(%rsp), %rdi
callq 0x3213c
leaq 0x90(%rsp), %rdi
callq 0xbfa1f
movl %eax, %ebx
movq 0x90(%rsp), %rdi
cmpq %r14, %rdi
je 0x7cedc
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x229c0
testl %ebx, %ebx
jne 0x7d3a9
leaq 0x1a0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7cf05
movq 0x1a0(%rsp), %rsi
incq %rsi
callq 0x229c0
leaq 0x100(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rsp), %rax
movq 0x1520(%rax), %rsi
movq 0x1528(%rax), %rdx
addq %rsi, %rdx
leaq 0xf0(%rsp), %rbx
movq %rbx, %rdi
callq 0x3213c
movq %rbx, %rdi
callq 0xbe9a8
movl %eax, %ebx
movq 0xf0(%rsp), %rdi
cmpq %r14, %rdi
je 0x7cf5d
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x229c0
testl %ebx, %ebx
je 0x7d268
movq %r15, 0x48(%rsp)
leaq 0x18(%rsp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x38(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
movq (%rsp), %rax
leaq 0x1730(%rax), %r12
leaq 0x75414(%rip), %r13     # 0xf23b0
leaq 0x81b88(%rip), %rbp     # 0xfeb2b
leaq 0x28(%rsp), %r14
leaq 0x753fd(%rip), %rbx     # 0xf23ac
leaq 0x190(%rsp), %r15
movq %r12, %rdi
movq %r13, %rsi
callq 0x22250
testl %eax, %eax
je 0x7d08f
movq %r12, %rdi
movq %rbx, %rsi
callq 0x22250
testl %eax, %eax
je 0x7d08f
movl $0x1f, %edx
movq 0xf8fbf(%rip), %rdi     # 0x175fa8
leaq 0x81af5(%rip), %rsi     # 0xfeae5
callq 0x22ab0
movq (%rsp), %rax
movq 0x1520(%rax), %rsi
movq 0x1528(%rax), %rdx
movq 0xf8f9a(%rip), %rdi     # 0x175fa8
callq 0x22ab0
movl $0x25, %edx
movq %rax, %rdi
leaq 0x81ae3(%rip), %rsi     # 0xfeb05
callq 0x22ab0
movq 0xf8faa(%rip), %rcx     # 0x175fd8
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %edx
movq 0xf8f8c(%rip), %rdi     # 0x175fd8
leaq 0x8(%rsp), %rsi
callq 0x23300
movq %r15, %rdi
leaq 0x8(%rsp), %rsi
movl $0x18, %edx
callq 0x23020
movq %r15, %rdi
movq %r14, %rsi
callq 0x22c50
movq %r15, %rdi
movq 0xf8ed3(%rip), %rsi     # 0x175f50
callq 0x226f0
leaq 0x210(%rsp), %rdi
callq 0x222d0
movq %r12, %rdi
movq %r13, %rsi
callq 0x22250
testl %eax, %eax
je 0x7d0ad
movq %r12, %rdi
movq %rbx, %rsi
callq 0x22250
testl %eax, %eax
jne 0x7d0c5
movq 0x30(%rsp), %rdx
movl $0x1, %r8d
movq %r14, %rdi
xorl %esi, %esi
movq %rbp, %rcx
callq 0x22fb0
movq %r14, %rdi
movq %rbp, %rsi
callq 0x22250
testl %eax, %eax
je 0x7d149
movq %r14, %rdi
leaq 0x74897(%rip), %rsi     # 0xf1975
callq 0x22250
testl %eax, %eax
je 0x7d149
movq %r14, %rdi
leaq 0xb0c38(%rip), %rsi     # 0x12dd29
callq 0x22250
testl %eax, %eax
je 0x7d111
movq %r14, %rdi
leaq 0x8334c(%rip), %rsi     # 0x100450
callq 0x22250
testl %eax, %eax
jne 0x7cfb7
leaq 0x160(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x81a92(%rip), %rsi     # 0xfebb6
leaq 0x81abc(%rip), %rdx     # 0xfebe7
leaq 0x150(%rsp), %rdi
callq 0x321d2
leaq 0x150(%rsp), %rsi
movq (%rsp), %rdi
callq 0x784c2
leaq 0x819dd(%rip), %rsi     # 0xfeb2d
leaq 0x190(%rsp), %rdi
movq 0x48(%rsp), %r15
movq %r15, %rdx
callq 0x31944
movq (%rsp), %rax
cmpl $0x0, 0x1614(%rax)
je 0x7d1b8
movq 0xf8e2f(%rip), %rbx     # 0x175fa8
leaq 0x819b4(%rip), %rsi     # 0xfeb34
movl $0x3d, %edx
movq %rbx, %rdi
callq 0x22ab0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq 0xf8dfd(%rip), %rdi     # 0x175fa8
callq 0x22050
movq %rax, %rdi
callq 0x22660
leaq 0x80(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x190(%rsp), %rsi
movq 0x198(%rsp), %rdx
addq %rsi, %rdx
leaq 0x70(%rsp), %rdi
callq 0x3213c
leaq 0x70(%rsp), %rdi
callq 0xbfa1f
movl %eax, %ebx
movq 0x70(%rsp), %rdi
cmpq %r14, %rdi
je 0x7d207
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x229c0
testl %ebx, %ebx
jne 0x7d34e
leaq 0x1a0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7d230
movq 0x1a0(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x7d24c
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x7d268
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x229c0
leaq 0x7acd8(%rip), %rsi     # 0xf7f47
leaq 0x190(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rdx
callq 0x31944
leaq 0x60(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq 0x50(%rsp), %rdi
callq 0x3213c
leaq 0x50(%rsp), %rdi
callq 0xbfa1f
movl %eax, %ebx
movq 0x50(%rsp), %rdi
cmpq %r14, %rdi
je 0x7d2c2
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x229c0
testl %ebx, %ebx
jne 0x7d2f9
leaq 0x1a0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7d2e7
movq 0x1a0(%rsp), %rsi
incq %rsi
callq 0x229c0
addq $0x318, %rsp            # imm = 0x318
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x818e8(%rip), %rsi     # 0xfebe8
leaq 0x8(%rsp), %rdi
leaq 0x190(%rsp), %rdx
callq 0x31944
leaq 0x846a0(%rip), %rsi     # 0x1019b9
leaq 0x8(%rsp), %rdi
callq 0x233b0
leaq 0xc0(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x7d3fe
movups (%rcx), %xmm0
movups %xmm0, (%r14)
jmp 0x7d411
leaq 0x8181d(%rip), %rsi     # 0xfeb72
leaq 0x170(%rsp), %rdi
leaq 0x190(%rsp), %rdx
callq 0x31944
leaq 0x84648(%rip), %rsi     # 0x1019b9
leaq 0x170(%rsp), %rdi
callq 0x233b0
leaq 0xe0(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x7d439
movups (%rcx), %xmm0
movups %xmm0, (%r14)
jmp 0x7d44c
leaq 0x816f9(%rip), %rsi     # 0xfeaa9
leaq 0x8(%rsp), %rdi
leaq 0x190(%rsp), %rdx
callq 0x31944
leaq 0x845f0(%rip), %rsi     # 0x1019b9
leaq 0x8(%rsp), %rdi
callq 0x233b0
leaq 0x120(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x7d474
movups (%rcx), %xmm0
movups %xmm0, (%r14)
jmp 0x7d487
movq %rdx, 0xb0(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xc0(%rsp)
movq 0x8(%rax), %rdx
leaq 0xb0(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq (%rsp), %rdi
callq 0x784c2
movq %rdx, 0xd0(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xe0(%rsp)
movq 0x8(%rax), %rdx
leaq 0xd0(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq (%rsp), %rdi
callq 0x784c2
movq %rdx, 0x110(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x120(%rsp)
movq 0x8(%rax), %rdx
leaq 0x110(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq (%rsp), %rdi
callq 0x784c2
movq %rax, %rbx
movq 0x110(%rsp), %rdi
cmpq %r14, %rdi
je 0x7d539
movq 0x120(%rsp), %rsi
jmp 0x7d52c
jmp 0x7d536
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
cmpq %r14, %rdi
je 0x7d4f0
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x229c0
jmp 0x7d4f0
movq %rax, %rbx
leaq 0x180(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7d622
movq 0x180(%rsp), %rsi
jmp 0x7d58a
jmp 0x7d5b8
movq %rax, %rbx
movq 0xb0(%rsp), %rdi
cmpq %r14, %rdi
je 0x7d539
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x229c0
jmp 0x7d539
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7d5bb
movq 0x18(%rsp), %rsi
jmp 0x7d5ae
jmp 0x7d61f
movq %rax, %rbx
movq 0x90(%rsp), %rdi
cmpq %r14, %rdi
je 0x7d5bb
movq 0xa0(%rsp), %rsi
jmp 0x7d5ae
jmp 0x7d5b8
jmp 0x7d5b8
movq %rax, %rbx
movq 0x70(%rsp), %rdi
cmpq %r14, %rdi
je 0x7d622
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x229c0
jmp 0x7d622
jmp 0x7d689
movq %rax, %rbx
movq 0x50(%rsp), %rdi
cmpq %r14, %rdi
je 0x7d5bb
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x229c0
jmp 0x7d5bb
movq %rax, %rbx
leaq 0x1a0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7d6c4
movq 0x1a0(%rsp), %rsi
jmp 0x7d6bc
movq %rax, %rbx
movq 0xf0(%rsp), %rdi
cmpq %r14, %rdi
je 0x7d6c4
movq 0x100(%rsp), %rsi
jmp 0x7d6bc
movq %rax, %rbx
movq 0x130(%rsp), %rdi
cmpq %r14, %rdi
je 0x7d6c4
movq 0x140(%rsp), %rsi
jmp 0x7d6bc
movq %rax, %rbx
leaq 0x1a0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7d68c
movq 0x1a0(%rsp), %rsi
jmp 0x7d67d
movq %rax, %rbx
movq 0xf8909(%rip), %rsi     # 0x175f50
leaq 0x190(%rsp), %rdi
callq 0x226f0
leaq 0x210(%rsp), %rdi
callq 0x222d0
jmp 0x7d68c
jmp 0x7d689
movq %rax, %rbx
movq 0x150(%rsp), %rdi
cmpq %r14, %rdi
je 0x7d68c
movq 0x160(%rsp), %rsi
incq %rsi
callq 0x229c0
jmp 0x7d68c
jmp 0x7d689
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x7d6a8
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x7d6c4
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x229c0
movq %rbx, %rdi
callq 0x23240