// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rsi, %rbp
movl %edi, 0x8(%rsp)
leaq 0x5049(%rip), %rsi      # 0x262c2
leaq 0x38(%rsp), %rdi
leaq 0x18(%rsp), %rdx
callq 0x77c0
leaq 0x7043(%rip), %rsi      # 0x282d2
leaq 0x18(%rsp), %rdi
leaq 0x58(%rsp), %rdx
callq 0x77c0
pushq $0x2
popq %r12
leaq 0x58(%rsp), %r14
leaq 0x98(%rsp), %r15
leaq 0x78(%rsp), %rbx
cmpl 0x8(%rsp), %r12d
jge 0x21494
movslq %r12d, %rax
movq (%rbp,%rax,8), %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0x77c0
movq %r14, %rdi
leaq 0x5d17(%rip), %rsi      # 0x26ff3
callq 0x132f3
testb %al, %al
jne 0x212f8
movq %r14, %rdi
leaq 0x5d07(%rip), %rsi      # 0x26ff6
callq 0x132f3
testb %al, %al
je 0x21320
xorl %r13d, %r13d
callq 0x2155e
xorl %r15d, %r15d
movq %r14, %rdi
callq 0x5778
incl %r12d
testb %r15b, %r15b
leaq 0x98(%rsp), %r15
jne 0x212b4
jmp 0x214ef
movq %r14, %rdi
leaq 0x621b(%rip), %rsi      # 0x27545
callq 0x132f3
testb %al, %al
je 0x21358
incl %r12d
cmpl 0x8(%rsp), %r12d
jge 0x213d6
movslq %r12d, %rax
movq (%rbp,%rax,8), %rsi
movb $0x1, %r15b
leaq 0x38(%rsp), %rdi
callq 0x5730
jmp 0x21303
movq %r14, %rdi
leaq 0x5f9b(%rip), %rsi      # 0x272fd
callq 0x132f3
testb %al, %al
je 0x21406
incl %r12d
cmpl 0x8(%rsp), %r12d
jge 0x21425
movslq %r12d, %rax
movq %rbp, 0x10(%rsp)
movq (%rbp,%rax,8), %rsi
movq %rbx, %rbp
movq %rbx, %rdi
leaq 0xf(%rsp), %rdx
callq 0x77c0
movq %r15, %rdi
movq %rbp, %rsi
leaq 0x4678(%rip), %rdx      # 0x25a1f
callq 0xf751
leaq 0x18(%rsp), %rdi
movq %r15, %rsi
callq 0x54a0
movq %r15, %rdi
callq 0x5778
movq %rbp, %rdi
callq 0x5778
movb $0x1, %r15b
movq 0x10(%rsp), %rbp
jmp 0x21303
movq 0x14c13(%rip), %rdi     # 0x35ff0
callq 0x51c0
movq %rax, %rdi
leaq 0x6efa(%rip), %rsi      # 0x282e6
callq 0x53f0
movq %rax, %rdi
callq 0x51c0
movq %rax, %rdi
callq 0x51c0
jmp 0x21488
movq 0x58(%rsp), %rax
cmpb $0x2d, (%rax)
jne 0x21452
movq 0x14bd9(%rip), %rdi     # 0x35ff0
callq 0x51c0
leaq 0x5c75(%rip), %rsi      # 0x27098
jmp 0x21465
movq 0x14bc4(%rip), %rdi     # 0x35ff0
callq 0x51c0
movq %rax, %rdi
leaq 0x610d(%rip), %rsi      # 0x27548
callq 0x53f0
movq %rax, %rdi
callq 0x51c0
movq %rax, %rdi
callq 0x51c0
jmp 0x21488
movq 0x14b97(%rip), %rdi     # 0x35ff0
callq 0x51c0
leaq 0x6ea3(%rip), %rsi      # 0x28308
movq %rax, %rdi
callq 0x53f0
movq %rax, %rdi
movq %r14, %rsi
callq 0x53a0
movq %rax, %rdi
callq 0x51c0
movq %rax, %rdi
callq 0x51c0
xorl %r15d, %r15d
pushq $0x1
popq %r13
jmp 0x21303
leaq 0x4e27(%rip), %rsi      # 0x262c2
leaq 0x38(%rsp), %rdi
callq 0x132f3
testb %al, %al
je 0x214d7
movq 0x14b40(%rip), %rdi     # 0x35ff0
callq 0x51c0
leaq 0x6e63(%rip), %rsi      # 0x2831f
movq %rax, %rdi
callq 0x53f0
movq %rax, %rdi
callq 0x51c0
callq 0x21195
pushq $0x1
popq %r13
jmp 0x214ef
leaq 0x38(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x145e0
xorl %r13d, %r13d
testl %eax, %eax
setne %r13b
leaq 0x18(%rsp), %rdi
callq 0x5778
leaq 0x38(%rsp), %rdi
callq 0x5778
movl %r13d, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x5778
jmp 0x21538
jmp 0x21535
movq %rax, %rbx
jmp 0x2154c
jmp 0x21530
movq %rax, %rbx
jmp 0x21542
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x5778
leaq 0x18(%rsp), %rdi
callq 0x5778
leaq 0x38(%rsp), %rdi
callq 0x5778
movq %rbx, %rdi
callq 0x56c0