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

	std::string outprefix = "mappedkmers";
	std::string reference = "";
	long int kmersize=15;
	bool includeref=false;
	bool maprepeats=false;
	bool fillall=false;
	bool variantonly=false;
	bool circular=false;
	std::vector < std::string > sample;
	std::vector < std::string > args;

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

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

		if (arg=="-h" || arg=="--help"){
			mapHelp();
			return 0;
		}
		else if (arg=="-c"){
			circular=true;
		}
		else if (arg == "-k"){
			i++;
			if (i<argc){
				try {
					kmersize = getint(argv[i]);
				}
				catch (const std::invalid_argument& e) {
					std::cerr << std::endl << "Expecting positive integer after -k flag" << std::endl << std::endl;
					return 1;
				}
			}
			else {
				std::cerr << std::endl << "Expecting positive integer after -k flag" << std::endl << std::endl;
				return 1;
			}
			if (kmersize < MinKmer || kmersize > MaxKmer || kmersize % 3 != 0){
				std::cerr << std::endl << "Kmer size must be a positive integer between " << MinKmer << " and " << MaxKmer << " and must be divisible by 3" << std::endl << std::endl;
				return 1;
			}
		}
		else if (arg == "-r"){
			i++;
			if (i<argc){
				reference = argv[i];
			}
			else {
				std::cerr << std::endl << "Expecting file name after -r flag" << std::endl << std::endl;
				return 1;
			}
		}
		else if (arg == "-i"){
			includeref = true;
		}
		else if (arg == "-m"){
			maprepeats = true;
		}
		else if (arg == "-a"){
			fillall = true;
		}
		else if (arg == "-v"){
			variantonly = true;
		}
		else if (arg == "-o"){
			i++;
			if (i<argc){
				outprefix = std::string(argv[i]);
			}
			else {
				std::cerr << std::endl << "Expecting file name after -o 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 == "-s"){
			i++;
			if (i<argc){
				fileToVector(argv[i], sample);
			}
			else {
				std::cerr << std::endl << "Expecting file name after -s 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;
		mapHelp();
		return 1;
	}

	if (variantonly){
		outprefix+="_variants";
	}

	outprefix+=".aln";

	if (reference==""){
		std::cerr << std::endl << "Reference file is required" << std::endl;
		mapHelp();
		return 1;
	}

	skaVersion();

	std::cout << "Aligning ";
	if (args.size()>maxNamesToPrint){
		std::cout << args.size() << " files";
	}
	else {
		for (std::vector < std::string >::iterator it = args.begin(); it != args.end(); ++it){
			std::cout << *it << " ";
		}
	}
	std::cout << std::endl;
	std::cout << "Using split kmer size of " << kmersize << std::endl;
	std::cout << "Using " << reference << " as reference" << std::endl;
	if (includeref){
		std::cout << "Reference will be included in the alignment" << std::endl;
	}
	else{
		std::cout << "Reference will not be included in the alignment" << std::endl;
	}
	if (maprepeats){
		std::cout << "Repeats in the reference will be mapped rather than left as gaps" << std::endl;
	}
	else{
		std::cout << "Repeats in the reference will be output as gaps" << std::endl;
	}
	if (fillall){
		std::cout << "All bases in kmers will be mapped as lower case" << std::endl;
	}
	if (circular){
		std::cout << "Reference contigs will be treated as circular" << std::endl;
	}
	else {
		std::cout << "Reference contigs will be treated as linear" << std::endl;
	}
	std::cout << "Output will be written to " << outprefix << std::endl << std::endl;

	if (alignKmersToReference(reference, outprefix, args, kmersize, includeref, maprepeats, fillall, variantonly, sample, circular)){return 1;}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3c0, %rsp            # imm = 0x3C0
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x31(%rbp), %rdi
movq %rdi, -0x180(%rbp)
callq 0x6910
movq -0x180(%rbp), %rdx
leaq 0x8d04(%rip), %rsi      # 0x5c5f4
leaq -0x30(%rbp), %rdi
callq 0xab20
jmp 0x538fb
leaq -0x31(%rbp), %rdi
callq 0x65a0
leaq -0x69(%rbp), %rdi
movq %rdi, -0x188(%rbp)
callq 0x6910
movq -0x188(%rbp), %rdx
leaq 0x6990(%rip), %rsi      # 0x5a2b2
leaq -0x68(%rbp), %rdi
callq 0xab20
jmp 0x5392d
leaq -0x69(%rbp), %rdi
callq 0x65a0
movq $0xf, -0x78(%rbp)
movb $0x0, -0x79(%rbp)
movb $0x0, -0x7a(%rbp)
movb $0x0, -0x7b(%rbp)
movb $0x0, -0x7c(%rbp)
movb $0x0, -0x7d(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x1ab40
leaq -0xb0(%rbp), %rdi
callq 0x1ab40
movl $0x2, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x544ec
movq -0x10(%rbp), %rax
movslq -0xb4(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x198(%rbp)
leaq -0xd9(%rbp), %rdi
movq %rdi, -0x190(%rbp)
callq 0x6910
movq -0x198(%rbp), %rsi
movq -0x190(%rbp), %rdx
leaq -0xd8(%rbp), %rdi
callq 0xab20
jmp 0x539c8
leaq -0xd9(%rbp), %rdi
callq 0x65a0
leaq 0x760c(%rip), %rsi      # 0x5afe7
leaq -0xd8(%rbp), %rdi
callq 0x2dce0
movb %al, -0x199(%rbp)
jmp 0x539ef
movb -0x199(%rbp), %al
testb $0x1, %al
jne 0x53a22
jmp 0x539fb
leaq 0x75e8(%rip), %rsi      # 0x5afea
leaq -0xd8(%rbp), %rdi
callq 0x2dce0
movb %al, -0x19a(%rbp)
jmp 0x53a16
movb -0x19a(%rbp), %al
testb $0x1, %al
jne 0x53a22
jmp 0x53aa1
callq 0x536a0
jmp 0x53a29
movl $0x0, -0x4(%rbp)
movl $0x1, -0xe0(%rbp)
jmp 0x544a9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x31(%rbp), %rdi
callq 0x65a0
jmp 0x54ac1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x69(%rbp), %rdi
callq 0x65a0
jmp 0x54ab8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xd9(%rbp), %rdi
callq 0x65a0
jmp 0x54a97
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x544db
leaq 0x7ecf(%rip), %rsi      # 0x5b977
leaq -0xd8(%rbp), %rdi
callq 0x2dce0
movb %al, -0x19b(%rbp)
jmp 0x53abc
movb -0x19b(%rbp), %al
testb $0x1, %al
jne 0x53ac8
jmp 0x53ad1
movb $0x1, -0x7d(%rbp)
jmp 0x5449d
leaq 0x7519(%rip), %rsi      # 0x5aff1
leaq -0xd8(%rbp), %rdi
callq 0x2dce0
movb %al, -0x19c(%rbp)
jmp 0x53aec
movb -0x19c(%rbp), %al
testb $0x1, %al
jne 0x53afb
jmp 0x53dbb
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x53c12
movq -0x10(%rbp), %rax
movslq -0xb4(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x4c020
movq %rax, -0x1a8(%rbp)
jmp 0x53b36
movq -0x1a8(%rbp), %rax
movq %rax, -0x78(%rbp)
jmp 0x53c10
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x544db
movq -0x40(%rbp), %rdi
callq 0x6200
movq %rax, -0xe8(%rbp)
movq 0x25477(%rip), %rdi     # 0x78ff0
movq 0x25410(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x1b0(%rbp)
jmp 0x53b8e
movq -0x1b0(%rbp), %rdi
leaq 0x7458(%rip), %rsi      # 0x5aff4
callq 0x6520
movq %rax, -0x1b8(%rbp)
jmp 0x53baa
movq -0x1b8(%rbp), %rdi
movq 0x253d8(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x1c0(%rbp)
jmp 0x53bc6
movq -0x1c0(%rbp), %rdi
movq 0x253bc(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x53bdb
movl $0x1, -0x4(%rbp)
movl $0x1, -0xe0(%rbp)
callq 0x6860
jmp 0x53c06
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
callq 0x6860
jmp 0x53c0b
jmp 0x544a9
jmp 0x544db
jmp 0x53c91
movq 0x253d7(%rip), %rdi     # 0x78ff0
movq 0x25370(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x1c8(%rbp)
jmp 0x53c2e
movq -0x1c8(%rbp), %rdi
leaq 0x73b8(%rip), %rsi      # 0x5aff4
callq 0x6520
movq %rax, -0x1d0(%rbp)
jmp 0x53c4a
movq -0x1d0(%rbp), %rdi
movq 0x25338(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x1d8(%rbp)
jmp 0x53c66
movq -0x1d8(%rbp), %rdi
movq 0x2531c(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x53c7b
movl $0x1, -0x4(%rbp)
movl $0x1, -0xe0(%rbp)
jmp 0x544a9
movq -0x78(%rbp), %rax
movslq 0x25994(%rip), %rcx     # 0x79630
cmpq %rcx, %rax
jl 0x53cc9
movq -0x78(%rbp), %rax
movslq 0x25988(%rip), %rcx     # 0x79634
cmpq %rcx, %rax
jg 0x53cc9
movq -0x78(%rbp), %rax
movl $0x3, %ecx
cqto
idivq %rcx
cmpq $0x0, %rdx
je 0x53db6
movq 0x25320(%rip), %rdi     # 0x78ff0
movq 0x252b9(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x1e0(%rbp)
jmp 0x53ce5
movq -0x1e0(%rbp), %rdi
leaq 0x732a(%rip), %rsi      # 0x5b01d
callq 0x6520
movq %rax, -0x1e8(%rbp)
jmp 0x53d01
movq -0x1e8(%rbp), %rdi
movl 0x25922(%rip), %esi     # 0x79630
callq 0x68d0
movq %rax, -0x1f0(%rbp)
jmp 0x53d1c
movq -0x1f0(%rbp), %rdi
leaq 0x684c(%rip), %rsi      # 0x5a576
callq 0x6520
movq %rax, -0x1f8(%rbp)
jmp 0x53d38
movq -0x1f8(%rbp), %rdi
movl 0x258ef(%rip), %esi     # 0x79634
callq 0x68d0
movq %rax, -0x200(%rbp)
jmp 0x53d53
movq -0x200(%rbp), %rdi
leaq 0x72ea(%rip), %rsi      # 0x5b04b
callq 0x6520
movq %rax, -0x208(%rbp)
jmp 0x53d6f
movq -0x208(%rbp), %rdi
movq 0x25213(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x210(%rbp)
jmp 0x53d8b
movq -0x210(%rbp), %rdi
movq 0x251f7(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x53da0
movl $0x1, -0x4(%rbp)
movl $0x1, -0xe0(%rbp)
jmp 0x544a9
jmp 0x5449b
leaq 0x779c(%rip), %rsi      # 0x5b55e
leaq -0xd8(%rbp), %rdi
callq 0x2dce0
movb %al, -0x211(%rbp)
jmp 0x53dd6
movb -0x211(%rbp), %al
testb $0x1, %al
jne 0x53de5
jmp 0x53e9f
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x53e1b
movq -0x10(%rbp), %rax
movslq -0xb4(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq -0x68(%rbp), %rdi
callq 0x6710
jmp 0x53e19
jmp 0x53e9a
movq 0x251ce(%rip), %rdi     # 0x78ff0
movq 0x25167(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x220(%rbp)
jmp 0x53e37
movq -0x220(%rbp), %rdi
leaq 0x771c(%rip), %rsi      # 0x5b561
callq 0x6520
movq %rax, -0x228(%rbp)
jmp 0x53e53
movq -0x228(%rbp), %rdi
movq 0x2512f(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x230(%rbp)
jmp 0x53e6f
movq -0x230(%rbp), %rdi
movq 0x25113(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x53e84
movl $0x1, -0x4(%rbp)
movl $0x1, -0xe0(%rbp)
jmp 0x544a9
jmp 0x54499
leaq 0x7693(%rip), %rsi      # 0x5b539
leaq -0xd8(%rbp), %rdi
callq 0x2dce0
movb %al, -0x231(%rbp)
jmp 0x53eba
movb -0x231(%rbp), %al
testb $0x1, %al
jne 0x53ec6
jmp 0x53ecf
movb $0x1, -0x79(%rbp)
jmp 0x54497
leaq 0x81fe(%rip), %rsi      # 0x5c0d4
leaq -0xd8(%rbp), %rdi
callq 0x2dce0
movb %al, -0x232(%rbp)
jmp 0x53eea
movb -0x232(%rbp), %al
testb $0x1, %al
jne 0x53ef6
jmp 0x53eff
movb $0x1, -0x7a(%rbp)
jmp 0x54495
leaq 0x80e7(%rip), %rsi      # 0x5bfed
leaq -0xd8(%rbp), %rdi
callq 0x2dce0
movb %al, -0x233(%rbp)
jmp 0x53f1a
movb -0x233(%rbp), %al
testb $0x1, %al
jne 0x53f26
jmp 0x53f2f
movb $0x1, -0x7b(%rbp)
jmp 0x54493
leaq 0x745e(%rip), %rsi      # 0x5b394
leaq -0xd8(%rbp), %rdi
callq 0x2dce0
movb %al, -0x234(%rbp)
jmp 0x53f4a
movb -0x234(%rbp), %al
testb $0x1, %al
jne 0x53f56
jmp 0x53f5f
movb $0x1, -0x7c(%rbp)
jmp 0x54491
leaq 0x738b(%rip), %rsi      # 0x5b2f1
leaq -0xd8(%rbp), %rdi
callq 0x2dce0
movb %al, -0x235(%rbp)
jmp 0x53f7a
movb -0x235(%rbp), %al
testb $0x1, %al
jne 0x53f89
jmp 0x540ba
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x54036
movq -0x10(%rbp), %rax
movslq -0xb4(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x248(%rbp)
leaq -0x109(%rbp), %rdi
movq %rdi, -0x240(%rbp)
callq 0x6910
movq -0x248(%rbp), %rsi
movq -0x240(%rbp), %rdx
leaq -0x108(%rbp), %rdi
callq 0xab20
jmp 0x53fec
leaq -0x30(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x6640
leaq -0x108(%rbp), %rdi
callq 0x6a08
leaq -0x109(%rbp), %rdi
callq 0x65a0
jmp 0x540b5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x109(%rbp), %rdi
callq 0x65a0
jmp 0x544db
movq 0x24fb3(%rip), %rdi     # 0x78ff0
movq 0x24f4c(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x250(%rbp)
jmp 0x54052
movq -0x250(%rbp), %rdi
leaq 0x74dc(%rip), %rsi      # 0x5b53c
callq 0x6520
movq %rax, -0x258(%rbp)
jmp 0x5406e
movq -0x258(%rbp), %rdi
movq 0x24f14(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x260(%rbp)
jmp 0x5408a
movq -0x260(%rbp), %rdi
movq 0x24ef8(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x5409f
movl $0x1, -0x4(%rbp)
movl $0x1, -0xe0(%rbp)
jmp 0x544a9
jmp 0x5448f
leaq 0x6fa6(%rip), %rsi      # 0x5b067
leaq -0xd8(%rbp), %rdi
callq 0x2dce0
movb %al, -0x261(%rbp)
jmp 0x540d5
movb -0x261(%rbp), %al
testb $0x1, %al
jne 0x540e4
jmp 0x54234
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x541b0
movq -0x10(%rbp), %rax
movslq -0xb4(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x278(%rbp)
leaq -0x131(%rbp), %rdi
movq %rdi, -0x270(%rbp)
callq 0x6910
movq -0x278(%rbp), %rsi
movq -0x270(%rbp), %rdx
leaq -0x130(%rbp), %rdi
callq 0xab20
jmp 0x54147
leaq -0x130(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0xa6a0
jmp 0x5415c
leaq -0x130(%rbp), %rdi
callq 0x6a08
leaq -0x131(%rbp), %rdi
callq 0x65a0
jmp 0x5422f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x5419f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x130(%rbp), %rdi
callq 0x6a08
leaq -0x131(%rbp), %rdi
callq 0x65a0
jmp 0x544db
movq 0x24e39(%rip), %rdi     # 0x78ff0
movq 0x24dd2(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x280(%rbp)
jmp 0x541cc
movq -0x280(%rbp), %rdi
leaq 0x6e90(%rip), %rsi      # 0x5b06a
callq 0x6520
movq %rax, -0x288(%rbp)
jmp 0x541e8
movq -0x288(%rbp), %rdi
movq 0x24d9a(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x290(%rbp)
jmp 0x54204
movq -0x290(%rbp), %rdi
movq 0x24d7e(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x54219
movl $0x1, -0x4(%rbp)
movl $0x1, -0xe0(%rbp)
jmp 0x544a9
jmp 0x5448d
leaq 0x7134(%rip), %rsi      # 0x5b36f
leaq -0xd8(%rbp), %rdi
callq 0x2dce0
movb %al, -0x291(%rbp)
jmp 0x5424f
movb -0x291(%rbp), %al
testb $0x1, %al
jne 0x5425e
jmp 0x543ae
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x5432a
movq -0x10(%rbp), %rax
movslq -0xb4(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x2a8(%rbp)
leaq -0x159(%rbp), %rdi
movq %rdi, -0x2a0(%rbp)
callq 0x6910
movq -0x2a8(%rbp), %rsi
movq -0x2a0(%rbp), %rdx
leaq -0x158(%rbp), %rdi
callq 0xab20
jmp 0x542c1
leaq -0x158(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0xa6a0
jmp 0x542d6
leaq -0x158(%rbp), %rdi
callq 0x6a08
leaq -0x159(%rbp), %rdi
callq 0x65a0
jmp 0x543a9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x54319
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x6a08
leaq -0x159(%rbp), %rdi
callq 0x65a0
jmp 0x544db
movq 0x24cbf(%rip), %rdi     # 0x78ff0
movq 0x24c58(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x2b0(%rbp)
jmp 0x54346
movq -0x2b0(%rbp), %rdi
leaq 0x701e(%rip), %rsi      # 0x5b372
callq 0x6520
movq %rax, -0x2b8(%rbp)
jmp 0x54362
movq -0x2b8(%rbp), %rdi
movq 0x24c20(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x2c0(%rbp)
jmp 0x5437e
movq -0x2c0(%rbp), %rdi
movq 0x24c04(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x54393
movl $0x1, -0x4(%rbp)
movl $0x1, -0xe0(%rbp)
jmp 0x544a9
jmp 0x5448b
xorl %eax, %eax
movl %eax, %esi
leaq -0xd8(%rbp), %rdi
callq 0x69e0
movq %rax, -0x2c8(%rbp)
jmp 0x543c7
movq -0x2c8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x54472
movq 0x24c0f(%rip), %rdi     # 0x78ff0
movq 0x24ba8(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x2d0(%rbp)
jmp 0x543f6
movq -0x2d0(%rbp), %rdi
leaq 0x6c88(%rip), %rsi      # 0x5b08c
callq 0x6520
movq %rax, -0x2d8(%rbp)
jmp 0x54412
movq -0x2d8(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x64d0
movq %rax, -0x2e0(%rbp)
jmp 0x5442e
movq -0x2e0(%rbp), %rdi
movq 0x24b54(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x2e8(%rbp)
jmp 0x5444a
movq -0x2e8(%rbp), %rdi
movq 0x24b38(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x5445f
movl $0x1, -0x4(%rbp)
movl $0x1, -0xe0(%rbp)
jmp 0x544a9
leaq -0xb0(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0xabd0
jmp 0x54487
jmp 0x54489
jmp 0x5448b
jmp 0x5448d
jmp 0x5448f
jmp 0x54491
jmp 0x54493
jmp 0x54495
jmp 0x54497
jmp 0x54499
jmp 0x5449b
jmp 0x5449d
jmp 0x5449f
movl $0x0, -0xe0(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x6a08
movl -0xe0(%rbp), %eax
testl %eax, %eax
jne 0x54a61
jmp 0x544c5
jmp 0x544c7
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
jmp 0x53974
leaq -0xd8(%rbp), %rdi
callq 0x6a08
jmp 0x54a97
leaq -0xb0(%rbp), %rdi
callq 0xb670
cmpq $0x1, %rax
jae 0x54579
movq 0x24aeb(%rip), %rdi     # 0x78ff0
movq 0x24a84(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x2f0(%rbp)
jmp 0x5451a
movq -0x2f0(%rbp), %rdi
leaq 0x6b77(%rip), %rsi      # 0x5b09f
callq 0x6520
movq %rax, -0x2f8(%rbp)
jmp 0x54536
movq -0x2f8(%rbp), %rdi
movq 0x24a4c(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x5454b
callq 0x536a0
jmp 0x54552
movl $0x1, -0x4(%rbp)
movl $0x1, -0xe0(%rbp)
jmp 0x54a61
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x54a97
testb $0x1, -0x7c(%rbp)
je 0x54593
leaq 0x6e11(%rip), %rsi      # 0x5b397
leaq -0x30(%rbp), %rdi
callq 0x6500
jmp 0x54591
jmp 0x54593
leaq 0x51eb(%rip), %rsi      # 0x59785
leaq -0x30(%rbp), %rdi
callq 0x6500
jmp 0x545a5
leaq 0x5d06(%rip), %rsi      # 0x5a2b2
leaq -0x68(%rbp), %rdi
callq 0x2dce0
movb %al, -0x2f9(%rbp)
jmp 0x545bd
movb -0x2f9(%rbp), %al
testb $0x1, %al
jne 0x545c9
jmp 0x54633
movq 0x24a20(%rip), %rdi     # 0x78ff0
movq 0x249b9(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x308(%rbp)
jmp 0x545e5
movq -0x308(%rbp), %rdi
leaq 0x800d(%rip), %rsi      # 0x5c600
callq 0x6520
movq %rax, -0x310(%rbp)
jmp 0x54601
movq -0x310(%rbp), %rdi
movq 0x24981(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x54616
callq 0x536a0
jmp 0x5461d
movl $0x1, -0x4(%rbp)
movl $0x1, -0xe0(%rbp)
jmp 0x54a61
callq 0x4c460
jmp 0x5463a
movq 0x24967(%rip), %rdi     # 0x78fa8
leaq 0x7fd3(%rip), %rsi      # 0x5c61b
callq 0x6520
jmp 0x5464f
leaq -0xb0(%rbp), %rdi
callq 0xb670
movslq 0x24fde(%rip), %rcx     # 0x79640
cmpq %rcx, %rax
jbe 0x546a5
leaq -0xb0(%rbp), %rdi
callq 0xb670
movq %rax, %rsi
movq 0x2492b(%rip), %rdi     # 0x78fa8
callq 0x6120
movq %rax, -0x318(%rbp)
jmp 0x5468b
movq -0x318(%rbp), %rdi
leaq 0x6420(%rip), %rsi      # 0x5aab9
callq 0x6520
jmp 0x546a0
jmp 0x5472f
leaq -0xb0(%rbp), %rdi
callq 0xb4c0
movq %rax, -0x168(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0xb340
movq %rax, -0x170(%rbp)
leaq -0x168(%rbp), %rdi
leaq -0x170(%rbp), %rsi
callq 0x4a690
testb $0x1, %al
jne 0x546e4
jmp 0x5472d
leaq -0x168(%rbp), %rdi
callq 0x30840
movq %rax, %rsi
movq 0x248ae(%rip), %rdi     # 0x78fa8
callq 0x64d0
movq %rax, -0x320(%rbp)
jmp 0x54708
movq -0x320(%rbp), %rdi
leaq 0x5c37(%rip), %rsi      # 0x5a34d
callq 0x6520
jmp 0x5471d
jmp 0x5471f
leaq -0x168(%rbp), %rdi
callq 0x4a6d0
jmp 0x546b8
jmp 0x5472f
movq 0x24872(%rip), %rdi     # 0x78fa8
movq 0x24853(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x54744
movq 0x2485d(%rip), %rdi     # 0x78fa8
leaq 0x7ed3(%rip), %rsi      # 0x5c625
callq 0x6520
movq %rax, -0x328(%rbp)
jmp 0x54760
movq -0x328(%rbp), %rdi
movq -0x78(%rbp), %rsi
callq 0x6950
movq %rax, -0x330(%rbp)
jmp 0x54779
movq -0x330(%rbp), %rdi
movq 0x24809(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x5478e
movq 0x24813(%rip), %rdi     # 0x78fa8
leaq 0x7ea3(%rip), %rsi      # 0x5c63f
callq 0x6520
movq %rax, -0x338(%rbp)
jmp 0x547aa
movq -0x338(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x64d0
movq %rax, -0x340(%rbp)
jmp 0x547c3
movq -0x340(%rbp), %rdi
leaq 0x7e75(%rip), %rsi      # 0x5c646
callq 0x6520
movq %rax, -0x348(%rbp)
jmp 0x547df
movq -0x348(%rbp), %rdi
movq 0x247a3(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x547f4
testb $0x1, -0x79(%rbp)
je 0x5482d
movq 0x247a7(%rip), %rdi     # 0x78fa8
leaq 0x7e4c(%rip), %rsi      # 0x5c654
callq 0x6520
movq %rax, -0x350(%rbp)
jmp 0x54816
movq -0x350(%rbp), %rdi
movq 0x2476c(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x5482b
jmp 0x54860
movq 0x24774(%rip), %rdi     # 0x78fa8
leaq 0x7e45(%rip), %rsi      # 0x5c680
callq 0x6520
movq %rax, -0x358(%rbp)
jmp 0x54849
movq -0x358(%rbp), %rdi
movq 0x24739(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x5485e
jmp 0x54860
testb $0x1, -0x7a(%rbp)
je 0x54899
movq 0x2473b(%rip), %rdi     # 0x78fa8
leaq 0x7e3c(%rip), %rsi      # 0x5c6b0
callq 0x6520
movq %rax, -0x360(%rbp)
jmp 0x54882
movq -0x360(%rbp), %rdi
movq 0x24700(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x54897
jmp 0x548cc
movq 0x24708(%rip), %rdi     # 0x78fa8
leaq 0x7e4a(%rip), %rsi      # 0x5c6f1
callq 0x6520
movq %rax, -0x368(%rbp)
jmp 0x548b5
movq -0x368(%rbp), %rdi
movq 0x246cd(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x548ca
jmp 0x548cc
testb $0x1, -0x7b(%rbp)
je 0x54905
movq 0x246cf(%rip), %rdi     # 0x78fa8
leaq 0x7e41(%rip), %rsi      # 0x5c721
callq 0x6520
movq %rax, -0x370(%rbp)
jmp 0x548ee
movq -0x370(%rbp), %rdi
movq 0x24694(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x54903
jmp 0x54905
testb $0x1, -0x7d(%rbp)
je 0x5493e
movq 0x24696(%rip), %rdi     # 0x78fa8
leaq 0x7e38(%rip), %rsi      # 0x5c751
callq 0x6520
movq %rax, -0x378(%rbp)
jmp 0x54927
movq -0x378(%rbp), %rdi
movq 0x2465b(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x5493c
jmp 0x54971
movq 0x24663(%rip), %rdi     # 0x78fa8
leaq 0x7e33(%rip), %rsi      # 0x5c77f
callq 0x6520
movq %rax, -0x380(%rbp)
jmp 0x5495a
movq -0x380(%rbp), %rdi
movq 0x24628(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x5496f
jmp 0x54971
movq 0x24630(%rip), %rdi     # 0x78fa8
leaq 0x6a8d(%rip), %rsi      # 0x5b40c
callq 0x6520
movq %rax, -0x388(%rbp)
jmp 0x5498d
movq -0x388(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x64d0
movq %rax, -0x390(%rbp)
jmp 0x549a6
movq -0x390(%rbp), %rdi
movq 0x245dc(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x398(%rbp)
jmp 0x549c2
movq -0x398(%rbp), %rdi
movq 0x245c0(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x549d7
movl -0x78(%rbp), %eax
movl %eax, -0x174(%rbp)
movzbl -0x7d(%rbp), %ecx
andl $0x1, %ecx
movq %rsp, %rax
movl %ecx, 0x18(%rax)
leaq -0x98(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq -0x7c(%rbp), %rcx
movq %rcx, 0x8(%rax)
leaq -0x7b(%rbp), %rcx
movq %rcx, (%rax)
leaq -0x68(%rbp), %rdi
leaq -0x30(%rbp), %rsi
leaq -0xb0(%rbp), %rdx
leaq -0x174(%rbp), %rcx
leaq -0x79(%rbp), %r8
leaq -0x7a(%rbp), %r9
callq 0x36df0
movl %eax, -0x39c(%rbp)
jmp 0x54a32
movl -0x39c(%rbp), %eax
cmpl $0x0, %eax
je 0x54a50
movl $0x1, -0x4(%rbp)
movl $0x1, -0xe0(%rbp)
jmp 0x54a61
movl $0x0, -0x4(%rbp)
movl $0x1, -0xe0(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0xfe90
leaq -0x98(%rbp), %rdi
callq 0xfe90
leaq -0x68(%rbp), %rdi
callq 0x6a08
leaq -0x30(%rbp), %rdi
callq 0x6a08
movl -0x4(%rbp), %eax
addq $0x3c0, %rsp            # imm = 0x3C0
popq %rbp
retq
leaq -0xb0(%rbp), %rdi
callq 0xfe90
leaq -0x98(%rbp), %rdi
callq 0xfe90
leaq -0x68(%rbp), %rdi
callq 0x6a08
leaq -0x30(%rbp), %rdi
callq 0x6a08
movq -0x40(%rbp), %rdi
callq 0x6900
movq %rax, %rdi
callq 0x9b50
nopw %cs:(%rax,%rax)