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

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

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

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x180, %rsp            # imm = 0x180
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0xfbf0
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
callq 0xfc20
movq %rax, -0x20(%rbp)
leaq -0x18(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0xfc50
testb $0x1, %al
jne 0xe393
jmp 0xe6bd
movq -0x10(%rbp), %rax
movq %rax, -0xf8(%rbp)
leaq -0x18(%rbp), %rdi
callq 0xfcb0
movq -0xf8(%rbp), %rdi
movq %rax, %rsi
addq $0x20, %rsi
callq 0xfc80
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
callq 0xfce0
movq %rax, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0xf0f0
testb $0x1, %al
jne 0xe3de
jmp 0xe40f
leaq -0x28(%rbp), %rdi
callq 0xfd10
addq $0x28, %rax
movq %rax, -0x100(%rbp)
leaq -0x18(%rbp), %rdi
callq 0xfcb0
movq -0x100(%rbp), %rdi
movq %rax, %rsi
callq 0xabd0
jmp 0xe681
movq -0x10(%rbp), %rax
movq %rax, -0x120(%rbp)
leaq -0x18(%rbp), %rdi
movq %rdi, -0x118(%rbp)
callq 0xfcb0
movq -0x118(%rbp), %rdi
addq $0x20, %rax
movq %rax, -0x110(%rbp)
leaq -0xb8(%rbp), %rax
movq %rax, -0x108(%rbp)
movq %rax, -0xc0(%rbp)
callq 0xfcb0
movq -0x108(%rbp), %rdi
movq %rax, %rsi
callq 0x6230
jmp 0xe467
leaq -0xb8(%rbp), %rax
movq %rax, -0x98(%rbp)
movq $0x1, -0x90(%rbp)
leaq -0xcd(%rbp), %rdi
movq %rdi, -0x128(%rbp)
callq 0xfdc0
movq -0x128(%rbp), %rcx
movq -0x98(%rbp), %rsi
movq -0x90(%rbp), %rdx
leaq -0x88(%rbp), %rdi
callq 0xfde0
jmp 0xe4b6
movq -0x110(%rbp), %rsi
leaq -0x70(%rbp), %rdi
leaq -0x88(%rbp), %rdx
callq 0xfd80
jmp 0xe4cf
movq -0x120(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0xfd40
movb %dl, -0x131(%rbp)
movq %rax, -0x130(%rbp)
jmp 0xe4ee
movb -0x131(%rbp), %al
movq -0x130(%rbp), %rcx
movq %rcx, -0xe0(%rbp)
movb %al, -0xd8(%rbp)
leaq -0x70(%rbp), %rdi
callq 0xfe60
leaq -0x88(%rbp), %rdi
callq 0xfe90
leaq -0xcd(%rbp), %rdi
callq 0xfef0
leaq -0xb8(%rbp), %rax
movq %rax, -0x148(%rbp)
addq $0x20, %rax
movq %rax, -0x140(%rbp)
movq -0x140(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x150(%rbp)
callq 0x6a08
movq -0x148(%rbp), %rcx
movq -0x150(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x140(%rbp)
jne 0xe542
jmp 0xe681
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
movq -0xc0(%rbp), %rax
leaq -0xb8(%rbp), %rcx
cmpq %rax, %rcx
movq %rax, -0x158(%rbp)
je 0xe5d5
movq -0x158(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x160(%rbp)
callq 0x6a08
movq -0x160(%rbp), %rax
leaq -0xb8(%rbp), %rcx
cmpq %rcx, %rax
movq %rax, -0x158(%rbp)
jne 0xe5a4
jmp 0xe6c6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
jmp 0xe629
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
jmp 0xe61d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
leaq -0x70(%rbp), %rdi
callq 0xfe60
leaq -0x88(%rbp), %rdi
callq 0xfe90
leaq -0xcd(%rbp), %rdi
callq 0xfef0
leaq -0xb8(%rbp), %rax
movq %rax, -0x170(%rbp)
addq $0x20, %rax
movq %rax, -0x168(%rbp)
movq -0x168(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x178(%rbp)
callq 0x6a08
movq -0x170(%rbp), %rcx
movq -0x178(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x168(%rbp)
jne 0xe64e
jmp 0xe6c6
movq -0x8(%rbp), %rax
movq %rax, -0x180(%rbp)
leaq -0x18(%rbp), %rdi
xorl %esi, %esi
callq 0xff50
movq -0x180(%rbp), %rdi
movq %rax, -0xe8(%rbp)
movq -0xe8(%rbp), %rsi
callq 0xff10
movq %rax, -0xf0(%rbp)
jmp 0xe37d
addq $0x180, %rsp            # imm = 0x180
popq %rbp
retq
movq -0xc8(%rbp), %rdi
callq 0x6900
nopw %cs:(%rax,%rax)