// File: prophyle[P]prophasm/src/prophasm.cpp
// Function: main
int main (int argc, char* argv[])
{
	int32_t k=-1;

	std::string intersection_fn;
	std::vector<std::string> in_fns;
	std::vector<std::string> out_fns;
	std::string stats_fn;
	FILE *fstats=nullptr;

	if (argc<2){
		print_help();
		exit(1);
	}

	bool compute_intersection=false;
	bool compute_output=false;
	bool verbose=true;
	int32_t no_sets=0;

	int c;
	while ((c = getopt(argc, (char *const *)argv, "hSi:o:x:s:k:")) >= 0) {
		switch (c) {
			case 'h': {
				print_help();
				exit(0);
				break;
			}
			case 'i': {
				in_fns.push_back(std::string(optarg));
				no_sets+=1;
				break;
			}
			case 'o': {
				out_fns.push_back(std::string(optarg));
				compute_output=true;
				break;
			}
			case 'x': {
				intersection_fn=std::string(optarg);
				compute_intersection=true;
				break;
			}
			case 's': {
				stats_fn=std::string(optarg);
				if(stats_fn=="-"){
					fstats = stdin;
				}
				else {
					fstats = fopen(stats_fn.c_str(), "w+");
					test_file(fstats, stats_fn);
				}

				break;
			}
			case 'S': {
				verbose=false;

				break;
			}
			case 'k': {
				k = atoi(optarg);
				break;
			}
			case '?': {
				std::cerr<<"Unknown error"<<std::endl;
				exit(1);
				break;
			}
		}
	}

	if (k == -1){
		print_help();
		std::cerr << "K-mer size (-k) is required." << std::endl;
		return EXIT_FAILURE;
	}


	if (k <= 0 || max_allowed_kmer_length<k){
		std::cerr << "K-mer size must satisfy 1 <= k <= " << max_allowed_kmer_length << "." << std::endl;
		return EXIT_FAILURE;
	}

	if (compute_output && (static_cast<int32_t>(out_fns.size())!=no_sets)){
		std::cerr << "If -o is used, it must be used as many times as -i (" << no_sets << "!=" << out_fns.size() << ")." << std::endl;
		return EXIT_FAILURE;
	}

	if(fstats){
		fprintf(fstats,"# cmd: %s",argv[0]);

		for (int32_t i=1;i<argc;i++){
			fprintf(fstats," %s",argv[i]);
		}
		fprintf(fstats,"\n");
	}

	std::vector< std::unordered_set<nkmer_t> > full_sets(no_sets);

	if(verbose){
		std::cerr << "=====================" << std::endl;
		std::cerr << "1) Loading references" << std::endl;
		std::cerr << "=====================" << std::endl;
	}


	std::vector<int32_t> in_sizes;
	std::vector<int32_t> out_sizes;

	for(int32_t i=0;i<no_sets;i++){
		kmers_from_fasta(in_fns[i],full_sets[i],k,fstats,verbose);
		//debug_print_kmer_set(full_sets[i],k);
		in_sizes.insert(in_sizes.end(),full_sets[i].size());
	}

	if(verbose){
		std::cerr << "===============" << std::endl;
		std::cerr << "2) Intersecting" << std::endl;
		std::cerr << "===============" << std::endl;
	}


	std::unordered_set<nkmer_t> intersection;

	int32_t intersection_size = 0;

	if(compute_intersection){
		if (verbose){
			std::cerr << "2.1) Computing intersection" << std::endl;
		}

		find_intersection(full_sets, intersection);
		intersection_size  = intersection.size();
		if (verbose){
			std::cerr << "   intersection size: " <<  intersection_size << std::endl;
		}
		if(compute_output){
			if (verbose){
				std::cerr << "2.2) Removing this intersection from all kmer sets" << std::endl;
			}
			remove_subset(full_sets, intersection);
		}
	}

	if(compute_output){
		for (int32_t i=0;i<no_sets;i++){
			out_sizes.insert(out_sizes.end(),full_sets[i].size());
			assert(in_sizes[i]==out_sizes[i]+intersection_size);
			if (verbose){
				std::cerr << in_sizes[i] << " " << out_sizes[i] << " ...inter:" << intersection_size << std::endl;
			}
		}
	}

	if(verbose){
		std::cerr << "=============" << std::endl;
		std::cerr << "3) Assembling" << std::endl;
		std::cerr << "=============" << std::endl;
	}

	if(compute_output){
		for(int32_t i=0;i<static_cast<int32_t>(in_fns.size());i++){
			assemble(out_fns[i], full_sets[i], k, fstats, verbose);
		}
	}
	if(compute_intersection){
		assemble(intersection_fn, intersection, k, fstats, verbose);
	}

	if (fstats){
		fclose(fstats);
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3f0, %rsp            # imm = 0x3F0
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0xffffffff, -0x14(%rbp) # imm = 0xFFFFFFFF
leaq -0x38(%rbp), %rdi
callq 0x33a0
leaq -0x50(%rbp), %rdi
callq 0x5380
leaq -0x68(%rbp), %rdi
callq 0x5380
leaq -0x88(%rbp), %rdi
callq 0x33a0
movq $0x0, -0x90(%rbp)
cmpl $0x2, -0x8(%rbp)
jge 0x3990
callq 0x3600
jmp 0x396f
movl $0x1, %edi
callq 0x3330
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x48a8
movb $0x0, -0x9d(%rbp)
movb $0x0, -0x9e(%rbp)
movb $0x1, -0x9f(%rbp)
movl $0x0, -0xa4(%rbp)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq 0x8bd9(%rip), %rdx      # 0xc596
callq 0x3070
movl %eax, -0xa8(%rbp)
cmpl $0x0, %eax
jl 0x3df5
movl -0xa8(%rbp), %eax
addl $-0x3f, %eax
movl %eax, %ecx
movq %rcx, -0x258(%rbp)
subl $0x39, %eax
ja 0x3df0
movq -0x258(%rbp), %rax
leaq 0x8616(%rip), %rcx      # 0xc010
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
callq 0x3600
jmp 0x3a0a
xorl %edi, %edi
callq 0x3330
movq 0xe5a8(%rip), %rax      # 0x11fc0
movq (%rax), %rax
movq %rax, -0x268(%rbp)
leaq -0xc9(%rbp), %rdi
movq %rdi, -0x260(%rbp)
callq 0x3460
movq -0x268(%rbp), %rsi
movq -0x260(%rbp), %rdx
leaq -0xc8(%rbp), %rdi
callq 0x53d0
jmp 0x3a51
leaq -0x50(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x53a0
jmp 0x3a63
leaq -0xc8(%rbp), %rdi
callq 0x3170
leaq -0xc9(%rbp), %rdi
callq 0x32e0
movl -0xa4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa4(%rbp)
jmp 0x3df0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x3ac1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x3170
leaq -0xc9(%rbp), %rdi
callq 0x32e0
jmp 0x48a8
movq 0xe4e7(%rip), %rax      # 0x11fc0
movq (%rax), %rax
movq %rax, -0x278(%rbp)
leaq -0xf1(%rbp), %rdi
movq %rdi, -0x270(%rbp)
callq 0x3460
movq -0x278(%rbp), %rsi
movq -0x270(%rbp), %rdx
leaq -0xf0(%rbp), %rdi
callq 0x53d0
jmp 0x3b12
leaq -0x68(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x53a0
jmp 0x3b24
leaq -0xf0(%rbp), %rdi
callq 0x3170
leaq -0xf1(%rbp), %rdi
callq 0x32e0
movb $0x1, -0x9e(%rbp)
jmp 0x3df0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x3b7a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x3170
leaq -0xf1(%rbp), %rdi
callq 0x32e0
jmp 0x48a8
movq 0xe42e(%rip), %rax      # 0x11fc0
movq (%rax), %rax
movq %rax, -0x288(%rbp)
leaq -0x119(%rbp), %rdi
movq %rdi, -0x280(%rbp)
callq 0x3460
movq -0x288(%rbp), %rsi
movq -0x280(%rbp), %rdx
leaq -0x118(%rbp), %rdi
callq 0x53d0
jmp 0x3bcb
leaq -0x38(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x3340
leaq -0x118(%rbp), %rdi
callq 0x3170
leaq -0x119(%rbp), %rdi
callq 0x32e0
movb $0x1, -0x9d(%rbp)
jmp 0x3df0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x119(%rbp), %rdi
callq 0x32e0
jmp 0x48a8
movq 0xe397(%rip), %rax      # 0x11fc0
movq (%rax), %rax
movq %rax, -0x298(%rbp)
leaq -0x141(%rbp), %rdi
movq %rdi, -0x290(%rbp)
callq 0x3460
movq -0x298(%rbp), %rsi
movq -0x290(%rbp), %rdx
leaq -0x140(%rbp), %rdi
callq 0x53d0
jmp 0x3c62
leaq -0x88(%rbp), %rdi
movq %rdi, -0x2a8(%rbp)
leaq -0x140(%rbp), %rsi
movq %rsi, -0x2b0(%rbp)
callq 0x3340
movq -0x2b0(%rbp), %rdi
callq 0x3170
leaq -0x141(%rbp), %rdi
callq 0x32e0
movq -0x2a8(%rbp), %rdi
leaq 0x88fa(%rip), %rsi      # 0xc5a3
callq 0x5480
movb %al, -0x299(%rbp)
jmp 0x3cb6
movb -0x299(%rbp), %al
testb $0x1, %al
jne 0x3cc2
jmp 0x3cfb
movq 0xe307(%rip), %rax      # 0x11fd0
movq (%rax), %rax
movq %rax, -0x90(%rbp)
jmp 0x3d96
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x141(%rbp), %rdi
callq 0x32e0
jmp 0x48a8
leaq -0x88(%rbp), %rdi
callq 0x30e0
movq %rax, %rdi
leaq 0x8894(%rip), %rsi      # 0xc5a5
callq 0x3310
movq %rax, -0x2b8(%rbp)
jmp 0x3d1f
movq -0x2b8(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rax
movq %rax, -0x2c0(%rbp)
leaq -0x168(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x30f0
jmp 0x3d50
movq -0x2c0(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0x3780
jmp 0x3d65
leaq -0x168(%rbp), %rdi
callq 0x3170
jmp 0x3d96
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x3170
jmp 0x48a8
jmp 0x3df0
movb $0x0, -0x9f(%rbp)
jmp 0x3df0
movq 0xe218(%rip), %rax      # 0x11fc0
movq (%rax), %rdi
callq 0x33f0
movl %eax, -0x14(%rbp)
jmp 0x3df0
movq 0xe234(%rip), %rdi      # 0x11ff0
leaq 0x87e5(%rip), %rsi      # 0xc5a8
callq 0x3270
movq %rax, -0x2c8(%rbp)
jmp 0x3dd1
movq -0x2c8(%rbp), %rdi
movq 0xe1d9(%rip), %rsi      # 0x11fb8
callq 0x32b0
jmp 0x3de6
movl $0x1, %edi
callq 0x3330
jmp 0x39af
cmpl $-0x1, -0x14(%rbp)
jne 0x3e49
callq 0x3600
jmp 0x3e02
movq 0xe1e7(%rip), %rdi      # 0x11ff0
leaq 0x87a6(%rip), %rsi      # 0xc5b6
callq 0x3270
movq %rax, -0x2d0(%rbp)
jmp 0x3e1e
movq -0x2d0(%rbp), %rdi
movq 0xe18c(%rip), %rsi      # 0x11fb8
callq 0x32b0
jmp 0x3e33
movl $0x1, -0x4(%rbp)
movl $0x1, -0x16c(%rbp)
jmp 0x4875
cmpl $0x0, -0x14(%rbp)
jle 0x3e59
movl $0x20, %eax
cmpl -0x14(%rbp), %eax
jge 0x3ed6
movq 0xe190(%rip), %rdi      # 0x11ff0
leaq 0x876c(%rip), %rsi      # 0xc5d3
callq 0x3270
movq %rax, -0x2d8(%rbp)
jmp 0x3e75
movq -0x2d8(%rbp), %rdi
movl $0x20, %esi
callq 0x3440
movq %rax, -0x2e0(%rbp)
jmp 0x3e8f
movq -0x2e0(%rbp), %rdi
leaq 0x86f7(%rip), %rsi      # 0xc594
callq 0x3270
movq %rax, -0x2e8(%rbp)
jmp 0x3eab
movq -0x2e8(%rbp), %rdi
movq 0xe0ff(%rip), %rsi      # 0x11fb8
callq 0x32b0
jmp 0x3ec0
movl $0x1, -0x4(%rbp)
movl $0x1, -0x16c(%rbp)
jmp 0x4875
testb $0x1, -0x9e(%rbp)
je 0x3fb3
leaq -0x68(%rbp), %rdi
callq 0x54b0
cmpl -0xa4(%rbp), %eax
je 0x3fb3
movq 0xe0f1(%rip), %rdi      # 0x11ff0
leaq 0x86f0(%rip), %rsi      # 0xc5f6
callq 0x3270
movq %rax, -0x2f0(%rbp)
jmp 0x3f14
movq -0x2f0(%rbp), %rdi
movl -0xa4(%rbp), %esi
callq 0x3440
movq %rax, -0x2f8(%rbp)
jmp 0x3f2f
movq -0x2f8(%rbp), %rdi
leaq 0x86ee(%rip), %rsi      # 0xc62b
callq 0x3270
movq %rax, -0x300(%rbp)
jmp 0x3f4b
leaq -0x68(%rbp), %rdi
callq 0x54b0
movq -0x300(%rbp), %rdi
movq %rax, %rsi
callq 0x3080
movq %rax, -0x308(%rbp)
jmp 0x3f6c
movq -0x308(%rbp), %rdi
leaq 0x8619(%rip), %rsi      # 0xc593
callq 0x3270
movq %rax, -0x310(%rbp)
jmp 0x3f88
movq -0x310(%rbp), %rdi
movq 0xe022(%rip), %rsi      # 0x11fb8
callq 0x32b0
jmp 0x3f9d
movl $0x1, -0x4(%rbp)
movl $0x1, -0x16c(%rbp)
jmp 0x4875
cmpq $0x0, -0x90(%rbp)
je 0x4038
movq -0x90(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
leaq 0x865c(%rip), %rsi      # 0xc62e
movb $0x0, %al
callq 0x33c0
movl $0x1, -0x170(%rbp)
movl -0x170(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x4023
movq -0x90(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq -0x170(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x8629(%rip), %rsi      # 0xc634
movb $0x0, %al
callq 0x33c0
movl -0x170(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x170(%rbp)
jmp 0x3fe3
movq -0x90(%rbp), %rdi
leaq 0x8533(%rip), %rsi      # 0xc564
movb $0x0, %al
callq 0x33c0
movslq -0xa4(%rbp), %rax
movq %rax, -0x320(%rbp)
leaq -0x189(%rbp), %rdi
movq %rdi, -0x318(%rbp)
callq 0x54d0
movq -0x320(%rbp), %rsi
movq -0x318(%rbp), %rdx
leaq -0x188(%rbp), %rdi
callq 0x54f0
jmp 0x4075
leaq -0x189(%rbp), %rdi
callq 0x5560
testb $0x1, -0x9f(%rbp)
je 0x415d
movq 0xdf5b(%rip), %rdi      # 0x11ff0
leaq 0x859c(%rip), %rsi      # 0xc638
callq 0x3270
movq %rax, -0x328(%rbp)
jmp 0x40aa
movq -0x328(%rbp), %rdi
movq 0xdf00(%rip), %rsi      # 0x11fb8
callq 0x32b0
jmp 0x40bf
movq 0xdf2a(%rip), %rdi      # 0x11ff0
leaq 0x8581(%rip), %rsi      # 0xc64e
callq 0x3270
movq %rax, -0x330(%rbp)
jmp 0x40db
movq -0x330(%rbp), %rdi
movq 0xdecf(%rip), %rsi      # 0x11fb8
callq 0x32b0
jmp 0x40f0
movq 0xdef9(%rip), %rdi      # 0x11ff0
leaq 0x853a(%rip), %rsi      # 0xc638
callq 0x3270
movq %rax, -0x338(%rbp)
jmp 0x410c
movq -0x338(%rbp), %rdi
movq 0xde9e(%rip), %rsi      # 0x11fb8
callq 0x32b0
jmp 0x4121
jmp 0x415d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x189(%rbp), %rdi
callq 0x5560
jmp 0x48a8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x4867
leaq -0x1a8(%rbp), %rdi
callq 0x5580
leaq -0x1c0(%rbp), %rdi
callq 0x5580
movl $0x0, -0x1c4(%rbp)
movl -0x1c4(%rbp), %eax
cmpl -0xa4(%rbp), %eax
jge 0x428c
movslq -0x1c4(%rbp), %rsi
leaq -0x50(%rbp), %rdi
callq 0x5810
movq %rax, -0x340(%rbp)
movslq -0x1c4(%rbp), %rsi
leaq -0x188(%rbp), %rdi
callq 0x5830
movq -0x340(%rbp), %rdi
movq %rax, %rsi
movl -0x14(%rbp), %edx
movq -0x90(%rbp), %rcx
movzbl -0x9f(%rbp), %r8d
andl $0x1, %r8d
callq 0x55a0
jmp 0x41e2
leaq -0x1a8(%rbp), %rdi
movq %rdi, -0x350(%rbp)
callq 0x5890
movq %rax, -0x1d8(%rbp)
leaq -0x1d0(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
callq 0x58c0
movslq -0x1c4(%rbp), %rsi
leaq -0x188(%rbp), %rdi
callq 0x5830
movq %rax, %rdi
callq 0x5900
movq -0x350(%rbp), %rdi
movl %eax, -0x1dc(%rbp)
movq -0x1d0(%rbp), %rsi
leaq -0x1dc(%rbp), %rdx
callq 0x5850
movq %rax, -0x348(%rbp)
jmp 0x4253
movq -0x348(%rbp), %rax
movq %rax, -0x1e8(%rbp)
movl -0x1c4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c4(%rbp)
jmp 0x417f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x484f
testb $0x1, -0x9f(%rbp)
je 0x432e
movq 0xdd50(%rip), %rdi      # 0x11ff0
leaq 0x8397(%rip), %rsi      # 0xc63e
callq 0x3270
movq %rax, -0x358(%rbp)
jmp 0x42b5
movq -0x358(%rbp), %rdi
movq 0xdcf5(%rip), %rsi      # 0x11fb8
callq 0x32b0
jmp 0x42ca
movq 0xdd1f(%rip), %rdi      # 0x11ff0
leaq 0x838c(%rip), %rsi      # 0xc664
callq 0x3270
movq %rax, -0x360(%rbp)
jmp 0x42e6
movq -0x360(%rbp), %rdi
movq 0xdcc4(%rip), %rsi      # 0x11fb8
callq 0x32b0
jmp 0x42fb
movq 0xdcee(%rip), %rdi      # 0x11ff0
leaq 0x8335(%rip), %rsi      # 0xc63e
callq 0x3270
movq %rax, -0x368(%rbp)
jmp 0x4317
movq -0x368(%rbp), %rdi
movq 0xdc93(%rip), %rsi      # 0x11fb8
callq 0x32b0
jmp 0x432c
jmp 0x432e
leaq -0x220(%rbp), %rdi
callq 0x5920
movl $0x0, -0x224(%rbp)
testb $0x1, -0x9d(%rbp)
je 0x448c
testb $0x1, -0x9f(%rbp)
je 0x43b0
movq 0xdc8f(%rip), %rdi      # 0x11ff0
leaq 0x830c(%rip), %rsi      # 0xc674
callq 0x3270
movq %rax, -0x370(%rbp)
jmp 0x4376
movq -0x370(%rbp), %rdi
movq 0xdc34(%rip), %rsi      # 0x11fb8
callq 0x32b0
jmp 0x438b
jmp 0x43b0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x220(%rbp), %rdi
callq 0x6350
jmp 0x484f
leaq -0x188(%rbp), %rdi
leaq -0x220(%rbp), %rsi
callq 0x5940
jmp 0x43c5
leaq -0x220(%rbp), %rdi
callq 0x5900
movl %eax, -0x224(%rbp)
testb $0x1, -0x9f(%rbp)
je 0x442e
movq 0xdc09(%rip), %rdi      # 0x11ff0
leaq 0x82a2(%rip), %rsi      # 0xc690
callq 0x3270
movq %rax, -0x378(%rbp)
jmp 0x43fc
movq -0x378(%rbp), %rdi
movl -0x224(%rbp), %esi
callq 0x3440
movq %rax, -0x380(%rbp)
jmp 0x4417
movq -0x380(%rbp), %rdi
movq 0xdb93(%rip), %rsi      # 0x11fb8
callq 0x32b0
jmp 0x442c
jmp 0x442e
testb $0x1, -0x9e(%rbp)
je 0x448a
testb $0x1, -0x9f(%rbp)
je 0x4473
movq 0xdba9(%rip), %rdi      # 0x11ff0
leaq 0x8259(%rip), %rsi      # 0xc6a7
callq 0x3270
movq %rax, -0x388(%rbp)
jmp 0x445c
movq -0x388(%rbp), %rdi
movq 0xdb4e(%rip), %rsi      # 0x11fb8
callq 0x32b0
jmp 0x4471
jmp 0x4473
leaq -0x188(%rbp), %rdi
leaq -0x220(%rbp), %rsi
callq 0x5c10
jmp 0x4488
jmp 0x448a
jmp 0x448c
testb $0x1, -0x9e(%rbp)
je 0x467b
movl $0x0, -0x228(%rbp)
movl -0x228(%rbp), %eax
cmpl -0xa4(%rbp), %eax
jge 0x4679
leaq -0x1c0(%rbp), %rdi
movq %rdi, -0x398(%rbp)
callq 0x5890
movq %rax, -0x238(%rbp)
leaq -0x230(%rbp), %rdi
leaq -0x238(%rbp), %rsi
callq 0x58c0
movslq -0x228(%rbp), %rsi
leaq -0x188(%rbp), %rdi
callq 0x5830
movq %rax, %rdi
callq 0x5900
movq -0x398(%rbp), %rdi
movl %eax, -0x23c(%rbp)
movq -0x230(%rbp), %rsi
leaq -0x23c(%rbp), %rdx
callq 0x5850
movq %rax, -0x390(%rbp)
jmp 0x4526
movq -0x390(%rbp), %rax
movq %rax, -0x248(%rbp)
movslq -0x228(%rbp), %rsi
leaq -0x1a8(%rbp), %rdi
callq 0x5cd0
movl (%rax), %eax
movl %eax, -0x39c(%rbp)
movslq -0x228(%rbp), %rsi
leaq -0x1c0(%rbp), %rdi
callq 0x5cd0
movq %rax, %rcx
movl -0x39c(%rbp), %eax
movl (%rcx), %ecx
addl -0x224(%rbp), %ecx
cmpl %ecx, %eax
jne 0x4579
jmp 0x4598
leaq 0x815a(%rip), %rdi      # 0xc6da
leaq 0x817f(%rip), %rsi      # 0xc706
movl $0x2b7, %edx            # imm = 0x2B7
leaq 0x8180(%rip), %rcx      # 0xc713
callq 0x3180
testb $0x1, -0x9f(%rbp)
je 0x4663
movslq -0x228(%rbp), %rsi
leaq -0x1a8(%rbp), %rdi
callq 0x5cd0
movl (%rax), %esi
movq 0xda2f(%rip), %rdi      # 0x11ff0
callq 0x3440
movq %rax, -0x3a8(%rbp)
jmp 0x45cf
movq -0x3a8(%rbp), %rdi
leaq 0x7fb4(%rip), %rsi      # 0xc591
callq 0x3270
movq %rax, -0x3b0(%rbp)
jmp 0x45eb
movslq -0x228(%rbp), %rsi
leaq -0x1c0(%rbp), %rdi
callq 0x5cd0
movq -0x3b0(%rbp), %rdi
movl (%rax), %esi
callq 0x3440
movq %rax, -0x3b8(%rbp)
jmp 0x4615
movq -0x3b8(%rbp), %rdi
leaq 0x8107(%rip), %rsi      # 0xc72a
callq 0x3270
movq %rax, -0x3c0(%rbp)
jmp 0x4631
movq -0x3c0(%rbp), %rdi
movl -0x224(%rbp), %esi
callq 0x3440
movq %rax, -0x3c8(%rbp)
jmp 0x464c
movq -0x3c8(%rbp), %rdi
movq 0xd95e(%rip), %rsi      # 0x11fb8
callq 0x32b0
jmp 0x4661
jmp 0x4663
jmp 0x4665
movl -0x228(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x228(%rbp)
jmp 0x44a3
jmp 0x467b
testb $0x1, -0x9f(%rbp)
je 0x471d
movq 0xd961(%rip), %rdi      # 0x11ff0
leaq 0x7faa(%rip), %rsi      # 0xc640
callq 0x3270
movq %rax, -0x3d0(%rbp)
jmp 0x46a4
movq -0x3d0(%rbp), %rdi
movq 0xd906(%rip), %rsi      # 0x11fb8
callq 0x32b0
jmp 0x46b9
movq 0xd930(%rip), %rdi      # 0x11ff0
leaq 0x806e(%rip), %rsi      # 0xc735
callq 0x3270
movq %rax, -0x3d8(%rbp)
jmp 0x46d5
movq -0x3d8(%rbp), %rdi
movq 0xd8d5(%rip), %rsi      # 0x11fb8
callq 0x32b0
jmp 0x46ea
movq 0xd8ff(%rip), %rdi      # 0x11ff0
leaq 0x7f48(%rip), %rsi      # 0xc640
callq 0x3270
movq %rax, -0x3e0(%rbp)
jmp 0x4706
movq -0x3e0(%rbp), %rdi
movq 0xd8a4(%rip), %rsi      # 0x11fb8
callq 0x32b0
jmp 0x471b
jmp 0x471d
testb $0x1, -0x9e(%rbp)
je 0x47bf
movl $0x0, -0x24c(%rbp)
movl -0x24c(%rbp), %eax
movl %eax, -0x3e4(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x54b0
movq %rax, %rcx
movl -0x3e4(%rbp), %eax
cmpl %ecx, %eax
jge 0x47bd
movslq -0x24c(%rbp), %rsi
leaq -0x68(%rbp), %rdi
callq 0x5810
movq %rax, -0x3f0(%rbp)
movslq -0x24c(%rbp), %rsi
leaq -0x188(%rbp), %rdi
callq 0x5830
movq -0x3f0(%rbp), %rdi
movq %rax, %rsi
movl -0x14(%rbp), %edx
movq -0x90(%rbp), %rcx
movzbl -0x9f(%rbp), %r8d
andl $0x1, %r8d
callq 0x5cf0
jmp 0x47a7
jmp 0x47a9
movl -0x24c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24c(%rbp)
jmp 0x4734
jmp 0x47bf
testb $0x1, -0x9d(%rbp)
je 0x47f2
movl -0x14(%rbp), %edx
movq -0x90(%rbp), %rcx
movzbl -0x9f(%rbp), %r8d
andl $0x1, %r8d
leaq -0x38(%rbp), %rdi
leaq -0x220(%rbp), %rsi
callq 0x5cf0
jmp 0x47f0
jmp 0x47f2
cmpq $0x0, -0x90(%rbp)
je 0x480c
movq -0x90(%rbp), %rdi
callq 0x3280
jmp 0x480a
jmp 0x480c
movl $0x0, -0x4(%rbp)
movl $0x1, -0x16c(%rbp)
leaq -0x220(%rbp), %rdi
callq 0x6350
leaq -0x1c0(%rbp), %rdi
callq 0x6370
leaq -0x1a8(%rbp), %rdi
callq 0x6370
leaq -0x188(%rbp), %rdi
callq 0x63d0
jmp 0x4875
leaq -0x1c0(%rbp), %rdi
callq 0x6370
leaq -0x1a8(%rbp), %rdi
callq 0x6370
leaq -0x188(%rbp), %rdi
callq 0x63d0
jmp 0x48a8
leaq -0x88(%rbp), %rdi
callq 0x3170
leaq -0x68(%rbp), %rdi
callq 0x6430
leaq -0x50(%rbp), %rdi
callq 0x6430
leaq -0x38(%rbp), %rdi
callq 0x3170
movl -0x4(%rbp), %eax
addq $0x3f0, %rsp            # imm = 0x3F0
popq %rbp
retq
leaq -0x88(%rbp), %rdi
callq 0x3170
leaq -0x68(%rbp), %rdi
callq 0x6430
leaq -0x50(%rbp), %rdi
callq 0x6430
leaq -0x38(%rbp), %rdi
callq 0x3170
movq -0x98(%rbp), %rdi
callq 0x3450
nopl (%rax,%rax)