// File: /workspace/github_cpp_makefile_star2_O2/simonrharris[P]SKA/src/kmers.cpp
// Function: getSubsample(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>>>> const&, std::vector<bool, std::allocator<bool>>&)
int getSubsample(const std::vector < std::string > & sample, const std::vector < std::string > & names, std::vector < bool > & include){
	std::set < std::string > sampleSet;

	if (sample.size()>0){
		for (std::vector < std::string >::const_iterator it=sample.begin(); it!=sample.end(); ++it){
			std::pair < std::set < std::string >::iterator,bool> ret = sampleSet.insert(*it);
			if (not ret.second){
				std::cerr << "Warning " << *it << " is in your sample file more than once" << std::endl;
			}
		}
		std::cout << sampleSet.size() << " unique sample names found in your sample file" << std::endl;
	}
	else {
		for (std::vector < std::string >::const_iterator it=names.begin(); it!=names.end(); ++it){
			sampleSet.insert(*it);
		}
	}

	std::vector < bool > included(sampleSet.size());

	for (std::vector < std::string >::const_iterator it=names.begin(); it!=names.end(); ++it){
		std::set < std::string >::iterator it2 = sampleSet.find(*it);
		if (it2 != sampleSet.end()){
			if (included[distance(sampleSet.begin(), it2)]==true){
				std::cerr << "Warning " << *it << " is in your input files more than once. Only the first occurrence will be kept" << std::endl;
			}
			else{
				included[distance(sampleSet.begin(), it2)]=true;
				include[distance(names.begin(), it)]=true;		
			}
		}
	}

	for (std::vector < bool >::iterator it=included.begin(); it!=included.end(); ++it){
		if (not *it){
			std::set < std::string >::iterator it2 = sampleSet.begin();
			advance(it2, distance(included.begin(), it));
			std::cerr << "Warning " << *it2 << " is in your sample file but not in any of your input files" << std::endl;
		}
	}
	std::cout << std::endl;

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdx, 0x8(%rsp)
movq %rsi, %r14
leaq 0x18(%rsp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
movq (%rdi), %r15
movq 0x8(%rdi), %rax
cmpq %r15, %rax
je 0x8874
movq %rdi, %rbx
leaq 0x10(%rsp), %r12
leaq 0x1ce59(%rip), %rbp     # 0x254ad
leaq 0x1ce5b(%rip), %r13     # 0x254b6
cmpq %rax, %r15
je 0x86a7
movq %r12, %rdi
movq %r15, %rsi
callq 0x9a1e
testb $0x1, %dl
jne 0x869d
movq 0x2d979(%rip), %rdi     # 0x35ff0
movq %rbp, %rsi
callq 0x53f0
movq %rax, %rdi
movq %r15, %rsi
callq 0x53a0
movq %rax, %rdi
movq %r13, %rsi
callq 0x53f0
movq %rax, %rdi
callq 0x51c0
addq $0x20, %r15
movq 0x8(%rbx), %rax
jmp 0x865b
movq 0x38(%rsp), %rsi
movq 0x2d905(%rip), %rdi     # 0x35fb8
callq 0x5280
leaq 0x1ce1e(%rip), %rsi     # 0x254dd
movq %rax, %rdi
callq 0x53f0
movq %rax, %rdi
callq 0x51c0
movq 0x38(%rsp), %rsi
leaq 0x40(%rsp), %rdi
movq %rsp, %rdx
callq 0x9076
movq (%r14), %rbx
leaq 0x10(%rsp), %r15
leaq 0x40(%rsp), %r12
movq %rbx, %r13
cmpq 0x8(%r14), %r13
je 0x87aa
movq %r15, %rdi
movq %r13, %rsi
callq 0x9c1c
movq %rax, %rbp
leaq 0x18(%rsp), %rax
cmpq %rax, %rbp
je 0x879d
movq 0x28(%rsp), %rdi
movq %rbp, %rsi
callq 0x91a3
movq %r12, %rdi
movq %rax, %rsi
callq 0x903c
testq %rdx, (%rax)
je 0x876b
movq 0x2d8b5(%rip), %rdi     # 0x35ff0
leaq 0x1cd6b(%rip), %rsi     # 0x254ad
callq 0x53f0
movq %rax, %rdi
movq %r13, %rsi
callq 0x53a0
movq %rax, %rdi
leaq 0x1cdb0(%rip), %rsi     # 0x2550c
callq 0x53f0
movq %rax, %rdi
callq 0x51c0
jmp 0x879d
movq 0x28(%rsp), %rdi
movq %rbp, %rsi
callq 0x91a3
movq %r12, %rdi
movq %rax, %rsi
callq 0x903c
orq %rdx, (%rax)
movq %rbx, %rsi
subq (%r14), %rsi
sarq $0x5, %rsi
movq 0x8(%rsp), %rdi
callq 0x903c
orq %rdx, (%rax)
addq $0x20, %r13
addq $0x20, %rbx
jmp 0x86f1
xorl %ebp, %ebp
movq 0x40(%rsp), %r13
movq 0x2d838(%rip), %r14     # 0x35ff0
leaq 0x1ccee(%rip), %r15     # 0x254ad
leaq 0x1cd95(%rip), %r12     # 0x2555b
xorl %ebx, %ebx
cmpq 0x50(%rsp), %r13
jne 0x87d5
cmpl 0x58(%rsp), %ebx
je 0x8843
movq (%r13), %rax
btq %rbx, %rax
jb 0x882c
movl %ebx, %eax
movq 0x28(%rsp), %rcx
movq %rcx, (%rsp)
movq %r13, %rcx
subq 0x40(%rsp), %rcx
leaq (%rax,%rcx,8), %rsi
movq %rsp, %rdi
callq 0x91de
movq %r14, %rdi
movq %r15, %rsi
callq 0x53f0
movq (%rsp), %rsi
addq $0x20, %rsi
movq %rax, %rdi
callq 0x53a0
movq %rax, %rdi
movq %r12, %rsi
callq 0x53f0
movq %rax, %rdi
callq 0x51c0
xorl %eax, %eax
cmpl $0x3f, %ebx
leal 0x1(%rbx), %ecx
sete %al
leaq (%r13,%rax,8), %r13
cmovel %ebp, %ecx
movl %ecx, %ebx
jmp 0x87c8
movq 0x2d76e(%rip), %rdi     # 0x35fb8
callq 0x51c0
leaq 0x40(%rsp), %rdi
callq 0x908a
leaq 0x10(%rsp), %rdi
callq 0x922a
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r14), %rbx
leaq 0x10(%rsp), %r15
cmpq 0x8(%r14), %rbx
je 0x86cf
movq %r15, %rdi
movq %rbx, %rsi
callq 0x9a1e
addq $0x20, %rbx
jmp 0x887c
jmp 0x88ac
jmp 0x88a7
jmp 0x88a7
jmp 0x88ac
jmp 0x88ac
jmp 0x88a7
jmp 0x88ac
jmp 0x88ac
movq %rax, %rbx
jmp 0x88b9
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x908a
leaq 0x10(%rsp), %rdi
callq 0x922a
movq %rbx, %rdi
callq 0x56c0