// File: /workspace/github_cpp_makefile_star2_O3/richardposner[P]BioNetFit2/src/code/Swarm.cpp
// Function: Swarm::update_cur_particle_params(unsigned int, unsigned int, bool)
void Swarm::update_cur_particle_params(unsigned int pID, unsigned int mid, bool overwrite){ //razi: this need to be tested


	std::vector<unsigned int> mids;
	unsigned int i, mapfrom, mapto, nF;

	if(options.verbosity >=4){cout<<"update_cur_particle_params started."<<endl;} //mypause();

	if ((mid < (unsigned) -1) && (mid >= options.models.size()))
		outputError("updating current particle parameters, wrong model number" + toString(mid)+". Quitting....");

	if (mid == (unsigned) -1){
		for (i=0; i< options.models.size(); i++)
			mids.push_back(i);  //razi: do for all models if mid=-1
	}else
		mids.push_back(mid);

	for (i = 0; i <mids.size(); i++){
		mid=mids[i]; nF=options.models[mid]->getNumFreeParams();
		vector <double> InVec = subparticleCurrParamSets_[pID][mid];
		if (!InVec.empty()){
			vector <double> OutVec(nF);
			if ((!overwrite) && (particleCurrParamSets_[pID].size()>= nF)){
				for (i=0; i<nF; i++)
					OutVec[i] = particleCurrParamSets_[pID][i];
			}
			for (auto fp = freeParamMapping[mid].begin(); fp != freeParamMapping[mid].end(); fp++){
				mapfrom = fp->first;
				mapto = fp->second;
				if(options.verbosity >=4) cout<<"copying value for free parames from model:"<<mid<< " to the full list index1:"<< mapfrom <<"  index2:"<<mapto<<endl;
				if (overwrite || (OutVec[mapto]==0))
					OutVec[mapto] = InVec[mapfrom];
				particleCurrParamSets_[pID] = OutVec;
			}

		}
	}
	if(options.verbosity >=4){cout<<"update_cur_particle_params finished."<<endl;} //mypause();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movl %ecx, 0x2c(%rsp)
movq %rdi, %rbx
movl %esi, 0x8(%rsp)
movl %edx, 0x4(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
cmpl $0x4, 0x1614(%rdi)
jb 0x8b136
movq 0xeaeb5(%rip), %r14     # 0x175fa8
leaq 0x76d25(%rip), %rsi     # 0x101e1f
movl $0x23, %edx
movq %r14, %rdi
callq 0x22ab0
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq 0xeae83(%rip), %rdi     # 0x175fa8
callq 0x22050
movq %rax, %rdi
callq 0x22660
movl 0x4(%rsp), %edx
cmpl $-0x1, %edx
je 0x8b171
movl %edx, %eax
movq 0x15c8(%rbx), %rcx
subq 0x15c0(%rbx), %rcx
sarq $0x3, %rcx
cmpq %rax, %rcx
jbe 0x8b4e9
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x8b1e0
movl %edx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x8b1ef
movl $0x0, (%rsp)
movq 0x15c0(%rbx), %rax
movq 0x15c8(%rbx), %rcx
cmpq %rax, %rcx
je 0x8b1ef
xorl %edx, %edx
leaq 0x10(%rsp), %r14
movq %rsp, %r15
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x8b1ae
movl %edx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x8b1c7
movq %r14, %rdi
movq %r15, %rdx
callq 0x6b0da
movq 0x15c0(%rbx), %rax
movq 0x15c8(%rbx), %rcx
movl (%rsp), %edx
incl %edx
movl %edx, (%rsp)
movq %rcx, %rsi
subq %rax, %rsi
sarq $0x3, %rsi
cmpq %rdx, %rsi
ja 0x8b195
jmp 0x8b1ef
leaq 0x10(%rsp), %rdi
leaq 0x4(%rsp), %rdx
callq 0x6b0da
movl $0x0, (%rsp)
movq 0x10(%rsp), %rdi
cmpq %rdi, 0x18(%rsp)
je 0x8b471
leaq 0x1460(%rbx), %rax
movq %rax, 0x70(%rsp)
leaq 0x1400(%rbx), %r15
xorl %eax, %eax
movl (%rdi,%rax,4), %eax
movl %eax, 0x4(%rsp)
movq 0x15c0(%rbx), %rcx
movq (%rcx,%rax,8), %rax
movq 0x58(%rax), %r12
movq 0x70(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0xa7e66
movq %rax, %rdi
leaq 0x4(%rsp), %rsi
callq 0xa7e00
leaq 0x30(%rsp), %rdi
movq %rax, %rsi
callq 0x65d5c
movq 0x30(%rsp), %rdi
cmpq 0x38(%rsp), %rdi
je 0x8b43d
movl %r12d, %r14d
leaq 0x50(%rsp), %rdi
movq %r14, %rsi
leaq 0xf(%rsp), %rdx
callq 0xa75c2
cmpb $0x0, 0x2c(%rsp)
jne 0x8b2dc
movq %r15, %rdi
leaq 0x8(%rsp), %rsi
callq 0xa7e00
movq 0x8(%rax), %rcx
subq (%rax), %rcx
sarq $0x3, %rcx
cmpq %r14, %rcx
jb 0x8b2dc
movl $0x0, (%rsp)
testl %r12d, %r12d
je 0x8b2dc
movq %r15, %rdi
leaq 0x8(%rsp), %rsi
callq 0xa7e00
movl (%rsp), %ecx
movq (%rax), %rax
movsd (%rax,%rcx,8), %xmm0
movq 0x50(%rsp), %rax
movsd %xmm0, (%rax,%rcx,8)
leal 0x1(%rcx), %eax
movl %eax, (%rsp)
cmpl %r12d, %eax
jb 0x8b2af
movl 0x4(%rsp), %eax
movq 0x1980(%rbx), %rcx
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
addq %rcx, %rax
addq $0x8, %rax
movq 0x10(%rax), %r14
cmpq %rax, %r14
je 0x8b421
movl 0x20(%r14), %r13d
movl 0x24(%r14), %r12d
cmpl $0x4, 0x1614(%rbx)
jb 0x8b3ae
movl $0x2a, %edx
movq 0xeac84(%rip), %rdi     # 0x175fa8
leaq 0x76b60(%rip), %rsi     # 0x101e8b
callq 0x22ab0
movl 0x4(%rsp), %esi
movq 0xeac6d(%rip), %rdi     # 0x175fa8
callq 0x22650
movq %rax, %rbp
movl $0x19, %edx
movq %rax, %rdi
leaq 0x76b64(%rip), %rsi     # 0x101eb6
callq 0x22ab0
movq %rbp, %rdi
movq %r13, %rsi
callq 0x22650
movq %rax, %rbp
movl $0x9, %edx
movq %rax, %rdi
leaq 0x76b5c(%rip), %rsi     # 0x101ed0
callq 0x22ab0
movq %rbp, %rdi
movq %r12, %rsi
callq 0x22650
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %rbp, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
movq 0x50(%rsp), %rax
cmpb $0x0, 0x2c(%rsp)
jne 0x8b3cc
movsd (%rax,%r12,8), %xmm0
ucomisd 0x6b720(%rip), %xmm0    # 0xf6ae8
jne 0x8b3dd
jp 0x8b3dd
movq 0x30(%rsp), %rcx
movsd (%rcx,%r13,8), %xmm0
movsd %xmm0, (%rax,%r12,8)
movq %r15, %rdi
leaq 0x8(%rsp), %rsi
callq 0xa7e00
movq %rax, %rdi
leaq 0x50(%rsp), %rsi
callq 0xa7650
movq %r14, %rdi
callq 0x22670
movq %rax, %r14
movl 0x4(%rsp), %eax
movq 0x1980(%rbx), %rcx
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
addq %rcx, %rax
addq $0x8, %rax
jmp 0x8b2fa
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x8b438
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x229c0
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x8b44f
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x229c0
movl (%rsp), %eax
incl %eax
movl %eax, (%rsp)
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rcx
subq %rdi, %rcx
sarq $0x2, %rcx
cmpq %rax, %rcx
ja 0x8b21b
cmpl $0x4, 0x1614(%rbx)
jb 0x8b4c5
movq 0xeab27(%rip), %rbx     # 0x175fa8
leaq 0x76a52(%rip), %rsi     # 0x101eda
movl $0x24, %edx
movq %rbx, %rdi
callq 0x22ab0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq 0xeaaf5(%rip), %rdi     # 0x175fa8
callq 0x22050
movq %rax, %rdi
callq 0x22660
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x8b4d7
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x229c0
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x50(%rsp), %rdi
movl %edx, %esi
callq 0xbfa49
leaq 0x76947(%rip), %rcx     # 0x101e43
leaq 0x50(%rsp), %rdi
movl $0x38, %r8d
xorl %esi, %esi
xorl %edx, %edx
callq 0x22a80
leaq 0x40(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x8b533
movupd (%rcx), %xmm0
movupd %xmm0, (%r14)
jmp 0x8b540
movq %rdx, 0x30(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x40(%rsp)
movq 0x8(%rax), %rdx
leaq 0x30(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x76919(%rip), %rsi     # 0x101e7c
callq 0x233b0
leaq 0x88(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x8b58e
movupd (%rcx), %xmm0
movupd %xmm0, (%r15)
jmp 0x8b59e
movq %rdx, 0x78(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x88(%rsp)
movq 0x8(%rax), %rdx
leaq 0x78(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %rbx, %rdi
callq 0x784c2
movq %rax, %rbx
movq 0x78(%rsp), %rdi
cmpq %r15, %rdi
je 0x8b5e4
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x229c0
jmp 0x8b5e4
movq %rax, %rbx
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0x8b600
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x229c0
jmp 0x8b600
movq %rax, %rbx
leaq 0x60(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8b65d
movq 0x60(%rsp), %rsi
incq %rsi
jmp 0x8b658
jmp 0x8b625
jmp 0x8b625
jmp 0x8b625
jmp 0x8b62c
movq %rax, %rbx
jmp 0x8b646
movq %rax, %rbx
jmp 0x8b65d
jmp 0x8b62c
movq %rax, %rbx
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x8b646
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x229c0
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x8b65d
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x229c0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x8b674
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x229c0
movq %rbx, %rdi
callq 0x23240