// File: /workspace/github_cpp_makefile_star2_O1/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), %rbp
movq %rbp, -0x10(%rbp)
movq 0x1520(%rsi), %rsi
movq 0x1528(%r15), %rdx
addq %rsi, %rdx
leaq 0x28(%rsp), %r12
movq %r12, %rdi
callq 0x32180
leaq 0x66aee(%rip), %rsi     # 0x1002ec
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 0x99e67
leaq 0x66ac3(%rip), %rsi     # 0x1002fc
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 0x66a58(%rip), %rsi     # 0x100308
leaq 0xc8(%rsp), %rdi
movl $0x8, %edx
callq 0x22ab0
movq 0x14c0(%r15), %rsi
movq 0x14c8(%r15), %rdx
leaq 0xc8(%rsp), %r12
movq %r12, %rdi
callq 0x22ab0
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %r13, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
cmpb $0x1, 0x1770(%r15)
jne 0x9996a
leaq 0x1500(%r15), %rdx
leaq 0x669ef(%rip), %rsi     # 0x100311
leaq 0xa8(%rsp), %rdi
callq 0x319d8
leaq 0x65eb1(%rip), %rsi     # 0xff7e7
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 0x99988
movq %rdx, 0x48(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x58(%rsp)
jmp 0x9998e
leaq 0x669b4(%rip), %rsi     # 0x100325
leaq 0xc8(%rsp), %rdi
movl $0x11, %edx
callq 0x22ab0
jmp 0x99bb4
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 0x78(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x999e4
movq %rdx, 0x68(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x78(%rsp)
jmp 0x999ea
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)
leaq 0x667f4(%rip), %rsi     # 0x100201
callq 0x233b0
leaq 0x98(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x99a42
movq %rdx, 0x88(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x98(%rsp)
jmp 0x99a48
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
leaq 0x88(%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), %rbp
movq %rbp, -0x10(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x99aa1
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x99aa8
movups (%rcx), %xmm0
movups %xmm0, (%rbp)
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, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %r13, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x99b18
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
leaq 0x38(%rsp), %rbp
je 0x99b42
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x99b5e
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x99b7a
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x229c0
leaq 0xb8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x99b9b
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x229c0
leaq 0x66778(%rip), %rsi     # 0x10031a
leaq 0xc8(%rsp), %rdi
movl $0xa, %edx
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 0x99c63
leaq 0x1778(%r15), %rdx
leaq 0x6673a(%rip), %rsi     # 0x100337
leaq 0x8(%rsp), %rdi
callq 0x319d8
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 0x99c63
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x229c0
cmpq $0x0, 0x1758(%r15)
je 0x99ce1
leaq 0x1750(%r15), %rdx
leaq 0x666c5(%rip), %rsi     # 0x100340
leaq 0x8(%rsp), %rdi
callq 0x319d8
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 0x99ce1
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x229c0
leaq 0x66661(%rip), %rsi     # 0x100349
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 0x5e0f6(%rip), %rsi     # 0xf7e10
movl $0x1, %edx
movq %rax, %rdi
callq 0x22ab0
cmpq $0x0, 0x1668(%r15)
je 0x99d79
leaq 0x66620(%rip), %rsi     # 0x100358
leaq 0xc8(%rsp), %rdi
movl $0xa, %edx
callq 0x22ab0
movq 0x1660(%r15), %rsi
movq 0x1668(%r15), %rdx
leaq 0xc8(%rsp), %rdi
callq 0x22ab0
leaq 0x5e0a4(%rip), %rsi     # 0xf7e10
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 0xdc1b5(%rip), %rdi     # 0x175f90
leaq 0x66581(%rip), %rsi     # 0x100363
movl $0x47, %edx
callq 0x22ab0
leaq 0x665b8(%rip), %rsi     # 0x1003ab
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 0x66594(%rip), %rsi     # 0x1003b7
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 0x66571(%rip), %rsi     # 0x1003be
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 0x99e86
movq %rdx, (%rbx)
movq (%rax), %rcx
movq %rcx, 0x10(%rbx)
jmp 0x99e8c
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 0xdc0c5(%rip), %rax     # 0x175f70
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 %rbp, %rdi
je 0x99ef3
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 0x99f48
movq %rax, %rbx
jmp 0x99f6d
movq %rax, %rbx
jmp 0x99f89
movq %rax, %rbx
jmp 0x99fa5
jmp 0x99ff6
jmp 0x99ff6
jmp 0x99ff6
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x99f48
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x99f6d
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x99f89
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x99fa5
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x229c0
leaq 0xb8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x99ff9
movq 0xb8(%rsp), %rsi
jmp 0x99fec
movq %rax, %rbx
jmp 0x9a006
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
jne 0x9a015
jmp 0x9a022
jmp 0x99fd6
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x99ff9
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x229c0
jmp 0x99ff9
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0x22ea0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x9a022
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x229c0
movq %rbx, %rdi
callq 0x23240