// File: /workspace/github_cpp_makefile_star2_O2/richardposner[P]BioNetFit2/src/code/Swarm.cpp
// Function: Swarm::generateTorqueBatchScript(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
string Swarm::generateTorqueBatchScript(string cmd) {
	string batchScriptPath = options.jobOutputDir + "batch_script.sh";
	ofstream batchScript(batchScriptPath, ios::out);

	if (batchScript.is_open()) {
		batchScript << "#!/bin/bash" << endl << endl;

		batchScript << "#PBS -N " << options.jobName << endl;

		if (options.saveClusterOutput) {
			batchScript << "#PBS -o " + options.outputDir + "/" + options.jobName + "_cluster_output/" + options.jobName << endl;
			batchScript << "#PBS -j oe" << endl;
		}
		else {
			batchScript << "#PBS -o /dev/null" << endl;
		}

		if (!options.clusterQueue.empty()) {
			batchScript << "#PBS -p	" + options.clusterQueue << endl;
		}

		// Specify the cluster account if needed
		if (!options.clusterAccount.empty()) {
			batchScript << "#PBS -A " + options.clusterAccount << endl;
		}

		batchScript << "#PBS -l procs=" << options.swarmSize + 1 << ",";

		//if (options.maxFitTime != MAX_LONG) {
		//	batchScript << " walltime=00:00:" << toString(options.maxFitTime) << ",";
		//}
		if (!options.maxFitTime.empty()) { //Raquel fixed torque support
			batchScript << " walltime=" << options.maxFitTime << ","; //Raquel fixed torque support
		}

		batchScript << endl << endl;

		cout<<"Swarm::generateTorqueBatchScript Might need some modifications ....642\n";
		batchScript << "mpirun -np1" << cmd << " load " << sConf_[0] << " : cmd ";
		batchScript.close();
	}

	return cmd;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x2c8, %rsp            # imm = 0x2C8
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
addq $0x1520, %rsi           # imm = 0x1520
leaq 0x60dd7(%rip), %rdx     # 0xde4bc
leaq 0xa8(%rsp), %r12
movq %r12, %rdi
callq 0x334ed
leaq 0xc8(%rsp), %rdi
pushq $0x10
popq %rdx
movq %r12, %rsi
callq 0x294c0
leaq 0x138(%rsp), %rdi
callq 0x28200
testb %al, %al
je 0x7d9dc
leaq 0x60da8(%rip), %rsi     # 0xde4cc
leaq 0xc8(%rsp), %rdi
callq 0x289f0
movq %rax, %rdi
callq 0x284a0
movq %rax, %rdi
callq 0x284a0
leaq 0x60d90(%rip), %rsi     # 0xde4d8
leaq 0xc8(%rsp), %rdi
callq 0x289f0
leaq 0x14c0(%r15), %r12
movq %rax, %rdi
movq %r12, %rsi
callq 0x28910
movq %rax, %rdi
callq 0x284a0
cmpb $0x1, 0x1770(%r15)
jne 0x7d843
leaq 0x1500(%r15), %rdx
leaq 0x60d56(%rip), %rsi     # 0xde4e1
leaq 0x28(%rsp), %rdi
callq 0x3338b
leaq 0x6021b(%rip), %rdx     # 0xdd9b7
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x3336c
leaq 0x68(%rsp), %rdi
leaq 0x48(%rsp), %rsi
movq %r12, %rdx
callq 0x334ce
leaq 0x60c0d(%rip), %rdx     # 0xde3d1
leaq 0x88(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x3336c
leaq 0x8(%rsp), %rdi
leaq 0x88(%rsp), %rsi
movq %r12, %rdx
callq 0x334ce
leaq 0xc8(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x28910
movq %rax, %rdi
callq 0x284a0
leaq 0x8(%rsp), %rdi
callq 0x295a0
leaq 0x88(%rsp), %rdi
callq 0x295a0
leaq 0x68(%rsp), %rdi
callq 0x295a0
leaq 0x48(%rsp), %rdi
callq 0x295a0
leaq 0x28(%rsp), %rdi
callq 0x295a0
leaq 0x60ca9(%rip), %rsi     # 0xde4ea
jmp 0x7d84a
leaq 0x60cab(%rip), %rsi     # 0xde4f5
leaq 0xc8(%rsp), %rdi
callq 0x289f0
movq %rax, %rdi
callq 0x284a0
cmpq $0x0, 0x1780(%r15)
je 0x7d8a5
leaq 0x1778(%r15), %rdx
leaq 0x60c90(%rip), %rsi     # 0xde507
leaq 0x8(%rsp), %rdi
callq 0x3338b
leaq 0xc8(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x28910
movq %rax, %rdi
callq 0x284a0
leaq 0x8(%rsp), %rdi
callq 0x295a0
cmpq $0x0, 0x1758(%r15)
je 0x7d8eb
leaq 0x1750(%r15), %rdx
leaq 0x60c53(%rip), %rsi     # 0xde510
leaq 0x8(%rsp), %rdi
callq 0x3338b
leaq 0xc8(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x28910
movq %rax, %rdi
callq 0x284a0
leaq 0x8(%rsp), %rdi
callq 0x295a0
leaq 0x60c27(%rip), %rsi     # 0xde519
leaq 0xc8(%rsp), %rdi
callq 0x289f0
movl 0x1620(%r15), %esi
incl %esi
movq %rax, %rdi
callq 0x29290
leaq 0x583f9(%rip), %rsi     # 0xd5d10
movq %rax, %rdi
callq 0x289f0
cmpq $0x0, 0x1668(%r15)
je 0x7d95b
leaq 0x60bf8(%rip), %rsi     # 0xde528
leaq 0xc8(%rsp), %rdi
callq 0x289f0
leaq 0x1660(%r15), %rsi
movq %rax, %rdi
callq 0x28910
leaq 0x583bd(%rip), %rsi     # 0xd5d10
movq %rax, %rdi
callq 0x289f0
leaq 0xc8(%rsp), %rdi
callq 0x284a0
movq %rax, %rdi
callq 0x284a0
movq 0xe8621(%rip), %rdi     # 0x165f98
leaq 0x60bb5(%rip), %rsi     # 0xde533
callq 0x289f0
leaq 0x60bf1(%rip), %rsi     # 0xde57b
leaq 0xc8(%rsp), %rdi
callq 0x289f0
movq %rax, %rdi
movq %r14, %rsi
callq 0x28910
leaq 0x60bde(%rip), %rsi     # 0xde587
movq %rax, %rdi
callq 0x289f0
movq 0x1938(%r15), %rsi
movq %rax, %rdi
callq 0x28910
leaq 0x60bc7(%rip), %rsi     # 0xde58e
movq %rax, %rdi
callq 0x289f0
leaq 0xc8(%rsp), %rdi
callq 0x28e60
movq %rbx, %rdi
movq %r14, %rsi
callq 0x28d00
leaq 0xc8(%rsp), %rdi
callq 0x28f10
leaq 0xa8(%rsp), %rdi
callq 0x295a0
movq %rbx, %rax
addq $0x2c8, %rsp            # imm = 0x2C8
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
jmp 0x7da3a
movq %rax, %rbx
jmp 0x7da47
movq %rax, %rbx
jmp 0x7da51
movq %rax, %rbx
jmp 0x7da5b
jmp 0x7da78
jmp 0x7da78
jmp 0x7da78
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x295a0
leaq 0x88(%rsp), %rdi
callq 0x295a0
leaq 0x68(%rsp), %rdi
callq 0x295a0
leaq 0x48(%rsp), %rdi
callq 0x295a0
leaq 0x28(%rsp), %rdi
jmp 0x7da6c
jmp 0x7da64
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x295a0
jmp 0x7da7b
movq %rax, %rbx
jmp 0x7da88
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0x28f10
leaq 0xa8(%rsp), %rdi
callq 0x295a0
movq %rbx, %rdi
callq 0x292f0
nop