// File: /workspace/github_cpp_makefile_star2_O3/simonrharris[P]SKA/src/kmers.cpp
// Function: collectSampleNames(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>>>> 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>>>>&, bool)
int collectSampleNames(const std::vector < std::string > & files, std::vector < std::string > & names, bool verbose){
	if (verbose){
		std::cout << "Collecting number of samples " << std::endl;
	}
	int kmersize;
	std::ifstream fileStream;
	for (std::string::size_type s = 0; s < files.size(); ++s){
		fileStream.open(files[s], std::ios::in);

		if (fileStream.fail()) {
			std::cerr << "Failed to open " << files[s] << std::endl << std::endl;
			return 1;
		}
		int newkmersize;

		if (readKmerHeader(fileStream, newkmersize, names)){return 1;}
		
		if (s==0){
			kmersize=newkmersize;
		}

		if (newkmersize!=kmersize){
			std::cerr << "kmer files have different kmer sizes" << std::endl << std::endl;
			return 1;
		}
		fileStream.close();
	}

	int numSamples=names.size();
	if (verbose){
		std::cout << "Found " << numSamples << " samples in " << files.size() << " files" << std::endl;
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movq %rsi, 0x8(%rsp)
movq %rdi, %rbx
movl %edx, (%rsp)
testl %edx, %edx
je 0x98b3
movq 0x37748(%rip), %r15     # 0x40fc0
leaq 0x29bee(%rip), %rsi     # 0x3346d
movl $0x1d, %edx
movq %r15, %rdi
callq 0x5420
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq %r15, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5250
leaq 0x10(%rsp), %rdi
callq 0x5410
movq (%rbx), %rsi
cmpq %rsi, 0x8(%rbx)
je 0x994a
xorl %r13d, %r13d
leaq 0x10(%rsp), %r15
xorl %ebp, %ebp
addq %r13, %rsi
movq %r15, %rdi
movl $0x8, %edx
callq 0x5350
movq 0x10(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x30(%rsp,%rax)
jne 0x99fb
movq %r15, %rdi
leaq 0x4(%rsp), %rsi
movq 0x8(%rsp), %rdx
callq 0x9684
testl %eax, %eax
jne 0x9af7
movl 0x4(%rsp), %r14d
testq %rbp, %rbp
je 0x9925
cmpl %r14d, %r12d
jne 0x9a87
movq %r15, %rdi
callq 0x50b0
incq %rbp
movq (%rbx), %rsi
movq 0x8(%rbx), %rax
subq %rsi, %rax
sarq $0x5, %rax
addq $0x20, %r13
movl %r14d, %r12d
cmpq %rax, %rbp
jb 0x98d4
xorl %r15d, %r15d
cmpb $0x0, (%rsp)
je 0x9afd
movq 0x8(%rsp), %rax
movq 0x8(%rax), %r12
subq (%rax), %r12
movq 0x37656(%rip), %rdi     # 0x40fc0
leaq 0x2ac1d(%rip), %rsi     # 0x3458e
movl $0x6, %edx
callq 0x5420
shrq $0x5, %r12
movq 0x3763a(%rip), %rdi     # 0x40fc0
movl %r12d, %esi
callq 0x5690
movq %rax, %r14
leaq 0x29b18(%rip), %rsi     # 0x334b0
movl $0xc, %edx
movq %rax, %rdi
callq 0x5420
movq 0x8(%rbx), %rsi
subq (%rbx), %rsi
sarq $0x5, %rsi
movq %r14, %rdi
callq 0x5240
movq %rax, %rbx
leaq 0x2b12f(%rip), %rsi     # 0x34af1
movl $0x6, %edx
movq %rax, %rdi
callq 0x5420
movq (%rbx), %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
jmp 0x9afd
movq 0x375ee(%rip), %rdi     # 0x40ff0
leaq 0x29a2e(%rip), %rsi     # 0x33437
movl $0xf, %edx
callq 0x5420
movq (%rbx), %rax
movq (%rax,%r13), %rsi
movq 0x8(%rax,%r13), %rdx
movq 0x375ca(%rip), %rdi     # 0x40ff0
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, %r15d
movq %rax, %rdi
callq 0x5250
jmp 0x9afd
movq 0x37562(%rip), %rbx     # 0x40ff0
leaq 0x299f6(%rip), %rsi     # 0x3348b
movl $0x24, %edx
movq %rbx, %rdi
callq 0x5420
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq 0x37530(%rip), %rdi     # 0x40ff0
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
movq %rax, %rdi
callq 0x5250
movl $0x1, %r15d
leaq 0x10(%rsp), %rdi
callq 0x50d0
movl %r15d, %eax
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x9b24
jmp 0x9b24
jmp 0x9b24
jmp 0x9b24
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x50d0
movq %rbx, %rdi
callq 0x56a0