// File: 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
movq %rsp, %rbp
subq $0x2b0, %rsp            # imm = 0x2B0
movb %dl, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
andb $0x1, %al
movb %al, -0x19(%rbp)
testb $0x1, -0x19(%rbp)
je 0xcf12
movq 0x6c0b1(%rip), %rdi     # 0x78fa8
leaq 0x4c56f(%rip), %rsi     # 0x5946d
callq 0x6520
movq %rax, %rdi
movq 0x6c083(%rip), %rsi     # 0x78f90
callq 0x6570
leaq -0x228(%rbp), %rdi
callq 0x65f0
movq $0x0, -0x230(%rbp)
movq -0x230(%rbp), %rax
movq %rax, -0x250(%rbp)
movq -0x10(%rbp), %rdi
callq 0xb670
movq %rax, %rcx
movq -0x250(%rbp), %rax
cmpq %rcx, %rax
jae 0xd13e
movq -0x10(%rbp), %rdi
movq -0x230(%rbp), %rsi
callq 0xf2d0
movq %rax, %rsi
leaq -0x228(%rbp), %rdi
movl $0x8, %edx
callq 0x6490
jmp 0xcf79
movq -0x228(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x228(%rbp,%rax), %rdi
callq 0x6030
movb %al, -0x251(%rbp)
jmp 0xcf99
movb -0x251(%rbp), %al
testb $0x1, %al
jne 0xcfa8
jmp 0xd056
movq 0x6c041(%rip), %rdi     # 0x78ff0
leaq 0x4c481(%rip), %rsi     # 0x59437
callq 0x6520
movq %rax, -0x260(%rbp)
jmp 0xcfc4
movq -0x10(%rbp), %rdi
movq -0x230(%rbp), %rsi
callq 0xf2d0
movq -0x260(%rbp), %rdi
movq %rax, %rsi
callq 0x64d0
movq %rax, -0x268(%rbp)
jmp 0xcfec
movq -0x268(%rbp), %rdi
movq 0x6bf96(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x270(%rbp)
jmp 0xd008
movq -0x270(%rbp), %rdi
movq 0x6bf7a(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0xd01d
movl $0x1, -0x4(%rbp)
movl $0x1, -0x240(%rbp)
jmp 0xd20f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
leaq -0x228(%rbp), %rdi
callq 0x6140
jmp 0xd227
movq -0x18(%rbp), %rdx
leaq -0x228(%rbp), %rdi
leaq -0x244(%rbp), %rsi
callq 0xcd40
movl %eax, -0x274(%rbp)
jmp 0xd075
movl -0x274(%rbp), %eax
cmpl $0x0, %eax
je 0xd096
movl $0x1, -0x4(%rbp)
movl $0x1, -0x240(%rbp)
jmp 0xd20f
cmpq $0x0, -0x230(%rbp)
jne 0xd0a9
movl -0x244(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x244(%rbp), %eax
cmpl -0x20(%rbp), %eax
je 0xd117
movq 0x6bf35(%rip), %rdi     # 0x78ff0
leaq 0x4c3c9(%rip), %rsi     # 0x5948b
callq 0x6520
movq %rax, -0x280(%rbp)
jmp 0xd0d0
movq -0x280(%rbp), %rdi
movq 0x6beb2(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x288(%rbp)
jmp 0xd0ec
movq -0x288(%rbp), %rdi
movq 0x6be96(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0xd101
movl $0x1, -0x4(%rbp)
movl $0x1, -0x240(%rbp)
jmp 0xd20f
leaq -0x228(%rbp), %rdi
callq 0x60f0
jmp 0xd125
jmp 0xd127
movq -0x230(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x230(%rbp)
jmp 0xcf29
movq -0x18(%rbp), %rdi
callq 0xb670
movl %eax, -0x248(%rbp)
testb $0x1, -0x19(%rbp)
je 0xd1fe
movq 0x6be4a(%rip), %rdi     # 0x78fa8
leaq 0x4d3ee(%rip), %rsi     # 0x5a553
callq 0x6520
movq %rax, -0x290(%rbp)
jmp 0xd173
movq -0x290(%rbp), %rdi
movl -0x248(%rbp), %esi
callq 0x68d0
movq %rax, -0x298(%rbp)
jmp 0xd18e
movq -0x298(%rbp), %rdi
leaq 0x4c314(%rip), %rsi     # 0x594b0
callq 0x6520
movq %rax, -0x2a0(%rbp)
jmp 0xd1aa
movq -0x10(%rbp), %rdi
callq 0xb670
movq -0x2a0(%rbp), %rdi
movq %rax, %rsi
callq 0x6120
movq %rax, -0x2a8(%rbp)
jmp 0xd1cb
movq -0x2a8(%rbp), %rdi
leaq 0x4d8e0(%rip), %rsi     # 0x5aab9
callq 0x6520
movq %rax, -0x2b0(%rbp)
jmp 0xd1e7
movq -0x2b0(%rbp), %rdi
movq 0x6bd9b(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0xd1fc
jmp 0xd1fe
movl $0x0, -0x4(%rbp)
movl $0x1, -0x240(%rbp)
leaq -0x228(%rbp), %rdi
callq 0x6140
movl -0x4(%rbp), %eax
addq $0x2b0, %rsp            # imm = 0x2B0
popq %rbp
retq
movq -0x238(%rbp), %rdi
callq 0x6900
nopw %cs:(%rax,%rax)