// File: richardposner[P]BioNetFit2/src/code/Swarm.cpp
// Function: Swarm::generateBNF2MPICommand(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
string Swarm::generateBNF2MPICommand(string cmd) {

	if(options.verbosity >=4){
		cout << "Entering generateBNF2MPICommand()" << endl;
	}
	int maxSubPar = 0;
	maxSubPar = fcalcsubParID(options.swarmSize, options.models.size()-1, options.models.size());


	//sbatch << "mpirun -prepend-rank -np 1 " << runCmd << " load " << sConf_ << " : -np " << options.swarmSize << " " << runCmd << " particle 0 run " << sConf_ << endl;
	string newCmd = "mpirun -oversubscribe ";
	if (options.hostfile.size()) {
		newCmd += "-hostfile " + options.hostfile + " ";
	}
	newCmd += "-tag-output -np 1 " + cmd + " -a load -c " + sConf_[0] + " : -oversubscribe ";
	if (options.hostfile.size()) {
		newCmd += "-hostfile " + options.hostfile + " ";
	}
	newCmd += "-tag-output -np " + toString(maxSubPar) + " " + cmd + " -t particle -p 0 -a run -c " + sConf_[0];

	if (options.saveClusterOutput) {
		newCmd += " > " + options.outputDir + "/" + options.jobName + "_cluster_output/" + options.jobName + " 2>&1";
	}
	if(options.verbosity >=3){
	cout << "MPI command built from generateBNF2MPICommand: " << endl << newCmd << endl;
	}
	return newCmd;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x300, %rsp            # imm = 0x300
movq %rdx, -0x2d0(%rbp)
movq %rdi, -0x2c8(%rbp)
movq %rdi, %rax
movq %rax, -0x2c0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x2b8(%rbp)
cmpl $0x4, 0x1614(%rax)
jb 0x10dc65
movq 0x1c7306(%rip), %rdi    # 0x2d4f50
leaq 0xd51a0(%rip), %rsi     # 0x1e2df1
callq 0x2ff50
movq %rax, %rdi
movq 0x1c7368(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
movq -0x2b8(%rbp), %rdi
movl $0x0, -0x1c(%rbp)
movl 0x1620(%rdi), %eax
movl %eax, -0x2e0(%rbp)
addq $0x15c0, %rdi           # imm = 0x15C0
movq %rdi, -0x2e8(%rbp)
callq 0x45170
movq -0x2e8(%rbp), %rdi
decl %eax
movl %eax, -0x2dc(%rbp)
callq 0x45170
movl -0x2e0(%rbp), %edi
movl -0x2dc(%rbp), %esi
movl %eax, %edx
callq 0x17d3a0
movl %eax, -0x1c(%rbp)
movb $0x0, -0x1d(%rbp)
leaq -0x1e(%rbp), %rdi
movq %rdi, -0x2d8(%rbp)
callq 0x30a70
movq -0x2c8(%rbp), %rdi
movq -0x2d8(%rbp), %rdx
leaq 0xd512e(%rip), %rsi     # 0x1e2e13
callq 0x44470
jmp 0x10dcec
leaq -0x1e(%rbp), %rdi
callq 0x311c0
movq -0x2b8(%rbp), %rdi
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0x300, %rdi            # imm = 0x300
callq 0x2f720
cmpq $0x0, %rax
je 0x10ddd1
movq -0x2b8(%rbp), %rdx
addq $0x17c0, %rdx           # imm = 0x17C0
leaq 0xd501d(%rip), %rsi     # 0x1e2d4b
leaq -0x70(%rbp), %rdi
callq 0x44240
jmp 0x10dd39
leaq 0xd638f(%rip), %rdx     # 0x1e40cf
leaq -0x50(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x441f0
jmp 0x10dd4f
movq -0x2c8(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x2f1e0
jmp 0x10dd61
leaq -0x50(%rbp), %rdi
callq 0x311e8
leaq -0x70(%rbp), %rdi
callq 0x311e8
jmp 0x10ddd1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x1e(%rbp), %rdi
callq 0x311c0
jmp 0x10e401
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x10e3f5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x10ddc3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x311e8
leaq -0x70(%rbp), %rdi
callq 0x311e8
jmp 0x10e3f5
movq -0x2d0(%rbp), %rdx
leaq 0xd5387(%rip), %rsi     # 0x1e3166
leaq -0xf0(%rbp), %rdi
callq 0x44240
jmp 0x10dded
leaq 0xd4f9d(%rip), %rdx     # 0x1e2d91
leaq -0xd0(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x441f0
jmp 0x10de09
movq -0x2b8(%rbp), %rdi
addq $0x1938, %rdi           # imm = 0x1938
xorl %eax, %eax
movl %eax, %esi
callq 0x449e0
movq %rax, %rdx
leaq -0xb0(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x44760
jmp 0x10de38
leaq 0xd4feb(%rip), %rdx     # 0x1e2e2a
leaq -0x90(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x441f0
jmp 0x10de54
movq -0x2c8(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x2f1e0
jmp 0x10de69
leaq -0x90(%rbp), %rdi
callq 0x311e8
leaq -0xb0(%rbp), %rdi
callq 0x311e8
leaq -0xd0(%rbp), %rdi
callq 0x311e8
leaq -0xf0(%rbp), %rdi
callq 0x311e8
movq -0x2b8(%rbp), %rdi
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0x300, %rdi            # imm = 0x300
callq 0x2f720
cmpq $0x0, %rax
je 0x10dfd0
movq -0x2b8(%rbp), %rdx
addq $0x17c0, %rdx           # imm = 0x17C0
leaq 0xd4e79(%rip), %rsi     # 0x1e2d4b
leaq -0x130(%rbp), %rdi
callq 0x44240
jmp 0x10dee0
leaq 0xd61e8(%rip), %rdx     # 0x1e40cf
leaq -0x110(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x441f0
jmp 0x10defc
movq -0x2c8(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x2f1e0
jmp 0x10df11
leaq -0x110(%rbp), %rdi
callq 0x311e8
leaq -0x130(%rbp), %rdi
callq 0x311e8
jmp 0x10dfd0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x10df88
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x10df7c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x10df70
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x311e8
leaq -0xb0(%rbp), %rdi
callq 0x311e8
leaq -0xd0(%rbp), %rdi
callq 0x311e8
leaq -0xf0(%rbp), %rdi
callq 0x311e8
jmp 0x10e3f5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x10dfbf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x311e8
leaq -0x130(%rbp), %rdi
callq 0x311e8
jmp 0x10e3f5
movl -0x1c(%rbp), %esi
leaq -0x1f0(%rbp), %rdi
callq 0x17ce40
jmp 0x10dfe1
leaq 0xd4dcb(%rip), %rsi     # 0x1e2db3
leaq -0x1d0(%rbp), %rdi
leaq -0x1f0(%rbp), %rdx
callq 0x8e0f0
jmp 0x10dffd
leaq 0xd60cb(%rip), %rdx     # 0x1e40cf
leaq -0x1b0(%rbp), %rdi
leaq -0x1d0(%rbp), %rsi
callq 0x441f0
jmp 0x10e019
movq -0x2d0(%rbp), %rdx
leaq -0x190(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
callq 0x44760
jmp 0x10e035
leaq 0xd4e01(%rip), %rdx     # 0x1e2e3d
leaq -0x170(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x441f0
jmp 0x10e051
movq -0x2b8(%rbp), %rdi
addq $0x1938, %rdi           # imm = 0x1938
xorl %eax, %eax
movl %eax, %esi
callq 0x449e0
movq %rax, %rdx
leaq -0x150(%rbp), %rdi
leaq -0x170(%rbp), %rsi
callq 0x44760
jmp 0x10e080
movq -0x2c8(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0x2f1e0
jmp 0x10e095
leaq -0x150(%rbp), %rdi
callq 0x311e8
leaq -0x170(%rbp), %rdi
callq 0x311e8
leaq -0x190(%rbp), %rdi
callq 0x311e8
leaq -0x1b0(%rbp), %rdi
callq 0x311e8
leaq -0x1d0(%rbp), %rdi
callq 0x311e8
leaq -0x1f0(%rbp), %rdi
callq 0x311e8
movq -0x2b8(%rbp), %rax
testb $0x1, 0x1770(%rax)
je 0x10e354
movq -0x2b8(%rbp), %rdx
addq $0x1500, %rdx           # imm = 0x1500
leaq 0xd3232(%rip), %rsi     # 0x1e1338
leaq -0x2b0(%rbp), %rdi
callq 0x44240
jmp 0x10e114
leaq 0xd4238(%rip), %rdx     # 0x1e2353
leaq -0x290(%rbp), %rdi
leaq -0x2b0(%rbp), %rsi
callq 0x441f0
jmp 0x10e130
movq -0x2b8(%rbp), %rdx
addq $0x14c0, %rdx           # imm = 0x14C0
leaq -0x270(%rbp), %rdi
leaq -0x290(%rbp), %rsi
callq 0x44760
jmp 0x10e153
leaq 0xd4c86(%rip), %rdx     # 0x1e2de0
leaq -0x250(%rbp), %rdi
leaq -0x270(%rbp), %rsi
callq 0x441f0
jmp 0x10e16f
movq -0x2b8(%rbp), %rdx
addq $0x14c0, %rdx           # imm = 0x14C0
leaq -0x230(%rbp), %rdi
leaq -0x250(%rbp), %rsi
callq 0x44760
jmp 0x10e192
leaq 0xcd2ba(%rip), %rdx     # 0x1db453
leaq -0x210(%rbp), %rdi
leaq -0x230(%rbp), %rsi
callq 0x441f0
jmp 0x10e1ae
movq -0x2c8(%rbp), %rdi
leaq -0x210(%rbp), %rsi
callq 0x2f1e0
jmp 0x10e1c3
leaq -0x210(%rbp), %rdi
callq 0x311e8
leaq -0x230(%rbp), %rdi
callq 0x311e8
leaq -0x250(%rbp), %rdi
callq 0x311e8
leaq -0x270(%rbp), %rdi
callq 0x311e8
leaq -0x290(%rbp), %rdi
callq 0x311e8
leaq -0x2b0(%rbp), %rdi
callq 0x311e8
jmp 0x10e354
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x10e2a1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x10e295
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x10e289
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x10e27d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x10e271
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x150(%rbp), %rdi
callq 0x311e8
leaq -0x170(%rbp), %rdi
callq 0x311e8
leaq -0x190(%rbp), %rdi
callq 0x311e8
leaq -0x1b0(%rbp), %rdi
callq 0x311e8
leaq -0x1d0(%rbp), %rdi
callq 0x311e8
leaq -0x1f0(%rbp), %rdi
callq 0x311e8
jmp 0x10e3f5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x10e343
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x10e337
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x10e32b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x10e31f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x10e313
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x210(%rbp), %rdi
callq 0x311e8
leaq -0x230(%rbp), %rdi
callq 0x311e8
leaq -0x250(%rbp), %rdi
callq 0x311e8
leaq -0x270(%rbp), %rdi
callq 0x311e8
leaq -0x290(%rbp), %rdi
callq 0x311e8
leaq -0x2b0(%rbp), %rdi
callq 0x311e8
jmp 0x10e3f5
movq -0x2b8(%rbp), %rax
cmpl $0x3, 0x1614(%rax)
jb 0x10e3cf
movq 0x1c6be5(%rip), %rdi    # 0x2d4f50
leaq 0xd4ae8(%rip), %rsi     # 0x1e2e5a
callq 0x2ff50
movq %rax, -0x2f0(%rbp)
jmp 0x10e380
movq -0x2f0(%rbp), %rdi
movq 0x1c6c3a(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
movq %rax, -0x2f8(%rbp)
jmp 0x10e39c
movq -0x2c8(%rbp), %rsi
movq -0x2f8(%rbp), %rdi
callq 0x2f780
movq %rax, -0x300(%rbp)
jmp 0x10e3b8
movq -0x300(%rbp), %rdi
movq 0x1c6c02(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0x10e3cd
jmp 0x10e3cf
movb $0x1, -0x1d(%rbp)
testb $0x1, -0x1d(%rbp)
jne 0x10e3e5
movq -0x2c8(%rbp), %rdi
callq 0x311e8
movq -0x2c0(%rbp), %rax
addq $0x300, %rsp            # imm = 0x300
popq %rbp
retq
movq -0x2c8(%rbp), %rdi
callq 0x311e8
movq -0x28(%rbp), %rdi
callq 0x30170
nopw (%rax,%rax)