// File: /workspace/github_cpp_makefile_star2_O3/simonrharris[P]SKA/src/kmers.cpp
// Function: reverseStringKmerMap(std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::equal_to<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::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>&, std::unordered_map<std::vector<bool, std::allocator<bool>>, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>, std::hash<std::vector<bool, std::allocator<bool>>>, std::equal_to<std::vector<bool, std::allocator<bool>>>, std::allocator<std::pair<std::vector<bool, std::allocator<bool>> const, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>>>&)
void reverseStringKmerMap(std::unordered_map < std::string, std::string > & kmerMap, std::unordered_map < std::vector < bool >, std::vector < std::string > > & revKmerMap){

	std::unordered_map < std::string, std::string >::iterator it = kmerMap.begin();
	std::unordered_map < std::string, std::string >::iterator endIter = kmerMap.end();

	for (; it!=endIter; ){

		for (int i=0; i<5; ++i){
			std::string kmer (1, bases[i]);
			kmer+=it->first;
			std::vector < bool > myvb (it->second.length(), false);

			int j=0;
			bool matched=false;
			for (std::string::iterator sit=it->second.begin(); sit!=it->second.end(); ++sit, ++j){
				if (*sit==bases[i]){
					myvb[j]=true;
					matched=true;
				}
			}

			if (matched){
				std::unordered_map < std::vector < bool >, std::vector < std::string > >::iterator it2 = revKmerMap.find(myvb);//check if the bitset is in the map
				if ( it2 != revKmerMap.end() ){//if the bitset is in the map
					it2->second.push_back(kmer); //add the kmer
				}
				else {//if the bitset isn't in the map
					revKmerMap.insert(std::make_pair(myvb, std::vector < std::string > {kmer})); //insert the vector into the map
				}
			}
		}
		kmerMap.erase(it++); //remove kmer from kmerMap to save space
	}

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rsi, 0x8(%rsp)
movq %rdi, 0x68(%rsp)
movq 0x10(%rdi), %r15
testq %r15, %r15
je 0xa9cd
leaq 0x36d67(%rip), %r14     # 0x414c5
leaq 0x70(%rsp), %rbp
leaq 0x48(%rsp), %rbx
xorl %r12d, %r12d
movsbl (%r14,%r12), %edx
leaq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movl $0x1, %esi
leaq 0x10(%rsp), %r13
movq %r13, %rdi
callq 0x5440
movq 0x8(%r15), %rsi
movq 0x10(%r15), %rdx
movq %r13, %rdi
callq 0x5110
movq 0x30(%r15), %rsi
movb $0x0, 0x98(%rsp)
movq %rbp, %rdi
leaq 0x98(%rsp), %rdx
movq %rbx, %rcx
callq 0xabec
movq 0x30(%r15), %rcx
testq %rcx, %rcx
je 0xa965
movq 0x28(%r15), %rax
xorl %edx, %edx
movq 0x70(%rsp), %rsi
xorl %r9d, %r9d
movq %rax, %rdi
movb (%r14,%r12), %r10b
addq %rax, %rcx
xorl %r8d, %r8d
movq %rdi, %r11
cmpb %r10b, (%r11)
je 0xa7f8
incq %r11
decq %r8
cmpq %rcx, %r11
jne 0xa7e6
jmp 0xa82e
movl %edx, %ecx
subq %r8, %rcx
movl %ecx, %r9d
movl $0x1, %r10d
shlq %cl, %r10
shrl $0x6, %r9d
orq %r10, (%rsi,%r9,8)
movq 0x30(%r15), %rcx
subq %r8, %rdi
incq %rdi
subl %r8d, %edx
incl %edx
leaq (%rax,%rcx), %r8
movb $0x1, %r9b
cmpq %r8, %rdi
jne 0xa7d9
jmp 0xa838
testb $0x1, %r9b
je 0xa965
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
callq 0xc07c
testq %rax, %rax
je 0xa860
addq $0x30, %rax
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x8528
jmp 0xa965
leaq 0x58(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x8566
movq %rbx, %rsi
movq %rbp, %rbx
movl $0x1, %edx
leaq 0x30(%rsp), %rdi
movq %rsi, %r13
leaq 0x7(%rsp), %rcx
callq 0xab26
leaq 0x98(%rsp), %rbp
movq %rbp, %rdi
movq %rbx, %rsi
callq 0xad36
movaps 0x30(%rsp), %xmm0
movups %xmm0, 0xc0(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0xd0(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
callq 0xc360
leaq 0xc0(%rsp), %rdi
callq 0xab8e
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
movq %rbx, %rbp
je 0xa93c
movq 0xb8(%rsp), %rsi
subq %rdi, %rsi
callq 0x53c0
xorl %eax, %eax
movq %rax, 0x98(%rsp)
movl %eax, 0xa0(%rsp)
movq %rax, 0xa8(%rsp)
movl %eax, 0xb0(%rsp)
movq %rax, 0xb8(%rsp)
leaq 0x30(%rsp), %rdi
callq 0xab8e
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
movq %r13, %rbx
je 0xa965
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x53c0
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0xa988
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x53c0
movq $0x0, 0x70(%rsp)
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0xa9a4
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x53c0
incq %r12
cmpq $0x5, %r12
jne 0xa76b
movq (%r15), %r12
movq 0x68(%rsp), %rdi
movq %r15, %rsi
callq 0xc7ce
movq %r12, %r15
testq %r12, %r12
jne 0xa768
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
jmp 0xa9f4
movq %rax, %r14
leaq 0x98(%rsp), %rdi
callq 0xab6e
leaq 0x30(%rsp), %rdi
callq 0xab8e
jmp 0xaa05
jmp 0xaa23
movq %rax, %r14
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0xaa26
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x53c0
jmp 0xaa26
movq %rax, %r14
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0xaa5e
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x53c0
xorl %eax, %eax
movq %rax, 0x70(%rsp)
movl $0x0, 0x78(%rsp)
movq %rax, 0x80(%rsp)
jmp 0xaa5e
jmp 0xaa5b
movq %rax, %r14
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0xaa7a
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x53c0
movq %r14, %rdi
callq 0x56a0