// File: CK7[P]abawaca/src/abawaca.cpp
// Function: Prog_params::read_params(int, char const**)
int Prog_params::read_params(int argc, const char** argv)
{
	if((argc == 1) || ((argc == 2) && (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")))) {
		usage(argv[0]);
		return -1;
	}

	// Read parameters
	for(auto i=1; i<argc; i++) {
		if(!strcmp(argv[i], "-u")) {
			abawaca_build_dir = argv[++i];
			char data_file[2048];
			sprintf(data_file, "%s/data.txt", abawaca_build_dir.c_str());
			FILE* fp = fopen(data_file, "r");
			if(fp == NULL) {
				cerr << "Error: could not find " << abawaca_build_dir << "/data.txt. Is it possible that the data was generated using an old version of abawaca-build? (prior to v1.07)" << endl << endl; 
				return -1;
			}
			char line[8192];
			while(fgets(line, 8192, fp)) {
				char* p = strrchr(line, '\n');
				while((p != NULL) && (*p == '\n'))  {
					*(p--) = 0;
				}
				p=strchr(line, '\t');
				*(p++) = 0;
				while(isspace(*p) && (*p != 0))
					p++;

				if(!strcmp(line, "Links")) {
					links_file = p;
				}
				else if(!strcmp(line, "Info")) {
					info_file = p;
				}
				else if(!strcmp(line, "Names")) {
					names_file = p;
				}
				else if(!strcmp(line, "Lrn")) {
					lrn_file = p;
				}
				else if(!strcmp(line, "Assembly")) {
					fasta_file = p;
				}
				else if(!strcmp(line, "SCG")) {
					gene2scg_file = p;
				}
			}
/*			lrn_file = abawaca_build_dir + "/abawaca.lrn";
			names_file = abawaca_build_dir + "/abawaca.names";
			info_file = abawaca_build_dir + "/abawaca.info";
			links_file = abawaca_build_dir + "/abawaca.links";*/
		}
		else if(!strcmp(argv[i], "-f"))
			fasta_file = argv[++i];
		else if(!strcmp(argv[i], "-o"))
			root_dir = argv[++i];
		else if(!strcmp(argv[i], "-p")) {
			ncpus = atoi(argv[++i]);
			if(ncpus==0 || ncpus>40) {
				cerr << "Error: # CPUs (" << argv[i] << ") must be an integer between 1 to 40" << endl << endl;
				return -1; 
			}
		}
		else if(!strcmp(argv[i], "-c"))
			gene2scg_file = argv[++i];
		else {
			cerr << "Unrecognizes flag: " << argv[i] << endl;
			return -1;
		}
	}

	// Make sure we have everything we need
	if(lrn_file == "") {
		cerr << "abawaca-build directrory was not specified (-u)" << endl << endl;
		return -1;
	}

	FILE* IN = fopen(names_file.c_str(), "r");
	if(IN == NULL) {
		cerr << "Could not read names file (" << names_file << ") from the abawaca directory (" << abawaca_build_dir << ")" << endl;
		return -1;
	}
	fclose(IN);

	IN = fopen(lrn_file.c_str(), "r");
	if(IN == NULL) {
		cerr << "Could not read lrn file (" << lrn_file << ") from the abawaca directory (" << abawaca_build_dir << ")" << endl;
		return -1;
	}
	fclose(IN);

	IN = fopen(info_file.c_str(), "r");
	if(IN == NULL) {
		cerr << "Could not read info file (" << info_file << ") from the abawaca directory (" << abawaca_build_dir << ")" << endl;
		return -1;
	}
	fclose(IN);

	IN = fopen(links_file.c_str(), "r");
	if(IN == NULL) {
		cerr << "Could not read links file (" << links_file << ") from the abawaca directory (" << abawaca_build_dir << ")" << endl;
		return -1;
	}
	fclose(IN);

	IN = fopen(fasta_file.c_str(), "r");
	if(IN == NULL) {
		cerr << "Could not read " << fasta_file << endl;
		return -1;
	}
	fclose(IN);

	if(gene2scg_file.size() > 0) {
		IN = fopen(gene2scg_file.c_str(), "r");
		if(IN == NULL) {
			cerr << "Could not read " << gene2scg_file << endl;
			return -1;
		}
		fclose(IN);
	}

//	const char* p = strrchr(argv[0], '/');
//	if(p != NULL) {
//		string s = argv[0];
//		scg_list_file = s.substr(0, p-argv[0]+1) + scg_list_file;
//	}
	IN = fopen(scg_list_file.c_str(), "r");
	if(IN == NULL) {
		cerr << "Could not read " << scg_list_file << endl;
		return -1;
	}
	fclose(IN);

	cluster_dir = root_dir + string("/clusters");
	fasta_dir = root_dir + string("/final-clusters");

	char 			line[1024] = {};

	if(!directory_exists(root_dir.c_str())) {
		sprintf(line, "mkdir %s", root_dir.c_str());
		system(line);
	}
	if(!directory_exists(cluster_dir.c_str())) {
		sprintf(line, "mkdir %s", cluster_dir.c_str());
		system(line);
	}
	if(!directory_exists(fasta_dir.c_str())) {
		sprintf(line, "mkdir %s", fasta_dir.c_str());
		system(line);
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2d50, %rsp           # imm = 0x2D50
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x2cf8(%rbp)
cmpl $0x1, -0x14(%rbp)
je 0x8b4f
cmpl $0x2, -0x14(%rbp)
jne 0x8b6e
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x2c778(%rip), %rsi     # 0x352a4
callq 0x55e0
cmpl $0x0, %eax
je 0x8b4f
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x2c762(%rip), %rsi     # 0x352a7
callq 0x55e0
cmpl $0x0, %eax
jne 0x8b6e
movq -0x2cf8(%rbp), %rdi
movq -0x20(%rbp), %rax
movq (%rax), %rsi
callq 0x9cd0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x98a3
movl $0x1, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x90d2
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x2c71a(%rip), %rsi     # 0x352ae
callq 0x55e0
cmpl $0x0, %eax
jne 0x8ed9
movq -0x2cf8(%rbp), %rdi
movq -0x20(%rbp), %rax
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x24(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rsi
addq $0x100, %rdi            # imm = 0x100
callq 0x55a0
movq -0x2cf8(%rbp), %rdi
leaq -0x830(%rbp), %rax
movq %rax, -0x2d00(%rbp)
addq $0x100, %rdi            # imm = 0x100
callq 0x5190
movq -0x2d00(%rbp), %rdi
movq %rax, %rdx
leaq 0x2c6b6(%rip), %rsi     # 0x352b1
movb $0x0, %al
callq 0x50b0
leaq -0x830(%rbp), %rdi
leaq 0x2c53d(%rip), %rsi     # 0x3514d
callq 0x54b0
movq %rax, -0x838(%rbp)
cmpq $0x0, -0x838(%rbp)
jne 0x8c88
movq 0x443bb(%rip), %rdi     # 0x4cfe8
leaq 0x2c689(%rip), %rsi     # 0x352bd
callq 0x53f0
movq -0x2cf8(%rbp), %rsi
movq %rax, %rdi
addq $0x100, %rsi            # imm = 0x100
callq 0x5360
movq %rax, %rdi
leaq 0x2c67b(%rip), %rsi     # 0x352d4
callq 0x53f0
movq %rax, %rdi
movq 0x44328(%rip), %rsi     # 0x4cf90
callq 0x5440
movq %rax, %rdi
movq 0x44319(%rip), %rsi     # 0x4cf90
callq 0x5440
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x98a3
jmp 0x8c8a
leaq -0x2840(%rbp), %rdi
movq -0x838(%rbp), %rdx
movl $0x2000, %esi           # imm = 0x2000
callq 0x5690
cmpq $0x0, %rax
je 0x8ed4
leaq -0x2840(%rbp), %rdi
movl $0xa, %esi
callq 0x5470
movq %rax, -0x2848(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x2848(%rbp)
movb %al, -0x2d01(%rbp)
je 0x8cec
movq -0x2848(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xa, %eax
sete %al
movb %al, -0x2d01(%rbp)
movb -0x2d01(%rbp), %al
testb $0x1, %al
jne 0x8cf8
jmp 0x8d12
movq -0x2848(%rbp), %rax
movq %rax, %rcx
addq $-0x1, %rcx
movq %rcx, -0x2848(%rbp)
movb $0x0, (%rax)
jmp 0x8cc4
leaq -0x2840(%rbp), %rdi
movl $0x9, %esi
callq 0x5170
movq %rax, -0x2848(%rbp)
movq -0x2848(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x2848(%rbp)
movb $0x0, (%rax)
movq -0x2848(%rbp), %rax
movsbl (%rax), %edi
callq 0x5090
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x2d02(%rbp)
je 0x8d76
movq -0x2848(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x2d02(%rbp)
movb -0x2d02(%rbp), %al
testb $0x1, %al
jne 0x8d82
jmp 0x8d96
movq -0x2848(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x2848(%rbp)
jmp 0x8d42
leaq -0x2840(%rbp), %rdi
leaq 0x2c59e(%rip), %rsi     # 0x35342
callq 0x55e0
cmpl $0x0, %eax
jne 0x8dca
movq -0x2cf8(%rbp), %rdi
movq -0x2848(%rbp), %rsi
addq $0x60, %rdi
callq 0x55a0
jmp 0x8ecf
leaq -0x2840(%rbp), %rdi
leaq 0x2c570(%rip), %rsi     # 0x35348
callq 0x55e0
cmpl $0x0, %eax
jne 0x8dfe
movq -0x2cf8(%rbp), %rdi
movq -0x2848(%rbp), %rsi
addq $0x40, %rdi
callq 0x55a0
jmp 0x8ecd
leaq -0x2840(%rbp), %rdi
leaq 0x2c541(%rip), %rsi     # 0x3534d
callq 0x55e0
cmpl $0x0, %eax
jne 0x8e32
movq -0x2cf8(%rbp), %rdi
movq -0x2848(%rbp), %rsi
addq $0x20, %rdi
callq 0x55a0
jmp 0x8ecb
leaq -0x2840(%rbp), %rdi
leaq 0x2c513(%rip), %rsi     # 0x35353
callq 0x55e0
cmpl $0x0, %eax
jne 0x8e5f
movq -0x2cf8(%rbp), %rdi
movq -0x2848(%rbp), %rsi
callq 0x55a0
jmp 0x8ec9
leaq -0x2840(%rbp), %rdi
leaq 0x2c4ea(%rip), %rsi     # 0x35357
callq 0x55e0
cmpl $0x0, %eax
jne 0x8e93
movq -0x2cf8(%rbp), %rdi
movq -0x2848(%rbp), %rsi
addq $0x80, %rdi
callq 0x55a0
jmp 0x8ec7
leaq -0x2840(%rbp), %rdi
leaq 0x2c264(%rip), %rsi     # 0x35105
callq 0x55e0
cmpl $0x0, %eax
jne 0x8ec5
movq -0x2cf8(%rbp), %rdi
movq -0x2848(%rbp), %rsi
addq $0xc0, %rdi
callq 0x55a0
jmp 0x8ec7
jmp 0x8ec9
jmp 0x8ecb
jmp 0x8ecd
jmp 0x8ecf
jmp 0x8c8a
jmp 0x90c2
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x2c474(%rip), %rsi     # 0x35360
callq 0x55e0
cmpl $0x0, %eax
jne 0x8f22
movq -0x2cf8(%rbp), %rdi
movq -0x20(%rbp), %rax
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x24(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rsi
addq $0x80, %rdi
callq 0x55a0
jmp 0x90c0
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x2c42e(%rip), %rsi     # 0x35363
callq 0x55e0
cmpl $0x0, %eax
jne 0x8f6b
movq -0x2cf8(%rbp), %rdi
movq -0x20(%rbp), %rax
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x24(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rsi
addq $0xa0, %rdi
callq 0x55a0
jmp 0x90be
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x2c3e8(%rip), %rsi     # 0x35366
callq 0x55e0
cmpl $0x0, %eax
jne 0x9032
movq -0x20(%rbp), %rax
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x24(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x5670
movl %eax, %ecx
movq -0x2cf8(%rbp), %rax
movl %ecx, 0x160(%rax)
cmpl $0x0, 0x160(%rax)
je 0x8fcd
movq -0x2cf8(%rbp), %rax
cmpl $0x28, 0x160(%rax)
jle 0x902d
movq 0x44014(%rip), %rdi     # 0x4cfe8
leaq 0x2c38e(%rip), %rsi     # 0x35369
callq 0x53f0
movq %rax, %rdi
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x53f0
movq %rax, %rdi
leaq 0x2c37b(%rip), %rsi     # 0x35379
callq 0x53f0
movq %rax, %rdi
movq 0x43f83(%rip), %rsi     # 0x4cf90
callq 0x5440
movq %rax, %rdi
movq 0x43f74(%rip), %rsi     # 0x4cf90
callq 0x5440
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x98a3
jmp 0x90bc
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x2c359(%rip), %rsi     # 0x3539e
callq 0x55e0
cmpl $0x0, %eax
jne 0x9078
movq -0x2cf8(%rbp), %rdi
movq -0x20(%rbp), %rax
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x24(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rsi
addq $0xc0, %rdi
callq 0x55a0
jmp 0x90ba
movq 0x43f69(%rip), %rdi     # 0x4cfe8
leaq 0x2c31b(%rip), %rsi     # 0x353a1
callq 0x53f0
movq %rax, %rdi
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x53f0
movq %rax, %rdi
movq 0x43ee7(%rip), %rsi     # 0x4cf90
callq 0x5440
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x98a3
jmp 0x90bc
jmp 0x90be
jmp 0x90c0
jmp 0x90c2
jmp 0x90c4
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x8b75
movq -0x2cf8(%rbp), %rdi
leaq 0x2d18d(%rip), %rsi     # 0x3626d
callq 0xae40
testb $0x1, %al
jne 0x90eb
jmp 0x9128
movq 0x43ef6(%rip), %rdi     # 0x4cfe8
leaq 0x2c2bc(%rip), %rsi     # 0x353b5
callq 0x53f0
movq %rax, %rdi
movq 0x43e88(%rip), %rsi     # 0x4cf90
callq 0x5440
movq %rax, %rdi
movq 0x43e79(%rip), %rsi     # 0x4cf90
callq 0x5440
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x98a3
movq -0x2cf8(%rbp), %rdi
addq $0x20, %rdi
callq 0x5190
movq %rax, %rdi
leaq 0x2c00b(%rip), %rsi     # 0x3514d
callq 0x54b0
movq %rax, -0x2850(%rbp)
cmpq $0x0, -0x2850(%rbp)
jne 0x91cd
movq 0x43e89(%rip), %rdi     # 0x4cfe8
leaq 0x2c27f(%rip), %rsi     # 0x353e5
callq 0x53f0
movq -0x2cf8(%rbp), %rsi
movq %rax, %rdi
addq $0x20, %rsi
callq 0x5360
movq %rax, %rdi
leaq 0x2c279(%rip), %rsi     # 0x35401
callq 0x53f0
movq -0x2cf8(%rbp), %rsi
movq %rax, %rdi
addq $0x100, %rsi            # imm = 0x100
callq 0x5360
movq %rax, %rdi
leaq 0x2d3f0(%rip), %rsi     # 0x3659d
callq 0x53f0
movq %rax, %rdi
movq 0x43dd4(%rip), %rsi     # 0x4cf90
callq 0x5440
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x98a3
movq -0x2850(%rbp), %rdi
callq 0x5400
movq -0x2cf8(%rbp), %rdi
callq 0x5190
movq %rax, %rdi
leaq 0x2bf5e(%rip), %rsi     # 0x3514d
callq 0x54b0
movq %rax, -0x2850(%rbp)
cmpq $0x0, -0x2850(%rbp)
jne 0x9276
movq 0x43ddc(%rip), %rdi     # 0x4cfe8
leaq 0x2c20d(%rip), %rsi     # 0x35420
callq 0x53f0
movq -0x2cf8(%rbp), %rsi
movq %rax, %rdi
callq 0x5360
movq %rax, %rdi
leaq 0x2c1d0(%rip), %rsi     # 0x35401
callq 0x53f0
movq -0x2cf8(%rbp), %rsi
movq %rax, %rdi
addq $0x100, %rsi            # imm = 0x100
callq 0x5360
movq %rax, %rdi
leaq 0x2d347(%rip), %rsi     # 0x3659d
callq 0x53f0
movq %rax, %rdi
movq 0x43d2b(%rip), %rsi     # 0x4cf90
callq 0x5440
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x98a3
movq -0x2850(%rbp), %rdi
callq 0x5400
movq -0x2cf8(%rbp), %rdi
addq $0x40, %rdi
callq 0x5190
movq %rax, %rdi
leaq 0x2beb1(%rip), %rsi     # 0x3514d
callq 0x54b0
movq %rax, -0x2850(%rbp)
cmpq $0x0, -0x2850(%rbp)
jne 0x9327
movq 0x43d2f(%rip), %rdi     # 0x4cfe8
leaq 0x2c17a(%rip), %rsi     # 0x3543a
callq 0x53f0
movq -0x2cf8(%rbp), %rsi
movq %rax, %rdi
addq $0x40, %rsi
callq 0x5360
movq %rax, %rdi
leaq 0x2c11f(%rip), %rsi     # 0x35401
callq 0x53f0
movq -0x2cf8(%rbp), %rsi
movq %rax, %rdi
addq $0x100, %rsi            # imm = 0x100
callq 0x5360
movq %rax, %rdi
leaq 0x2d296(%rip), %rsi     # 0x3659d
callq 0x53f0
movq %rax, %rdi
movq 0x43c7a(%rip), %rsi     # 0x4cf90
callq 0x5440
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x98a3
movq -0x2850(%rbp), %rdi
callq 0x5400
movq -0x2cf8(%rbp), %rdi
addq $0x60, %rdi
callq 0x5190
movq %rax, %rdi
leaq 0x2be00(%rip), %rsi     # 0x3514d
callq 0x54b0
movq %rax, -0x2850(%rbp)
cmpq $0x0, -0x2850(%rbp)
jne 0x93d8
movq 0x43c7e(%rip), %rdi     # 0x4cfe8
leaq 0x2c0e4(%rip), %rsi     # 0x35455
callq 0x53f0
movq -0x2cf8(%rbp), %rsi
movq %rax, %rdi
addq $0x60, %rsi
callq 0x5360
movq %rax, %rdi
leaq 0x2c06e(%rip), %rsi     # 0x35401
callq 0x53f0
movq -0x2cf8(%rbp), %rsi
movq %rax, %rdi
addq $0x100, %rsi            # imm = 0x100
callq 0x5360
movq %rax, %rdi
leaq 0x2d1e5(%rip), %rsi     # 0x3659d
callq 0x53f0
movq %rax, %rdi
movq 0x43bc9(%rip), %rsi     # 0x4cf90
callq 0x5440
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x98a3
movq -0x2850(%rbp), %rdi
callq 0x5400
movq -0x2cf8(%rbp), %rdi
addq $0x80, %rdi
callq 0x5190
movq %rax, %rdi
leaq 0x2bd4c(%rip), %rsi     # 0x3514d
callq 0x54b0
movq %rax, -0x2850(%rbp)
cmpq $0x0, -0x2850(%rbp)
jne 0x945b
movq 0x43bca(%rip), %rdi     # 0x4cfe8
leaq 0x2c04c(%rip), %rsi     # 0x35471
callq 0x53f0
movq -0x2cf8(%rbp), %rsi
movq %rax, %rdi
addq $0x80, %rsi
callq 0x5360
movq %rax, %rdi
movq 0x43b46(%rip), %rsi     # 0x4cf90
callq 0x5440
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x98a3
movq -0x2850(%rbp), %rdi
callq 0x5400
movq -0x2cf8(%rbp), %rdi
addq $0xc0, %rdi
callq 0x52c0
cmpq $0x0, %rax
jbe 0x9507
movq -0x2cf8(%rbp), %rdi
addq $0xc0, %rdi
callq 0x5190
movq %rax, %rdi
leaq 0x2bcac(%rip), %rsi     # 0x3514d
callq 0x54b0
movq %rax, -0x2850(%rbp)
cmpq $0x0, -0x2850(%rbp)
jne 0x94fb
movq 0x43b2a(%rip), %rdi     # 0x4cfe8
leaq 0x2bfac(%rip), %rsi     # 0x35471
callq 0x53f0
movq -0x2cf8(%rbp), %rsi
movq %rax, %rdi
addq $0xc0, %rsi
callq 0x5360
movq %rax, %rdi
movq 0x43aa6(%rip), %rsi     # 0x4cf90
callq 0x5440
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x98a3
movq -0x2850(%rbp), %rdi
callq 0x5400
movq -0x2cf8(%rbp), %rdi
addq $0xe0, %rdi
callq 0x5190
movq %rax, %rdi
leaq 0x2bc29(%rip), %rsi     # 0x3514d
callq 0x54b0
movq %rax, -0x2850(%rbp)
cmpq $0x0, -0x2850(%rbp)
jne 0x957e
movq 0x43aa7(%rip), %rdi     # 0x4cfe8
leaq 0x2bf29(%rip), %rsi     # 0x35471
callq 0x53f0
movq -0x2cf8(%rbp), %rsi
movq %rax, %rdi
addq $0xe0, %rsi
callq 0x5360
movq %rax, %rdi
movq 0x43a23(%rip), %rsi     # 0x4cf90
callq 0x5440
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x98a3
movq -0x2850(%rbp), %rdi
callq 0x5400
movq -0x2cf8(%rbp), %rax
addq $0xa0, %rax
movq %rax, -0x2d18(%rbp)
leaq -0x2891(%rbp), %rdi
movq %rdi, -0x2d10(%rbp)
callq 0x5760
movq -0x2d10(%rbp), %rdx
leaq 0x2bec2(%rip), %rsi     # 0x35481
leaq -0x2890(%rbp), %rdi
callq 0x55b0
jmp 0x95cd
movq -0x2d18(%rbp), %rsi
leaq -0x2870(%rbp), %rdi
leaq -0x2890(%rbp), %rdx
callq 0xae70
jmp 0x95e9
movq -0x2cf8(%rbp), %rdi
addq $0x120, %rdi            # imm = 0x120
leaq -0x2870(%rbp), %rsi
movq %rsi, -0x2d30(%rbp)
callq 0x5500
movq -0x2d30(%rbp), %rdi
callq 0x5250
leaq -0x2890(%rbp), %rdi
callq 0x5250
leaq -0x2891(%rbp), %rdi
callq 0x5460
movq -0x2cf8(%rbp), %rax
addq $0xa0, %rax
movq %rax, -0x2d28(%rbp)
leaq -0x28e9(%rbp), %rdi
movq %rdi, -0x2d20(%rbp)
callq 0x5760
movq -0x2d20(%rbp), %rdx
leaq 0x2be28(%rip), %rsi     # 0x3548b
leaq -0x28e8(%rbp), %rdi
callq 0x55b0
jmp 0x9671
movq -0x2d28(%rbp), %rsi
leaq -0x28c8(%rbp), %rdi
leaq -0x28e8(%rbp), %rdx
callq 0xae70
jmp 0x968d
movq -0x2cf8(%rbp), %rdi
addq $0x140, %rdi            # imm = 0x140
leaq -0x28c8(%rbp), %rsi
callq 0x5500
leaq -0x28c8(%rbp), %rdi
callq 0x5250
leaq -0x28e8(%rbp), %rdi
callq 0x5250
leaq -0x28e9(%rbp), %rdi
callq 0x5460
leaq -0x2cf0(%rbp), %rdi
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x5210
movq -0x2cf8(%rbp), %rdi
addq $0xa0, %rdi
callq 0x5190
movq %rax, %rdi
callq 0x30d50
cmpl $0x0, %eax
jne 0x97d2
movq -0x2cf8(%rbp), %rdi
leaq -0x2cf0(%rbp), %rax
movq %rax, -0x2d38(%rbp)
addq $0xa0, %rdi
callq 0x5190
movq -0x2d38(%rbp), %rdi
movq %rax, %rdx
leaq 0x2bd67(%rip), %rsi     # 0x3549b
movb $0x0, %al
callq 0x50b0
leaq -0x2cf0(%rbp), %rdi
callq 0x5330
jmp 0x97d2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28a0(%rbp)
movl %eax, -0x28a4(%rbp)
jmp 0x977e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28a0(%rbp)
movl %eax, -0x28a4(%rbp)
leaq -0x2890(%rbp), %rdi
callq 0x5250
leaq -0x2891(%rbp), %rdi
callq 0x5460
jmp 0x98af
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28a0(%rbp)
movl %eax, -0x28a4(%rbp)
jmp 0x97c1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28a0(%rbp)
movl %eax, -0x28a4(%rbp)
leaq -0x28e8(%rbp), %rdi
callq 0x5250
leaq -0x28e9(%rbp), %rdi
callq 0x5460
jmp 0x98af
movq -0x2cf8(%rbp), %rdi
addq $0x120, %rdi            # imm = 0x120
callq 0x5190
movq %rax, %rdi
callq 0x30d50
cmpl $0x0, %eax
jne 0x9837
movq -0x2cf8(%rbp), %rdi
leaq -0x2cf0(%rbp), %rax
movq %rax, -0x2d40(%rbp)
addq $0x120, %rdi            # imm = 0x120
callq 0x5190
movq -0x2d40(%rbp), %rdi
movq %rax, %rdx
leaq 0x2bc77(%rip), %rsi     # 0x3549b
movb $0x0, %al
callq 0x50b0
leaq -0x2cf0(%rbp), %rdi
callq 0x5330
movq -0x2cf8(%rbp), %rdi
addq $0x140, %rdi            # imm = 0x140
callq 0x5190
movq %rax, %rdi
callq 0x30d50
cmpl $0x0, %eax
jne 0x989c
movq -0x2cf8(%rbp), %rdi
leaq -0x2cf0(%rbp), %rax
movq %rax, -0x2d48(%rbp)
addq $0x140, %rdi            # imm = 0x140
callq 0x5190
movq -0x2d48(%rbp), %rdi
movq %rax, %rdx
leaq 0x2bc12(%rip), %rsi     # 0x3549b
movb $0x0, %al
callq 0x50b0
leaq -0x2cf0(%rbp), %rdi
callq 0x5330
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x2d50, %rsp           # imm = 0x2D50
popq %rbp
retq
movq -0x28a0(%rbp), %rdi
callq 0x5750
nopl (%rax,%rax)