// File: /workspace/github_cpp_makefile_star2_O3/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 0x37fdf(%rip), %rbx     # 0x40fc0
leaq 0x2a461(%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 0x9108
movq 0x37f94(%rip), %rdi     # 0x40ff0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq 0x37f79(%rip), %rdi     # 0x40ff0
callq 0x5030
movq %rax, %rdi
callq 0x5250
movq %rax, %rbx
leaq 0x2a3a2(%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 0x91d5
movq 0x10(%r15), %r13
testq %r13, %r13
je 0x91c9
leaq 0x18(%rsp), %r12
leaq 0x8(%rsp), %r14
leaq 0x2b17b(%rip), %r15     # 0x342a1
movq %r12, 0x8(%rsp)
movq 0x8(%r13), %rsi
movq 0x10(%r13), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x8566
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 0x9155
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 0x91bc
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x53c0
movq (%r13), %r13
testq %r13, %r13
jne 0x9126
xorl %ebx, %ebx
leaq 0x28(%rsp), %rdi
callq 0x5530
movq 0x37dd4(%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 0x921d
movq %rax, %rbx
jmp 0x923e
jmp 0x9224
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x923e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x53c0
leaq 0x28(%rsp), %rdi
callq 0x55a0
movq %rbx, %rdi
callq 0x56a0