// File: /workspace/github_cpp_makefile_star2_O2/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 0x8471
movq 0x2db5b(%rip), %rdi     # 0x35fb8
leaq 0x1cff9(%rip), %rsi     # 0x2545d
callq 0x53f0
movq %rax, %rdi
callq 0x51c0
leaq 0x10(%rsp), %r12
movq %r12, %rdi
callq 0x5450
xorl %r15d, %r15d
xorl %ebp, %ebp
movq (%rbx), %rsi
movq 0x8(%rbx), %rax
subq %rsi, %rax
sarq $0x5, %rax
cmpq %rax, %rbp
jae 0x84f9
addq %r15, %rsi
movq %r12, %rdi
pushq $0x8
popq %rdx
callq 0x5380
movq 0x10(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x30(%rsp,%rax)
jne 0x856f
movq %r12, %rdi
leaq 0x4(%rsp), %rsi
movq 0x8(%rsp), %rdx
callq 0x832b
testl %eax, %eax
jne 0x85c5
movl 0x4(%rsp), %r13d
testq %rbp, %rbp
je 0x84e5
cmpl %r13d, %r14d
jne 0x85a2
movq %r12, %rdi
callq 0x50a0
incq %rbp
addq $0x20, %r15
movl %r13d, %r14d
jmp 0x8483
xorl %r15d, %r15d
cmpb $0x0, (%rsp)
je 0x85c9
movq 0x8(%rsp), %rax
movq 0x8(%rax), %r12
subq (%rax), %r12
movq 0x2da9f(%rip), %rdi     # 0x35fb8
leaq 0x1e043(%rip), %rsi     # 0x26563
callq 0x53f0
shrq $0x5, %r12
movq %rax, %rdi
movl %r12d, %esi
callq 0x56a0
leaq 0x1cf65(%rip), %rsi     # 0x254a0
movq %rax, %rdi
callq 0x53f0
movq 0x8(%rbx), %rsi
subq (%rbx), %rsi
sarq $0x5, %rsi
movq %rax, %rdi
callq 0x5280
leaq 0x1e568(%rip), %rsi     # 0x26ac5
movq %rax, %rdi
callq 0x53f0
movq %rax, %rdi
callq 0x51c0
jmp 0x85c9
movq 0x2da7a(%rip), %rdi     # 0x35ff0
leaq 0x1ceaa(%rip), %rsi     # 0x25427
callq 0x53f0
addq (%rbx), %r15
movq %rax, %rdi
movq %r15, %rsi
callq 0x53a0
movq %rax, %rdi
callq 0x51c0
movq %rax, %rdi
callq 0x51c0
jmp 0x85c5
movq 0x2da47(%rip), %rdi     # 0x35ff0
leaq 0x1cecb(%rip), %rsi     # 0x2547b
callq 0x53f0
movq %rax, %rdi
callq 0x51c0
movq %rax, %rdi
callq 0x51c0
pushq $0x1
popq %r15
leaq 0x10(%rsp), %rdi
callq 0x50e0
movl %r15d, %eax
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x85f0
jmp 0x85f0
jmp 0x85f0
jmp 0x85f0
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x50e0
movq %rbx, %rdi
callq 0x56c0