// File: simonrharris[P]SKA/src/kmers.cpp
// Function: addKmerToStringMap(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::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, char, std::vector<bool, std::allocator<bool>> const&, std::vector<int, std::allocator<int>> const&, int, int, int)
void addKmerToStringMap(std::unordered_map < std::string, std::string > & myKmerMap, const std::string & myKmer, const char myBase, const std::vector < bool > & myBits, const std::vector < int > & mySamples, int currentSampleNumber, int totalSamples, int maxMissing){
	std::unordered_map < std::string, std::string >::iterator kmit = myKmerMap.find(myKmer);//check if the kmer is in the map
	if ( kmit != myKmerMap.end() ){//if the kmer is in the map
		for (int i=0; i<mySamples.size(); ++i){ //add the base to all samples that are true in the bitset
			if (myBits[mySamples[i]]){
				kmit->second[i+currentSampleNumber]=myBase;
			}
		}
	}
	else {//if the kmer isn't in the map
		if ((currentSampleNumber)<=maxMissing){
			std::pair < std::unordered_map < std::string, std::string >::iterator, bool > ret = myKmerMap.insert(std::make_pair(myKmer, std::string (totalSamples,'-')));
			for (int i=0; i<mySamples.size(); ++i){
				if (myBits[mySamples[i]]){
					ret.first->second[i+currentSampleNumber]=myBase;
				}
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movb %dl, %al
movl 0x18(%rbp), %edx
movl 0x10(%rbp), %edx
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb %al, -0x11(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xf760
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
callq 0xf7c0
movq %rax, -0x40(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0xf790
testb $0x1, %al
jne 0xda5e
jmp 0xdaf9
movl $0x0, -0x44(%rbp)
movslq -0x44(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0x28(%rbp), %rdi
callq 0xf7f0
movq %rax, %rcx
movq -0xf0(%rbp), %rax
cmpq %rcx, %rax
jae 0xdaf4
movq -0x20(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0x28(%rbp), %rdi
movslq -0x44(%rbp), %rsi
callq 0xf860
movq -0xf8(%rbp), %rdi
movslq (%rax), %rsi
callq 0xf810
testb $0x1, %al
jne 0xdab5
jmp 0xdae4
movb -0x11(%rbp), %al
movb %al, -0xf9(%rbp)
leaq -0x38(%rbp), %rdi
callq 0xf880
movq %rax, %rdi
addq $0x20, %rdi
movl -0x44(%rbp), %eax
addl -0x2c(%rbp), %eax
movslq %eax, %rsi
callq 0x69e0
movb -0xf9(%rbp), %cl
movb %cl, (%rax)
jmp 0xdae6
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0xda65
jmp 0xdcff
movl -0x2c(%rbp), %eax
cmpl 0x18(%rbp), %eax
jg 0xdcfd
movq -0x8(%rbp), %rax
movq %rax, -0x120(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x118(%rbp)
movslq 0x10(%rbp), %rax
movq %rax, -0x110(%rbp)
leaq -0xb9(%rbp), %rdi
movq %rdi, -0x108(%rbp)
callq 0x6910
movq -0x110(%rbp), %rsi
movq -0x108(%rbp), %rcx
leaq -0xb8(%rbp), %rdi
movl $0x2d, %edx
callq 0x9150
jmp 0xdb5a
movq -0x118(%rbp), %rsi
leaq -0x98(%rbp), %rdi
leaq -0xb8(%rbp), %rdx
callq 0xf8f0
jmp 0xdb76
movq -0x120(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0xf8b0
movb %dl, -0x129(%rbp)
movq %rax, -0x128(%rbp)
jmp 0xdb98
movb -0x129(%rbp), %al
movq -0x128(%rbp), %rcx
movq %rcx, -0xe0(%rbp)
movb %al, -0xd8(%rbp)
movq -0xe0(%rbp), %rax
movq %rax, -0x58(%rbp)
movb -0xd8(%rbp), %al
movb %al, -0x50(%rbp)
leaq -0x98(%rbp), %rdi
callq 0xf930
leaq -0xb8(%rbp), %rdi
callq 0x6a08
leaq -0xb9(%rbp), %rdi
callq 0x65a0
movl $0x0, -0xe4(%rbp)
movslq -0xe4(%rbp), %rax
movq %rax, -0x138(%rbp)
movq -0x28(%rbp), %rdi
callq 0xf7f0
movq %rax, %rcx
movq -0x138(%rbp), %rax
cmpq %rcx, %rax
jae 0xdcfb
movq -0x20(%rbp), %rax
movq %rax, -0x140(%rbp)
movq -0x28(%rbp), %rdi
movslq -0xe4(%rbp), %rsi
callq 0xf860
movq -0x140(%rbp), %rdi
movslq (%rax), %rsi
callq 0xf810
testb $0x1, %al
jne 0xdc51
jmp 0xdce5
movb -0x11(%rbp), %al
movb %al, -0x141(%rbp)
leaq -0x58(%rbp), %rdi
callq 0xf880
movq %rax, %rdi
addq $0x20, %rdi
movl -0xe4(%rbp), %eax
addl -0x2c(%rbp), %eax
movslq %eax, %rsi
callq 0x69e0
movb -0x141(%rbp), %cl
movb %cl, (%rax)
jmp 0xdce5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
jmp 0xdcd7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
jmp 0xdccb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
leaq -0x98(%rbp), %rdi
callq 0xf930
leaq -0xb8(%rbp), %rdi
callq 0x6a08
leaq -0xb9(%rbp), %rdi
callq 0x65a0
jmp 0xdd08
jmp 0xdce7
movl -0xe4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xe4(%rbp)
jmp 0xdbf4
jmp 0xdcfd
jmp 0xdcff
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
movq -0xc8(%rbp), %rdi
callq 0x6900
nopw %cs:(%rax,%rax)