// File: richardposner[P]BioNetFit2/src/code/Particle.cpp
// Function: subParticle::setModel(unsigned int)
void subParticle::setModel(unsigned int mid){
	if (!parParticle) {
		cout<<"Particle::setModel Error: Parent Particle is not set yet. I'm quitting ....\n";
		exit(0);
	}

	if (!parParticle->swarm_) {
		cout<<"Particle::setModel Error: Swarm object is not set yet. I'm quitting ....\n";
		exit(0);
	}

	if (mid_!=mid) {
		parParticle->swarm_->outputError("Particle::setModel Error: Trying to set invalid model id. I'm quitting ....");
		exit(0);
	}

	if ((mid<0) || (mid >= parParticle->swarm_->options.models.size())) {
		parParticle->swarm_->outputError("Particle::setModel Error: Particle model out of range. I'm quitting ....");
		exit(0);
	}

	model = parParticle->swarm_->options.models.at(mid);
	//parParticle->swarm_->setParticleModelId(id_, mid);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x78(%rbp)
cmpq $0x0, (%rax)
jne 0xb190a
movq 0x223659(%rip), %rdi    # 0x2d4f50
leaq 0x12a815(%rip), %rsi    # 0x1dc113
callq 0x2ff50
xorl %edi, %edi
callq 0x30200
movq -0x78(%rbp), %rax
movq (%rax), %rax
cmpq $0x0, 0xa8(%rax)
jne 0xb1935
movq 0x22362e(%rip), %rdi    # 0x2d4f50
leaq 0x12a837(%rip), %rsi    # 0x1dc160
callq 0x2ff50
xorl %edi, %edi
callq 0x30200
movq -0x78(%rbp), %rax
movl 0x8(%rax), %eax
cmpl -0xc(%rbp), %eax
je 0xb19d9
movq -0x78(%rbp), %rax
movq (%rax), %rax
movq 0xa8(%rax), %rax
movq %rax, -0x88(%rbp)
leaq -0x31(%rbp), %rdi
movq %rdi, -0x80(%rbp)
callq 0x30a70
movq -0x80(%rbp), %rdx
leaq 0x12a838(%rip), %rsi    # 0x1dc1aa
leaq -0x30(%rbp), %rdi
callq 0x44470
jmp 0xb197d
movq -0x88(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0xeada0
jmp 0xb198f
leaq -0x30(%rbp), %rdi
callq 0x311e8
leaq -0x31(%rbp), %rdi
callq 0x311c0
xorl %edi, %edi
callq 0x30200
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0xb19cb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x311e8
leaq -0x31(%rbp), %rdi
callq 0x311c0
jmp 0xb1af1
cmpl $0x0, -0xc(%rbp)
jb 0xb1a1d
movq -0x78(%rbp), %rax
movl -0xc(%rbp), %ecx
movq %rcx, -0x90(%rbp)
movq (%rax), %rax
movq 0xa8(%rax), %rdi
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0x100, %rdi            # imm = 0x100
callq 0x45170
movq %rax, %rcx
movq -0x90(%rbp), %rax
cmpq %rcx, %rax
jb 0xb1ab4
movq -0x78(%rbp), %rax
movq (%rax), %rax
movq 0xa8(%rax), %rax
movq %rax, -0xa0(%rbp)
leaq -0x69(%rbp), %rdi
movq %rdi, -0x98(%rbp)
callq 0x30a70
movq -0x98(%rbp), %rdx
leaq 0x12a7a6(%rip), %rsi    # 0x1dc1f6
leaq -0x68(%rbp), %rdi
callq 0x44470
jmp 0xb1a5b
movq -0xa0(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0xeada0
jmp 0xb1a6d
leaq -0x68(%rbp), %rdi
callq 0x311e8
leaq -0x69(%rbp), %rdi
callq 0x311c0
xorl %edi, %edi
callq 0x30200
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0xb1aa9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x311e8
leaq -0x69(%rbp), %rdi
callq 0x311c0
jmp 0xb1af1
movq -0x78(%rbp), %rax
movq (%rax), %rax
movq 0xa8(%rax), %rdi
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0x100, %rdi            # imm = 0x100
movl -0xc(%rbp), %eax
movl %eax, %esi
callq 0x45190
movq %rax, %rcx
movq -0x78(%rbp), %rax
movq (%rcx), %rcx
movq %rcx, 0x10(%rax)
addq $0xa0, %rsp
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x30170
nopw (%rax,%rax)