// File: /workspace/github_cpp_makefile_star2_O3/richardposner[P]BioNetFit2/src/code/Swarm.cpp
// Function: Swarm::generateBestFitModel(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Swarm::generateBestFitModel(string outputDir) {
	map<string, double> paramSet;

	vector<string> paramVals;
	auto best = allGenFits.begin();
	split(best->second, paramVals);

	auto fp = this->getFreeParams_().begin();
	for (unsigned int i = 1; i < paramVals.size(); i++) {
		paramSet.insert(pair<string, double> (fp->first, stod(paramVals[i])));
		++fp;
	}
	if (options.verbosity>=3) cout<<"Swarm: Generating Best Fit Model in path:"<< outputDir<< " File:"<<options.jobName<<".bngl .\n";

	//razi TODO:   adjust paramSet based on the model
	for (unsigned int mid =0; mid < options.models.size(); mid++){
		options.models[mid]->outputModelWithParams(paramSet, outputDir, (options.jobName + ".bngl"), "", false, false, false, false, false);
	}

	if(options.verbosity>=3){
		cout << "Finished saving " << options.jobName << ".bngl" << endl;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %rsi, 0x38(%rsp)
leaq 0xe0(%rsp), %rax
movl $0x0, (%rax)
xorl %ecx, %ecx
movq %rcx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rcx, 0x20(%rax)
movq %rcx, 0x30(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq %rdi, 0x8(%rsp)
movq 0x20(%rdi), %r14
leaq 0x70(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x6ca1e(%rip), %rsi     # 0x101424
leaq 0x6ca18(%rip), %rdx     # 0x101425
leaq 0x60(%rsp), %rdi
callq 0x321d2
addq $0x28, %r14
leaq 0x20(%rsp), %rsi
leaq 0x60(%rsp), %rdx
movq %r14, %rdi
callq 0xbea28
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
je 0x94a44
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0x20(%rsp), %r12
movq 0x28(%rsp), %rax
subq %r12, %rax
cmpq $0x21, %rax
jb 0x94b54
movq 0x8(%rsp), %rax
movq 0x15a8(%rax), %rbx
callq 0x22070
movq %rax, 0x18(%rsp)
movl $0x1, %eax
movl $0x2, %ebp
leaq 0x60(%rsp), %r14
movq 0x18(%rsp), %r15
shlq $0x5, %rax
movq (%r12,%rax), %r12
movl (%r15), %eax
movl %eax, 0x14(%rsp)
movl $0x0, (%r15)
movq %r12, %rdi
leaq 0xd0(%rsp), %rsi
callq 0x22760
cmpq %r12, 0xd0(%rsp)
je 0x94e13
movl (%r15), %eax
testl %eax, %eax
movsd %xmm0, 0xc8(%rsp)
je 0x94ad3
cmpl $0x22, %eax
jne 0x94ada
jmp 0x94e1f
movl 0x14(%rsp), %eax
movl %eax, (%r15)
movq %r13, 0x60(%rsp)
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x3213c
movsd 0xc8(%rsp), %xmm0
movsd %xmm0, 0x80(%rsp)
leaq 0xd8(%rsp), %rdi
movq %r14, %rsi
callq 0x4d068
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
je 0x94b2b
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x229c0
movq %rbx, %rdi
callq 0x22ad0
movq %rax, %rbx
movl %ebp, %eax
movq 0x20(%rsp), %r12
movq 0x28(%rsp), %rcx
subq %r12, %rcx
sarq $0x5, %rcx
incl %ebp
cmpq %rax, %rcx
ja 0x94a85
movq 0x8(%rsp), %rax
cmpl $0x2, 0x1614(%rax)
jbe 0x94bd8
movq 0xe143f(%rip), %rdi     # 0x175fa8
leaq 0x6c934(%rip), %rsi     # 0x1014a4
movl $0x29, %edx
callq 0x22ab0
movq 0x38(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq 0xe141b(%rip), %rdi     # 0x175fa8
callq 0x22ab0
movq %rax, %r14
leaq 0x69a78(%rip), %rsi     # 0xfe614
movl $0x6, %edx
movq %rax, %rdi
callq 0x22ab0
movq 0x8(%rsp), %rax
movq 0x14c0(%rax), %rsi
movq 0x14c8(%rax), %rdx
movq %r14, %rdi
callq 0x22ab0
leaq 0x6c903(%rip), %rsi     # 0x1014ce
movl $0x8, %edx
movq %rax, %rdi
callq 0x22ab0
movq 0x8(%rsp), %rcx
movq 0x15c0(%rcx), %rax
cmpq %rax, 0x15c8(%rcx)
je 0x94d67
movl $0x1, %r12d
leaq 0x108(%rsp), %r13
leaq 0x40(%rsp), %rbp
leaq 0xa8(%rsp), %r15
xorl %ecx, %ecx
movq %r13, %rdi
movq (%rax,%rcx,8), %rbx
leaq 0xd8(%rsp), %rsi
callq 0x51772
leaq 0x98(%rsp), %rax
movq %rax, 0x88(%rsp)
movq 0x38(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x88(%rsp), %rdi
callq 0x3213c
leaq 0x50(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x8(%rsp), %rax
movq 0x14c0(%rax), %rsi
movq 0x14c8(%rax), %rdx
addq %rsi, %rdx
movq %rbp, %r14
movq %rbp, %rdi
callq 0x3213c
movq %r14, %rdi
leaq 0x64680(%rip), %rsi     # 0xf9303
callq 0x233b0
leaq 0xb8(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq %r15, %rdi
leaq 0x61fcf(%rip), %rdx     # 0xf6c71
movq %rdx, %rsi
callq 0x321d2
movq %rbx, %rdi
movq %r13, %rsi
leaq 0x88(%rsp), %rdx
movq %rbp, %rcx
movq %r15, %r8
xorl %r9d, %r9d
xorl %eax, %eax
pushq %rax
pushq %rax
pushq %rax
pushq %rax
callq 0x4ebec
addq $0x20, %rsp
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0x94cf5
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x94d11
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x94d36
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x229c0
movq %r13, %rdi
callq 0x4a472
movl %r12d, %ecx
movq 0x8(%rsp), %rdx
movq 0x15c0(%rdx), %rax
movq 0x15c8(%rdx), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
incl %r12d
cmpq %rcx, %rdx
ja 0x94c0e
movq 0x8(%rsp), %rax
cmpl $0x2, 0x1614(%rax)
jbe 0x94dea
movq 0xe122c(%rip), %rdi     # 0x175fa8
leaq 0x6c754(%rip), %rsi     # 0x1014d7
movl $0x10, %edx
callq 0x22ab0
movq 0x8(%rsp), %rax
movq 0x14c0(%rax), %rsi
movq 0x14c8(%rax), %rdx
movq 0xe1201(%rip), %rdi     # 0x175fa8
callq 0x22ab0
movq %rax, %rbx
leaq 0x6454d(%rip), %rsi     # 0xf9303
movl $0x5, %edx
movq %rax, %rdi
callq 0x22ab0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %rbx, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
leaq 0x20(%rsp), %rdi
callq 0x31a0a
leaq 0xd8(%rsp), %rdi
callq 0x4a472
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5d921(%rip), %rdi     # 0xf273b
callq 0x225a0
leaq 0x5d915(%rip), %rdi     # 0xf273b
callq 0x22e40
jmp 0x94e33
jmp 0x94e56
jmp 0x94e56
jmp 0x94e56
movq %rax, %r15
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
je 0x94ee5
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x229c0
jmp 0x94ee5
movq %rax, %r15
jmp 0x94ee5
movq %rax, %r15
jmp 0x94ed8
movq %rax, %r15
jmp 0x94eb3
jmp 0x94e6a
movq %rax, %r15
jmp 0x94e97
movq %rax, %r15
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0x94e97
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x94eb3
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x94ed8
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x229c0
leaq 0x108(%rsp), %rdi
callq 0x4a472
leaq 0x20(%rsp), %rdi
callq 0x31a0a
leaq 0xd8(%rsp), %rdi
callq 0x4a472
movq %r15, %rdi
callq 0x23240
movq %rax, %r15
movq 0x18(%rsp), %rax
cmpl $0x0, (%rax)
jne 0x94ee5
movq 0x18(%rsp), %rax
movl 0x14(%rsp), %ecx
movl %ecx, (%rax)
jmp 0x94ee5