// File: /workspace/github_cpp_makefile_star2_O2/richardposner[P]BioNetFit2/src/code/Swarm.cpp
// Function: Swarm::generateSlurmMultiProgCmd(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
string Swarm::generateSlurmMultiProgCmd(string runCmd) {
	string multiProgConfPath = options.jobOutputDir + "multiprog.conf";
	ofstream multiprog(multiProgConfPath, ios::out);

	if (multiprog.is_open()) {

		vector<string> paths;
		paths.push_back(sConf_[0]);
		paths.push_back(expPaths_[0][0]);
		paths.push_back(exePath_);

		string mycommonPath = commonPath(paths, '/');
		string expsubPath;
		string exesubPath;
		string sconfsubPath;

		multiprog << "#SBATCH --workdir=" << mycommonPath << endl;

		string command = exePath_ + " -a load -c " + sConf_[0];
		//multiprog << "0 " << runCmd << " load " << sConf_[0] << endl;
		multiprog << "0 " << command << endl;
		int subPID;
		for (int id = 1; id <= options.swarmSize; ++id) {
			for (unsigned int mid = 0; mid < options.models.size(); ++mid){

				subPID = fcalcsubParID(id, mid, options.models.size());

				exesubPath = exePath_.substr(mycommonPath.length(), mycommonPath.length()+exePath_.length());
				expsubPath = expPaths_[mid][0].substr(mycommonPath.length(), mycommonPath.length()+expPaths_[mid][0].length());
				sconfsubPath = sConf_[mid].substr(mycommonPath.length(), mycommonPath.length()+sConf_[mid].length());

				//multiprog << toString(subPID) + " " << runCmd << " particle " << toString(id) << " run " << sConf_[mid] << endl;
				//				multiprog << toString(id) + " " << runCmd << " particle " << toString(id) << " run " << sConf_[mid] << endl;
				command = "." + exesubPath + " -t particle -p " + toString(subPID) + " -a cluster -g " + toString(currentGeneration) + " -c ." + sconfsubPath + " -e ." + expsubPath;  //razi: consider more than 1 exp
				command = command + " -n " + toString(this->getNumModels());
				//command = command + " >> pOUT 2>&1";
				multiprog << toString(subPID) + " " << command << endl;



			}
		}
		multiprog.close();
	}
	return generateSlurmCommand(multiProgConfPath);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x498, %rsp            # imm = 0x498
movq %rsi, %r14
movq %rdi, %r15
addq $0x1520, %rsi           # imm = 0x1520
leaq 0x61570(%rip), %rdx     # 0xde47b
leaq 0x1d8(%rsp), %rbx
movq %rbx, %rdi
callq 0x334ed
leaq 0x298(%rsp), %rdi
pushq $0x10
popq %rdx
movq %rbx, %rsi
callq 0x294c0
leaq 0x308(%rsp), %rdi
callq 0x28200
testb %al, %al
je 0x7d497
xorps %xmm0, %xmm0
leaq 0x50(%rsp), %rdi
movaps %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
movq 0x1938(%r14), %rsi
callq 0x33776
leaq 0x1908(%r14), %rdi
leaq 0x78(%rsp), %rsi
andl $0x0, (%rsi)
movq %rdi, 0x28(%rsp)
callq 0x85e5c
movq (%rax), %rsi
leaq 0x50(%rsp), %rdi
callq 0x33776
leaq 0x17e0(%r14), %rsi
leaq 0x50(%rsp), %rdi
movq %rsi, 0x20(%rsp)
callq 0x33776
leaq 0x78(%rsp), %rdi
leaq 0x50(%rsp), %rsi
pushq $0x2f
popq %rdx
callq 0x9f2e4
leaq 0x108(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
leaq 0xe8(%rsp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %cl, (%rax)
movb %cl, (%rdx)
leaq 0xc8(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
leaq 0x6149b(%rip), %rsi     # 0xde48a
leaq 0x298(%rsp), %rdi
callq 0x289f0
leaq 0x78(%rsp), %rsi
movq %rax, %rdi
callq 0x28910
movq %rax, %rdi
callq 0x284a0
leaq 0x6136a(%rip), %rdx     # 0xde382
leaq 0x30(%rsp), %rdi
movq 0x20(%rsp), %rsi
callq 0x334ed
movq 0x1938(%r14), %rdx
leaq 0x98(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x334ce
movq %r14, 0x10(%rsp)
movq %r15, 0x70(%rsp)
leaq 0x30(%rsp), %rdi
callq 0x295a0
leaq 0x61442(%rip), %rsi     # 0xde49d
leaq 0x298(%rsp), %rdi
callq 0x289f0
leaq 0x98(%rsp), %rsi
movq %rax, %rdi
callq 0x28910
movq %rax, %rdi
callq 0x284a0
pushq $0x1
popq %rbx
leaq 0x138(%rsp), %r15
leaq 0x158(%rsp), %r13
movq 0x10(%rsp), %rax
cmpl 0x1620(%rax), %ebx
jg 0x7d438
xorl %esi, %esi
movl %ebx, 0x1c(%rsp)
movl %esi, 0xc(%rsp)
movl %esi, %eax
movq 0x10(%rsp), %rcx
movq 0x15c8(%rcx), %rdx
subq 0x15c0(%rcx), %rdx
sarq $0x3, %rdx
cmpq %rax, %rdx
jbe 0x7d431
movl %ebx, %edi
callq 0x9ec09
movl %eax, 0x18(%rsp)
movq 0x80(%rsp), %rdx
movq 0x10(%rsp), %r12
movq 0x17e8(%r12), %rcx
addq %rdx, %rcx
leaq 0x30(%rsp), %rbp
movq %rbp, %rdi
movq 0x20(%rsp), %rsi
callq 0x28a90
leaq 0xb8(%rsp), %r14
leaq 0xd8(%rsp), %rdi
movq %rbp, %rsi
callq 0x28c40
movq %rbp, %rdi
callq 0x295a0
movq 0x28(%rsp), %rdi
leaq 0xc(%rsp), %rsi
callq 0x5ab04
movq (%rax), %rbp
movq 0x80(%rsp), %rbx
movq 0x28(%rsp), %rdi
leaq 0xc(%rsp), %rsi
callq 0x5ab04
movq (%rax), %rax
movq 0x8(%rax), %rcx
addq %rbx, %rcx
leaq 0x30(%rsp), %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x28a90
leaq 0xf8(%rsp), %rdi
leaq 0x30(%rsp), %rbx
movq %rbx, %rsi
callq 0x28c40
movq %rbx, %rdi
callq 0x295a0
movl 0xc(%rsp), %eax
movq 0x1938(%r12), %rcx
shlq $0x5, %rax
leaq (%rcx,%rax), %rsi
movq 0x80(%rsp), %rdx
movq 0x8(%rcx,%rax), %rcx
addq %rdx, %rcx
movq %rbx, %rdi
callq 0x28a90
movq %r14, %rdi
movq %rbx, %rsi
callq 0x28c40
movq %rbx, %rdi
callq 0x295a0
movq %r15, %rdi
leaq 0x5fedf(%rip), %rsi     # 0xdd0ad
leaq 0xd8(%rsp), %rdx
callq 0x3338b
movq %r13, %rdi
movq %r15, %rsi
leaq 0x6031f(%rip), %rdx     # 0xdd507
callq 0x3336c
leaq 0x218(%rsp), %rbx
movq %rbx, %rdi
movl 0x18(%rsp), %esi
callq 0x9e9c3
leaq 0x258(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x4e6ed
leaq 0x178(%rsp), %rdi
movq %rbp, %rsi
leaq 0x61277(%rip), %rdx     # 0xde4a0
callq 0x3336c
movq 0x10(%rsp), %rax
movl 0x13e8(%rax), %esi
leaq 0x1f8(%rsp), %r13
movq %r13, %rdi
callq 0x9f56b
leaq 0x238(%rsp), %r12
movq %r12, %rdi
leaq 0x178(%rsp), %rsi
movq %r13, %rdx
callq 0x4e6ed
leaq 0x278(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
leaq 0x61237(%rip), %rdx     # 0xde4b0
callq 0x3336c
leaq 0x198(%rsp), %r12
movq %r12, %rdi
movq %r13, %rsi
leaq 0xb8(%rsp), %rdx
callq 0x334ce
movq %r13, %rbx
leaq 0x1b8(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
leaq 0x61205(%rip), %rdx     # 0xde4b6
callq 0x3336c
leaq 0x30(%rsp), %r13
movq %r13, %rdi
movq %r14, %rsi
leaq 0xf8(%rsp), %rdx
callq 0x334ce
leaq 0x98(%rsp), %r15
movq %r15, %rdi
movq %r13, %rsi
callq 0x28c40
movq %r13, %rdi
callq 0x295a0
movq %r14, %rdi
callq 0x295a0
leaq 0x198(%rsp), %r12
movq %r12, %rdi
callq 0x295a0
movq %rbx, %rdi
callq 0x295a0
leaq 0x238(%rsp), %rdi
callq 0x295a0
leaq 0x1f8(%rsp), %rdi
callq 0x295a0
leaq 0x178(%rsp), %rdi
callq 0x295a0
movq %rbp, %rdi
callq 0x295a0
leaq 0x218(%rsp), %rdi
callq 0x295a0
leaq 0x158(%rsp), %rdi
callq 0x295a0
leaq 0x138(%rsp), %rdi
callq 0x295a0
movq %r14, %rdi
movq %r15, %rsi
leaq 0x601b8(%rip), %rdx     # 0xdd524
callq 0x334ed
movq 0x10(%rsp), %rax
movq 0x15c8(%rax), %rsi
subq 0x15c0(%rax), %rsi
shrq $0x3, %rsi
movq %r12, %rdi
callq 0x9f56b
movq %r13, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x4e6ed
movq %r15, %rdi
movq %r13, %rsi
callq 0x28c40
movq %r13, %rdi
callq 0x295a0
movq %r12, %rdi
callq 0x295a0
movq %r14, %rdi
callq 0x295a0
movq %r14, %rdi
movl 0x18(%rsp), %esi
callq 0x9e9c3
movq %r13, %rdi
movq %r14, %rsi
leaq 0x62233(%rip), %rdx     # 0xdf60d
callq 0x3336c
leaq 0x298(%rsp), %rdi
movq %r13, %rsi
callq 0x28910
movq %rax, %rdi
movq %r15, %rsi
callq 0x28910
movq %rax, %rdi
callq 0x284a0
movq %r13, %rdi
callq 0x295a0
movq %r14, %rdi
callq 0x295a0
movl 0xc(%rsp), %esi
incl %esi
movl 0x1c(%rsp), %ebx
leaq 0x138(%rsp), %r15
leaq 0x158(%rsp), %r13
jmp 0x7d0aa
incl %ebx
jmp 0x7d093
leaq 0x298(%rsp), %rdi
callq 0x28e60
leaq 0x98(%rsp), %rdi
callq 0x295a0
leaq 0xb8(%rsp), %rdi
callq 0x295a0
leaq 0xd8(%rsp), %rdi
callq 0x295a0
leaq 0xf8(%rsp), %rdi
callq 0x295a0
leaq 0x78(%rsp), %rdi
callq 0x295a0
leaq 0x50(%rsp), %rdi
callq 0x3355a
movq 0x70(%rsp), %r15
movq 0x10(%rsp), %r14
leaq 0x118(%rsp), %rdi
leaq 0x1d8(%rsp), %rsi
callq 0x28dd0
leaq 0x118(%rsp), %rdx
pushq $0x1
popq %rcx
movq %r15, %rdi
movq %r14, %rsi
xorl %r8d, %r8d
callq 0x6cf02
leaq 0x118(%rsp), %rdi
callq 0x295a0
leaq 0x298(%rsp), %rdi
callq 0x28f10
leaq 0x1d8(%rsp), %rdi
callq 0x295a0
movq %r15, %rax
addq $0x498, %rsp            # imm = 0x498
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x7d653
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
jmp 0x7d65e
jmp 0x7d54b
jmp 0x7d536
movq %rax, %rbx
leaq 0x118(%rsp), %rdi
callq 0x295a0
jmp 0x7d69e
movq %rax, %rbx
jmp 0x7d69e
jmp 0x7d536
movq %rax, %rbx
jmp 0x7d694
movq %rax, %rbx
jmp 0x7d6ab
jmp 0x7d653
movq %rax, %rbx
jmp 0x7d663
jmp 0x7d555
movq %rax, %rbx
jmp 0x7d644
movq %rax, %rbx
leaq 0x198(%rsp), %rdi
jmp 0x7d63f
jmp 0x7d653
jmp 0x7d653
movq %rax, %rbx
jmp 0x7d5f2
movq %rax, %rbx
jmp 0x7d619
movq %rax, %rbx
jmp 0x7d5d1
movq %rax, %rbx
jmp 0x7d5ff
movq %rax, %rbx
jmp 0x7d60c
movq %rax, %rbx
leaq 0x1b8(%rsp), %rdi
callq 0x295a0
jmp 0x7d5b7
movq %rax, %rbx
jmp 0x7d5c4
jmp 0x7d653
jmp 0x7d653
movq %rax, %rbx
leaq 0x198(%rsp), %rdi
callq 0x295a0
leaq 0x278(%rsp), %rdi
callq 0x295a0
leaq 0x238(%rsp), %rdi
callq 0x295a0
jmp 0x7d5e5
jmp 0x7d653
movq %rax, %rbx
leaq 0x1f8(%rsp), %rdi
callq 0x295a0
leaq 0x178(%rsp), %rdi
callq 0x295a0
leaq 0x258(%rsp), %rdi
callq 0x295a0
leaq 0x218(%rsp), %rdi
callq 0x295a0
leaq 0x158(%rsp), %rdi
callq 0x295a0
leaq 0x138(%rsp), %rdi
jmp 0x7d64c
movq %rax, %rbx
jmp 0x7d626
jmp 0x7d653
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x295a0
leaq 0x1b8(%rsp), %rdi
callq 0x295a0
jmp 0x7d656
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x295a0
leaq 0xb8(%rsp), %rdi
callq 0x295a0
leaq 0xd8(%rsp), %rdi
callq 0x295a0
leaq 0xf8(%rsp), %rdi
callq 0x295a0
leaq 0x78(%rsp), %rdi
callq 0x295a0
leaq 0x50(%rsp), %rdi
callq 0x3355a
leaq 0x298(%rsp), %rdi
callq 0x28f10
leaq 0x1d8(%rsp), %rdi
callq 0x295a0
movq %rbx, %rdi
callq 0x292f0