// File: /workspace/github_cpp_makefile_star2_O3/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, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rax
cmpq %rbx, %rax
ja 0x547c7
leaq 0x48(%rsp), %r12
movq %r12, %rdi
movl %edx, %esi
callq 0xbfa49
leaq 0xa421d(%rip), %rcx     # 0xf88e1
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 0x546fe
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x54706
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 0xa41a4(%rip), %rsi     # 0xf88cd
callq 0x233b0
leaq 0x38(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x54755
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0x5475d
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
leaq 0x28(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
callq 0xbfa27
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x54795
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x547ac
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x229c0
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x547c7
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x229c0
movq 0xa8(%r15), %r13
movq 0x15c0(%r13), %rax
movq 0x15c8(%r13), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %rbx, %rdx
jbe 0x5488a
movq (%rax,%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 0x5489b
movq 0x28(%r12), %rdx
cmpq 0x8(%r14), %rdx
jne 0x54861
testq %rdx, %rdx
je 0x5482e
movq (%r14), %rsi
movq 0x20(%r12), %rdi
callq 0x229f0
testl %eax, %eax
jne 0x54861
movq (%r15), %rdi
movq 0x8(%r15), %rdx
subq %rdi, %rdx
sarq $0x4, %rdx
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rdx
cmpq %rbx, %rdx
jbe 0x5488a
addq %rbp, %rdi
movq %r14, %rsi
callq 0x68a56
movq 0xa8(%r15), %r13
movq %r12, %rdi
callq 0x22ad0
movq %rax, %r12
movq 0x15c0(%r13), %rax
movq 0x15c8(%r13), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %rbx, %rdx
ja 0x547fc
leaq 0x9ede8(%rip), %rdi     # 0xf3679
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 %r13, %rdi
je 0x548c9
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x229c0
jmp 0x548c9
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x548e5
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x229c0
jmp 0x548e5
movq %rax, %rbx
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x54900
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x229c0
movq %rbx, %rdi
callq 0x23240