// File: /workspace/github_cpp_makefile_star2_O2/richardposner[P]BioNetFit2/src/code/Config.cpp
// Function: Config::checkConsistency()
void Config::checkConsistency() {
	/*
	 * Make sure we have SOME sort of stop criteria
	 */

	if (swarm_->options.fitType.empty()) {
		swarm_->outputError("Error: You didn't specify a fit_type in your .conf file. Refer to the documentation with help on setting this option. Quitting.");
	}

	if (swarm_->options.jobName.empty()) {
		swarm_->outputError("Error: You didn't specify a job_name. Quitting.");
	}

	if (swarm_->options.fitType != "ga" && swarm_->options.fitType != "sa" && swarm_->options.fitType != "de" && swarm_->options.fitType != "pso") {
		swarm_->outputError("Error: Unrecognized fit_type. Quitting.");
	}
	if (swarm_->options.models.size() < 1) {
		swarm_->outputError("Error: You didn't specify a model in your .conf file. Refer to the documentation with help on setting this option. Quitting.");
	}
	if (swarm_->options.expFiles.empty()) {
		swarm_->outputError("Error: You didn't specify any .exp files in your .conf file. Refer to the documentation with help on setting this option. Quitting.");
	}

	if (swarm_->options.outputDir.empty()) {
		swarm_->outputError("Error: You didn't specify an output_dir in your .conf file. Refer to the documentation with help on setting this option. Quitting.");
	}

	if (swarm_->options.bngCommand.empty()) {
		swarm_->outputError("Error: You didn't specify a bng_command in your .conf file. Refer to the documentation with help on setting this option. Quitting.");
	}

	if (swarm_->options.swarmSize == 0) {
		swarm_->outputError("Error: You didn't specify a population_size in your .conf file. Refer to the documentation with help on setting this option. Quitting.");
	}

	if (swarm_->options.enhancedInertia && swarm_->options.fitType == "pso") {
		if (!swarm_->options.enhancedStop) {
			swarm_->outputError("Error: You set enhanced_inertia to true, but enhanced_stop to false. Enhanced inertia requires enhanced_stop to be set to true. Quitting.");
		}
	}

	if (swarm_->options.enhancedStop  && swarm_->options.fitType == "pso") {
		if (swarm_->options.nmax == 0) {
			swarm_->outputError("Error: You set enhanced_stop to true, but did not set a maximum permance value (nmax) in your .conf file. Quitting.");
		}
	}

	if (swarm_->options.useCluster && swarm_->options.emailWhenFinished && swarm_->options.emailAddress.empty()) {
		swarm_->outputError("Error: You set email_when_finished to true, but did not specify an email address. Quitting.");
	}

	if (swarm_->options.useCluster && !swarm_->options.clusterSoftware.empty() && (swarm_->options.clusterSoftware != "mpi" && swarm_->options.clusterSoftware != "slurm" && swarm_->options.clusterSoftware != "torque" && swarm_->options.clusterSoftware != "BNF2mpi")) {
		cout << swarm_->options.clusterSoftware << endl;
		swarm_->outputError("Error: You set cluster_software to an invalid option. Quitting.");
	}

	if (swarm_->options.fitType == "de") {
		if (swarm_->options.mutateType == 1 && (swarm_->options.swarmSize / swarm_->options.numIslands) < 2 ) {
			swarm_->outputError("Error: mutate_type=1 requires at least 2 members per island. Quitting.");
		}

		if (swarm_->options.mutateType == 2 && (swarm_->options.swarmSize / swarm_->options.numIslands) < 4 ) {
			swarm_->outputError("Error: mutate_type=2 requires at least 4 members per island. Quitting.");
		}

		if (swarm_->options.mutateType == 3 && (swarm_->options.swarmSize / swarm_->options.numIslands) < 3 ) {
			swarm_->outputError("Error: mutate_type=3 requires at least 3 members per island. Quitting.");
		}

		if (swarm_->options.mutateType == 4 && (swarm_->options.swarmSize / swarm_->options.numIslands) < 5 ) {
			swarm_->outputError("Error: mutate_type=4 requires at least 5 members per island. Quitting.");
		}

		if (swarm_->options.numIslands == 0) {
			swarm_->outputError("Error: You are running a differential evolution fit, but didn't specify the number of islands to use. Quitting.");
		}
	}

	if (swarm_->options.fitType == "pso") {
		if (swarm_->options.fitType == "qpso") {
			if (!swarm_->options.maxNumSimulations) {
				swarm_->outputError("Error: You are using qpso, but didn't set max_num_simulations. Quitting.");
			}
		}
	}


	if (swarm_->options.fitType == "sa") {
		if ((unsigned) swarm_->options.swarmSize < (swarm_->options.models[0]->getNumFreeParams() + 1)) {
			swarm_->outputError("Error: You are using simulated annealing but your swarm size is less than N+1, where N is the number of free parameters in your model. Quitting.");
		}
		if (swarm_->options.synchronicity) {
			swarm_->outputError("Error: Simulated annealing does not support synchronous fitting. Quitting.");
		}
	}

	if (swarm_->options.fitType == "ga") {
		if (swarm_->options.synchronicity && swarm_->options.maxGenerations == 0) {
			swarm_->outputError("Error: You are running a synchronous ga fit, but didn't specify max_generations. Quitting.");
		}
	}

	//razi: check consistency between the model and exp files.
	//TODO more checks may be needed here
	if (!swarm_->check_model_exp_consistency()){
		swarm_->outputError("Error: Models are not consistent with exp files.");
	}

}

