// File: /workspace/github_cpp_makefile_star2_O3/simonrharris[P]SKA/src/ska.cpp
// Function: uniqueSubcommand(int, char**)
int uniqueSubcommand(int argc, char *argv[]){

	std::string outfile="unique.skf";
	std::vector < std::string > ingroup;
	float minproportion=0.9;
	std::vector < std::string > args;
	bool allowNs = false;

	for (int i=2; i<argc; ++i){

		std::string arg=(argv[i]);

		if (arg=="-h" || arg=="--help"){
			uniqueHelp();
			return 0;
		}
		else if (arg == "-f"){
			i++;
			if (i<argc){
				fileToVector(argv[i], args);
			}
			else {
				std::cerr << std::endl << "Expecting file name after -f flag" << std::endl << std::endl;
				return 1;
			}
		}
		else if (arg == "-o"){
			i++;
			if (i<argc){
				outfile = std::string(argv[i])+".skf";
			}
			else {
				std::cerr << std::endl << "Expecting file name after -o flag" << std::endl << std::endl;
				return 1;
			}
		}
		else if (arg == "-i"){
			i++;
			if (i<argc){
				fileToVector(argv[i], ingroup);
			}
			else {
				std::cerr << std::endl << "Expecting file name after -i flag" << std::endl << std::endl;
				return 1;
			}
		}
		else if (arg == "-n"){
			allowNs = true;
		}
		else if (arg == "-p"){
			i++;
			if (i<argc){
				try {
					minproportion = getfloat(argv[i]);
				}
				catch (const std::invalid_argument& e) {
					std::cerr << std::endl << "Expecting float between 0 and 1 after -p flag" << std::endl << std::endl;
					return 1;
				}
			}
			else {
				std::cerr << std::endl << "Expecting float between 0 and 1 after -p flag" << std::endl << std::endl;
				return 1;
			}
			if (minproportion < 0 || minproportion > 1){
				std::cerr << std::endl << "Minimum proportion must be between 0 and 1" << std::endl << std::endl;
				return 1;
			}
		}
		else {
			args.push_back(arg);
		}
	}

	if (ingroup.size()<1){
		std::cerr << std::endl << "At least one ingroup kmer file must be specified" << std::endl;
		uniqueHelp();
		return 1;
	}

	if (args.size()<1){
		std::cerr << std::endl << "At least one kmer file must be specified" << std::endl;
		uniqueHelp();
		return 1;
	}

	skaVersion();

	std::cout << "Finding unique kmers in at least " << minproportion*100 << "% of ";
	for (std::vector < std::string >::iterator it = ingroup.begin(); it != ingroup.end(); ++it){
		std::cout << *it << " ";
	}

	std::cout << std::endl;

	std::cout << "Output will be written to " << outfile << std::endl;

	std::cout << std::endl;

	if (uniqueKmers(ingroup, args, minproportion, outfile, allowNs)){return 1;}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rsi, 0x10(%rsp)
movl %edi, %ebp
leaq 0x70(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x6a72(%rip), %rsi      # 0x36ba8
leaq 0x6a75(%rip), %rdx      # 0x36bb2
leaq 0x60(%rsp), %rdi
callq 0x85fc
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
xorl %eax, %eax
movq %rax, 0x50(%rsp)
movl $0x3f666666, 0x8(%rsp)  # imm = 0x3F666666
movq %rax, 0x90(%rsp)
movaps %xmm0, 0x80(%rsp)
cmpl $0x3, %ebp
jl 0x30977
leaq 0x30(%rsp), %r12
movl $0x2, %r14d
movl $0x0, 0x1c(%rsp)
leaq 0xb8(%rsp), %r15
movslq %r14d, %rax
movq 0x10(%rsp), %rcx
movq (%rcx,%rax,8), %rsi
movq %r15, %rdi
leaq 0x20(%rsp), %rdx
callq 0x182e0
movq %r15, %rdi
leaq 0x4e6a(%rip), %rsi      # 0x3501f
callq 0x50f0
testl %eax, %eax
je 0x30264
movq %r15, %rdi
leaq 0x4e56(%rip), %rsi      # 0x35022
callq 0x50f0
testl %eax, %eax
je 0x30264
movq %r15, %rdi
leaq 0x4ebc(%rip), %rsi      # 0x3509f
callq 0x50f0
testl %eax, %eax
je 0x30274
movq %r15, %rdi
leaq 0x512f(%rip), %rsi      # 0x35329
callq 0x50f0
testl %eax, %eax
je 0x302b6
movq %r15, %rdi
leaq 0x5360(%rip), %rsi      # 0x35571
callq 0x50f0
testl %eax, %eax
je 0x303bc
movq %r15, %rdi
leaq 0x698b(%rip), %rsi      # 0x36bb3
callq 0x50f0
movb $0x1, %r12b
testl %eax, %eax
je 0x304ae
movq %r15, %rdi
leaq 0x5109(%rip), %rsi      # 0x3534b
callq 0x50f0
testl %eax, %eax
je 0x30559
leaq 0x80(%rsp), %rdi
movq %r15, %rsi
callq 0x8528
jmp 0x30735
xorl %r12d, %r12d
callq 0x2fe68
xorl %r13d, %r13d
jmp 0x30735
incl %r14d
cmpl %ebp, %r14d
jge 0x3031c
movslq %r14d, %rax
movq 0x10(%rsp), %rcx
movq (%rcx,%rax,8), %rsi
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
leaq 0x98(%rsp), %rdx
callq 0x182e0
movq %rbx, %rdi
leaq 0x80(%rsp), %rsi
callq 0x8148
jmp 0x303f6
incl %r14d
cmpl %ebp, %r14d
jge 0x3040e
movslq %r14d, %rax
movq 0x10(%rsp), %rcx
movq (%rcx,%rax,8), %rsi
leaq 0x98(%rsp), %rbx
movq %rbx, %rdi
leaq 0xf(%rsp), %rdx
callq 0x182e0
movq %rbx, %rdi
leaq 0x5a61(%rip), %rsi      # 0x35d4e
callq 0x5710
movq %r12, 0x20(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3061e
movq %rdx, 0x20(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x30(%rsp)
jmp 0x30626
movq 0x10ccd(%rip), %rcx     # 0x40ff0
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq 0x10caf(%rip), %rdi     # 0x40ff0
callq 0x5030
movq %rax, %rdi
callq 0x5250
movq %rax, %r13
movl $0x21, %edx
movq %rax, %rdi
leaq 0x4d42(%rip), %rsi      # 0x350a2
callq 0x5420
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq %r13, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5250
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq %r13, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5250
jmp 0x3072c
incl %r14d
cmpl %ebp, %r14d
jge 0x304b9
movslq %r14d, %rax
movq 0x10(%rsp), %rcx
movq (%rcx,%rax,8), %rsi
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
leaq 0x98(%rsp), %rdx
callq 0x182e0
movq %rbx, %rdi
leaq 0x40(%rsp), %rsi
callq 0x8148
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0x30689
movq 0x30(%rsp), %rsi
jmp 0x30681
movq 0x10bdb(%rip), %rcx     # 0x40ff0
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq 0x10bbd(%rip), %rdi     # 0x40ff0
callq 0x5030
movq %rax, %rdi
callq 0x5250
movq %rax, %r13
movl $0x21, %edx
movq %rax, %rdi
leaq 0x5122(%rip), %rsi      # 0x35574
callq 0x5420
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq %r13, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5250
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq %r13, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5250
jmp 0x3072c
movb $0x1, %al
movl %eax, 0x1c(%rsp)
jmp 0x30735
movq 0x10b30(%rip), %rcx     # 0x40ff0
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq 0x10b12(%rip), %rdi     # 0x40ff0
callq 0x5030
movq %rax, %rdi
callq 0x5250
movq %rax, %r13
movl $0x21, %edx
movq %rax, %rdi
leaq 0x5e15(%rip), %rsi      # 0x36312
callq 0x5420
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq %r13, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5250
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq %r13, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5250
jmp 0x3072c
incl %r14d
cmpl %ebp, %r14d
jge 0x30691
movslq %r14d, %rax
movq 0x10(%rsp), %rcx
movq (%rcx,%rax,8), %rdi
callq 0x25d65
movss %xmm0, 0x8(%rsp)
xorps %xmm1, %xmm1
ucomiss %xmm0, %xmm1
ja 0x30591
ucomiss 0x2a79(%rip), %xmm0     # 0x33004
jbe 0x30735
movq 0x10a58(%rip), %rcx     # 0x40ff0
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq 0x10a3a(%rip), %rdi     # 0x40ff0
callq 0x5030
movq %rax, %rdi
callq 0x5250
movq %rax, %r13
movl $0x2a, %edx
movq %rax, %rdi
leaq 0x4da7(%rip), %rsi      # 0x3537c
callq 0x5420
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq %r13, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5250
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x53a0
jmp 0x30719
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
movq %rdx, 0x28(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x60(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x5470
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0x30664
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x53c0
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0x30689
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x53c0
movb $0x1, %r12b
jmp 0x30735
movq 0x10958(%rip), %rcx     # 0x40ff0
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq 0x1093a(%rip), %rdi     # 0x40ff0
callq 0x5030
movq %rax, %rdi
callq 0x5250
movq %rax, %r13
movl $0x2d, %edx
movq %rax, %rdi
leaq 0x4c79(%rip), %rsi      # 0x3534e
callq 0x5420
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq %r13, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5250
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq %r13, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5250
movl $0x1, %r13d
xorl %r12d, %r12d
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0x3075a
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x53c0
testb %r12b, %r12b
je 0x307c3
incl %r14d
cmpl %ebp, %r14d
leaq 0x30(%rsp), %r12
jl 0x30192
jmp 0x307cd
movq %rax, %r13
cmpl $0x1, %edx
jne 0x30afc
movq %r13, %rdi
callq 0x5160
movq 0x10863(%rip), %rdi     # 0x40ff0
callq 0x5190
movq %rax, %r13
movl $0x2d, %edx
movq %rax, %rdi
leaq 0x4baa(%rip), %rsi      # 0x3534e
callq 0x5420
movq %r13, %rdi
callq 0x5190
movq %rax, %rdi
callq 0x5190
callq 0x5630
jmp 0x3072c
leaq 0x70(%rsp), %r15
jmp 0x309ef
movq 0x48(%rsp), %rax
cmpq 0x40(%rsp), %rax
leaq 0x70(%rsp), %r15
je 0x30977
movq 0x88(%rsp), %rax
cmpq 0x80(%rsp), %rax
je 0x30a32
callq 0x26352
movq 0x107bc(%rip), %rdi     # 0x40fc0
leaq 0x6405(%rip), %rsi      # 0x36c10
movl $0x21, %edx
callq 0x5420
movss 0x8(%rsp), %xmm0
mulss 0x2e59(%rip), %xmm0     # 0x3367c
cvtss2sd %xmm0, %xmm0
movq 0x10792(%rip), %rbx     # 0x40fc0
movq %rbx, %rdi
callq 0x5610
leaq 0x63f5(%rip), %rsi      # 0x36c32
movl $0x5, %edx
movq %rax, %rdi
callq 0x5420
movq 0x40(%rsp), %r12
cmpq 0x48(%rsp), %r12
je 0x30890
movq 0x10763(%rip), %r14     # 0x40fc0
leaq 0x3b24(%rip), %r15      # 0x34388
movq (%r12), %rsi
movq 0x8(%r12), %rdx
movq %r14, %rdi
callq 0x5420
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x5420
addq $0x20, %r12
cmpq 0x48(%rsp), %r12
jne 0x30864
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
leaq 0x70(%rsp), %r15
callq 0x53a0
movsbl %al, %esi
movq 0x1070d(%rip), %rdi     # 0x40fc0
callq 0x5030
movq %rax, %rdi
callq 0x5250
movq 0x106f9(%rip), %rdi     # 0x40fc0
leaq 0x4b76(%rip), %rsi      # 0x35444
movl $0x1a, %edx
callq 0x5420
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
movq 0x106d7(%rip), %rbx     # 0x40fc0
movq %rbx, %rdi
callq 0x5420
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq %r14, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5250
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq 0x10687(%rip), %rdi     # 0x40fc0
callq 0x5030
movq %rax, %rdi
callq 0x5250
movzbl 0x1c(%rsp), %r8d
andl $0x1, %r8d
leaq 0x40(%rsp), %rdi
leaq 0x80(%rsp), %rsi
leaq 0x8(%rsp), %rdx
leaq 0x60(%rsp), %rcx
callq 0x22de0
xorl %r13d, %r13d
testl %eax, %eax
setne %r13b
jmp 0x309ef
movq 0x10672(%rip), %rdi     # 0x40ff0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq 0x10657(%rip), %rdi     # 0x40ff0
callq 0x5030
movq %rax, %rdi
callq 0x5250
movq %rax, %rbx
leaq 0x6206(%rip), %rsi      # 0x36bb6
movl $0x30, %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
movl $0x1, %r13d
callq 0x2fe68
leaq 0x80(%rsp), %rdi
callq 0xab8e
leaq 0x40(%rsp), %rdi
callq 0xab8e
movq 0x60(%rsp), %rdi
cmpq %r15, %rdi
je 0x30a1d
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x53c0
movl %r13d, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x105b7(%rip), %rdi     # 0x40ff0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x53a0
movsbl %al, %esi
movq 0x1059c(%rip), %rdi     # 0x40ff0
callq 0x5030
movq %rax, %rdi
callq 0x5250
movq %rax, %rbx
leaq 0x617c(%rip), %rsi      # 0x36be7
movl $0x28, %edx
movq %rax, %rdi
callq 0x5420
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x53a0
jmp 0x309d1
jmp 0x30af9
movq %rax, %r13
callq 0x5630
jmp 0x30afc
movq %rax, %rdi
callq 0x7d38
jmp 0x30acd
jmp 0x30af9
movq %rax, %r13
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0x30afc
movq 0xa8(%rsp), %rsi
jmp 0x30adf
jmp 0x30af9
movq %rax, %r13
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0x30afc
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x53c0
jmp 0x30afc
jmp 0x30af9
movq %rax, %r13
jmp 0x30b54
jmp 0x30af4
jmp 0x30af4
movq %rax, %r13
jmp 0x30b21
movq %rax, %r13
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0x30b21
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x53c0
leaq 0x80(%rsp), %rdi
callq 0xab8e
leaq 0x40(%rsp), %rdi
callq 0xab8e
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x30b54
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x53c0
movq %r13, %rdi
callq 0x56a0