// File: richardposner[P]BioNetFit2/src/code/Swarm.cpp
// Function: Swarm::runSSA()
void Swarm::runSSA() {
	if (options.verbosity >= 3) {
		cout << "Running an asynchronous PSADE fit" << endl;
	}

	// Initialize and/or fill our parameter vectors
	vector<unsigned int> isLocal = vector<unsigned int>(options.swarmSize, 0);
	vector<float> particleTemps = vector<float>(options.swarmSize + 1, 0);
	vector<float> particleRadii = vector<float>(options.swarmSize + 1, 0);
	vector<float> particleFs = generateParticleFs();
	vector<float> particleCRs = generateParticleCRs();
	vector<float> cpuToParticle = vector<float>(options.swarmSize + 1, 0);
	vector<vector<float> > trialParams = vector<vector<float> >(options.swarmSize + 1, vector<float>(2, 0));

	// Launch the initialization population and map
	// CPUs to particles
	for (int p = 1; p <= options.swarmSize; ++p) {
		launchParticle(p);
		cpuToParticle[p] = p;
	}

	unordered_map<unsigned int, vector<double> > finishedParticles;
	int numFinishedParticles = 0;

	// Wait for initialization population to finish simulations
	while (numFinishedParticles < options.swarmSize) {


	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1b0, %rsp            # imm = 0x1B0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x150(%rbp)
cmpl $0x3, 0x1614(%rax)
jb 0xf2905
movq 0x1e2666(%rip), %rdi    # 0x2d4f50
leaq 0xf0ea1(%rip), %rsi     # 0x1e3792
callq 0x2ff50
movq %rax, %rdi
movq 0x1e26c8(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
movq -0x150(%rbp), %rax
movslq 0x1620(%rax), %rax
movq %rax, -0x160(%rbp)
movl $0x0, -0x24(%rbp)
leaq -0x25(%rbp), %rdi
movq %rdi, -0x158(%rbp)
callq 0xb4e90
movq -0x160(%rbp), %rsi
movq -0x158(%rbp), %rcx
leaq -0x20(%rbp), %rdi
leaq -0x24(%rbp), %rdx
callq 0x122290
jmp 0xf294e
leaq -0x25(%rbp), %rdi
callq 0xb8c40
movq -0x150(%rbp), %rax
movl 0x1620(%rax), %eax
incl %eax
cltq
movq %rax, -0x170(%rbp)
movl $0x0, -0x54(%rbp)
leaq -0x55(%rbp), %rdi
movq %rdi, -0x168(%rbp)
callq 0x124730
movq -0x170(%rbp), %rsi
movq -0x168(%rbp), %rcx
leaq -0x50(%rbp), %rdi
leaq -0x54(%rbp), %rdx
callq 0x124750
jmp 0xf29a3
leaq -0x55(%rbp), %rdi
callq 0x1247d0
movq -0x150(%rbp), %rax
movl 0x1620(%rax), %eax
incl %eax
cltq
movq %rax, -0x180(%rbp)
movl $0x0, -0x74(%rbp)
leaq -0x75(%rbp), %rdi
movq %rdi, -0x178(%rbp)
callq 0x124730
movq -0x180(%rbp), %rsi
movq -0x178(%rbp), %rcx
leaq -0x70(%rbp), %rdi
leaq -0x74(%rbp), %rdx
callq 0x124750
jmp 0xf29f8
leaq -0x75(%rbp), %rdi
callq 0x1247d0
movq -0x150(%rbp), %rsi
leaq -0x90(%rbp), %rdi
callq 0x1161c0
jmp 0xf2a16
movq -0x150(%rbp), %rsi
leaq -0xa8(%rbp), %rdi
callq 0x1162f0
jmp 0xf2a2b
movq -0x150(%rbp), %rax
movl 0x1620(%rax), %eax
incl %eax
cltq
movq %rax, -0x190(%rbp)
movl $0x0, -0xc4(%rbp)
leaq -0xc5(%rbp), %rdi
movq %rdi, -0x188(%rbp)
callq 0x124730
movq -0x190(%rbp), %rsi
movq -0x188(%rbp), %rcx
leaq -0xc0(%rbp), %rdi
leaq -0xc4(%rbp), %rdx
callq 0x124750
jmp 0xf2a83
leaq -0xc5(%rbp), %rdi
callq 0x1247d0
movq -0x150(%rbp), %rax
movl 0x1620(%rax), %eax
incl %eax
cltq
movq %rax, -0x1a0(%rbp)
movl $0x0, -0xfc(%rbp)
leaq -0xfd(%rbp), %rdi
movq %rdi, -0x198(%rbp)
callq 0x124730
movq -0x198(%rbp), %rcx
leaq -0xf8(%rbp), %rdi
movl $0x2, %esi
leaq -0xfc(%rbp), %rdx
callq 0x124750
jmp 0xf2ae5
leaq -0xfe(%rbp), %rdi
movq %rdi, -0x1a8(%rbp)
callq 0x1247f0
movq -0x1a0(%rbp), %rsi
movq -0x1a8(%rbp), %rcx
leaq -0xe0(%rbp), %rdi
leaq -0xf8(%rbp), %rdx
callq 0x124810
jmp 0xf2b1b
leaq -0xfe(%rbp), %rdi
callq 0x124890
leaq -0xf8(%rbp), %rdi
callq 0x1248b0
leaq -0xfd(%rbp), %rdi
callq 0x1247d0
movl $0x1, -0x104(%rbp)
movq -0x150(%rbp), %rcx
movl -0x104(%rbp), %eax
cmpl 0x1620(%rcx), %eax
jg 0xf2ca5
movq -0x150(%rbp), %rdi
movl -0x104(%rbp), %esi
xorl %edx, %edx
callq 0xfff80
jmp 0xf2b78
cvtsi2ssl -0x104(%rbp), %xmm0
movss %xmm0, -0x1ac(%rbp)
movslq -0x104(%rbp), %rsi
leaq -0xc0(%rbp), %rdi
callq 0x124910
movss -0x1ac(%rbp), %xmm0
movss %xmm0, (%rax)
movl -0x104(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x104(%rbp)
jmp 0xf2b49
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x25(%rbp), %rdi
callq 0xb8c40
jmp 0xf2d71
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x55(%rbp), %rdi
callq 0x1247d0
jmp 0xf2d68
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x75(%rbp), %rdi
callq 0x1247d0
jmp 0xf2d5f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0xf2d56
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0xf2d4a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0xc5(%rbp), %rdi
callq 0x1247d0
jmp 0xf2d3e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0xf2c77
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0xfe(%rbp), %rdi
callq 0x124890
leaq -0xf8(%rbp), %rdi
callq 0x1248b0
leaq -0xfd(%rbp), %rdi
callq 0x1247d0
jmp 0xf2d32
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x124af0
jmp 0xf2d32
leaq -0x140(%rbp), %rdi
callq 0x123840
movl $0x0, -0x144(%rbp)
movq -0x150(%rbp), %rcx
movl -0x144(%rbp), %eax
cmpl 0x1620(%rcx), %eax
jge 0xf2cd2
jmp 0xf2cbb
leaq -0x140(%rbp), %rdi
callq 0x123920
leaq -0xe0(%rbp), %rdi
callq 0x124af0
leaq -0xc0(%rbp), %rdi
callq 0x1248b0
leaq -0xa8(%rbp), %rdi
callq 0x1248b0
leaq -0x90(%rbp), %rdi
callq 0x1248b0
leaq -0x70(%rbp), %rdi
callq 0x1248b0
leaq -0x50(%rbp), %rdi
callq 0x1248b0
leaq -0x20(%rbp), %rdi
callq 0xb2400
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbp
retq
leaq -0xc0(%rbp), %rdi
callq 0x1248b0
leaq -0xa8(%rbp), %rdi
callq 0x1248b0
leaq -0x90(%rbp), %rdi
callq 0x1248b0
leaq -0x70(%rbp), %rdi
callq 0x1248b0
leaq -0x50(%rbp), %rdi
callq 0x1248b0
leaq -0x20(%rbp), %rdi
callq 0xb2400
movq -0x30(%rbp), %rdi
callq 0x30170
nopw (%rax,%rax)