// Assembly:
pushq %r14
pushq %rbx
subq $0x2c8, %rsp            # imm = 0x2C8
movq %rdi, %rbx
movq 0x8(%rdi), %r14
cmpq $0x0, 0x14e8(%r14)
jne 0x3288f
leaq 0x9d69d(%rip), %rsi     # 0xcfef9
leaq 0x2a8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x33402
leaq 0x2a8(%rsp), %rsi
movq %r14, %rdi
callq 0x6aed2
leaq 0x2a8(%rsp), %rdi
callq 0x295a0
movq 0x8(%rbx), %r14
cmpq $0x0, 0x14c8(%r14)
jne 0x328d3
leaq 0x9d6d9(%rip), %rsi     # 0xcff79
leaq 0x288(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x33402
leaq 0x288(%rsp), %rsi
movq %r14, %rdi
callq 0x6aed2
leaq 0x288(%rsp), %rdi
callq 0x295a0
movq 0x8(%rbx), %r14
addq $0x14e0, %r14           # imm = 0x14E0
leaq 0x9d6c8(%rip), %rsi     # 0xcffa9
movq %r14, %rdi
callq 0x33990
testb %al, %al
je 0x32978
movl $0x14e0, %r14d          # imm = 0x14E0
movq 0x8(%rbx), %rdi
addq %r14, %rdi
leaq 0x9d6a7(%rip), %rsi     # 0xcffac
callq 0x33990
testb %al, %al
je 0x32978
addq 0x8(%rbx), %r14
leaq 0xd9b42(%rip), %rsi     # 0x10c45b
movq %r14, %rdi
callq 0x33990
testb %al, %al
je 0x32978
movl $0x14e0, %edi           # imm = 0x14E0
addq 0x8(%rbx), %rdi
leaq 0xaa79d(%rip), %rsi     # 0xdd0d2
callq 0x33990
testb %al, %al
je 0x32978
movq 0x8(%rbx), %r14
leaq 0x9d666(%rip), %rsi     # 0xcffaf
leaq 0x268(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x33402
leaq 0x268(%rsp), %rsi
movq %r14, %rdi
callq 0x6aed2
leaq 0x268(%rsp), %rdi
callq 0x295a0
movq 0x8(%rbx), %r14
movq 0x15c8(%r14), %rax
cmpq 0x15c0(%r14), %rax
jne 0x329c6
leaq 0x9d644(%rip), %rsi     # 0xcffd7
leaq 0x248(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x33402
leaq 0x248(%rsp), %rsi
movq %r14, %rdi
callq 0x6aed2
leaq 0x248(%rsp), %rdi
callq 0x295a0
movq 0x8(%rbx), %r14
cmpq $0x0, 0x1588(%r14)
jne 0x32a0a
leaq 0x9d67d(%rip), %rsi     # 0xd0054
leaq 0x228(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x33402
leaq 0x228(%rsp), %rsi
movq %r14, %rdi
callq 0x6aed2
leaq 0x228(%rsp), %rdi
callq 0x295a0
movq 0x8(%rbx), %r14
cmpq $0x0, 0x1508(%r14)
jne 0x32a4e
leaq 0x9d6bd(%rip), %rsi     # 0xd00d8
leaq 0x208(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x33402
leaq 0x208(%rsp), %rsi
movq %r14, %rdi
callq 0x6aed2
leaq 0x208(%rsp), %rdi
callq 0x295a0
movq 0x8(%rbx), %r14
cmpq $0x0, 0x1548(%r14)
jne 0x32a92
leaq 0x9d6fc(%rip), %rsi     # 0xd015b
leaq 0x1e8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x33402
leaq 0x1e8(%rsp), %rsi
movq %r14, %rdi
callq 0x6aed2
leaq 0x1e8(%rsp), %rdi
callq 0x295a0
movq 0x8(%rbx), %r14
cmpl $0x0, 0x1620(%r14)
jne 0x32ad6
leaq 0x9d73b(%rip), %rsi     # 0xd01de
leaq 0x1c8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x33402
leaq 0x1c8(%rsp), %rsi
movq %r14, %rdi
callq 0x6aed2
leaq 0x1c8(%rsp), %rdi
callq 0x295a0
movq 0x8(%rbx), %r14
cmpb $0x1, 0x16f9(%r14)
jne 0x32b42
addq $0x14e0, %r14           # imm = 0x14E0
leaq 0xaa5e4(%rip), %rsi     # 0xdd0d2
movq %r14, %rdi
callq 0x3357b
movq 0x8(%rbx), %r14
testb %al, %al
je 0x32b42
cmpb $0x0, 0x16f8(%r14)
jne 0x32b42
leaq 0x9d756(%rip), %rsi     # 0xd0265
leaq 0x1a8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x33402
leaq 0x1a8(%rsp), %rsi
movq %r14, %rdi
callq 0x6aed2
leaq 0x1a8(%rsp), %rdi
callq 0x295a0
movq 0x8(%rbx), %r14
cmpb $0x1, 0x16f8(%r14)
jne 0x32bae
addq $0x14e0, %r14           # imm = 0x14E0
leaq 0xaa578(%rip), %rsi     # 0xdd0d2
movq %r14, %rdi
callq 0x3357b
movq 0x8(%rbx), %r14
testb %al, %al
je 0x32bae
cmpl $0x0, 0x1694(%r14)
jne 0x32bae
leaq 0x9d774(%rip), %rsi     # 0xd02ef
leaq 0x188(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x33402
leaq 0x188(%rsp), %rsi
movq %r14, %rdi
callq 0x6aed2
leaq 0x188(%rsp), %rdi
callq 0x295a0
movq 0x8(%rbx), %r14
movb 0x1631(%r14), %al
cmpb $0x1, %al
jne 0x32c0e
cmpb $0x1, 0x1798(%r14)
jne 0x32c0e
cmpq $0x0, 0x17a8(%r14)
jne 0x32c0e
leaq 0x9d78f(%rip), %rsi     # 0xd0363
leaq 0x168(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x33402
leaq 0x168(%rsp), %rsi
movq %r14, %rdi
callq 0x6aed2
leaq 0x168(%rsp), %rdi
callq 0x295a0
movq 0x8(%rbx), %r14
movb 0x1631(%r14), %al
testb $0x1, %al
je 0x32d00
cmpq $0x0, 0x1738(%r14)
je 0x32d00
addq $0x1730, %r14           # imm = 0x1730
leaq 0x9d79e(%rip), %rsi     # 0xd03d0
movq %r14, %rdi
callq 0x33990
movq 0x8(%rbx), %r14
testb %al, %al
je 0x32d00
addq $0x1730, %r14           # imm = 0x1730
leaq 0x9d76b(%rip), %rsi     # 0xd03bf
movq %r14, %rdi
callq 0x33990
movq 0x8(%rbx), %r14
testb %al, %al
je 0x32d00
addq $0x1730, %r14           # imm = 0x1730
leaq 0x9d74f(%rip), %rsi     # 0xd03c5
movq %r14, %rdi
callq 0x33990
movq 0x8(%rbx), %r14
testb %al, %al
je 0x32d00
addq $0x1730, %r14           # imm = 0x1730
leaq 0x9d738(%rip), %rsi     # 0xd03cc
movq %r14, %rdi
callq 0x33990
movq 0x8(%rbx), %r14
testb %al, %al
je 0x32d00
addq $0x1730, %r14           # imm = 0x1730
movq 0x1332e6(%rip), %rdi    # 0x165f98
movq %r14, %rsi
callq 0x28910
movq %rax, %rdi
callq 0x284a0
movq 0x8(%rbx), %r14
leaq 0x9d707(%rip), %rsi     # 0xd03d4
leaq 0x148(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x33402
leaq 0x148(%rsp), %rsi
movq %r14, %rdi
callq 0x6aed2
leaq 0x148(%rsp), %rdi
callq 0x295a0
movq 0x8(%rbx), %r14
addq $0x14e0, %r14           # imm = 0x14E0
leaq 0xd974d(%rip), %rsi     # 0x10c45b
movq %r14, %rdi
callq 0x3357b
movq 0x8(%rbx), %r14
testb %al, %al
je 0x32ede
movl 0x1700(%r14), %eax
cmpl $0x1, %eax
jne 0x32d88
movl 0x1620(%r14), %eax
xorl %edx, %edx
divl 0x16fc(%r14)
cmpl $0x1, %eax
ja 0x32e9a
leaq 0x9d6c6(%rip), %rsi     # 0xd0414
leaq 0x128(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x33402
leaq 0x128(%rsp), %rsi
movq %r14, %rdi
callq 0x6aed2
leaq 0x128(%rsp), %rdi
callq 0x295a0
movq 0x8(%rbx), %r14
movl 0x1700(%r14), %eax
cmpl $0x2, %eax
jne 0x32de7
movl 0x1620(%r14), %eax
xorl %edx, %edx
divl 0x16fc(%r14)
cmpl $0x3, %eax
ja 0x32e9a
leaq 0x9d6ae(%rip), %rsi     # 0xd045b
leaq 0x108(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x33402
leaq 0x108(%rsp), %rsi
movq %r14, %rdi
callq 0x6aed2
leaq 0x108(%rsp), %rdi
callq 0x295a0
movq 0x8(%rbx), %r14
movl 0x1700(%r14), %eax
cmpl $0x3, %eax
jne 0x32e46
movl 0x1620(%r14), %eax
xorl %edx, %edx
divl 0x16fc(%r14)
cmpl $0x2, %eax
ja 0x32e9a
leaq 0x9d696(%rip), %rsi     # 0xd04a2
leaq 0xe8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x33402
leaq 0xe8(%rsp), %rsi
movq %r14, %rdi
callq 0x6aed2
leaq 0xe8(%rsp), %rdi
callq 0x295a0
movq 0x8(%rbx), %r14
movl 0x1700(%r14), %eax
cmpl $0x4, %eax
jne 0x32e9a
movl 0x1620(%r14), %eax
xorl %edx, %edx
divl 0x16fc(%r14)
cmpl $0x4, %eax
ja 0x32e9a
leaq 0x9d682(%rip), %rsi     # 0xd04e9
leaq 0xc8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x33402
leaq 0xc8(%rsp), %rsi
movq %r14, %rdi
callq 0x6aed2
leaq 0xc8(%rsp), %rdi
callq 0x295a0
movq 0x8(%rbx), %r14
cmpl $0x0, 0x16fc(%r14)
jne 0x32ede
leaq 0x9d685(%rip), %rsi     # 0xd0530
leaq 0xa8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x33402
leaq 0xa8(%rsp), %rsi
movq %r14, %rdi
callq 0x6aed2
leaq 0xa8(%rsp), %rdi
callq 0x295a0
movq 0x8(%rbx), %r14
addq $0x14e0, %r14           # imm = 0x14E0
leaq 0xaa1e6(%rip), %rsi     # 0xdd0d2
movq %r14, %rdi
callq 0x3357b
movq 0x8(%rbx), %r14
testb %al, %al
je 0x32f5e
addq $0x14e0, %r14           # imm = 0x14E0
leaq 0x9c9bf(%rip), %rsi     # 0xcf8c9
movq %r14, %rdi
callq 0x3357b
movq 0x8(%rbx), %r14
testb %al, %al
je 0x32f5e
cmpq $0x0, 0x1680(%r14)
jne 0x32f5e
leaq 0x9d675(%rip), %rsi     # 0xd05a0
leaq 0x88(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x33402
leaq 0x88(%rsp), %rsi
movq %r14, %rdi
callq 0x6aed2
leaq 0x88(%rsp), %rdi
callq 0x295a0
movq 0x8(%rbx), %r14
addq $0x14e0, %r14           # imm = 0x14E0
leaq 0x9d040(%rip), %rsi     # 0xcffac
movq %r14, %rdi
callq 0x3357b
movq 0x8(%rbx), %r14
testb %al, %al
je 0x33004
movq 0x15c0(%r14), %rax
movq (%rax), %rax
movl 0x58(%rax), %eax
incl %eax
cmpl %eax, 0x1620(%r14)
jae 0x32fc9
leaq 0x9d64a(%rip), %rsi     # 0xd05e9
leaq 0x68(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x33402
leaq 0x68(%rsp), %rsi
movq %r14, %rdi
callq 0x6aed2
leaq 0x68(%rsp), %rdi
callq 0x295a0
movq 0x8(%rbx), %r14
cmpb $0x1, 0x1618(%r14)
jne 0x33004
leaq 0x9d6a0(%rip), %rsi     # 0xd067a
leaq 0x48(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x33402
leaq 0x48(%rsp), %rsi
movq %r14, %rdi
callq 0x6aed2
leaq 0x48(%rsp), %rdi
callq 0x295a0
movq 0x8(%rbx), %r14
addq $0x14e0, %r14           # imm = 0x14E0
leaq 0x9cf97(%rip), %rsi     # 0xcffa9
movq %r14, %rdi
callq 0x3357b
movq 0x8(%rbx), %r14
testb %al, %al
je 0x33067
cmpb $0x1, 0x1618(%r14)
jne 0x33067
cmpl $0x0, 0x161c(%r14)
jne 0x33067
leaq 0x9d688(%rip), %rsi     # 0xd06c5
leaq 0x28(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x33402
leaq 0x28(%rsp), %rsi
movq %r14, %rdi
callq 0x6aed2
leaq 0x28(%rsp), %rdi
callq 0x295a0
movq 0x8(%rbx), %r14
movq %r14, %rdi
callq 0x6be6a
testb %al, %al
jne 0x330a4
movq 0x8(%rbx), %rbx
leaq 0x9d6a2(%rip), %rsi     # 0xd0720
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x33402
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x6aed2
leaq 0x8(%rsp), %rdi
callq 0x295a0
addq $0x2c8, %rsp            # imm = 0x2C8
popq %rbx
popq %r14
retq
movq %rax, %rbx
leaq 0x148(%rsp), %rdi
jmp 0x33237
jmp 0x3323e
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
jmp 0x33237
jmp 0x3323e
movq %rax, %rbx
leaq 0x268(%rsp), %rdi
jmp 0x33237
jmp 0x3323e
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
jmp 0x33237
jmp 0x3323e
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
jmp 0x33237
jmp 0x3323e
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
jmp 0x33237
movq %rax, %rbx
leaq 0x108(%rsp), %rdi
jmp 0x33237
jmp 0x3323e
movq %rax, %rbx
leaq 0x168(%rsp), %rdi
jmp 0x33237
jmp 0x3323e
movq %rax, %rbx
leaq 0x188(%rsp), %rdi
jmp 0x33237
jmp 0x3323e
jmp 0x3323e
movq %rax, %rbx
leaq 0x128(%rsp), %rdi
jmp 0x33237
movq %rax, %rbx
leaq 0x1a8(%rsp), %rdi
jmp 0x33237
jmp 0x3323e
jmp 0x3323e
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
jmp 0x33237
jmp 0x3323e
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
jmp 0x33237
jmp 0x3323e
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
jmp 0x33237
jmp 0x3323e
movq %rax, %rbx
leaq 0x1c8(%rsp), %rdi
jmp 0x33237
movq %rax, %rbx
leaq 0x1e8(%rsp), %rdi
jmp 0x33237
jmp 0x3323e
movq %rax, %rbx
leaq 0x208(%rsp), %rdi
jmp 0x33237
jmp 0x3323e
movq %rax, %rbx
leaq 0x228(%rsp), %rdi
jmp 0x33237
jmp 0x3323e
movq %rax, %rbx
leaq 0x248(%rsp), %rdi
jmp 0x33237
jmp 0x3323e
movq %rax, %rbx
leaq 0x288(%rsp), %rdi
jmp 0x33237
jmp 0x3323e
movq %rax, %rbx
leaq 0x2a8(%rsp), %rdi
jmp 0x33237
jmp 0x3323e
jmp 0x3323e
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x295a0
jmp 0x33241
movq %rax, %rbx
movq %rbx, %rdi
callq 0x292f0
nop