// File: /workspace/github_cpp_makefile_star2_O1/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 0x9911
movq 0x376ea(%rip), %r15     # 0x40fc0
leaq 0x29b90(%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 0x9a2b
xorl %r13d, %r13d
leaq 0x10(%rsp), %r15
xorl %r12d, %r12d
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 0x9adc
movq %r15, %rdi
leaq 0x4(%rsp), %rsi
movq 0x8(%rsp), %rdx
callq 0x96e2
testl %eax, %eax
jne 0x9a02
testq %r12, %r12
movl 0x4(%rsp), %eax
cmovel %eax, %r14d
cmpl %r14d, %eax
jne 0x998e
movb $0x1, %bpl
movq %r15, %rdi
callq 0x50b0
jmp 0x9a04
movl $0x24, %edx
movq 0x37656(%rip), %rdi     # 0x40ff0
leaq 0x29aea(%rip), %rsi     # 0x3348b
callq 0x5420
movq 0x37643(%rip), %rcx     # 0x40ff0
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq 0x37625(%rip), %rdi     # 0x40ff0
callq 0x5030
movq %rax, %rdi
callq 0x5250
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq %rbp, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5250
xorl %ebp, %ebp
testb %bpl, %bpl
je 0x9b68
incq %r12
movq (%rbx), %rsi
movq 0x8(%rbx), %rax
subq %rsi, %rax
sarq $0x5, %rax
addq $0x20, %r13
cmpq %rax, %r12
jb 0x9933
xorl %r15d, %r15d
cmpb $0x0, (%rsp)
je 0x9b6e
movq 0x8(%rsp), %rax
movq 0x8(%rax), %r12
subq (%rax), %r12
movq 0x37575(%rip), %rdi     # 0x40fc0
leaq 0x2ab4c(%rip), %rsi     # 0x3459e
movl $0x6, %edx
callq 0x5420
shrq $0x5, %r12
movq 0x37559(%rip), %rdi     # 0x40fc0
movl %r12d, %esi
callq 0x5690
movq %rax, %r14
leaq 0x29a37(%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 0x2b05e(%rip), %rsi     # 0x34b01
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 0x9b6e
movq 0x3750d(%rip), %rdi     # 0x40ff0
leaq 0x2994d(%rip), %rsi     # 0x33437
movl $0xf, %edx
callq 0x5420
movq (%rbx), %rax
movq (%rax,%r13), %rsi
movq 0x8(%rax,%r13), %rdx
movq 0x374e9(%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 0x9b6e
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 0x9b93
jmp 0x9b93
jmp 0x9b93
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x50d0
movq %rbx, %rdi
callq 0x56a0