// File: richardposner[P]BioNetFit2/src/code/Swarm.cpp
// Function: Swarm::doSwarm()
void Swarm::doSwarm() {
	if(options.verbosity >=3) cout<<"doSwarm invoked: bootsrtarps:"<< options.bootstrap<<" \n";
	for (bootstrapCounter = 0; bootstrapCounter <= options.bootstrap; ++bootstrapCounter) {
		initFit();
		// Main fit loops

		if (options.synchronicity) {
			if (options.fitType == "ga") {
				runSGA();
				if(options.verbosity>=3){
					cout << "Finished GA" << endl;
				}
			}
			else if (options.fitType == "pso") {
				//cout << "RAQUEL BEFORE PSO" << endl;
				runSPSO();
				//cout << "RAQUEL After PSO" << endl;

			}
			else if (options.fitType == "de") {
				runSDE();
			}
			else if (options.fitType == "sa") {
				runSSA();
			}
		}

		// Asynchronous fit loops
		else {
			// Genetic fit
			if (options.fitType == "ga") {
				runAGA();
			}
			// PSO fit
			else if (options.fitType == "pso") {
				runAPSO();
			}
			else if (options.fitType == "de") {
				runADE();
			}
			else if (options.fitType == "sa") {
				runASA();
			}
		}
		if(options.verbosity>=4){

			cout << "RAQUEL: starting finishFit function" << endl;

		}
		finishFit();
		if(options.verbosity>=4){

			cout << "RAQUEL: done finishFit function" << endl;
		}

	}

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
cmpl $0x3, 0x1614(%rax)
jb 0xeff81
movq 0x1e4ffc(%rip), %rdi    # 0x2d4f50
leaq 0xf1794(%rip), %rsi     # 0x1e16ef
callq 0x2ff50
movq %rax, %rdi
movq -0x10(%rbp), %rax
movl 0x1638(%rax), %esi
callq 0x30640
movq %rax, %rdi
leaq 0x11558b(%rip), %rsi    # 0x205507
callq 0x2ff50
movq -0x10(%rbp), %rax
movl $0x0, 0x13ec(%rax)
movq -0x10(%rbp), %rcx
movl 0x13ec(%rcx), %eax
cmpl 0x1638(%rcx), %eax
ja 0xf01e4
movq -0x10(%rbp), %rdi
callq 0xec890
movq -0x10(%rbp), %rax
testb $0x1, 0x1618(%rax)
je 0xf00aa
movq -0x10(%rbp), %rdi
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0x20, %rdi
leaq 0xe4409(%rip), %rsi     # 0x1d43de
callq 0x44930
testb $0x1, %al
jne 0xeffe0
jmp 0xf001d
movq -0x10(%rbp), %rdi
callq 0xf01f0
movq -0x10(%rbp), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xf0018
movq 0x1e4f53(%rip), %rdi    # 0x2d4f50
leaq 0xf1709(%rip), %rsi     # 0x1e170d
callq 0x2ff50
movq %rax, %rdi
movq 0x1e4fb5(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xf00a5
movq -0x10(%rbp), %rdi
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0x20, %rdi
leaq 0xf1a0f(%rip), %rsi     # 0x1e1a42
callq 0x44930
testb $0x1, %al
jne 0xf003e
jmp 0xf0049
movq -0x10(%rbp), %rdi
callq 0xf0830
jmp 0xf00a3
movq -0x10(%rbp), %rdi
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0x20, %rdi
leaq 0x12149c(%rip), %rsi    # 0x2114fb
callq 0x44930
testb $0x1, %al
jne 0xf006a
jmp 0xf0075
movq -0x10(%rbp), %rdi
callq 0xf0f20
jmp 0xf00a1
movq -0x10(%rbp), %rdi
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0x20, %rdi
leaq 0xe4356(%rip), %rsi     # 0x1d43e1
callq 0x44930
testb $0x1, %al
jne 0xf0096
jmp 0xf009f
movq -0x10(%rbp), %rdi
callq 0xf28c0
jmp 0xf00a1
jmp 0xf00a3
jmp 0xf00a5
jmp 0xf0163
movq -0x10(%rbp), %rdi
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0x20, %rdi
leaq 0xe431e(%rip), %rsi     # 0x1d43de
callq 0x44930
testb $0x1, %al
jne 0xf00cb
jmp 0xf00d9
movq -0x10(%rbp), %rdi
callq 0xf2d80
jmp 0xf0161
movq -0x10(%rbp), %rdi
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0x20, %rdi
leaq 0xf1953(%rip), %rsi     # 0x1e1a42
callq 0x44930
testb $0x1, %al
jne 0xf00fa
jmp 0xf0105
movq -0x10(%rbp), %rdi
callq 0xf3910
jmp 0xf015f
movq -0x10(%rbp), %rdi
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0x20, %rdi
leaq 0x1213e0(%rip), %rsi    # 0x2114fb
callq 0x44930
testb $0x1, %al
jne 0xf0126
jmp 0xf0131
movq -0x10(%rbp), %rdi
callq 0xf43b0
jmp 0xf015d
movq -0x10(%rbp), %rdi
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0x20, %rdi
leaq 0xe429a(%rip), %rsi     # 0x1d43e1
callq 0x44930
testb $0x1, %al
jne 0xf0152
jmp 0xf015b
movq -0x10(%rbp), %rdi
callq 0xf5d80
jmp 0xf015d
jmp 0xf015f
jmp 0xf0161
jmp 0xf0163
movq -0x10(%rbp), %rax
cmpl $0x4, 0x1614(%rax)
jb 0xf0192
movq 0x1e4dd9(%rip), %rdi    # 0x2d4f50
leaq 0xf159b(%rip), %rsi     # 0x1e1719
callq 0x2ff50
movq %rax, %rdi
movq 0x1e4e3b(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
movq -0x10(%rbp), %rdi
callq 0xf8ca0
movq -0x10(%rbp), %rax
cmpl $0x4, 0x1614(%rax)
jb 0xf01ca
movq 0x1e4da1(%rip), %rdi    # 0x2d4f50
leaq 0xf1587(%rip), %rsi     # 0x1e173d
callq 0x2ff50
movq %rax, %rdi
movq 0x1e4e03(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xf01cc
movq -0x10(%rbp), %rax
movl 0x13ec(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x13ec(%rax)
jmp 0xeff8f
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)