// File: /workspace/github_cpp_makefile_star2_O2/richardposner[P]BioNetFit2/src/code/Swarm.cpp
// Function: Swarm::setModel(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int, bool)
void Swarm::setModel(std::string path, int mid, bool overwrite){
	std::string modelfile = convertToAbsPath(path);
	unsigned int  nmodel=getNumModels();

	if ((unsigned) mid == nmodel){
		this->options.models.push_back(new Model(this, modelfile));  //add to the end
		if(options.verbosity >=4) cout<<" Model["<< mid<<"]: "<<path<<" is appended to the list of models."<<endl;
	}else if ((unsigned) mid < nmodel){ //model may exist
		if ((overwrite) || (! options.models.at(mid))){ //if no model is set or overwrite is allowed
			this->options.models[mid] = new Model(this, modelfile); //you may need to kill the overwritten model
			if(options.verbosity >=4) cout<<" Model["<< mid<<"]: "<<path<<" is added to the list of models."<<endl;
		}
	}else {    //include dummy
		for (unsigned int i=0; i < mid - nmodel; i++) //add dummy file
			this->options.models.push_back(0);
		this->options.models.push_back(new Model(this, modelfile));  //add to the end
		if(options.verbosity >=4) cout<<" Model["<< mid<<"]: "<<path<<" is added to the list of models after filling dummy models."<<endl;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movl %ecx, %ebx
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %r15
leaq 0x98(%rsp), %r12
movq %r12, %rdi
callq 0x28dd0
leaq 0x18(%rsp), %rdi
movq %rdi, 0x8(%rsp)
movq %r12, %rsi
callq 0x9e3f4
leaq 0x98(%rsp), %rdi
callq 0x295a0
leaq 0x15c0(%r15), %r12
movq 0x15c8(%r15), %r13
subq 0x15c0(%r15), %r13
shrq $0x3, %r13
cmpl %ebp, %r13d
jne 0x6b975
movl $0xc0, %edi
callq 0x28a10
movq %rax, %r13
leaq 0x78(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x28dd0
movb $0x1, %bl
leaq 0x78(%rsp), %rdx
movq %r13, %rdi
movq %r15, %rsi
callq 0x4be90
leaq 0x10(%rsp), %rsi
movq %r13, (%rsi)
xorl %ebx, %ebx
movq %r12, %rdi
callq 0x5bcf4
leaq 0x78(%rsp), %rdi
callq 0x295a0
cmpl $0x4, 0x1614(%r15)
jb 0x6baee
movq 0xfa65f(%rip), %rdi     # 0x165f98
leaq 0x70ee9(%rip), %rsi     # 0xdc829
callq 0x289f0
movq %rax, %rdi
movl %ebp, %esi
callq 0x29290
leaq 0x95115(%rip), %rsi     # 0x100a6b
movq %rax, %rdi
callq 0x289f0
movq %rax, %rdi
movq %r14, %rsi
callq 0x28910
leaq 0x70ec1(%rip), %rsi     # 0xdc831
jmp 0x6bade
jbe 0x6ba2c
movslq %ebp, %r13
testb %bl, %bl
jne 0x6b997
movq %r12, %rdi
movq %r13, %rsi
callq 0x3374c
cmpq $0x0, (%rax)
jne 0x6baee
movl $0xc0, %edi
callq 0x28a10
movq %rax, %r12
leaq 0x58(%rsp), %rdi
leaq 0x18(%rsp), %rbx
movq %rbx, %rsi
callq 0x28dd0
leaq 0x58(%rsp), %rdx
movq %r12, %rdi
movq %r15, %rsi
callq 0x4be90
movq 0x15c0(%r15), %rax
movq %r12, (%rax,%r13,8)
leaq 0x58(%rsp), %rdi
callq 0x295a0
cmpl $0x4, 0x1614(%r15)
jb 0x6baee
movq 0xfa5a8(%rip), %rdi     # 0x165f98
leaq 0x70e32(%rip), %rsi     # 0xdc829
callq 0x289f0
movq %rax, %rdi
movl %ebp, %esi
callq 0x29290
leaq 0x9505e(%rip), %rsi     # 0x100a6b
movq %rax, %rdi
callq 0x289f0
movq %rax, %rdi
movq %r14, %rsi
callq 0x28910
leaq 0x70e2e(%rip), %rsi     # 0xdc855
jmp 0x6bade
leaq 0x10(%rsp), %rbx
cmpl %r13d, %ebp
je 0x6ba4c
andq $0x0, 0x10(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
callq 0x5bcf4
incl %r13d
jmp 0x6ba31
movl $0xc0, %edi
callq 0x28a10
movq %rax, %r13
leaq 0x38(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x28dd0
movb $0x1, %bl
leaq 0x38(%rsp), %rdx
movq %r13, %rdi
movq %r15, %rsi
callq 0x4be90
leaq 0x10(%rsp), %rsi
movq %r13, (%rsi)
xorl %ebx, %ebx
movq %r12, %rdi
callq 0x5bcf4
leaq 0x38(%rsp), %rdi
callq 0x295a0
cmpl $0x4, 0x1614(%r15)
jb 0x6baee
movq 0xfa4f1(%rip), %rdi     # 0x165f98
leaq 0x70d7b(%rip), %rsi     # 0xdc829
callq 0x289f0
movq %rax, %rdi
movl %ebp, %esi
callq 0x29290
leaq 0x94fa7(%rip), %rsi     # 0x100a6b
movq %rax, %rdi
callq 0x289f0
movq %rax, %rdi
movq %r14, %rsi
callq 0x28910
leaq 0x70d98(%rip), %rsi     # 0xdc876
movq %rax, %rdi
callq 0x289f0
movq %rax, %rdi
callq 0x284a0
leaq 0x18(%rsp), %rdi
callq 0x295a0
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
leaq 0x58(%rsp), %rdi
callq 0x295a0
jmp 0x6bb1c
movq %rax, %r14
movl $0xc0, %esi
movq %r12, %rdi
callq 0x28a50
movq %rbx, 0x8(%rsp)
jmp 0x6bb74
jmp 0x6bb3e
jmp 0x6bb71
movq %rax, %r14
leaq 0x38(%rsp), %rdi
jmp 0x6bb4d
movq %rax, %r14
jmp 0x6bb56
jmp 0x6bb71
movq %rax, %r14
leaq 0x78(%rsp), %rdi
callq 0x295a0
testb %bl, %bl
je 0x6bb74
movl $0xc0, %esi
movq %r13, %rdi
callq 0x28a50
jmp 0x6bb74
movq %rax, %r14
movq %r12, 0x8(%rsp)
jmp 0x6bb74
jmp 0x6bb71
movq %rax, %r14
movq 0x8(%rsp), %rdi
callq 0x295a0
movq %r14, %rdi
callq 0x292f0