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

	std::string outfile="fastq";
	long int covcutoff=4;
	long int filecovcutoff=2;
	long int kmersize=15;
	long int minquality=20;
	bool printalleles=false;
	float minmaf=0.2;
	std::vector < std::string > args;

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

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

		if (arg=="-h" || arg=="--help"){
			fastqHelp();
			return 0;
		}
		else if (arg=="-a"){
			printalleles=true;
		}
		else if (arg == "-c"){
			i++;
			if (i<argc){
				try {
					covcutoff = getint(argv[i]);
				}
				catch (const std::invalid_argument& e) {
					std::cerr << std::endl << "Expecting positive integer after -c flag" << std::endl << std::endl;
					return 1;
				}
			}
			else {
				std::cerr << std::endl << "Expecting positive integer after -c flag" << std::endl << std::endl;
				return 1;
			}
			if (covcutoff < MinCov){
				std::cerr << std::endl << "Coverage cutoff must be a positive integer greater than or equal to " << MinCov << std::endl << std::endl;
				return 1;
			}
		}
		else if (arg == "-C"){
			i++;
			if (i<argc){
				try {
					filecovcutoff = getint(argv[i]);
				}
				catch (const std::invalid_argument& e) {
					std::cerr << std::endl << "Expecting positive integer after -C flag" << std::endl << std::endl;
					return 1;
				}
			}
			else {
				std::cerr << std::endl << "Expecting positive integer after -C flag" << std::endl << std::endl;
				return 1;
			}
			if (filecovcutoff < MinFileCov){
				std::cerr << std::endl << "File coverage cutoff must be a positive integer greater than or equal to " << MinFileCov << std::endl << std::endl;
				return 1;
			}
		}
		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 == "-m"){
			i++;
			if (i<argc){
				try {
					minmaf = getfloat(argv[i]);
				}
				catch (const std::invalid_argument& e) {
					std::cerr << std::endl << "Expecting float between 0 and 1 after -m flag" << std::endl << std::endl;
					return 1;
				}
			}
			else {
				std::cerr << std::endl << "Expecting float between 0 and 1 after -m flag" << std::endl << std::endl;
				return 1;
			}
			if (minmaf < 0 || minmaf > 1){
				std::cerr << std::endl << "Minimum minor allele frequency must be between 0 and 1" << std::endl << std::endl;
				return 1;
			}
		}
		else if (arg == "-o"){
			i++;
			if (i<argc){
				outfile = std::string(argv[i]);
			}
			else {
				std::cerr << std::endl << "Expecting file name after -o flag" << std::endl << std::endl;
				return 1;
			}
		}
		else if (arg == "-q"){
			i++;
			if (i<argc){
				try {
					minquality = getint(argv[i]);
				}
				catch (const std::invalid_argument& e) {
					std::cerr << std::endl << "Expecting positive integer after -q flag" << std::endl << std::endl;
					return 1;
				}
			}
			else {
				std::cerr << std::endl << "Expecting positive integer after -q flag" << std::endl << std::endl;
				return 1;
			}
			if (minquality < MinQual || minquality > MaxQual){
				std::cerr << std::endl << "Minimum quality cutoff must be a positive integer between " << MinQual << " and " << MaxQual << 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;
		fastqHelp();
		return 1;
	}

	skaVersion();

	std::cout << "Creating split " << kmersize << "mers for ";
	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 << "Filters:" << std::endl;
	std::cout << "\tCoverage cutoff = " << covcutoff << std::endl;
	std::cout << "\tPer file coverage cutoff = " << filecovcutoff << std::endl;
	std::cout << "\tMinimum minor allele frequency = " << minmaf << std::endl;
	std::cout << "\tMinimum base quality = " << minquality << std::endl;
	std::cout << "Output will be written to " << outfile << ".skf" << std::endl;
	if (printalleles){
		std::cout << "Allele frequencies will be written to " << outfile << "_alleles.tsv" << std::endl;
	}

	std::cout << std::endl;

	if (fastqToKmers(args, outfile, kmersize, minquality, filecovcutoff, covcutoff, minmaf, printalleles)){return 1;}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x450, %rsp            # imm = 0x450
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x31(%rbp), %rdi
movq %rdi, -0x130(%rbp)
callq 0x6910
movq -0x130(%rbp), %rdx
leaq 0xad07(%rip), %rsi      # 0x5bfe7
leaq -0x30(%rbp), %rdi
callq 0xab20
jmp 0x512eb
leaq -0x31(%rbp), %rdi
callq 0x65a0
movq $0x4, -0x50(%rbp)
movq $0x2, -0x58(%rbp)
movq $0xf, -0x60(%rbp)
movq $0x14, -0x68(%rbp)
movb $0x0, -0x69(%rbp)
movss 0x95d0(%rip), %xmm0     # 0x5a8f0
movss %xmm0, -0x70(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x1ab40
movl $0x2, -0x8c(%rbp)
movl -0x8c(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x523fd
movq -0x10(%rbp), %rax
movslq -0x8c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x140(%rbp)
leaq -0xb1(%rbp), %rdi
movq %rdi, -0x138(%rbp)
callq 0x6910
movq -0x140(%rbp), %rsi
movq -0x138(%rbp), %rdx
leaq -0xb0(%rbp), %rdi
callq 0xab20
jmp 0x5138f
leaq -0xb1(%rbp), %rdi
callq 0x65a0
leaq 0x9c45(%rip), %rsi      # 0x5afe7
leaq -0xb0(%rbp), %rdi
callq 0x2dce0
movb %al, -0x141(%rbp)
jmp 0x513b6
movb -0x141(%rbp), %al
testb $0x1, %al
jne 0x513e9
jmp 0x513c2
leaq 0x9c21(%rip), %rsi      # 0x5afea
leaq -0xb0(%rbp), %rdi
callq 0x2dce0
movb %al, -0x142(%rbp)
jmp 0x513dd
movb -0x142(%rbp), %al
testb $0x1, %al
jne 0x513e9
jmp 0x5144e
callq 0x51100
jmp 0x513f0
movl $0x0, -0x4(%rbp)
movl $0x1, -0xb8(%rbp)
jmp 0x523ba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x31(%rbp), %rdi
callq 0x65a0
jmp 0x528e4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xb1(%rbp), %rdi
callq 0x65a0
jmp 0x528cf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x523ec
leaq 0xab98(%rip), %rsi      # 0x5bfed
leaq -0xb0(%rbp), %rdi
callq 0x2dce0
movb %al, -0x143(%rbp)
jmp 0x51469
movb -0x143(%rbp), %al
testb $0x1, %al
jne 0x51475
jmp 0x5147e
movb $0x1, -0x69(%rbp)
jmp 0x523ae
leaq 0xa4f2(%rip), %rsi      # 0x5b977
leaq -0xb0(%rbp), %rdi
callq 0x2dce0
movb %al, -0x144(%rbp)
jmp 0x51499
movb -0x144(%rbp), %al
testb $0x1, %al
jne 0x514a8
jmp 0x516f1
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
movl -0x8c(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x515bf
movq -0x10(%rbp), %rax
movslq -0x8c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x4c020
movq %rax, -0x150(%rbp)
jmp 0x514e3
movq -0x150(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x515bd
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 0x523ec
movq -0x40(%rbp), %rdi
callq 0x6200
movq %rax, -0xc0(%rbp)
movq 0x27aca(%rip), %rdi     # 0x78ff0
movq 0x27a63(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x158(%rbp)
jmp 0x5153b
movq -0x158(%rbp), %rdi
leaq 0xaaa7(%rip), %rsi      # 0x5bff0
callq 0x6520
movq %rax, -0x160(%rbp)
jmp 0x51557
movq -0x160(%rbp), %rdi
movq 0x27a2b(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x168(%rbp)
jmp 0x51573
movq -0x168(%rbp), %rdi
movq 0x27a0f(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x51588
movl $0x1, -0x4(%rbp)
movl $0x1, -0xb8(%rbp)
callq 0x6860
jmp 0x515b3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
callq 0x6860
jmp 0x515b8
jmp 0x523ba
jmp 0x523ec
jmp 0x5163e
movq 0x27a2a(%rip), %rdi     # 0x78ff0
movq 0x279c3(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x170(%rbp)
jmp 0x515db
movq -0x170(%rbp), %rdi
leaq 0xaa07(%rip), %rsi      # 0x5bff0
callq 0x6520
movq %rax, -0x178(%rbp)
jmp 0x515f7
movq -0x178(%rbp), %rdi
movq 0x2798b(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x180(%rbp)
jmp 0x51613
movq -0x180(%rbp), %rdi
movq 0x2796f(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x51628
movl $0x1, -0x4(%rbp)
movl $0x1, -0xb8(%rbp)
jmp 0x523ba
movq -0x50(%rbp), %rax
movslq 0x27ff3(%rip), %rcx     # 0x7963c
cmpq %rcx, %rax
jge 0x516ec
movq 0x27997(%rip), %rdi     # 0x78ff0
movq 0x27930(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x188(%rbp)
jmp 0x5166e
movq -0x188(%rbp), %rdi
leaq 0xa99d(%rip), %rsi      # 0x5c019
callq 0x6520
movq %rax, -0x190(%rbp)
jmp 0x5168a
movq -0x190(%rbp), %rdi
movl 0x27fa5(%rip), %esi     # 0x7963c
callq 0x68d0
movq %rax, -0x198(%rbp)
jmp 0x516a5
movq -0x198(%rbp), %rdi
movq 0x278dd(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x1a0(%rbp)
jmp 0x516c1
movq -0x1a0(%rbp), %rdi
movq 0x278c1(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x516d6
movl $0x1, -0x4(%rbp)
movl $0x1, -0xb8(%rbp)
jmp 0x523ba
jmp 0x523ac
leaq 0xa966(%rip), %rsi      # 0x5c05e
leaq -0xb0(%rbp), %rdi
callq 0x2dce0
movb %al, -0x1a1(%rbp)
jmp 0x5170c
movb -0x1a1(%rbp), %al
testb $0x1, %al
jne 0x5171b
jmp 0x51964
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
movl -0x8c(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x51832
movq -0x10(%rbp), %rax
movslq -0x8c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x4c020
movq %rax, -0x1b0(%rbp)
jmp 0x51756
movq -0x1b0(%rbp), %rax
movq %rax, -0x58(%rbp)
jmp 0x51830
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 0x523ec
movq -0x40(%rbp), %rdi
callq 0x6200
movq %rax, -0xc8(%rbp)
movq 0x27857(%rip), %rdi     # 0x78ff0
movq 0x277f0(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x1b8(%rbp)
jmp 0x517ae
movq -0x1b8(%rbp), %rdi
leaq 0xa8a5(%rip), %rsi      # 0x5c061
callq 0x6520
movq %rax, -0x1c0(%rbp)
jmp 0x517ca
movq -0x1c0(%rbp), %rdi
movq 0x277b8(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x1c8(%rbp)
jmp 0x517e6
movq -0x1c8(%rbp), %rdi
movq 0x2779c(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x517fb
movl $0x1, -0x4(%rbp)
movl $0x1, -0xb8(%rbp)
callq 0x6860
jmp 0x51826
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
callq 0x6860
jmp 0x5182b
jmp 0x523ba
jmp 0x523ec
jmp 0x518b1
movq 0x277b7(%rip), %rdi     # 0x78ff0
movq 0x27750(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x1d0(%rbp)
jmp 0x5184e
movq -0x1d0(%rbp), %rdi
leaq 0xa805(%rip), %rsi      # 0x5c061
callq 0x6520
movq %rax, -0x1d8(%rbp)
jmp 0x5186a
movq -0x1d8(%rbp), %rdi
movq 0x27718(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x1e0(%rbp)
jmp 0x51886
movq -0x1e0(%rbp), %rdi
movq 0x276fc(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x5189b
movl $0x1, -0x4(%rbp)
movl $0x1, -0xb8(%rbp)
jmp 0x523ba
movq -0x58(%rbp), %rax
movslq 0x27e1c(%rip), %rcx     # 0x796d8
cmpq %rcx, %rax
jge 0x5195f
movq 0x27724(%rip), %rdi     # 0x78ff0
movq 0x276bd(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x1e8(%rbp)
jmp 0x518e1
movq -0x1e8(%rbp), %rdi
leaq 0xa79b(%rip), %rsi      # 0x5c08a
callq 0x6520
movq %rax, -0x1f0(%rbp)
jmp 0x518fd
movq -0x1f0(%rbp), %rdi
movl 0x27dce(%rip), %esi     # 0x796d8
callq 0x68d0
movq %rax, -0x1f8(%rbp)
jmp 0x51918
movq -0x1f8(%rbp), %rdi
movq 0x2766a(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x200(%rbp)
jmp 0x51934
movq -0x200(%rbp), %rdi
movq 0x2764e(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x51949
movl $0x1, -0x4(%rbp)
movl $0x1, -0xb8(%rbp)
jmp 0x523ba
jmp 0x523aa
leaq 0x9686(%rip), %rsi      # 0x5aff1
leaq -0xb0(%rbp), %rdi
callq 0x2dce0
movb %al, -0x201(%rbp)
jmp 0x5197f
movb -0x201(%rbp), %al
testb $0x1, %al
jne 0x5198e
jmp 0x51c4e
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
movl -0x8c(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x51aa5
movq -0x10(%rbp), %rax
movslq -0x8c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x4c020
movq %rax, -0x210(%rbp)
jmp 0x519c9
movq -0x210(%rbp), %rax
movq %rax, -0x60(%rbp)
jmp 0x51aa3
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 0x523ec
movq -0x40(%rbp), %rdi
callq 0x6200
movq %rax, -0xd0(%rbp)
movq 0x275e4(%rip), %rdi     # 0x78ff0
movq 0x2757d(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x218(%rbp)
jmp 0x51a21
movq -0x218(%rbp), %rdi
leaq 0x95c5(%rip), %rsi      # 0x5aff4
callq 0x6520
movq %rax, -0x220(%rbp)
jmp 0x51a3d
movq -0x220(%rbp), %rdi
movq 0x27545(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x228(%rbp)
jmp 0x51a59
movq -0x228(%rbp), %rdi
movq 0x27529(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x51a6e
movl $0x1, -0x4(%rbp)
movl $0x1, -0xb8(%rbp)
callq 0x6860
jmp 0x51a99
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
callq 0x6860
jmp 0x51a9e
jmp 0x523ba
jmp 0x523ec
jmp 0x51b24
movq 0x27544(%rip), %rdi     # 0x78ff0
movq 0x274dd(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x230(%rbp)
jmp 0x51ac1
movq -0x230(%rbp), %rdi
leaq 0x9525(%rip), %rsi      # 0x5aff4
callq 0x6520
movq %rax, -0x238(%rbp)
jmp 0x51add
movq -0x238(%rbp), %rdi
movq 0x274a5(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x240(%rbp)
jmp 0x51af9
movq -0x240(%rbp), %rdi
movq 0x27489(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x51b0e
movl $0x1, -0x4(%rbp)
movl $0x1, -0xb8(%rbp)
jmp 0x523ba
movq -0x60(%rbp), %rax
movslq 0x27b01(%rip), %rcx     # 0x79630
cmpq %rcx, %rax
jl 0x51b5c
movq -0x60(%rbp), %rax
movslq 0x27af5(%rip), %rcx     # 0x79634
cmpq %rcx, %rax
jg 0x51b5c
movq -0x60(%rbp), %rax
movl $0x3, %ecx
cqto
idivq %rcx
cmpq $0x0, %rdx
je 0x51c49
movq 0x2748d(%rip), %rdi     # 0x78ff0
movq 0x27426(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x248(%rbp)
jmp 0x51b78
movq -0x248(%rbp), %rdi
leaq 0x9497(%rip), %rsi      # 0x5b01d
callq 0x6520
movq %rax, -0x250(%rbp)
jmp 0x51b94
movq -0x250(%rbp), %rdi
movl 0x27a8f(%rip), %esi     # 0x79630
callq 0x68d0
movq %rax, -0x258(%rbp)
jmp 0x51baf
movq -0x258(%rbp), %rdi
leaq 0x89b9(%rip), %rsi      # 0x5a576
callq 0x6520
movq %rax, -0x260(%rbp)
jmp 0x51bcb
movq -0x260(%rbp), %rdi
movl 0x27a5c(%rip), %esi     # 0x79634
callq 0x68d0
movq %rax, -0x268(%rbp)
jmp 0x51be6
movq -0x268(%rbp), %rdi
leaq 0x9457(%rip), %rsi      # 0x5b04b
callq 0x6520
movq %rax, -0x270(%rbp)
jmp 0x51c02
movq -0x270(%rbp), %rdi
movq 0x27380(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x278(%rbp)
jmp 0x51c1e
movq -0x278(%rbp), %rdi
movq 0x27364(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x51c33
movl $0x1, -0x4(%rbp)
movl $0x1, -0xb8(%rbp)
jmp 0x523ba
jmp 0x523a8
leaq 0xa47f(%rip), %rsi      # 0x5c0d4
leaq -0xb0(%rbp), %rdi
callq 0x2dce0
movb %al, -0x279(%rbp)
jmp 0x51c69
movb -0x279(%rbp), %al
testb $0x1, %al
jne 0x51c78
jmp 0x51eb0
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
movl -0x8c(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x51d92
movq -0x10(%rbp), %rax
movslq -0x8c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x4c0c0
movss %xmm0, -0x280(%rbp)
jmp 0x51cb4
movss -0x280(%rbp), %xmm0
movss %xmm0, -0x70(%rbp)
jmp 0x51d90
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 0x523ec
movq -0x40(%rbp), %rdi
callq 0x6200
movq %rax, -0xd8(%rbp)
movq 0x272f7(%rip), %rdi     # 0x78ff0
movq 0x27290(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x288(%rbp)
jmp 0x51d0e
movq -0x288(%rbp), %rdi
leaq 0xa3bb(%rip), %rsi      # 0x5c0d7
callq 0x6520
movq %rax, -0x290(%rbp)
jmp 0x51d2a
movq -0x290(%rbp), %rdi
movq 0x27258(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x298(%rbp)
jmp 0x51d46
movq -0x298(%rbp), %rdi
movq 0x2723c(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x51d5b
movl $0x1, -0x4(%rbp)
movl $0x1, -0xb8(%rbp)
callq 0x6860
jmp 0x51d86
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
callq 0x6860
jmp 0x51d8b
jmp 0x523ba
jmp 0x523ec
jmp 0x51e11
movq 0x27257(%rip), %rdi     # 0x78ff0
movq 0x271f0(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x2a0(%rbp)
jmp 0x51dae
movq -0x2a0(%rbp), %rdi
leaq 0xa31b(%rip), %rsi      # 0x5c0d7
callq 0x6520
movq %rax, -0x2a8(%rbp)
jmp 0x51dca
movq -0x2a8(%rbp), %rdi
movq 0x271b8(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x2b0(%rbp)
jmp 0x51de6
movq -0x2b0(%rbp), %rdi
movq 0x2719c(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x51dfb
movl $0x1, -0x4(%rbp)
movl $0x1, -0xb8(%rbp)
jmp 0x523ba
xorps %xmm0, %xmm0
ucomiss -0x70(%rbp), %xmm0
ja 0x51e2c
movss -0x70(%rbp), %xmm0
movss 0x71dd(%rip), %xmm1     # 0x59004
ucomiss %xmm1, %xmm0
jbe 0x51eab
movq 0x271bd(%rip), %rdi     # 0x78ff0
movq 0x27156(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x2b8(%rbp)
jmp 0x51e48
movq -0x2b8(%rbp), %rdi
leaq 0xa2af(%rip), %rsi      # 0x5c105
callq 0x6520
movq %rax, -0x2c0(%rbp)
jmp 0x51e64
movq -0x2c0(%rbp), %rdi
movq 0x2711e(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x2c8(%rbp)
jmp 0x51e80
movq -0x2c8(%rbp), %rdi
movq 0x27102(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x51e95
movl $0x1, -0x4(%rbp)
movl $0x1, -0xb8(%rbp)
jmp 0x523ba
jmp 0x523a6
leaq 0x943a(%rip), %rsi      # 0x5b2f1
leaq -0xb0(%rbp), %rdi
callq 0x2dce0
movb %al, -0x2c9(%rbp)
jmp 0x51ecb
movb -0x2c9(%rbp), %al
testb $0x1, %al
jne 0x51eda
jmp 0x5200b
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
movl -0x8c(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x51f87
movq -0x10(%rbp), %rax
movslq -0x8c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x2e0(%rbp)
leaq -0xf9(%rbp), %rdi
movq %rdi, -0x2d8(%rbp)
callq 0x6910
movq -0x2e0(%rbp), %rsi
movq -0x2d8(%rbp), %rdx
leaq -0xf8(%rbp), %rdi
callq 0xab20
jmp 0x51f3d
leaq -0x30(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x6640
leaq -0xf8(%rbp), %rdi
callq 0x6a08
leaq -0xf9(%rbp), %rdi
callq 0x65a0
jmp 0x52006
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xf9(%rbp), %rdi
callq 0x65a0
jmp 0x523ec
movq 0x27062(%rip), %rdi     # 0x78ff0
movq 0x26ffb(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x2e8(%rbp)
jmp 0x51fa3
movq -0x2e8(%rbp), %rdi
leaq 0x958b(%rip), %rsi      # 0x5b53c
callq 0x6520
movq %rax, -0x2f0(%rbp)
jmp 0x51fbf
movq -0x2f0(%rbp), %rdi
movq 0x26fc3(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x2f8(%rbp)
jmp 0x51fdb
movq -0x2f8(%rbp), %rdi
movq 0x26fa7(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x51ff0
movl $0x1, -0x4(%rbp)
movl $0x1, -0xb8(%rbp)
jmp 0x523ba
jmp 0x523a4
leaq 0x96d2(%rip), %rsi      # 0x5b6e4
leaq -0xb0(%rbp), %rdi
callq 0x2dce0
movb %al, -0x2f9(%rbp)
jmp 0x52026
movb -0x2f9(%rbp), %al
testb $0x1, %al
jne 0x52035
jmp 0x522c5
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
movl -0x8c(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x5214c
movq -0x10(%rbp), %rax
movslq -0x8c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x4c020
movq %rax, -0x308(%rbp)
jmp 0x52070
movq -0x308(%rbp), %rax
movq %rax, -0x68(%rbp)
jmp 0x5214a
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 0x523ec
movq -0x40(%rbp), %rdi
callq 0x6200
movq %rax, -0x108(%rbp)
movq 0x26f3d(%rip), %rdi     # 0x78ff0
movq 0x26ed6(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x310(%rbp)
jmp 0x520c8
movq -0x310(%rbp), %rdi
leaq 0xa066(%rip), %rsi      # 0x5c13c
callq 0x6520
movq %rax, -0x318(%rbp)
jmp 0x520e4
movq -0x318(%rbp), %rdi
movq 0x26e9e(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x320(%rbp)
jmp 0x52100
movq -0x320(%rbp), %rdi
movq 0x26e82(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x52115
movl $0x1, -0x4(%rbp)
movl $0x1, -0xb8(%rbp)
callq 0x6860
jmp 0x52140
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
callq 0x6860
jmp 0x52145
jmp 0x523ba
jmp 0x523ec
jmp 0x521cb
movq 0x26e9d(%rip), %rdi     # 0x78ff0
movq 0x26e36(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x328(%rbp)
jmp 0x52168
movq -0x328(%rbp), %rdi
leaq 0x9fc6(%rip), %rsi      # 0x5c13c
callq 0x6520
movq %rax, -0x330(%rbp)
jmp 0x52184
movq -0x330(%rbp), %rdi
movq 0x26dfe(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x338(%rbp)
jmp 0x521a0
movq -0x338(%rbp), %rdi
movq 0x26de2(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x521b5
movl $0x1, -0x4(%rbp)
movl $0x1, -0xb8(%rbp)
jmp 0x523ba
movq -0x68(%rbp), %rax
movslq 0x274fe(%rip), %rcx     # 0x796d4
cmpq %rcx, %rax
jl 0x521ef
movq -0x68(%rbp), %rax
movslq 0x27452(%rip), %rcx     # 0x79638
cmpq %rcx, %rax
jle 0x522c0
movq 0x26dfa(%rip), %rdi     # 0x78ff0
movq 0x26d93(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x340(%rbp)
jmp 0x5220b
movq -0x340(%rbp), %rdi
leaq 0x9f4c(%rip), %rsi      # 0x5c165
callq 0x6520
movq %rax, -0x348(%rbp)
jmp 0x52227
movq -0x348(%rbp), %rdi
movl 0x274a0(%rip), %esi     # 0x796d4
callq 0x68d0
movq %rax, -0x350(%rbp)
jmp 0x52242
movq -0x350(%rbp), %rdi
leaq 0x8326(%rip), %rsi      # 0x5a576
callq 0x6520
movq %rax, -0x358(%rbp)
jmp 0x5225e
movq -0x358(%rbp), %rdi
movl 0x273cd(%rip), %esi     # 0x79638
callq 0x68d0
movq %rax, -0x360(%rbp)
jmp 0x52279
movq -0x360(%rbp), %rdi
movq 0x26d09(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x368(%rbp)
jmp 0x52295
movq -0x368(%rbp), %rdi
movq 0x26ced(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x522aa
movl $0x1, -0x4(%rbp)
movl $0x1, -0xb8(%rbp)
jmp 0x523ba
jmp 0x523a2
xorl %eax, %eax
movl %eax, %esi
leaq -0xb0(%rbp), %rdi
callq 0x69e0
movq %rax, -0x370(%rbp)
jmp 0x522de
movq -0x370(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x52389
movq 0x26cf8(%rip), %rdi     # 0x78ff0
movq 0x26c91(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x378(%rbp)
jmp 0x5230d
movq -0x378(%rbp), %rdi
leaq 0x8d71(%rip), %rsi      # 0x5b08c
callq 0x6520
movq %rax, -0x380(%rbp)
jmp 0x52329
movq -0x380(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x64d0
movq %rax, -0x388(%rbp)
jmp 0x52345
movq -0x388(%rbp), %rdi
movq 0x26c3d(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x390(%rbp)
jmp 0x52361
movq -0x390(%rbp), %rdi
movq 0x26c21(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x52376
movl $0x1, -0x4(%rbp)
movl $0x1, -0xb8(%rbp)
jmp 0x523ba
leaq -0x88(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0xabd0
jmp 0x5239e
jmp 0x523a0
jmp 0x523a2
jmp 0x523a4
jmp 0x523a6
jmp 0x523a8
jmp 0x523aa
jmp 0x523ac
jmp 0x523ae
jmp 0x523b0
movl $0x0, -0xb8(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x6a08
movl -0xb8(%rbp), %eax
testl %eax, %eax
jne 0x528ae
jmp 0x523d6
jmp 0x523d8
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x5133b
leaq -0xb0(%rbp), %rdi
callq 0x6a08
jmp 0x528cf
leaq -0x88(%rbp), %rdi
callq 0xb670
cmpq $0x1, %rax
jae 0x5248a
movq 0x26bda(%rip), %rdi     # 0x78ff0
movq 0x26b73(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x398(%rbp)
jmp 0x5242b
movq -0x398(%rbp), %rdi
leaq 0x8c66(%rip), %rsi      # 0x5b09f
callq 0x6520
movq %rax, -0x3a0(%rbp)
jmp 0x52447
movq -0x3a0(%rbp), %rdi
movq 0x26b3b(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x5245c
callq 0x51100
jmp 0x52463
movl $0x1, -0x4(%rbp)
movl $0x1, -0xb8(%rbp)
jmp 0x528ae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x528cf
callq 0x4c460
jmp 0x52491
movq 0x26b10(%rip), %rdi     # 0x78fa8
leaq 0x8c12(%rip), %rsi      # 0x5b0b1
callq 0x6520
movq %rax, -0x3a8(%rbp)
jmp 0x524ad
movq -0x3a8(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x6950
movq %rax, -0x3b0(%rbp)
jmp 0x524c6
movq -0x3b0(%rbp), %rdi
leaq 0x7305(%rip), %rsi      # 0x597d9
callq 0x6520
jmp 0x524db
leaq -0x88(%rbp), %rdi
callq 0xb670
movslq 0x27152(%rip), %rcx     # 0x79640
cmpq %rcx, %rax
jbe 0x52531
leaq -0x88(%rbp), %rdi
callq 0xb670
movq %rax, %rsi
movq 0x26a9f(%rip), %rdi     # 0x78fa8
callq 0x6120
movq %rax, -0x3b8(%rbp)
jmp 0x52517
movq -0x3b8(%rbp), %rdi
leaq 0x8594(%rip), %rsi      # 0x5aab9
callq 0x6520
jmp 0x5252c
jmp 0x525bb
leaq -0x88(%rbp), %rdi
callq 0xb4c0
movq %rax, -0x110(%rbp)
leaq -0x88(%rbp), %rdi
callq 0xb340
movq %rax, -0x118(%rbp)
leaq -0x110(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x4a690
testb $0x1, %al
jne 0x52570
jmp 0x525b9
leaq -0x110(%rbp), %rdi
callq 0x30840
movq %rax, %rsi
movq 0x26a22(%rip), %rdi     # 0x78fa8
callq 0x64d0
movq %rax, -0x3c0(%rbp)
jmp 0x52594
movq -0x3c0(%rbp), %rdi
leaq 0x7dab(%rip), %rsi      # 0x5a34d
callq 0x6520
jmp 0x525a9
jmp 0x525ab
leaq -0x110(%rbp), %rdi
callq 0x4a6d0
jmp 0x52544
jmp 0x525bb
movq 0x269e6(%rip), %rdi     # 0x78fa8
movq 0x269c7(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x525d0
movq 0x269d1(%rip), %rdi     # 0x78fa8
leaq 0x9bc2(%rip), %rsi      # 0x5c1a0
callq 0x6520
movq %rax, -0x3c8(%rbp)
jmp 0x525ec
movq -0x3c8(%rbp), %rdi
movq 0x26996(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x52601
movq 0x269a0(%rip), %rdi     # 0x78fa8
leaq 0x9b9a(%rip), %rsi      # 0x5c1a9
callq 0x6520
movq %rax, -0x3d0(%rbp)
jmp 0x5261d
movq -0x3d0(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x6950
movq %rax, -0x3d8(%rbp)
jmp 0x52636
movq -0x3d8(%rbp), %rdi
movq 0x2694c(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x5264b
movq 0x26956(%rip), %rdi     # 0x78fa8
leaq 0x9b64(%rip), %rsi      # 0x5c1bd
callq 0x6520
movq %rax, -0x3e0(%rbp)
jmp 0x52667
movq -0x3e0(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x6950
movq %rax, -0x3e8(%rbp)
jmp 0x52680
movq -0x3e8(%rbp), %rdi
movq 0x26902(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x52695
movq 0x2690c(%rip), %rdi     # 0x78fa8
leaq 0x9b37(%rip), %rsi      # 0x5c1da
callq 0x6520
movq %rax, -0x3f0(%rbp)
jmp 0x526b1
movq -0x3f0(%rbp), %rdi
movss -0x70(%rbp), %xmm0
callq 0x63f0
movq %rax, -0x3f8(%rbp)
jmp 0x526cb
movq -0x3f8(%rbp), %rdi
movq 0x268b7(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x526e0
movq 0x268c1(%rip), %rdi     # 0x78fa8
leaq 0x9b0f(%rip), %rsi      # 0x5c1fd
callq 0x6520
movq %rax, -0x400(%rbp)
jmp 0x526fc
movq -0x400(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x6950
movq %rax, -0x408(%rbp)
jmp 0x52715
movq -0x408(%rbp), %rdi
movq 0x2686d(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x5272a
movq 0x26877(%rip), %rdi     # 0x78fa8
leaq 0x8cd4(%rip), %rsi      # 0x5b40c
callq 0x6520
movq %rax, -0x410(%rbp)
jmp 0x52746
movq -0x410(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x64d0
movq %rax, -0x418(%rbp)
jmp 0x5275f
movq -0x418(%rbp), %rdi
leaq 0x95a9(%rip), %rsi      # 0x5bd16
callq 0x6520
movq %rax, -0x420(%rbp)
jmp 0x5277b
movq -0x420(%rbp), %rdi
movq 0x26807(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x52790
testb $0x1, -0x69(%rbp)
je 0x527fe
movq 0x2680b(%rip), %rdi     # 0x78fa8
leaq 0x9a72(%rip), %rsi      # 0x5c216
callq 0x6520
movq %rax, -0x428(%rbp)
jmp 0x527b2
movq -0x428(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x64d0
movq %rax, -0x430(%rbp)
jmp 0x527cb
movq -0x430(%rbp), %rdi
leaq 0x7410(%rip), %rsi      # 0x59be9
callq 0x6520
movq %rax, -0x438(%rbp)
jmp 0x527e7
movq -0x438(%rbp), %rdi
movq 0x2679b(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x527fc
jmp 0x527fe
movq 0x267a3(%rip), %rdi     # 0x78fa8
movq 0x26784(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x52813
movl -0x60(%rbp), %eax
movl %eax, -0x11c(%rbp)
movl -0x68(%rbp), %eax
movl %eax, -0x120(%rbp)
movl -0x58(%rbp), %eax
movl %eax, -0x124(%rbp)
movl -0x50(%rbp), %eax
movl %eax, -0x128(%rbp)
movzbl -0x69(%rbp), %ecx
andl $0x1, %ecx
movq %rsp, %rax
movl %ecx, 0x8(%rax)
leaq -0x70(%rbp), %rcx
movq %rcx, (%rax)
leaq -0x88(%rbp), %rdi
leaq -0x30(%rbp), %rsi
leaq -0x11c(%rbp), %rdx
leaq -0x120(%rbp), %rcx
leaq -0x124(%rbp), %r8
leaq -0x128(%rbp), %r9
callq 0x28c00
movl %eax, -0x43c(%rbp)
jmp 0x5287f
movl -0x43c(%rbp), %eax
cmpl $0x0, %eax
je 0x5289d
movl $0x1, -0x4(%rbp)
movl $0x1, -0xb8(%rbp)
jmp 0x528ae
movl $0x0, -0x4(%rbp)
movl $0x1, -0xb8(%rbp)
leaq -0x88(%rbp), %rdi
callq 0xfe90
leaq -0x30(%rbp), %rdi
callq 0x6a08
movl -0x4(%rbp), %eax
addq $0x450, %rsp            # imm = 0x450
popq %rbp
retq
leaq -0x88(%rbp), %rdi
callq 0xfe90
leaq -0x30(%rbp), %rdi
callq 0x6a08
movq -0x40(%rbp), %rdi
callq 0x6900
movq %rax, %rdi
callq 0x9b50
nopw %cs:(%rax,%rax)