// File: /workspace/github_cpp_makefile_star2_O1/richardposner[P]BioNetFit2/src/code/Particle.cpp
// Function: Particle::setParam(std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, double>, unsigned int)
void Particle::setParam(pair<std::string, double> myParams, unsigned int mid){

	/* razi: moved to constructor
	unsigned int gap= mid+1-simParams_.size();
	if (gap>0){   //fill dummy
		std::map<std::string, double> dummyParam;		//dummyParam[""]=0;
		for (int i=0; i < gap; i++)
			simParams_.push_back(dummyParam);//simParams_.push_back(std::map<std::string, double> dummyParam);
	}*/

	if (mid>=simParams_.size())  outputError("setParam failed. Invalid model id:"+toString(mid)+". I am quitting....");
		//Raquel: this code check with the master whether the parameter exists in model
	for (auto p = swarm_->options.models.at(mid)->getFreeParams_().begin(); p != swarm_->options.models.at(mid)->getFreeParams_().end(); ++p) {
		if(p->first == myParams.first) {
				//cout << "Raquel myParams first: " << myParams.first << " second: " << myParams.second << endl;
				simParams_.at(mid).insert(myParams);//Raquel: if it does exist, set the param value
		}//Raquel: otherwise, do nothing
	}

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r14
movq %rdi, %r15
movl %edx, %ebx
movq 0x8(%rdi), %rax
subq (%rdi), %rax
sarq $0x4, %rax
movabsq $-0x5555555555555555, %r13 # imm = 0xAAAAAAAAAAAAAAAB
imulq %r13, %rax
cmpq %rbx, %rax
ja 0x54ac6
leaq 0x48(%rsp), %r12
movq %r12, %rdi
movl %edx, %esi
callq 0xc03b8
leaq 0xa3f3d(%rip), %rcx     # 0xf8901
movl $0x22, %r8d
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x22a80
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x549fe
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x54a06
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
leaq 0x8(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0xa3ec4(%rip), %rsi     # 0xf88ed
callq 0x233b0
leaq 0x38(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x54a55
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0x54a5c
movups (%rcx), %xmm0
movups %xmm0, (%rbp)
movq 0x8(%rax), %rdx
leaq 0x28(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
callq 0xc0396
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x54a94
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x54aab
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x229c0
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x54ac6
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0xa8(%r15), %rax
movq 0x15c0(%rax), %rcx
movq 0x15c8(%rax), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq %rbx, %rdx
jbe 0x54ba0
movq 0xa8(%r15), %rdx
movq 0x15c0(%rdx), %rax
movq 0x15c8(%rdx), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %rbx, %rdx
jbe 0x54ba0
movq (%rcx,%rbx,8), %rcx
movq 0x48(%rcx), %r12
leaq (%rbx,%rbx,2), %rbp
shlq $0x4, %rbp
movq (%rax,%rbx,8), %rax
addq $0x38, %rax
cmpq %rax, %r12
je 0x54bb1
movq 0x28(%r12), %rdx
cmpq 0x8(%r14), %rdx
jne 0x54b74
testq %rdx, %rdx
je 0x54b52
movq (%r14), %rsi
movq 0x20(%r12), %rdi
callq 0x229f0
testl %eax, %eax
jne 0x54b74
movq (%r15), %rdi
movq 0x8(%r15), %rdx
subq %rdi, %rdx
sarq $0x4, %rdx
imulq %r13, %rdx
cmpq %rbx, %rdx
jbe 0x54ba0
addq %rbp, %rdi
movq %r14, %rsi
callq 0x68f10
movq %r12, %rdi
callq 0x22ad0
movq %rax, %r12
movq 0xa8(%r15), %rcx
movq 0x15c0(%rcx), %rax
movq 0x15c8(%rcx), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %rbx, %rdx
ja 0x54b20
leaq 0x9eb1e(%rip), %rdi     # 0xf36c5
movq %rbx, %rsi
xorl %eax, %eax
callq 0x22f40
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x54bdf
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x229c0
jmp 0x54bdf
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x54bfb
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x229c0
jmp 0x54bfb
movq %rax, %rbx
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x54c16
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x229c0
movq %rbx, %rdi
callq 0x23240