// File: /workspace/github_cpp_makefile_star2_O3/richardposner[P]BioNetFit2/src/code/Swarm.cpp
// Function: Swarm::generateBootstrapMaps(std::vector<std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::map<double, unsigned int, std::less<double>, std::allocator<std::pair<double const, unsigned int>>>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, std::map<double, unsigned int, std::less<double>, std::allocator<std::pair<double const, unsigned int>>>>>>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::map<double, unsigned int, std::less<double>, std::allocator<std::pair<double const, unsigned int>>>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, std::map<double, unsigned int, std::less<double>, std::allocator<std::pair<double const, unsigned int>>>>>>>>>, std::allocator<std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::map<double, unsigned int, std::less<double>, std::allocator<std::pair<double const, unsigned int>>>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, std::map<double, unsigned int, std::less<double>, std::allocator<std::pair<double const, unsigned int>>>>>>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::map<double, unsigned int, std::less<double>, std::allocator<std::pair<double const, unsigned int>>>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, std::map<double, unsigned int, std::less<double>, std::allocator<std::pair<double const, unsigned int>>>>>>>>>>>&)
void Swarm::generateBootstrapMaps(vector<map<string, map<string, map<double,unsigned int> > > > &bootStrapMaps) {
	for (unsigned int i = 0; i < options.bootstrap; ++i) {
		//cout << "i: " << i << endl;
		// For each .exp file
		map<string, map<string, map<double, unsigned int> > > maps;
		for (auto dataSet = options.expFiles.begin(); dataSet != options.expFiles.end(); ++dataSet) {
			//cout << "set: " << dataSet->first << endl;
			// For each column
			map<string, map<double, unsigned int> > bsMap;
			for (auto col = dataSet->second->dataCurrent->begin(); col != dataSet->second->dataCurrent->end(); ++col) {
				//cout << "col: " << col->first << endl;
				// Fill the map with 0's
				map<double, unsigned int> colVals;
				for (auto tp = col->second.begin(); tp != col->second.end(); ++tp) {
					//cout << "tp: " << tp->first << endl;
					colVals[tp->first] = 0;
				}

				// Select datapoints at random. If a datapoint is selected,
				// increment it's integer value in the vals map
				for (unsigned int o = 0; o < col->second.size(); ++o) {
					int i;
					if (col->second.size() > 1) {
					  i = rand() % (col->second.size() - 1);
					}
					else
					{
					  i = 0;
					}
					auto it = col->second.begin();
					advance(it, i);
					colVals[it->first] += 1;
					//cout << "chose " << i << " (" << it->first << ")" << endl;
				}

				// Insert this column into the map
				bsMap.insert(pair<string, map<double, unsigned int> >(col->first, colVals));
			}
			// Insert this dataset into the maps set
			maps.insert(pair<string, map<string, map<double, unsigned int> > >(dataSet->first, bsMap));
		}
		// Insert this set of maps into the master set
		bootStrapMaps.push_back(maps);
	}

	/*
	unsigned int setCounter = 1;
	for (auto bsSet = bootStrapMaps.begin(); bsSet != bootStrapMaps.end(); ++bsSet) {
		cout << "Set " << setCounter << endl;
		for (auto dataSet = bsSet->begin(); dataSet != bsSet->end(); ++dataSet) {
			cout << "Dataset " << dataSet->first << endl;
			for (auto col = dataSet->second.begin(); col != dataSet->second.end(); ++col) {
				cout << "Col " << col->first << endl;
				for (auto tp = col->second.begin(); tp != col->second.end(); ++tp) {
					cout << tp->first << " " << tp -> second << endl;
				}
			}
		}
	}
	 */
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rsi, 0x20(%rsp)
cmpl $0x0, 0x1638(%rdi)
je 0xa2456
leaq 0x1568(%rdi), %rax
movq %rax, 0x10(%rsp)
leaq 0x58(%rsp), %rbx
leaq 0xb8(%rsp), %rbp
leaq 0x88(%rsp), %r14
xorl %r15d, %r15d
movq %rdi, 0x18(%rsp)
movl %r15d, 0xc(%rsp)
movl $0x0, 0x60(%rsp)
xorl %ecx, %ecx
movq %rcx, 0x68(%rsp)
leaq 0x60(%rsp), %rax
movq %rax, 0x70(%rsp)
movq %rax, 0x78(%rsp)
movq %rcx, 0x80(%rsp)
movq 0x1578(%rdi), %r12
cmpq 0x10(%rsp), %r12
je 0xa2427
movl $0x0, 0x30(%rsp)
xorl %ecx, %ecx
movq %rcx, 0x38(%rsp)
leaq 0x30(%rsp), %rax
movq %rax, 0x40(%rsp)
movq %rax, 0x48(%rsp)
movq %rcx, 0x50(%rsp)
movq 0x40(%r12), %rax
movq (%rax), %rax
movq 0x18(%rax), %r13
addq $0x8, %rax
cmpq %rax, %r13
je 0xa23b3
movl $0x0, 0x90(%rsp)
xorl %ecx, %ecx
movq %rcx, 0x98(%rsp)
leaq 0x90(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq %rax, 0xa8(%rsp)
movq %rcx, 0xb0(%rsp)
movq 0x58(%r13), %r15
leaq 0x48(%r13), %rbx
cmpq %rbx, %r15
je 0xa22cf
leaq 0x20(%r15), %rsi
movq %r14, %rdi
callq 0x662fc
movl $0x0, (%rax)
movq %r15, %rdi
callq 0x22670
movq %rax, %r15
cmpq %rbx, %rax
jne 0xa22ad
movq 0x68(%r13), %rax
testq %rax, %rax
je 0xa2345
xorl %r15d, %r15d
cmpq $0x1, %rax
jbe 0xa2311
callq 0x22230
cltq
movq 0x58(%r13), %rsi
movq 0x68(%r13), %rcx
decq %rcx
xorl %edx, %edx
divq %rcx
movslq %edx, %rbx
testl %ebx, %ebx
jle 0xa2331
movq %rsi, %rdi
callq 0x22670
movq %rax, %rsi
decq %rbx
jne 0xa22ff
jmp 0xa2315
movq 0x58(%r13), %rsi
addq $0x20, %rsi
movq %r14, %rdi
callq 0x662fc
incl (%rax)
incl %r15d
movq 0x68(%r13), %rax
cmpq %r15, %rax
ja 0xa22db
jmp 0xa2345
je 0xa2315
movq %rsi, %rdi
callq 0x22a10
movq %rax, %rsi
incq %rbx
jne 0xa2333
jmp 0xa2315
leaq 0x20(%r13), %rsi
movq %rbp, %rdi
movq %r14, %rdx
callq 0xa860c
leaq 0x28(%rsp), %rdi
movq %rbp, %rsi
callq 0xbc610
leaq 0xd8(%rsp), %rdi
callq 0x462de
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0xa2393
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x229c0
movq %r14, %rdi
callq 0x462de
movq %r13, %rdi
callq 0x22670
movq %rax, %r13
movq 0x40(%r12), %rax
movq (%rax), %rax
jmp 0xa225e
leaq 0x20(%r12), %rsi
movq %rbp, %rdi
leaq 0x28(%rsp), %rdx
callq 0xa8688
leaq 0x58(%rsp), %rbx
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xbc718
leaq 0xd8(%rsp), %rdi
callq 0x4625a
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0xa2407
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x229c0
leaq 0x28(%rsp), %rdi
callq 0x4625a
movq %r12, %rdi
callq 0x22670
movq %rax, %r12
cmpq 0x10(%rsp), %rax
jne 0xa222f
movq 0x20(%rsp), %rdi
movq %rbx, %rsi
callq 0xa8704
movl 0xc(%rsp), %r15d
movq %rbx, %rdi
callq 0x461d6
incl %r15d
movq 0x18(%rsp), %rdi
cmpl 0x1638(%rdi), %r15d
jb 0xa21f2
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0xa24b4
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0xa86dc
jmp 0xa24aa
movq %rax, %rbx
jmp 0xa24aa
jmp 0xa249a
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0xa8660
jmp 0xa249d
jmp 0xa249a
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x462de
leaq 0x28(%rsp), %rdi
callq 0x4625a
leaq 0x58(%rsp), %rdi
callq 0x461d6
movq %rbx, %rdi
callq 0x23240