// File: richardposner[P]BioNetFit2/src/code/Swarm.cpp
// Function: Swarm::setExpPath(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int)
void Swarm::setExpPath(std::string prefixPath, std::string path, int mid){

/*   old ver, just one exp file for each model
	std::vector<string> paths;
	string expfile;

	expPaths_.clear();
	paths = split_string(path, ",");
	if (paths.size()>1)
		outputError("Can not set more than 1 exp file for each model at this version");

	for(int i=0; i< paths.size(); ++i){
		expfile = convertToAbsPath(paths.at(i));
//cout<<"Swarm::setExpPath AAA1  Enter a number..."; mypause();
		expPaths_.push_back(expfile);
//cout<<"Swarm::setExpPath AAA2, File:"<< expfile <<"  Enter a number..."; mypause();
		addExp(expfile, mid);
//cout<<"Swarm::setExpPath AAA3  Enter a number..."; mypause();

		if (options.verbosity >=3) cout<<"Exp["<<i<<"]  :"<<expfile <<" is added to the list of exp files.\n";
	}
*/

	std::vector<string> Paths;
	std::vector<string> absPaths;
	fs::path prefix(prefixPath);
	string expfile;
	Paths = split_string(path, ",");

	if (mid==-1){ //razi: means that each file is for one model [in the sqame order]

		for(unsigned int i=0; i< Paths.size(); ++i){
			fs::path path(Paths.at(i));
			fs::path abspath = path;
			
			if (!fs::exists(path.string())){
				abspath = prefix / path;
			}
			absPaths.clear();
			expfile = abspath.string();
			if(options.verbosity>=3){
				cout<<"*** exp file found"<<expfile<< " set for model:"<<i<<endl;
			}
			absPaths.push_back(expfile);
			expPaths_.insert(make_pair(i, absPaths));
			addExp(expfile, i);
			if (options.verbosity >=3) cout<<"Exp["<<i<<"]  :"<<expfile <<" is added to the list of exp files.\n";
		}


	}else{
		if((mid>=0)&&((unsigned) mid < options.models.size())){
			absPaths.clear();
			for(unsigned int i=0; i< Paths.size(); ++i){
				fs::path path(Paths.at(i));
				fs::path abspath = path;
				
				if (!fs::exists(path.string())){
					abspath = prefix / path;
				}
				expfile = abspath.string();
				absPaths.push_back(expfile);
				if(options.verbosity>=3){
					cout<<"*** exp file found"<<expfile<<endl;
				}
				if (options.verbosity >= 3){ cout<<"Swarm::setExpPath try to add  File:"<< expfile <<endl;}
				addExp(expfile, mid);
				if (options.verbosity >=3) cout<<"Exp["<<i<<"]  :"<<expfile <<" is added to the list of exp files for model:"<<mid<<".\n";
			}
			//cout<<"Number of exp files for this model: "<< absPaths.size()<<endl; cout<< "Number of expPaths_ before adding :"<< expPaths_.size()<<endl;
			expPaths_[mid]= absPaths; //razi: there is eeror for duplicate key, expPaths_.insert(make_pair(mid, absPaths));
		}
		else
			outputError("Invalid request to set exp files. I am quitting...");
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3e0, %rsp            # imm = 0x3E0
movq %rsi, -0x2b0(%rbp)
movq %rdx, -0x2c0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x2b8(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x448b0
leaq -0x50(%rbp), %rdi
callq 0x448b0
movq -0x2b0(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x43ef0
jmp 0xeae67
leaq -0xa0(%rbp), %rdi
callq 0x2f880
movq -0x2c0(%rbp), %rsi
leaq -0xd8(%rbp), %rdi
callq 0x2f300
jmp 0xeae88
leaq -0xf9(%rbp), %rdi
movq %rdi, -0x2c8(%rbp)
callq 0x30a70
movq -0x2c8(%rbp), %rdx
leaq 0xef767(%rip), %rsi     # 0x1da610
leaq -0xf8(%rbp), %rdi
callq 0x44470
jmp 0xeaeb7
leaq -0xb8(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
leaq -0xf8(%rbp), %rdx
callq 0x17ce70
jmp 0xeaed3
leaq -0x38(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0xd1b80
leaq -0xb8(%rbp), %rdi
callq 0x448d0
leaq -0xf8(%rbp), %rdi
callq 0x311e8
leaq -0xf9(%rbp), %rdi
callq 0x311c0
leaq -0xd8(%rbp), %rdi
callq 0x311e8
cmpl $-0x1, -0x1c(%rbp)
jne 0xeb388
movl $0x0, -0x100(%rbp)
movl -0x100(%rbp), %eax
movq %rax, -0x2d0(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x44960
movq %rax, %rcx
movq -0x2d0(%rbp), %rax
cmpq %rcx, %rax
jae 0xeb383
movl -0x100(%rbp), %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0x1216f0
movq %rax, -0x2d8(%rbp)
jmp 0xeaf6a
movq -0x2d8(%rbp), %rsi
leaq -0x120(%rbp), %rdi
callq 0x43ef0
jmp 0xeaf7f
leaq -0x140(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x4c010
jmp 0xeaf94
leaq -0x120(%rbp), %rdi
callq 0x44560
movq %rax, -0x2e0(%rbp)
jmp 0xeafa9
movq -0x2e0(%rbp), %rsi
leaq -0x160(%rbp), %rdi
callq 0x121760
jmp 0xeafbe
leaq -0x160(%rbp), %rdi
callq 0x121730
movb %al, -0x2e1(%rbp)
jmp 0xeafd2
movb -0x2e1(%rbp), %al
xorb $-0x1, %al
movb %al, -0x2e2(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x44570
movb -0x2e2(%rbp), %al
testb $0x1, %al
jne 0xeaffb
jmp 0xeb0dc
leaq -0x180(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x120(%rbp), %rdx
callq 0x44600
jmp 0xeb014
leaq -0x140(%rbp), %rdi
leaq -0x180(%rbp), %rsi
callq 0x121790
leaq -0x180(%rbp), %rdi
callq 0x44570
jmp 0xeb0dc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0xeb8a6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0xeb891
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0xeb080
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x311e8
leaq -0xf9(%rbp), %rdi
callq 0x311c0
leaq -0xd8(%rbp), %rdi
callq 0x311e8
jmp 0xeb891
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0xeb372
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0xeb366
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x44570
jmp 0xeb366
leaq -0x50(%rbp), %rdi
callq 0x451d0
leaq -0x140(%rbp), %rdi
callq 0x44560
movq %rax, -0x2f0(%rbp)
jmp 0xeb0fa
movq -0x2f0(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
callq 0x30fa0
jmp 0xeb10f
movq -0x2b8(%rbp), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xeb1a9
movq 0x1e9e26(%rip), %rdi    # 0x2d4f50
leaq 0xf5f44(%rip), %rsi     # 0x1e1075
callq 0x2ff50
movq %rax, -0x2f8(%rbp)
jmp 0xeb13f
movq -0x2f8(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x2f780
movq %rax, -0x300(%rbp)
jmp 0xeb15b
movq -0x300(%rbp), %rdi
leaq 0xf5f1f(%rip), %rsi     # 0x1e1088
callq 0x2ff50
movq %rax, -0x308(%rbp)
jmp 0xeb177
movq -0x308(%rbp), %rdi
movl -0x100(%rbp), %esi
callq 0x30640
movq %rax, -0x310(%rbp)
jmp 0xeb192
movq -0x310(%rbp), %rdi
movq 0x1e9e28(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xeb1a7
jmp 0xeb1a9
leaq -0x50(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x45280
jmp 0xeb1bb
movq -0x2b8(%rbp), %rax
addq $0x1908, %rax           # imm = 0x1908
movq %rax, -0x318(%rbp)
leaq -0x1a0(%rbp), %rdi
leaq -0x100(%rbp), %rsi
leaq -0x50(%rbp), %rdx
callq 0x121800
jmp 0xeb1e8
movq -0x318(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0x1217c0
movb %dl, -0x321(%rbp)
movq %rax, -0x320(%rbp)
jmp 0xeb20a
movb -0x321(%rbp), %al
movq -0x320(%rbp), %rcx
movq %rcx, -0x1b0(%rbp)
movb %al, -0x1a8(%rbp)
leaq -0x1a0(%rbp), %rdi
callq 0x121840
leaq -0x1d0(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x2f300
jmp 0xeb245
movq -0x2b8(%rbp), %rdi
movl -0x100(%rbp), %edx
leaq -0x1d0(%rbp), %rsi
callq 0xe9ab0
jmp 0xeb260
leaq -0x1d0(%rbp), %rdi
callq 0x311e8
movq -0x2b8(%rbp), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xeb33a
movq 0x1e9cc9(%rip), %rdi    # 0x2d4f50
leaq 0xf5e0a(%rip), %rsi     # 0x1e1098
callq 0x2ff50
movq %rax, -0x330(%rbp)
jmp 0xeb29c
movq -0x330(%rbp), %rdi
movl -0x100(%rbp), %esi
callq 0x30640
movq %rax, -0x338(%rbp)
jmp 0xeb2b7
movq -0x338(%rbp), %rdi
leaq 0xf5dd8(%rip), %rsi     # 0x1e109d
callq 0x2ff50
movq %rax, -0x340(%rbp)
jmp 0xeb2d3
movq -0x340(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x2f780
movq %rax, -0x348(%rbp)
jmp 0xeb2ef
movq -0x348(%rbp), %rdi
leaq 0xf5da5(%rip), %rsi     # 0x1e10a2
callq 0x2ff50
jmp 0xeb304
jmp 0xeb33a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x1a0(%rbp), %rdi
callq 0x121840
jmp 0xeb366
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x1d0(%rbp), %rdi
callq 0x311e8
jmp 0xeb366
leaq -0x140(%rbp), %rdi
callq 0x44570
leaq -0x120(%rbp), %rdi
callq 0x44570
movl -0x100(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x100(%rbp)
jmp 0xeaf27
leaq -0x140(%rbp), %rdi
callq 0x44570
leaq -0x120(%rbp), %rdi
callq 0x44570
jmp 0xeb891
jmp 0xeb861
cmpl $0x0, -0x1c(%rbp)
jl 0xeb7cd
movq -0x2b8(%rbp), %rdi
movl -0x1c(%rbp), %eax
movq %rax, -0x350(%rbp)
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0x100, %rdi            # imm = 0x100
callq 0x45170
movq %rax, %rcx
movq -0x350(%rbp), %rax
cmpq %rcx, %rax
jae 0xeb7cd
leaq -0x50(%rbp), %rdi
callq 0x451d0
movl $0x0, -0x1d4(%rbp)
movl -0x1d4(%rbp), %eax
movq %rax, -0x358(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x44960
movq %rax, %rcx
movq -0x358(%rbp), %rax
cmpq %rcx, %rax
jae 0xeb78a
movl -0x1d4(%rbp), %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0x1216f0
movq %rax, -0x360(%rbp)
jmp 0xeb41f
movq -0x360(%rbp), %rsi
leaq -0x1f8(%rbp), %rdi
callq 0x43ef0
jmp 0xeb434
leaq -0x218(%rbp), %rdi
leaq -0x1f8(%rbp), %rsi
callq 0x4c010
jmp 0xeb449
leaq -0x1f8(%rbp), %rdi
callq 0x44560
movq %rax, -0x368(%rbp)
jmp 0xeb45e
movq -0x368(%rbp), %rsi
leaq -0x238(%rbp), %rdi
callq 0x121760
jmp 0xeb473
leaq -0x238(%rbp), %rdi
callq 0x121730
movb %al, -0x369(%rbp)
jmp 0xeb487
movb -0x369(%rbp), %al
xorb $-0x1, %al
movb %al, -0x36a(%rbp)
leaq -0x238(%rbp), %rdi
callq 0x44570
movb -0x36a(%rbp), %al
testb $0x1, %al
jne 0xeb4ad
jmp 0xeb526
leaq -0x258(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x1f8(%rbp), %rdx
callq 0x44600
jmp 0xeb4c6
leaq -0x218(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x121790
leaq -0x258(%rbp), %rdi
callq 0x44570
jmp 0xeb526
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0xeb779
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0xeb76d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x238(%rbp), %rdi
callq 0x44570
jmp 0xeb76d
leaq -0x218(%rbp), %rdi
callq 0x44560
movq %rax, -0x378(%rbp)
jmp 0xeb53b
movq -0x378(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
callq 0x30fa0
jmp 0xeb550
leaq -0x50(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x45280
jmp 0xeb562
movq -0x2b8(%rbp), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xeb5c1
movq 0x1e99d7(%rip), %rdi    # 0x2d4f50
leaq 0xf5af5(%rip), %rsi     # 0x1e1075
callq 0x2ff50
movq %rax, -0x380(%rbp)
jmp 0xeb58e
movq -0x380(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x2f780
movq %rax, -0x388(%rbp)
jmp 0xeb5aa
movq -0x388(%rbp), %rdi
movq 0x1e9a10(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xeb5bf
jmp 0xeb5c1
movq -0x2b8(%rbp), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xeb620
movq 0x1e9978(%rip), %rdi    # 0x2d4f50
leaq 0xf5ae8(%rip), %rsi     # 0x1e10c7
callq 0x2ff50
movq %rax, -0x390(%rbp)
jmp 0xeb5ed
movq -0x390(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x2f780
movq %rax, -0x398(%rbp)
jmp 0xeb609
movq -0x398(%rbp), %rdi
movq 0x1e99b1(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0xeb61e
jmp 0xeb620
leaq -0x278(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x2f300
jmp 0xeb635
movq -0x2b8(%rbp), %rdi
movl -0x1c(%rbp), %edx
leaq -0x278(%rbp), %rsi
callq 0xe9ab0
jmp 0xeb64d
leaq -0x278(%rbp), %rdi
callq 0x311e8
movq -0x2b8(%rbp), %rax
cmpl $0x3, 0x1614(%rax)
jb 0xeb741
movq 0x1e98dc(%rip), %rdi    # 0x2d4f50
leaq 0xf5a1d(%rip), %rsi     # 0x1e1098
callq 0x2ff50
movq %rax, -0x3a0(%rbp)
jmp 0xeb689
movq -0x3a0(%rbp), %rdi
movl -0x1d4(%rbp), %esi
callq 0x30640
movq %rax, -0x3a8(%rbp)
jmp 0xeb6a4
movq -0x3a8(%rbp), %rdi
leaq 0xf59eb(%rip), %rsi     # 0x1e109d
callq 0x2ff50
movq %rax, -0x3b0(%rbp)
jmp 0xeb6c0
movq -0x3b0(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x2f780
movq %rax, -0x3b8(%rbp)
jmp 0xeb6dc
movq -0x3b8(%rbp), %rdi
leaq 0xf5a01(%rip), %rsi     # 0x1e10eb
callq 0x2ff50
movq %rax, -0x3c0(%rbp)
jmp 0xeb6f8
movq -0x3c0(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x2f800
movq %rax, -0x3c8(%rbp)
jmp 0xeb710
movq -0x3c8(%rbp), %rdi
leaq 0xf8a61(%rip), %rsi     # 0x1e417f
callq 0x2ff50
jmp 0xeb725
jmp 0xeb741
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x278(%rbp), %rdi
callq 0x311e8
jmp 0xeb76d
leaq -0x218(%rbp), %rdi
callq 0x44570
leaq -0x1f8(%rbp), %rdi
callq 0x44570
movl -0x1d4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1d4(%rbp)
jmp 0xeb3dc
leaq -0x218(%rbp), %rdi
callq 0x44570
leaq -0x1f8(%rbp), %rdi
callq 0x44570
jmp 0xeb891
movq -0x2b8(%rbp), %rdi
addq $0x1908, %rdi           # imm = 0x1908
movl -0x1c(%rbp), %eax
movl %eax, -0x27c(%rbp)
leaq -0x27c(%rbp), %rsi
callq 0x121860
movq %rax, -0x3d0(%rbp)
jmp 0xeb7b6
movq -0x3d0(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x45610
jmp 0xeb7c8
jmp 0xeb85f
leaq -0x2a1(%rbp), %rdi
movq %rdi, -0x3d8(%rbp)
callq 0x30a70
movq -0x3d8(%rbp), %rdx
leaq 0xf592b(%rip), %rsi     # 0x1e1119
leaq -0x2a0(%rbp), %rdi
callq 0x44470
jmp 0xeb7fc
movq -0x2b8(%rbp), %rdi
leaq -0x2a0(%rbp), %rsi
callq 0xeada0
jmp 0xeb811
leaq -0x2a0(%rbp), %rdi
callq 0x311e8
leaq -0x2a1(%rbp), %rdi
callq 0x311c0
jmp 0xeb85f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0xeb851
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x2a0(%rbp), %rdi
callq 0x311e8
leaq -0x2a1(%rbp), %rdi
callq 0x311c0
jmp 0xeb891
jmp 0xeb861
leaq -0xa0(%rbp), %rdi
callq 0x311e8
leaq -0x70(%rbp), %rdi
callq 0x44570
leaq -0x50(%rbp), %rdi
callq 0x448d0
leaq -0x38(%rbp), %rdi
callq 0x448d0
addq $0x3e0, %rsp            # imm = 0x3E0
popq %rbp
retq
leaq -0xa0(%rbp), %rdi
callq 0x311e8
leaq -0x70(%rbp), %rdi
callq 0x44570
leaq -0x50(%rbp), %rdi
callq 0x448d0
leaq -0x38(%rbp), %rdi
callq 0x448d0
movq -0x78(%rbp), %rdi
callq 0x30170
nopw %cs:(%rax,%rax)