// File: /workspace/github_cpp_makefile_star2_O3/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2c8, %rsp            # imm = 0x2C8
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x38(%rsp), %r13
movq %r13, -0x10(%r13)
movq 0x1520(%rsi), %rsi
movq 0x1528(%r15), %rdx
addq %rsi, %rdx
leaq 0x28(%rsp), %r12
movq %r12, %rdi
callq 0x3213c
leaq 0x6757f(%rip), %rsi     # 0x1002d3
movq %r12, %rdi
callq 0x233b0
leaq 0xc8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
movl $0x10, %edx
callq 0x233d0
leaq 0x138(%rsp), %rdi
callq 0x221e0
testb %al, %al
je 0x993aa
leaq 0x67554(%rip), %rsi     # 0x1002e3
leaq 0xc8(%rsp), %r12
movl $0xb, %edx
movq %r12, %rdi
callq 0x22ab0
movq 0xc8(%rsp), %rax
addq -0x18(%rax), %r12
movq %r12, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
leaq 0xc8(%rsp), %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %r12, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
leaq 0x674e9(%rip), %rsi     # 0x1002ef
leaq 0xc8(%rsp), %rdi
movl $0x8, %edx
callq 0x22ab0
movq 0x14c0(%r15), %rsi
movq 0x14c8(%r15), %rdx
leaq 0xc8(%rsp), %rdi
callq 0x22ab0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %r12, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
cmpb $0x1, 0x1770(%r15)
jne 0x98ebd
leaq 0x1500(%r15), %rdx
leaq 0x67483(%rip), %rsi     # 0x1002f8
leaq 0xa8(%rsp), %rdi
callq 0x31944
leaq 0x669ce(%rip), %rsi     # 0xff857
leaq 0xa8(%rsp), %rdi
callq 0x233b0
leaq 0x58(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x98ece
movq %rdx, 0x48(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x58(%rsp)
jmp 0x98ed4
movl $0x11, %edx
leaq 0x67443(%rip), %rsi     # 0x10030c
jmp 0x990e7
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
leaq 0x48(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x14c0(%r15), %rsi
movq 0x14c8(%r15), %rdx
callq 0x222b0
leaq 0x98(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x98f33
movq %rdx, 0x88(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x98(%rsp)
jmp 0x98f3a
movups (%rcx), %xmm0
movups %xmm0, (%rbp)
movq 0x8(%rax), %rdx
leaq 0x88(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x67288(%rip), %rsi     # 0x1001e8
callq 0x233b0
leaq 0x78(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x98f8c
movq %rdx, 0x68(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x78(%rsp)
jmp 0x98f92
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
leaq 0x68(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x14c0(%r15), %rsi
movq 0x14c8(%r15), %rdx
callq 0x222b0
leaq 0x18(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x98fe8
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x98ff0
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
leaq 0xc8(%rsp), %rdi
callq 0x22ab0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %r12, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x99060
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
leaq 0x38(%rsp), %r13
je 0x99081
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0x88(%rsp), %rdi
cmpq %rbp, %rdi
je 0x9909e
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x990ba
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x229c0
leaq 0xb8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x990db
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x229c0
movl $0xa, %edx
leaq 0x6721a(%rip), %rsi     # 0x100301
leaq 0xc8(%rsp), %r12
movq %r12, %rdi
callq 0x22ab0
movq 0xc8(%rsp), %rax
addq -0x18(%rax), %r12
movq %r12, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
leaq 0xc8(%rsp), %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
cmpq $0x0, 0x1780(%r15)
je 0x991a6
leaq 0x1778(%r15), %rdx
leaq 0x671de(%rip), %rsi     # 0x10031e
leaq 0x8(%rsp), %rdi
callq 0x31944
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
leaq 0xc8(%rsp), %rdi
callq 0x22ab0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %r12, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x991a6
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x229c0
cmpq $0x0, 0x1758(%r15)
je 0x99224
leaq 0x1750(%r15), %rdx
leaq 0x67169(%rip), %rsi     # 0x100327
leaq 0x8(%rsp), %rdi
callq 0x31944
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
leaq 0xc8(%rsp), %rdi
callq 0x22ab0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %r12, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x99224
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x229c0
leaq 0x67105(%rip), %rsi     # 0x100330
leaq 0xc8(%rsp), %rdi
movl $0xe, %edx
callq 0x22ab0
movl 0x1620(%r15), %esi
incl %esi
leaq 0xc8(%rsp), %r12
movq %r12, %rdi
callq 0x231e0
leaq 0x5eb63(%rip), %rsi     # 0xf7dc0
movl $0x1, %edx
movq %rax, %rdi
callq 0x22ab0
cmpq $0x0, 0x1668(%r15)
je 0x992bc
leaq 0x670c4(%rip), %rsi     # 0x10033f
leaq 0xc8(%rsp), %rdi
movl $0xa, %edx
callq 0x22ab0
movq 0x1660(%r15), %rsi
movq 0x1668(%r15), %rdx
leaq 0xc8(%rsp), %rdi
callq 0x22ab0
leaq 0x5eb11(%rip), %rsi     # 0xf7dc0
movl $0x1, %edx
movq %rax, %rdi
callq 0x22ab0
movq 0xc8(%rsp), %rax
addq -0x18(%rax), %r12
movq %r12, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
leaq 0xc8(%rsp), %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %r12, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
movq 0xdcc8a(%rip), %rdi     # 0x175fa8
leaq 0x67025(%rip), %rsi     # 0x10034a
movl $0x47, %edx
callq 0x22ab0
leaq 0x6705c(%rip), %rsi     # 0x100392
leaq 0xc8(%rsp), %rdi
movl $0xb, %edx
callq 0x22ab0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
leaq 0xc8(%rsp), %rdi
callq 0x22ab0
movq %rax, %r12
leaq 0x67038(%rip), %rsi     # 0x10039e
movl $0x6, %edx
movq %rax, %rdi
callq 0x22ab0
movq 0x1938(%r15), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %r12, %rdi
callq 0x22ab0
leaq 0x67015(%rip), %rsi     # 0x1003a5
movl $0x7, %edx
movq %rax, %rdi
callq 0x22ab0
leaq 0xc8(%rsp), %rdi
callq 0x22de0
leaq 0x10(%rbx), %rcx
movq %rcx, (%rbx)
movq (%r14), %rdx
leaq 0x10(%r14), %rax
cmpq %rax, %rdx
je 0x993c9
movq %rdx, (%rbx)
movq (%rax), %rcx
movq %rcx, 0x10(%rbx)
jmp 0x993cf
movups (%rax), %xmm0
movups %xmm0, (%rcx)
movq 0x8(%r14), %rcx
movq %rcx, 0x8(%rbx)
movq %rax, (%r14)
movq $0x0, 0x8(%r14)
movb $0x0, 0x10(%r14)
movq 0xdcb9a(%rip), %rax     # 0x175f88
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0xd0(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0xc8(%rsp,%rcx)
callq 0x227d0
leaq 0x1c0(%rsp), %rdi
callq 0x222d0
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x99436
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x229c0
movq %rbx, %rax
addq $0x2c8, %rsp            # imm = 0x2C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x99488
movq %rax, %rbx
jmp 0x994a4
movq %rax, %rbx
jmp 0x994c1
movq %rax, %rbx
jmp 0x994dd
jmp 0x9952e
jmp 0x9952e
jmp 0x9952e
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x99488
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x994a4
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0x88(%rsp), %rdi
cmpq %rbp, %rdi
je 0x994c1
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x994dd
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x229c0
leaq 0xb8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x99531
movq 0xb8(%rsp), %rsi
jmp 0x99524
movq %rax, %rbx
jmp 0x9953e
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
jne 0x9954d
jmp 0x9955a
jmp 0x9950e
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x99531
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x229c0
jmp 0x99531
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0x22ea0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x9955a
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x229c0
movq %rbx, %rdi
callq 0x23240