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

	bool distancefile=true;
	bool clusterfile=true;
	bool includesingletons=false;
	std::string prefix="distances";
	float minid=0.9;
	int maxsnps=20;
	std::vector < std::string > args;

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

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

		if (arg=="-h" || arg=="--help"){
			distanceHelp();
			return 0;
		}
		else if (arg=="-c"){
			clusterfile=false;
		}
		else if (arg == "-d"){
			distancefile=false;
		}
		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 == "-i"){
			i++;
			if (i<argc){
				try {
					minid = getfloat(argv[i]);
				}
				catch (const std::invalid_argument& e) {
					std::cerr << std::endl << "Expecting float between 0 and 1 after -i flag" << std::endl << std::endl;
					return 1;
				}
			}
			else {
				std::cerr << std::endl << "Expecting float between 0 and 1 after -i flag" << std::endl << std::endl;
				return 1;
			}
			if (minid < 0 || minid > 1){
				std::cerr << std::endl << "Minimum identity must be between 0 and 1" << std::endl << std::endl;
				return 1;
			}
		}
		else if (arg == "-o"){
			i++;
			if (i<argc){
				prefix = argv[i];
			}
			else {
				std::cerr << std::endl << "Expecting string after -o flag" << std::endl << std::endl;
				return 1;
			}
		}
		else if (arg == "-s"){
			i++;
			if (i<argc){
				try {
					maxsnps = getint(argv[i]);
				}
				catch (const std::invalid_argument& e) {
					std::cerr << std::endl << "Expecting positive integer after -s flag" << std::endl << std::endl;
					return 1;
				}
			}
			else {
				std::cerr << std::endl << "Expecting positive integer after -s flag" << std::endl << std::endl;
				return 1;
			}
			if (maxsnps < 0){
				std::cerr << std::endl << "Maximum number of SNPs must be 0 or greater" << std::endl << std::endl;
				return 1;
			}
		}
		else if (arg == "-S"){
			includesingletons=true;
		}
		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;
		distanceHelp();
		return 1;
	}

	if (distancefile==false && clusterfile==false){
		std::cerr << std::endl << "At least one output file is required. i.e. you cannot use the -c and -d flags together." << std::endl << std::endl;
		return 1;
	}
	if (prefix=="false"){
		std::cerr << std::endl << "An output prefix (-p) is required." << std::endl << std::endl;
		return 1;
	}

	skaVersion();

	std::cout << "Calculating pairwise distances 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 << "Clusters will be created for isolates that are within " << maxsnps << " SNPs of one another and share at least " << minid*100 << "% of the split kmers of the isolate with fewer kmers" << std::endl;

	if (distancefile){
		std::cout << "Distances will be written to " << prefix << ".distances.tsv" << std::endl;
	}
	if (clusterfile){
		std::cout << "Clusters will be written to files with the prefix " << prefix << std::endl;
	}
	std::cout << std::endl;

	if (kmerDistance(prefix, distancefile, clusterfile, args, maxsnps, minid, includesingletons)){return 1;}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2e0, %rsp            # imm = 0x2E0
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb $0x1, -0x11(%rbp)
movb $0x1, -0x12(%rbp)
movb $0x0, -0x13(%rbp)
leaq -0x39(%rbp), %rdi
movq %rdi, -0xf0(%rbp)
callq 0x6910
movq -0xf0(%rbp), %rdx
leaq 0xa46d(%rip), %rsi      # 0x59989
leaq -0x38(%rbp), %rdi
callq 0xab20
jmp 0x4f527
leaq -0x39(%rbp), %rdi
callq 0x65a0
movss 0xb3b4(%rip), %xmm0     # 0x5a8ec
movss %xmm0, -0x50(%rbp)
movl $0x14, -0x54(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x1ab40
movl $0x2, -0x74(%rbp)
movl -0x74(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x4fef6
movq -0x10(%rbp), %rax
movslq -0x74(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x100(%rbp)
leaq -0x99(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
callq 0x6910
movq -0x100(%rbp), %rsi
movq -0xf8(%rbp), %rdx
leaq -0x98(%rbp), %rdi
callq 0xab20
jmp 0x4f5a2
leaq -0x99(%rbp), %rdi
callq 0x65a0
leaq 0xba32(%rip), %rsi      # 0x5afe7
leaq -0x98(%rbp), %rdi
callq 0x2dce0
movb %al, -0x101(%rbp)
jmp 0x4f5c9
movb -0x101(%rbp), %al
testb $0x1, %al
jne 0x4f5fc
jmp 0x4f5d5
leaq 0xba0e(%rip), %rsi      # 0x5afea
leaq -0x98(%rbp), %rdi
callq 0x2dce0
movb %al, -0x102(%rbp)
jmp 0x4f5f0
movb -0x102(%rbp), %al
testb $0x1, %al
jne 0x4f5fc
jmp 0x4f661
callq 0x4f330
jmp 0x4f603
movl $0x0, -0x4(%rbp)
movl $0x1, -0xa0(%rbp)
jmp 0x4feb9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x39(%rbp), %rdi
callq 0x65a0
jmp 0x503d5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x99(%rbp), %rdi
callq 0x65a0
jmp 0x503c3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x4fee5
leaq 0xc30f(%rip), %rsi      # 0x5b977
leaq -0x98(%rbp), %rdi
callq 0x2dce0
movb %al, -0x103(%rbp)
jmp 0x4f67c
movb -0x103(%rbp), %al
testb $0x1, %al
jne 0x4f688
jmp 0x4f691
movb $0x0, -0x12(%rbp)
jmp 0x4fead
leaq 0xc2e2(%rip), %rsi      # 0x5b97a
leaq -0x98(%rbp), %rdi
callq 0x2dce0
movb %al, -0x104(%rbp)
jmp 0x4f6ac
movb -0x104(%rbp), %al
testb $0x1, %al
jne 0x4f6b8
jmp 0x4f6c1
movb $0x0, -0x11(%rbp)
jmp 0x4feab
leaq 0xb99f(%rip), %rsi      # 0x5b067
leaq -0x98(%rbp), %rdi
callq 0x2dce0
movb %al, -0x105(%rbp)
jmp 0x4f6dc
movb -0x105(%rbp), %al
testb $0x1, %al
jne 0x4f6eb
jmp 0x4f82c
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
movl -0x74(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x4f7a8
movq -0x10(%rbp), %rax
movslq -0x74(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x118(%rbp)
leaq -0xc1(%rbp), %rdi
movq %rdi, -0x110(%rbp)
callq 0x6910
movq -0x118(%rbp), %rsi
movq -0x110(%rbp), %rdx
leaq -0xc0(%rbp), %rdi
callq 0xab20
jmp 0x4f742
leaq -0xc0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0xa6a0
jmp 0x4f754
leaq -0xc0(%rbp), %rdi
callq 0x6a08
leaq -0xc1(%rbp), %rdi
callq 0x65a0
jmp 0x4f827
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x4f797
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x6a08
leaq -0xc1(%rbp), %rdi
callq 0x65a0
jmp 0x4fee5
movq 0x29841(%rip), %rdi     # 0x78ff0
movq 0x297da(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x120(%rbp)
jmp 0x4f7c4
movq -0x120(%rbp), %rdi
leaq 0xb898(%rip), %rsi      # 0x5b06a
callq 0x6520
movq %rax, -0x128(%rbp)
jmp 0x4f7e0
movq -0x128(%rbp), %rdi
movq 0x297a2(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x130(%rbp)
jmp 0x4f7fc
movq -0x130(%rbp), %rdi
movq 0x29786(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x4f811
movl $0x1, -0x4(%rbp)
movl $0x1, -0xa0(%rbp)
jmp 0x4feb9
jmp 0x4fea9
leaq 0xbd06(%rip), %rsi      # 0x5b539
leaq -0x98(%rbp), %rdi
callq 0x2dce0
movb %al, -0x131(%rbp)
jmp 0x4f847
movb -0x131(%rbp), %al
testb $0x1, %al
jne 0x4f856
jmp 0x4fa82
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
movl -0x74(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x4f964
movq -0x10(%rbp), %rax
movslq -0x74(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x4c0c0
movss %xmm0, -0x138(%rbp)
jmp 0x4f886
movss -0x138(%rbp), %xmm0
movss %xmm0, -0x50(%rbp)
jmp 0x4f962
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x4fee5
movq -0x48(%rbp), %rdi
callq 0x6200
movq %rax, -0xd0(%rbp)
movq 0x29725(%rip), %rdi     # 0x78ff0
movq 0x296be(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x140(%rbp)
jmp 0x4f8e0
movq -0x140(%rbp), %rdi
leaq 0xc08f(%rip), %rsi      # 0x5b97d
callq 0x6520
movq %rax, -0x148(%rbp)
jmp 0x4f8fc
movq -0x148(%rbp), %rdi
movq 0x29686(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x150(%rbp)
jmp 0x4f918
movq -0x150(%rbp), %rdi
movq 0x2966a(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x4f92d
movl $0x1, -0x4(%rbp)
movl $0x1, -0xa0(%rbp)
callq 0x6860
jmp 0x4f958
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
callq 0x6860
jmp 0x4f95d
jmp 0x4feb9
jmp 0x4fee5
jmp 0x4f9e3
movq 0x29685(%rip), %rdi     # 0x78ff0
movq 0x2961e(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x158(%rbp)
jmp 0x4f980
movq -0x158(%rbp), %rdi
leaq 0xbfef(%rip), %rsi      # 0x5b97d
callq 0x6520
movq %rax, -0x160(%rbp)
jmp 0x4f99c
movq -0x160(%rbp), %rdi
movq 0x295e6(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x168(%rbp)
jmp 0x4f9b8
movq -0x168(%rbp), %rdi
movq 0x295ca(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x4f9cd
movl $0x1, -0x4(%rbp)
movl $0x1, -0xa0(%rbp)
jmp 0x4feb9
xorps %xmm0, %xmm0
ucomiss -0x50(%rbp), %xmm0
ja 0x4f9fe
movss -0x50(%rbp), %xmm0
movss 0x960b(%rip), %xmm1     # 0x59004
ucomiss %xmm1, %xmm0
jbe 0x4fa7d
movq 0x295eb(%rip), %rdi     # 0x78ff0
movq 0x29584(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x170(%rbp)
jmp 0x4fa1a
movq -0x170(%rbp), %rdi
leaq 0xbf83(%rip), %rsi      # 0x5b9ab
callq 0x6520
movq %rax, -0x178(%rbp)
jmp 0x4fa36
movq -0x178(%rbp), %rdi
movq 0x2954c(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x180(%rbp)
jmp 0x4fa52
movq -0x180(%rbp), %rdi
movq 0x29530(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x4fa67
movl $0x1, -0x4(%rbp)
movl $0x1, -0xa0(%rbp)
jmp 0x4feb9
jmp 0x4fea7
leaq 0xb868(%rip), %rsi      # 0x5b2f1
leaq -0x98(%rbp), %rdi
callq 0x2dce0
movb %al, -0x181(%rbp)
jmp 0x4fa9d
movb -0x181(%rbp), %al
testb $0x1, %al
jne 0x4faac
jmp 0x4fb5a
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
movl -0x74(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x4fad6
movq -0x10(%rbp), %rax
movslq -0x74(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq -0x38(%rbp), %rdi
callq 0x6710
jmp 0x4fad4
jmp 0x4fb55
movq 0x29513(%rip), %rdi     # 0x78ff0
movq 0x294ac(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x190(%rbp)
jmp 0x4faf2
movq -0x190(%rbp), %rdi
leaq 0xb7f4(%rip), %rsi      # 0x5b2f4
callq 0x6520
movq %rax, -0x198(%rbp)
jmp 0x4fb0e
movq -0x198(%rbp), %rdi
movq 0x29474(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x1a0(%rbp)
jmp 0x4fb2a
movq -0x1a0(%rbp), %rdi
movq 0x29458(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x4fb3f
movl $0x1, -0x4(%rbp)
movl $0x1, -0xa0(%rbp)
jmp 0x4feb9
jmp 0x4fea5
leaq 0xb80e(%rip), %rsi      # 0x5b36f
leaq -0x98(%rbp), %rdi
callq 0x2dce0
movb %al, -0x1a1(%rbp)
jmp 0x4fb75
movb -0x1a1(%rbp), %al
testb $0x1, %al
jne 0x4fb84
jmp 0x4fd97
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
movl -0x74(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x4fc8e
movq -0x10(%rbp), %rax
movslq -0x74(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x4c020
movq %rax, -0x1b0(%rbp)
jmp 0x4fbb3
movq -0x1b0(%rbp), %rax
movl %eax, -0x54(%rbp)
jmp 0x4fc8c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x4fee5
movq -0x48(%rbp), %rdi
callq 0x6200
movq %rax, -0xd8(%rbp)
movq 0x293fb(%rip), %rdi     # 0x78ff0
movq 0x29394(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x1b8(%rbp)
jmp 0x4fc0a
movq -0x1b8(%rbp), %rdi
leaq 0xbdbc(%rip), %rsi      # 0x5b9d4
callq 0x6520
movq %rax, -0x1c0(%rbp)
jmp 0x4fc26
movq -0x1c0(%rbp), %rdi
movq 0x2935c(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x1c8(%rbp)
jmp 0x4fc42
movq -0x1c8(%rbp), %rdi
movq 0x29340(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x4fc57
movl $0x1, -0x4(%rbp)
movl $0x1, -0xa0(%rbp)
callq 0x6860
jmp 0x4fc82
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
callq 0x6860
jmp 0x4fc87
jmp 0x4feb9
jmp 0x4fee5
jmp 0x4fd0d
movq 0x2935b(%rip), %rdi     # 0x78ff0
movq 0x292f4(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x1d0(%rbp)
jmp 0x4fcaa
movq -0x1d0(%rbp), %rdi
leaq 0xbd1c(%rip), %rsi      # 0x5b9d4
callq 0x6520
movq %rax, -0x1d8(%rbp)
jmp 0x4fcc6
movq -0x1d8(%rbp), %rdi
movq 0x292bc(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x1e0(%rbp)
jmp 0x4fce2
movq -0x1e0(%rbp), %rdi
movq 0x292a0(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x4fcf7
movl $0x1, -0x4(%rbp)
movl $0x1, -0xa0(%rbp)
jmp 0x4feb9
cmpl $0x0, -0x54(%rbp)
jge 0x4fd92
movq 0x292d6(%rip), %rdi     # 0x78ff0
movq 0x2926f(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x1e8(%rbp)
jmp 0x4fd2f
movq -0x1e8(%rbp), %rdi
leaq 0xbcc0(%rip), %rsi      # 0x5b9fd
callq 0x6520
movq %rax, -0x1f0(%rbp)
jmp 0x4fd4b
movq -0x1f0(%rbp), %rdi
movq 0x29237(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x1f8(%rbp)
jmp 0x4fd67
movq -0x1f8(%rbp), %rdi
movq 0x2921b(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x4fd7c
movl $0x1, -0x4(%rbp)
movl $0x1, -0xa0(%rbp)
jmp 0x4feb9
jmp 0x4fea3
leaq 0xbc8b(%rip), %rsi      # 0x5ba29
leaq -0x98(%rbp), %rdi
callq 0x2dce0
movb %al, -0x1f9(%rbp)
jmp 0x4fdb2
movb -0x1f9(%rbp), %al
testb $0x1, %al
jne 0x4fdbe
jmp 0x4fdc7
movb $0x1, -0x13(%rbp)
jmp 0x4fea1
xorl %eax, %eax
movl %eax, %esi
leaq -0x98(%rbp), %rdi
callq 0x69e0
movq %rax, -0x208(%rbp)
jmp 0x4fde0
movq -0x208(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x4fe8b
movq 0x291f6(%rip), %rdi     # 0x78ff0
movq 0x2918f(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x210(%rbp)
jmp 0x4fe0f
movq -0x210(%rbp), %rdi
leaq 0xb26f(%rip), %rsi      # 0x5b08c
callq 0x6520
movq %rax, -0x218(%rbp)
jmp 0x4fe2b
movq -0x218(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x64d0
movq %rax, -0x220(%rbp)
jmp 0x4fe47
movq -0x220(%rbp), %rdi
movq 0x2913b(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x228(%rbp)
jmp 0x4fe63
movq -0x228(%rbp), %rdi
movq 0x2911f(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x4fe78
movl $0x1, -0x4(%rbp)
movl $0x1, -0xa0(%rbp)
jmp 0x4feb9
leaq -0x70(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0xabd0
jmp 0x4fe9d
jmp 0x4fe9f
jmp 0x4fea1
jmp 0x4fea3
jmp 0x4fea5
jmp 0x4fea7
jmp 0x4fea9
jmp 0x4feab
jmp 0x4fead
jmp 0x4feaf
movl $0x0, -0xa0(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x6a08
movl -0xa0(%rbp), %eax
testl %eax, %eax
jne 0x503a5
jmp 0x4fed5
jmp 0x4fed7
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x4f554
leaq -0x98(%rbp), %rdi
callq 0x6a08
jmp 0x503c3
leaq -0x70(%rbp), %rdi
callq 0xb670
cmpq $0x1, %rax
jae 0x4ff80
movq 0x290e4(%rip), %rdi     # 0x78ff0
movq 0x2907d(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x230(%rbp)
jmp 0x4ff21
movq -0x230(%rbp), %rdi
leaq 0xb170(%rip), %rsi      # 0x5b09f
callq 0x6520
movq %rax, -0x238(%rbp)
jmp 0x4ff3d
movq -0x238(%rbp), %rdi
movq 0x29045(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x4ff52
callq 0x4f330
jmp 0x4ff59
movl $0x1, -0x4(%rbp)
movl $0x1, -0xa0(%rbp)
jmp 0x503a5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x503c3
movb -0x11(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x5001d
movb -0x12(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x5001d
movq 0x2904b(%rip), %rdi     # 0x78ff0
movq 0x28fe4(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x240(%rbp)
jmp 0x4ffba
movq -0x240(%rbp), %rdi
leaq 0xba64(%rip), %rsi      # 0x5ba2c
callq 0x6520
movq %rax, -0x248(%rbp)
jmp 0x4ffd6
movq -0x248(%rbp), %rdi
movq 0x28fac(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x250(%rbp)
jmp 0x4fff2
movq -0x250(%rbp), %rdi
movq 0x28f90(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x50007
movl $0x1, -0x4(%rbp)
movl $0x1, -0xa0(%rbp)
jmp 0x503a5
leaq 0xba60(%rip), %rsi      # 0x5ba84
leaq -0x38(%rbp), %rdi
callq 0x2dce0
movb %al, -0x251(%rbp)
jmp 0x50035
movb -0x251(%rbp), %al
testb $0x1, %al
jne 0x50041
jmp 0x500c0
movq 0x28fa8(%rip), %rdi     # 0x78ff0
movq 0x28f41(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x260(%rbp)
jmp 0x5005d
movq -0x260(%rbp), %rdi
leaq 0xba1f(%rip), %rsi      # 0x5ba8a
callq 0x6520
movq %rax, -0x268(%rbp)
jmp 0x50079
movq -0x268(%rbp), %rdi
movq 0x28f09(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x270(%rbp)
jmp 0x50095
movq -0x270(%rbp), %rdi
movq 0x28eed(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x500aa
movl $0x1, -0x4(%rbp)
movl $0x1, -0xa0(%rbp)
jmp 0x503a5
callq 0x4c460
jmp 0x500c7
movq 0x28eda(%rip), %rdi     # 0x78fa8
leaq 0xb9d8(%rip), %rsi      # 0x5baad
callq 0x6520
jmp 0x500dc
leaq -0x70(%rbp), %rdi
callq 0xb670
movslq 0x29554(%rip), %rcx     # 0x79640
cmpq %rcx, %rax
jbe 0x5012c
leaq -0x70(%rbp), %rdi
callq 0xb670
movq %rax, %rsi
movq 0x28ea4(%rip), %rdi     # 0x78fa8
callq 0x6120
movq %rax, -0x278(%rbp)
jmp 0x50112
movq -0x278(%rbp), %rdi
leaq 0xa999(%rip), %rsi      # 0x5aab9
callq 0x6520
jmp 0x50127
jmp 0x501b0
leaq -0x70(%rbp), %rdi
callq 0xb4c0
movq %rax, -0xe0(%rbp)
leaq -0x70(%rbp), %rdi
callq 0xb340
movq %rax, -0xe8(%rbp)
leaq -0xe0(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x4a690
testb $0x1, %al
jne 0x50165
jmp 0x501ae
leaq -0xe0(%rbp), %rdi
callq 0x30840
movq %rax, %rsi
movq 0x28e2d(%rip), %rdi     # 0x78fa8
callq 0x64d0
movq %rax, -0x280(%rbp)
jmp 0x50189
movq -0x280(%rbp), %rdi
leaq 0xa1b6(%rip), %rsi      # 0x5a34d
callq 0x6520
jmp 0x5019e
jmp 0x501a0
leaq -0xe0(%rbp), %rdi
callq 0x4a6d0
jmp 0x5013c
jmp 0x501b0
movq 0x28df1(%rip), %rdi     # 0x78fa8
movq 0x28dd2(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x501c5
movq 0x28ddc(%rip), %rdi     # 0x78fa8
leaq 0xb8fe(%rip), %rsi      # 0x5bad1
callq 0x6520
movq %rax, -0x288(%rbp)
jmp 0x501e1
movq -0x288(%rbp), %rdi
movl -0x54(%rbp), %esi
callq 0x68d0
movq %rax, -0x290(%rbp)
jmp 0x501f9
movq -0x290(%rbp), %rdi
leaq 0xb901(%rip), %rsi      # 0x5bb08
callq 0x6520
movq %rax, -0x298(%rbp)
jmp 0x50215
movq -0x298(%rbp), %rdi
movss -0x50(%rbp), %xmm0
movss 0x944f(%rip), %xmm1     # 0x59678
mulss %xmm1, %xmm0
callq 0x63f0
movq %rax, -0x2a0(%rbp)
jmp 0x5023b
movq -0x2a0(%rbp), %rdi
leaq 0xb8e8(%rip), %rsi      # 0x5bb31
callq 0x6520
movq %rax, -0x2a8(%rbp)
jmp 0x50257
movq -0x2a8(%rbp), %rdi
movq 0x28d2b(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x5026c
testb $0x1, -0x11(%rbp)
je 0x502da
movq 0x28d2f(%rip), %rdi     # 0x78fa8
leaq 0xb8e6(%rip), %rsi      # 0x5bb66
callq 0x6520
movq %rax, -0x2b0(%rbp)
jmp 0x5028e
movq -0x2b0(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x64d0
movq %rax, -0x2b8(%rbp)
jmp 0x502a7
movq -0x2b8(%rbp), %rdi
leaq 0x9754(%rip), %rsi      # 0x59a09
callq 0x6520
movq %rax, -0x2c0(%rbp)
jmp 0x502c3
movq -0x2c0(%rbp), %rdi
movq 0x28cbf(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x502d8
jmp 0x502da
testb $0x1, -0x12(%rbp)
je 0x5032c
movq 0x28cc1(%rip), %rdi     # 0x78fa8
leaq 0xb896(%rip), %rsi      # 0x5bb84
callq 0x6520
movq %rax, -0x2c8(%rbp)
jmp 0x502fc
movq -0x2c8(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x64d0
movq %rax, -0x2d0(%rbp)
jmp 0x50315
movq -0x2d0(%rbp), %rdi
movq 0x28c6d(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x5032a
jmp 0x5032c
movq 0x28c75(%rip), %rdi     # 0x78fa8
movq 0x28c56(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x50341
movl -0x54(%rbp), %r8d
movss -0x50(%rbp), %xmm0
movzbl -0x13(%rbp), %r9d
movzbl -0x12(%rbp), %edx
movzbl -0x11(%rbp), %esi
andl $0x1, %esi
andl $0x1, %edx
andl $0x1, %r9d
leaq -0x38(%rbp), %rdi
leaq -0x70(%rbp), %rcx
callq 0x217e0
movl %eax, -0x2d4(%rbp)
jmp 0x50376
movl -0x2d4(%rbp), %eax
cmpl $0x0, %eax
je 0x50394
movl $0x1, -0x4(%rbp)
movl $0x1, -0xa0(%rbp)
jmp 0x503a5
movl $0x0, -0x4(%rbp)
movl $0x1, -0xa0(%rbp)
leaq -0x70(%rbp), %rdi
callq 0xfe90
leaq -0x38(%rbp), %rdi
callq 0x6a08
movl -0x4(%rbp), %eax
addq $0x2e0, %rsp            # imm = 0x2E0
popq %rbp
retq
leaq -0x70(%rbp), %rdi
callq 0xfe90
leaq -0x38(%rbp), %rdi
callq 0x6a08
movq -0x48(%rbp), %rdi
callq 0x6900
movq %rax, %rdi
callq 0x9b50
nopw %cs:(%rax,%rax)