// File: /workspace/github_cpp_makefile_star2_O2/richardposner[P]BioNetFit2/src/code/Swarm.cpp
// Function: Swarm::checkExternalMessages()
void Swarm::checkExternalMessages() {
	string messagePath = options.jobOutputDir + ".req";
	if (checkIfFileExists(messagePath)) {
		ifstream messageFile(messagePath);

		std::string line;

		if (messageFile.is_open()) {
			while (getline(messageFile, line)) {
				if (line == "output results") {
					string outputDir = options.jobOutputDir + "Results";
					string command = "mkdir " + outputDir + " && cp " + configPath_ + " " + outputDir;

					int errorCounter = 0;
					while (!runCommand(command) && errorCounter < 10) {
						//sleep(1);
						++errorCounter;
					}

					if (errorCounter > 10) {
						cout << "Error: Couldn't create directory: " + outputDir + " to contain final fitting results. Outputting results to screen.";
						outputRunSummary();
					}

					outputRunSummary(outputDir);
				}
			}
		}
		else {
			string errMsg = "Error: Couldn't open data file " + messagePath + " for parsing.";
			outputError(errMsg);
		}
		messageFile.close();
		string delCmd = "rm " + messagePath;
		runCommand(delCmd);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3c8, %rsp            # imm = 0x3C8
movq %rdi, 0x8(%rsp)
leaq 0x1520(%rdi), %rsi
leaq 0x61a57(%rip), %rdx     # 0xde303
leaq 0x80(%rsp), %rbx
movq %rbx, %rdi
movq %rsi, 0x38(%rsp)
callq 0x334ed
leaq 0x100(%rsp), %rdi
movq %rbx, %rsi
callq 0x28dd0
leaq 0x100(%rsp), %rdi
callq 0x9ec28
movl %eax, %ebx
leaq 0x100(%rsp), %rdi
callq 0x295a0
testl %ebx, %ebx
je 0x7cba1
leaq 0x1c0(%rsp), %rdi
leaq 0x80(%rsp), %rsi
pushq $0x8
popq %rdx
callq 0x29100
leaq 0xf0(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x238(%rsp), %rdi
callq 0x28200
testb %al, %al
je 0x7cbc0
movq 0x8(%rsp), %rax
addq $0x1800, %rax           # imm = 0x1800
movq %rax, 0x30(%rsp)
leaq 0xe0(%rsp), %rbx
leaq 0x60(%rsp), %rbp
leaq 0x1a0(%rsp), %r15
leaq 0x1c0(%rsp), %rdi
movq %rbx, %r14
movq %rbx, %rsi
callq 0x28180
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x7cb2b
movq %r14, %rbx
movq %r14, %rdi
leaq 0x6197b(%rip), %rsi     # 0xde308
callq 0x3357b
testb %al, %al
je 0x7c95b
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq 0x38(%rsp), %rsi
leaq 0x6113e(%rip), %rdx     # 0xddae8
callq 0x334ed
leaq 0x160(%rsp), %r13
movq %r13, %rdi
leaq 0x594d6(%rip), %rsi     # 0xd5e97
movq %rbx, %rdx
callq 0x3338b
leaq 0x180(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
leaq 0x60fdb(%rip), %rdx     # 0xdd9b9
callq 0x3336c
leaq 0x40(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rsi
movq 0x30(%rsp), %rdx
callq 0x334ce
leaq 0xc0(%rsp), %r12
movq %r12, %rdi
movq %r13, %rsi
leaq 0x62c00(%rip), %rdx     # 0xdf60d
callq 0x3336c
movq %rbp, %rdi
movq %r12, %rsi
leaq 0x10(%rsp), %rdx
callq 0x334ce
movq %r12, %rdi
callq 0x295a0
leaq 0x40(%rsp), %rdi
callq 0x295a0
leaq 0x180(%rsp), %rdi
callq 0x295a0
leaq 0x160(%rsp), %rdi
callq 0x295a0
xorl %r12d, %r12d
movq %r15, %rdi
movq %rbp, %rsi
callq 0x28dd0
movq %r15, %rdi
callq 0x9f543
movl %eax, %r13d
movq %r15, %rdi
callq 0x295a0
testl %r13d, %r13d
jne 0x7ca7f
cmpl $0x9, %r12d
ja 0x7ca7f
incl %r12d
jmp 0x7ca51
cmpl $0xb, %r12d
leaq 0x10(%rsp), %r12
jb 0x7cae6
leaq 0x40(%rsp), %r13
movq %r13, %rdi
leaq 0x60f28(%rip), %rsi     # 0xdd9c1
movq %r12, %rdx
callq 0x3338b
leaq 0xc0(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
leaq 0x60f5c(%rip), %rdx     # 0xdda12
callq 0x3336c
movq 0xe94d6(%rip), %rdi     # 0x165f98
movq %rbx, %rsi
callq 0x28910
movq %rbx, %rdi
callq 0x295a0
leaq 0x40(%rsp), %rdi
callq 0x295a0
movq 0x8(%rsp), %rdi
callq 0x7af8c
leaq 0x140(%rsp), %rdi
movq %r12, %rsi
callq 0x28dd0
movq 0x8(%rsp), %rdi
leaq 0x140(%rsp), %rbx
movq %rbx, %rsi
callq 0x7942a
movq %rbx, %rdi
callq 0x295a0
movq %rbp, %rdi
callq 0x295a0
movq %r12, %rdi
callq 0x295a0
movq %r14, %rbx
jmp 0x7c95b
leaq 0x1c0(%rsp), %rdi
callq 0x281c0
leaq 0x53240(%rip), %rsi     # 0xcfd7f
leaq 0x10(%rsp), %rdi
leaq 0x80(%rsp), %rdx
callq 0x3338b
leaq 0xa0(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x28dd0
leaq 0xa0(%rsp), %rdi
callq 0x9f543
leaq 0xa0(%rsp), %rdi
callq 0x295a0
leaq 0x10(%rsp), %rdi
callq 0x295a0
leaq 0xe0(%rsp), %rdi
callq 0x295a0
leaq 0x1c0(%rsp), %rdi
callq 0x28230
leaq 0x80(%rsp), %rdi
callq 0x295a0
addq $0x3c8, %rsp            # imm = 0x3C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x57fcc(%rip), %rsi     # 0xd4b93
leaq 0x60(%rsp), %rdi
leaq 0x80(%rsp), %rdx
callq 0x3338b
leaq 0x52922(%rip), %rdx     # 0xcf502
leaq 0x10(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x3336c
leaq 0x60(%rsp), %rdi
callq 0x295a0
leaq 0x120(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x28dd0
leaq 0x120(%rsp), %rsi
movq 0x8(%rsp), %rdi
callq 0x6aed2
movq %rax, %rbx
leaq 0x120(%rsp), %rdi
jmp 0x7cd12
jmp 0x7ccb4
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
jmp 0x7cd1c
jmp 0x7ccf3
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
jmp 0x7cd12
jmp 0x7ccb4
jmp 0x7ccf3
jmp 0x7ccf3
jmp 0x7cc77
movq %rax, %rbx
leaq 0x100(%rsp), %rdi
callq 0x295a0
jmp 0x7cd3b
movq %rax, %rbx
jmp 0x7cd3b
movq %rax, %rbx
jmp 0x7cc94
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
callq 0x295a0
leaq 0x40(%rsp), %rdi
jmp 0x7cd03
jmp 0x7cd0a
movq %rax, %rbx
leaq 0x140(%rsp), %rdi
jmp 0x7cd03
movq %rax, %rbx
jmp 0x7ccd0
movq %rax, %rbx
jmp 0x7cce7
movq %rax, %rbx
jmp 0x7cd17
movq %rax, %rbx
jmp 0x7ccda
jmp 0x7ccf3
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
callq 0x295a0
leaq 0x40(%rsp), %rdi
callq 0x295a0
leaq 0x180(%rsp), %rdi
callq 0x295a0
leaq 0x160(%rsp), %rdi
jmp 0x7cd12
jmp 0x7cd0a
movq %rax, %rbx
jmp 0x7cd21
movq %rax, %rbx
leaq 0x1a0(%rsp), %rdi
callq 0x295a0
jmp 0x7cd0d
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x295a0
leaq 0x10(%rsp), %rdi
callq 0x295a0
leaq 0xe0(%rsp), %rdi
callq 0x295a0
leaq 0x1c0(%rsp), %rdi
callq 0x28230
leaq 0x80(%rsp), %rdi
callq 0x295a0
movq %rbx, %rdi
callq 0x292f0