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

	std::vector < std::string > args;
	std::string queryfile="";

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

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

		if (arg=="-h" || arg=="--help"){
			compareHelp();
			return 0;
		}
		else if (arg == "-q"){
			i++;
			if (i<argc){
				queryfile = argv[i];
			}
			else {
				std::cerr << std::endl << "Expecting file name after -q flag" << std::endl << std::endl;
				return 1;
			}
		}
		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[0]=='-'){
			std::cerr << std::endl << "Unrecognised flag " << arg << std::endl << std::endl;
				return 1;
		}
		else {
			args.push_back(arg);
		}
	}

	if (args.size()<1){
		std::cerr << std::endl << "Too few arguments" << std::endl;
		compareHelp();
		return 1;
	}

	if (queryfile==""){
		std::cerr << std::endl << "Query kmer file is required" << std::endl;
		compareHelp();
		return 1;
	}

	if (compareKmerFiles(queryfile, args)){return 1;}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x1ab40
leaq -0x49(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
callq 0x6910
movq -0xb8(%rbp), %rdx
leaq 0xb589(%rip), %rsi      # 0x5a2b2
leaq -0x48(%rbp), %rdi
callq 0xab20
jmp 0x4ed34
leaq -0x49(%rbp), %rdi
callq 0x65a0
movl $0x2, -0x60(%rbp)
movl -0x60(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x4f19b
movq -0x10(%rbp), %rax
movslq -0x60(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xc8(%rbp)
leaq -0x81(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
callq 0x6910
movq -0xc8(%rbp), %rsi
movq -0xc0(%rbp), %rdx
leaq -0x80(%rbp), %rdi
callq 0xab20
jmp 0x4ed8f
leaq -0x81(%rbp), %rdi
callq 0x65a0
leaq 0xc245(%rip), %rsi      # 0x5afe7
leaq -0x80(%rbp), %rdi
callq 0x2dce0
movb %al, -0xc9(%rbp)
jmp 0x4edb3
movb -0xc9(%rbp), %al
testb $0x1, %al
jne 0x4ede3
jmp 0x4edbf
leaq 0xc224(%rip), %rsi      # 0x5afea
leaq -0x80(%rbp), %rdi
callq 0x2dce0
movb %al, -0xca(%rbp)
jmp 0x4edd7
movb -0xca(%rbp), %al
testb $0x1, %al
jne 0x4ede3
jmp 0x4ee48
callq 0x4ebe0
jmp 0x4edea
movl $0x0, -0x4(%rbp)
movl $0x1, -0x88(%rbp)
jmp 0x4f164
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x49(%rbp), %rdi
callq 0x65a0
jmp 0x4f31b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x81(%rbp), %rdi
callq 0x65a0
jmp 0x4f312
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x4f18d
leaq 0xc895(%rip), %rsi      # 0x5b6e4
leaq -0x80(%rbp), %rdi
callq 0x2dce0
movb %al, -0xcb(%rbp)
jmp 0x4ee60
movb -0xcb(%rbp), %al
testb $0x1, %al
jne 0x4ee6f
jmp 0x4ef1d
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
movl -0x60(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x4ee99
movq -0x10(%rbp), %rax
movslq -0x60(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq -0x48(%rbp), %rdi
callq 0x6710
jmp 0x4ee97
jmp 0x4ef18
movq 0x2a150(%rip), %rdi     # 0x78ff0
movq 0x2a0e9(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0xd8(%rbp)
jmp 0x4eeb5
movq -0xd8(%rbp), %rdi
leaq 0xc824(%rip), %rsi      # 0x5b6e7
callq 0x6520
movq %rax, -0xe0(%rbp)
jmp 0x4eed1
movq -0xe0(%rbp), %rdi
movq 0x2a0b1(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0xe8(%rbp)
jmp 0x4eeed
movq -0xe8(%rbp), %rdi
movq 0x2a095(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x4ef02
movl $0x1, -0x4(%rbp)
movl $0x1, -0x88(%rbp)
jmp 0x4f164
jmp 0x4f158
leaq 0xc143(%rip), %rsi      # 0x5b067
leaq -0x80(%rbp), %rdi
callq 0x2dce0
movb %al, -0xe9(%rbp)
jmp 0x4ef35
movb -0xe9(%rbp), %al
testb $0x1, %al
jne 0x4ef44
jmp 0x4f085
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
movl -0x60(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x4f001
movq -0x10(%rbp), %rax
movslq -0x60(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x100(%rbp)
leaq -0xa9(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
callq 0x6910
movq -0x100(%rbp), %rsi
movq -0xf8(%rbp), %rdx
leaq -0xa8(%rbp), %rdi
callq 0xab20
jmp 0x4ef9b
leaq -0xa8(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0xa6a0
jmp 0x4efad
leaq -0xa8(%rbp), %rdi
callq 0x6a08
leaq -0xa9(%rbp), %rdi
callq 0x65a0
jmp 0x4f080
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x4eff0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x6a08
leaq -0xa9(%rbp), %rdi
callq 0x65a0
jmp 0x4f18d
movq 0x29fe8(%rip), %rdi     # 0x78ff0
movq 0x29f81(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x108(%rbp)
jmp 0x4f01d
movq -0x108(%rbp), %rdi
leaq 0xc03f(%rip), %rsi      # 0x5b06a
callq 0x6520
movq %rax, -0x110(%rbp)
jmp 0x4f039
movq -0x110(%rbp), %rdi
movq 0x29f49(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x118(%rbp)
jmp 0x4f055
movq -0x118(%rbp), %rdi
movq 0x29f2d(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x4f06a
movl $0x1, -0x4(%rbp)
movl $0x1, -0x88(%rbp)
jmp 0x4f164
jmp 0x4f156
xorl %eax, %eax
movl %eax, %esi
leaq -0x80(%rbp), %rdi
callq 0x69e0
movq %rax, -0x120(%rbp)
jmp 0x4f09b
movq -0x120(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x4f143
movq 0x29f3b(%rip), %rdi     # 0x78ff0
movq 0x29ed4(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x128(%rbp)
jmp 0x4f0ca
movq -0x128(%rbp), %rdi
leaq 0xbfb4(%rip), %rsi      # 0x5b08c
callq 0x6520
movq %rax, -0x130(%rbp)
jmp 0x4f0e6
movq -0x130(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x64d0
movq %rax, -0x138(%rbp)
jmp 0x4f0ff
movq -0x138(%rbp), %rdi
movq 0x29e83(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x140(%rbp)
jmp 0x4f11b
movq -0x140(%rbp), %rdi
movq 0x29e67(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x4f130
movl $0x1, -0x4(%rbp)
movl $0x1, -0x88(%rbp)
jmp 0x4f164
leaq -0x28(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0xabd0
jmp 0x4f152
jmp 0x4f154
jmp 0x4f156
jmp 0x4f158
jmp 0x4f15a
movl $0x0, -0x88(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x6a08
movl -0x88(%rbp), %eax
testl %eax, %eax
jne 0x4f2f4
jmp 0x4f17d
jmp 0x4f17f
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x4ed44
leaq -0x80(%rbp), %rdi
callq 0x6a08
jmp 0x4f312
leaq -0x28(%rbp), %rdi
callq 0xb670
cmpq $0x1, %rax
jae 0x4f225
movq 0x29e3f(%rip), %rdi     # 0x78ff0
movq 0x29dd8(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x148(%rbp)
jmp 0x4f1c6
movq -0x148(%rbp), %rdi
leaq 0xbecb(%rip), %rsi      # 0x5b09f
callq 0x6520
movq %rax, -0x150(%rbp)
jmp 0x4f1e2
movq -0x150(%rbp), %rdi
movq 0x29da0(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x4f1f7
callq 0x4ebe0
jmp 0x4f1fe
movl $0x1, -0x4(%rbp)
movl $0x1, -0x88(%rbp)
jmp 0x4f2f4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x4f312
leaq 0xb086(%rip), %rsi      # 0x5a2b2
leaq -0x48(%rbp), %rdi
callq 0x2dce0
movb %al, -0x151(%rbp)
jmp 0x4f23d
movb -0x151(%rbp), %al
testb $0x1, %al
jne 0x4f249
jmp 0x4f2b0
movq 0x29da0(%rip), %rdi     # 0x78ff0
movq 0x29d39(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x160(%rbp)
jmp 0x4f265
movq -0x160(%rbp), %rdi
leaq 0xc496(%rip), %rsi      # 0x5b709
callq 0x6520
movq %rax, -0x168(%rbp)
jmp 0x4f281
movq -0x168(%rbp), %rdi
movq 0x29d01(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x4f296
callq 0x4ebe0
jmp 0x4f29d
movl $0x1, -0x4(%rbp)
movl $0x1, -0x88(%rbp)
jmp 0x4f2f4
leaq -0x48(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x1e470
movl %eax, -0x16c(%rbp)
jmp 0x4f2c5
movl -0x16c(%rbp), %eax
cmpl $0x0, %eax
je 0x4f2e3
movl $0x1, -0x4(%rbp)
movl $0x1, -0x88(%rbp)
jmp 0x4f2f4
movl $0x0, -0x4(%rbp)
movl $0x1, -0x88(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x6a08
leaq -0x28(%rbp), %rdi
callq 0xfe90
movl -0x4(%rbp), %eax
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
leaq -0x48(%rbp), %rdi
callq 0x6a08
leaq -0x28(%rbp), %rdi
callq 0xfe90
movq -0x58(%rbp), %rdi
callq 0x6900
nopl (%rax)