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

	std::string inputfile="";
	std::string outfile="humanised_kmers.tsv";

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

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

		if (arg=="-h" || arg=="--help"){
			infoHelp();
			return 0;
		}
		else if (arg == "-i"){
			i++;
			if (i<argc){
				inputfile = argv[i];
			}
			else {
				std::cerr << std::endl << "Expecting file name after -i flag" << std::endl << std::endl;
				return 1;
			}
		}
		else if (arg == "-o"){
			i++;
			if (i<argc){
				outfile = std::string(argv[i])+".tsv";
			}
			else {
				std::cerr << std::endl << "Expecting file name after -o 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 {
			std::cerr << std::endl << "Unrecognised argument " << arg << std::endl << std::endl;
			return 1;
		}
	}


	if (inputfile==""){
		std::cerr << std::endl << "Input kmer file is required" << std::endl;
		humaniseHelp();
		return 1;
	}

	if (humaniseKmers(inputfile, outfile)){return 1;}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1c0, %rsp            # imm = 0x1C0
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x31(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0x6910
movq -0xe8(%rbp), %rdx
leaq 0x7852(%rip), %rsi      # 0x5a2b2
leaq -0x30(%rbp), %rdi
callq 0xab20
jmp 0x52a6b
leaq -0x31(%rbp), %rdi
callq 0x65a0
leaq -0x69(%rbp), %rdi
movq %rdi, -0xf0(%rbp)
callq 0x6910
movq -0xf0(%rbp), %rdx
leaq 0x9834(%rip), %rsi      # 0x5c2c6
leaq -0x68(%rbp), %rdi
callq 0xab20
jmp 0x52a9d
leaq -0x69(%rbp), %rdi
callq 0x65a0
movl $0x2, -0x70(%rbp)
movl -0x70(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x52fe7
movq -0x10(%rbp), %rax
movslq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x100(%rbp)
leaq -0x91(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
callq 0x6910
movq -0x100(%rbp), %rsi
movq -0xf8(%rbp), %rdx
leaq -0x90(%rbp), %rdi
callq 0xab20
jmp 0x52afb
leaq -0x91(%rbp), %rdi
callq 0x65a0
leaq 0x84d9(%rip), %rsi      # 0x5afe7
leaq -0x90(%rbp), %rdi
callq 0x2dce0
movb %al, -0x101(%rbp)
jmp 0x52b22
movb -0x101(%rbp), %al
testb $0x1, %al
jne 0x52b55
jmp 0x52b2e
leaq 0x84b5(%rip), %rsi      # 0x5afea
leaq -0x90(%rbp), %rdi
callq 0x2dce0
movb %al, -0x102(%rbp)
jmp 0x52b49
movb -0x102(%rbp), %al
testb $0x1, %al
jne 0x52b55
jmp 0x52bd4
callq 0x53100
jmp 0x52b5c
movl $0x0, -0x4(%rbp)
movl $0x1, -0x98(%rbp)
jmp 0x52faa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x31(%rbp), %rdi
callq 0x65a0
jmp 0x530f4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x69(%rbp), %rdi
callq 0x65a0
jmp 0x530eb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x91(%rbp), %rdi
callq 0x65a0
jmp 0x530e2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x52fd6
leaq 0x895e(%rip), %rsi      # 0x5b539
leaq -0x90(%rbp), %rdi
callq 0x2dce0
movb %al, -0x103(%rbp)
jmp 0x52bef
movb -0x103(%rbp), %al
testb $0x1, %al
jne 0x52bfe
jmp 0x52cac
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
movl -0x70(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x52c28
movq -0x10(%rbp), %rax
movslq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq -0x30(%rbp), %rdi
callq 0x6710
jmp 0x52c26
jmp 0x52ca7
movq 0x263c1(%rip), %rdi     # 0x78ff0
movq 0x2635a(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x110(%rbp)
jmp 0x52c44
movq -0x110(%rbp), %rdi
leaq 0x9688(%rip), %rsi      # 0x5c2da
callq 0x6520
movq %rax, -0x118(%rbp)
jmp 0x52c60
movq -0x118(%rbp), %rdi
movq 0x26322(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x120(%rbp)
jmp 0x52c7c
movq -0x120(%rbp), %rdi
movq 0x26306(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x52c91
movl $0x1, -0x4(%rbp)
movl $0x1, -0x98(%rbp)
jmp 0x52faa
jmp 0x52f9e
leaq 0x863e(%rip), %rsi      # 0x5b2f1
leaq -0x90(%rbp), %rdi
callq 0x2dce0
movb %al, -0x121(%rbp)
jmp 0x52cc7
movb -0x121(%rbp), %al
testb $0x1, %al
jne 0x52cd6
jmp 0x52e3d
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
movl -0x70(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x52db9
movq -0x10(%rbp), %rax
movslq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x138(%rbp)
leaq -0xd9(%rbp), %rdi
movq %rdi, -0x130(%rbp)
callq 0x6910
movq -0x138(%rbp), %rsi
movq -0x130(%rbp), %rdx
leaq -0xd8(%rbp), %rdi
callq 0xab20
jmp 0x52d2d
leaq 0x6cdf(%rip), %rdx      # 0x59a13
leaq -0xb8(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x24a10
jmp 0x52d49
leaq -0x68(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x6640
leaq -0xb8(%rbp), %rdi
callq 0x6a08
leaq -0xd8(%rbp), %rdi
callq 0x6a08
leaq -0xd9(%rbp), %rdi
callq 0x65a0
jmp 0x52e38
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x52da8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x6a08
leaq -0xd9(%rbp), %rdi
callq 0x65a0
jmp 0x52fd6
movq 0x26230(%rip), %rdi     # 0x78ff0
movq 0x261c9(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x140(%rbp)
jmp 0x52dd5
movq -0x140(%rbp), %rdi
leaq 0x8759(%rip), %rsi      # 0x5b53c
callq 0x6520
movq %rax, -0x148(%rbp)
jmp 0x52df1
movq -0x148(%rbp), %rdi
movq 0x26191(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x150(%rbp)
jmp 0x52e0d
movq -0x150(%rbp), %rdi
movq 0x26175(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x52e22
movl $0x1, -0x4(%rbp)
movl $0x1, -0x98(%rbp)
jmp 0x52faa
jmp 0x52f9c
xorl %eax, %eax
movl %eax, %esi
leaq -0x90(%rbp), %rdi
callq 0x69e0
movq %rax, -0x158(%rbp)
jmp 0x52e56
movq -0x158(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x52f04
movq 0x26180(%rip), %rdi     # 0x78ff0
movq 0x26119(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x160(%rbp)
jmp 0x52e85
movq -0x160(%rbp), %rdi
leaq 0x81f9(%rip), %rsi      # 0x5b08c
callq 0x6520
movq %rax, -0x168(%rbp)
jmp 0x52ea1
movq -0x168(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x64d0
movq %rax, -0x170(%rbp)
jmp 0x52ebd
movq -0x170(%rbp), %rdi
movq 0x260c5(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x178(%rbp)
jmp 0x52ed9
movq -0x178(%rbp), %rdi
movq 0x260a9(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x52eee
movl $0x1, -0x4(%rbp)
movl $0x1, -0x98(%rbp)
jmp 0x52faa
movq 0x260e5(%rip), %rdi     # 0x78ff0
movq 0x2607e(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x180(%rbp)
jmp 0x52f20
movq -0x180(%rbp), %rdi
leaq 0x93ce(%rip), %rsi      # 0x5c2fc
callq 0x6520
movq %rax, -0x188(%rbp)
jmp 0x52f3c
movq -0x188(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x64d0
movq %rax, -0x190(%rbp)
jmp 0x52f58
movq -0x190(%rbp), %rdi
movq 0x2602a(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x198(%rbp)
jmp 0x52f74
movq -0x198(%rbp), %rdi
movq 0x2600e(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x52f89
movl $0x1, -0x4(%rbp)
movl $0x1, -0x98(%rbp)
jmp 0x52faa
jmp 0x52f9e
jmp 0x52fa0
movl $0x0, -0x98(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x6a08
movl -0x98(%rbp), %eax
testl %eax, %eax
jne 0x530c4
jmp 0x52fc6
jmp 0x52fc8
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
jmp 0x52aad
leaq -0x90(%rbp), %rdi
callq 0x6a08
jmp 0x530e2
leaq 0x72c4(%rip), %rsi      # 0x5a2b2
leaq -0x30(%rbp), %rdi
callq 0x2dce0
movb %al, -0x199(%rbp)
jmp 0x52fff
movb -0x199(%rbp), %al
testb $0x1, %al
jne 0x5300b
jmp 0x53080
movq 0x25fde(%rip), %rdi     # 0x78ff0
movq 0x25f77(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x1a8(%rbp)
jmp 0x53027
movq -0x1a8(%rbp), %rdi
leaq 0x92de(%rip), %rsi      # 0x5c313
callq 0x6520
movq %rax, -0x1b0(%rbp)
jmp 0x53043
movq -0x1b0(%rbp), %rdi
movq 0x25f3f(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x53058
callq 0x52900
jmp 0x5305f
movl $0x1, -0x4(%rbp)
movl $0x1, -0x98(%rbp)
jmp 0x530c4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x530e2
leaq -0x30(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x32cd0
movl %eax, -0x1b4(%rbp)
jmp 0x53095
movl -0x1b4(%rbp), %eax
cmpl $0x0, %eax
je 0x530b3
movl $0x1, -0x4(%rbp)
movl $0x1, -0x98(%rbp)
jmp 0x530c4
movl $0x0, -0x4(%rbp)
movl $0x1, -0x98(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x6a08
leaq -0x30(%rbp), %rdi
callq 0x6a08
movl -0x4(%rbp), %eax
addq $0x1c0, %rsp            # imm = 0x1C0
popq %rbp
retq
leaq -0x68(%rbp), %rdi
callq 0x6a08
leaq -0x30(%rbp), %rdi
callq 0x6a08
movq -0x40(%rbp), %rdi
callq 0x6900
nopl (%rax)