// File: /workspace/github_cpp_makefile_star2_O1/simonrharris[P]SKA/src/kmers.cpp
// Function: printKmerAlleleFrequencies(std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::array<int, 8ul>, 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::array<int, 8ul>>>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int printKmerAlleleFrequencies(const std::unordered_map < std::string, std::array < int, 8 > > & mymap, const std::string outputfile){
	
	std::cout << "Writing kmer allele frequencies to " << outputfile << std::endl;

	std::ofstream allelefile(outputfile);
	if (allelefile.fail()){
		std::cerr << std::endl << "Error: Failed to open " << outputfile << std::endl << std::endl;
		return 1;
	}
	for (std::unordered_map < std::string, std::array < int, 8 > >::const_iterator it=mymap.begin(); it!=mymap.end(); ++it){
		std::string kmer=it->first;
		allelefile << kmer;
		for (std::array < int, 8 >::const_iterator it2=it->second.begin(); it2!=it->second.end()-4; ++it2){
		
			allelefile << "\t" << *it2;
		
		}
		allelefile << std::endl;
	}
	allelefile.close();
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %rsi, %r14
movq %rdi, %r15
movq 0x37f83(%rip), %rbx     # 0x40fc0
leaq 0x2a405(%rip), %rsi     # 0x33449
movl $0x23, %edx
movq %rbx, %rdi
callq 0x5420
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %rbx, %rdi
callq 0x5420
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5250
leaq 0x28(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movl $0x10, %edx
callq 0x5720
movq (%rbx), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x48(%rsp,%rax)
je 0x9164
movq 0x37f38(%rip), %rdi     # 0x40ff0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq 0x37f1d(%rip), %rdi     # 0x40ff0
callq 0x5030
movq %rax, %rdi
callq 0x5250
movq %rax, %rbx
leaq 0x2a346(%rip), %rsi     # 0x33430
movl $0x16, %edx
movq %rax, %rdi
callq 0x5420
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %rbx, %rdi
callq 0x5420
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5250
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movl $0x1, %ebx
movq %rax, %rdi
callq 0x5250
jmp 0x9231
movq 0x10(%r15), %r13
testq %r13, %r13
je 0x9225
leaq 0x18(%rsp), %r12
leaq 0x8(%rsp), %r14
leaq 0x2b12f(%rip), %r15     # 0x342b1
movq %r12, 0x8(%rsp)
movq 0x8(%r13), %rsi
movq 0x10(%r13), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x859a
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x5420
movl $0x28, %ebp
movl $0x1, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5420
movl (%r13,%rbp), %esi
movq %rbx, %rdi
callq 0x5690
addq $0x4, %rbp
cmpq $0x38, %rbp
jne 0x91b1
movq 0x28(%rsp), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5250
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x9218
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x53c0
movq (%r13), %r13
testq %r13, %r13
jne 0x9182
xorl %ebx, %ebx
leaq 0x28(%rsp), %rdi
callq 0x5530
movq 0x37d78(%rip), %rax     # 0x40fb0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x30(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x28(%rsp,%rcx)
callq 0x5330
leaq 0x120(%rsp), %rdi
callq 0x5120
movl %ebx, %eax
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x9279
movq %rax, %rbx
jmp 0x929a
jmp 0x9280
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x929a
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x53c0
leaq 0x28(%rsp), %rdi
callq 0x55a0
movq %rbx, %rdi
callq 0x56a0