// File: /workspace/github_cpp_makefile_star2_O1/auton1[P]motiflocation/motiflocation.cpp
// Function: main
int main(int argc, char* argv[])
{
	int i;
	unsigned int ui;
	char filename1[255], outfilename[255];
	string startstr = "";
	string chrom_str = "";
	DNA SequenceSet1;
	bool f1 = false, f2 = false;
	int allowed_mutations = 0;
	bool chosen_chr = false;
	bool output_seqlen = false;
	bool uppercase_only = false, lowercase_only = false;
	bool KG_ref = false;

	for(i = 0; i < argc; i++)
	{
		if(*argv[i] == '-')
		{ 
			if((strcmp(argv[i], "-h") == 0) || (strcmp(argv[i], "-?") == 0) || (strcmp(argv[i], "-help") == 0)) 
			{
				print_help();
				exit (0);
			}
			if(strcmp(argv[i], "-file1") == 0) { strcpy(filename1 , argv[i+1]); f1 = true; }
			if(strcmp(argv[i], "-out") == 0) { strcpy(outfilename , argv[i+1]); f2 = true; }
			if(strcmp(argv[i], "-startstr") == 0) startstr = argv[i+1];
			if(strcmp(argv[i], "-chrom") == 0) {chrom_str = argv[i+1]; chosen_chr = true; }
			if(strcmp(argv[i], "-mutations") == 0) allowed_mutations = atoi(argv[i+1]);
			if(strcmp(argv[i], "-outputseqlen") == 0) output_seqlen = true;
			if(strcmp(argv[i], "-uppercase_only") == 0) uppercase_only = true;
			if(strcmp(argv[i], "-lowercase_only") == 0) lowercase_only = true;
			if(strcmp(argv[i], "-1000G_ref") == 0) KG_ref = true;
		}
	}

	if (chosen_chr == false)
	{
		chrom_str = "n.a";
	}

	if (!((f1 == true) && (f2 == true)))
	{
		cout << "Missing input parameter" << endl;
		print_help();
		exit(0);
	}

	
	std::transform(startstr.begin(), startstr.end(), startstr.begin(), ToLower());

	motif my_motif = motif(startstr);

	cout << "\nReading in Files" << endl;
	if ((strstr( filename1, ".fa" ) != NULL) || (strstr( filename1, ".fa.gz" ) != NULL))
	{
		cout << "File 1 Fasta file" << endl;
		if (chosen_chr == false)
			SequenceSet1.readFASTA(filename1, uppercase_only, lowercase_only, KG_ref);
		else
			SequenceSet1.readFASTA(filename1, chrom_str, uppercase_only, lowercase_only, KG_ref);
	}
	else
	{
		cout << "Appears to not be a fasta file? Should end in .fa" << endl;
		exit(0);
	}

	cout << "Finished reading files\n" << endl;
	for (unsigned int ui=0; ui<SequenceSet1.sequence.size(); ui++)
		cout << "Read " << SequenceSet1.sequence[ui].size() << " bases in " << SequenceSet1.header[ui] << endl;

	cout << "Searching for motif" << endl;
	vector<string> chroms;
	vector<int> positions;
	vector<int> seqnum;
	vector<string> revchroms;
	vector<int> reverse_positions;
	vector<int> revseqnum;

	for (unsigned int ui=0; ui<SequenceSet1.sequence.size(); ui++)
	{
		vector<int> tmp_positions;
		tmp_positions = my_motif.returnMotifLocations(SequenceSet1.sequence[ui].c_str(), my_motif.sequence.c_str(), allowed_mutations);
		vector<string> tmp_chroms(tmp_positions.size(), SequenceSet1.header[ui]);
		positions.insert( positions.end(), tmp_positions.begin(), tmp_positions.end() );
		chroms.insert(chroms.end(), tmp_chroms.begin(), tmp_chroms.end() );
		vector<int> tmp_seqnum(tmp_positions.size(), ui);
		seqnum.insert( seqnum.end(), tmp_seqnum.begin(), tmp_seqnum.end());
	}

	cout << "Searching for reverse complement" << endl;
	for (unsigned int ui=0; ui<SequenceSet1.sequence.size(); ui++)
	{
		vector<int> tmp_positions;
		tmp_positions = my_motif.returnMotifLocations(SequenceSet1.sequence[ui].c_str(), my_motif.complement.c_str(), allowed_mutations);
		vector<string> tmp_chroms(tmp_positions.size(), SequenceSet1.header[ui]);
		reverse_positions.insert( reverse_positions.end(), tmp_positions.begin(), tmp_positions.end() );
		revchroms.insert(revchroms.end(), tmp_chroms.begin(), tmp_chroms.end() );
		vector<int> tmp_seqnum(tmp_positions.size(), ui);
		revseqnum.insert( revseqnum.end(), tmp_seqnum.begin(), tmp_seqnum.end());
	}


	ofstream out_file;
	out_file.open(outfilename);
	//out_file << "chrom\tchromStart\tchromEnd\tstrand\tsequence" << endl;
	int plus = startstr.length();
	for (ui=0; ui < positions.size(); ui++)
	{
		out_file << chroms[ui] << "\t" << positions[ui] << "\t" << positions[ui] + plus << "\t+\t" << SequenceSet1.sequence[seqnum[ui]].substr(positions[ui], plus);
		if (output_seqlen == true)
			out_file << "\t" << SequenceSet1.sequence[seqnum[ui]].size();
		out_file << endl;
	}

	for (ui=0; ui < reverse_positions.size(); ui++)
	{
		out_file << revchroms[ui] << "\t" << reverse_positions[ui] << "\t" << reverse_positions[ui] + plus << "\t-\t" << SequenceSet1.sequence[revseqnum[ui]].substr(reverse_positions[ui], plus);
		if (output_seqlen == true)
			out_file << "\t" << SequenceSet1.sequence[revseqnum[ui]].size();
		out_file << endl;
	}
	out_file.close();
	
	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x668, %rsp            # imm = 0x668
movq %rsi, %r14
movl %edi, %ebx
leaq 0xa0(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x59f2(%rip), %r15      # 0x9187
leaq 0x90(%rsp), %rdi
movq %r15, %rsi
movq %r15, %rdx
callq 0x4bac
leaq 0x110(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x100(%rsp), %rdi
movq %r15, %rsi
movq %r15, %rdx
callq 0x4bac
leaq 0x158(%rsp), %rdi
callq 0x5ee4
testl %ebx, %ebx
jle 0x3a4f
movl %ebx, %r12d
xorl %ebp, %ebp
movq $0x0, 0xf8(%rsp)
movq $0x0, 0xf0(%rsp)
movl $0x0, 0x20(%rsp)
movq $0x0, 0xe8(%rsp)
movl $0x0, 0x1c(%rsp)
movl $0x0, 0x10(%rsp)
xorl %r13d, %r13d
xorl %r15d, %r15d
movq (%r14,%rbp,8), %rbx
cmpb $0x2d, (%rbx)
jne 0x3a23
movq %rbx, %rdi
leaq 0x5806(%rip), %rsi      # 0x9040
callq 0x3330
testl %eax, %eax
je 0x45c6
movq %rbx, %rdi
leaq 0x57f2(%rip), %rsi      # 0x9043
callq 0x3330
testl %eax, %eax
je 0x45c6
movq %rbx, %rdi
leaq 0x57de(%rip), %rsi      # 0x9046
callq 0x3330
testl %eax, %eax
je 0x45c6
movq %r13, 0x1b8(%rsp)
movq %rbx, %rdi
leaq 0x57c5(%rip), %rsi      # 0x904c
callq 0x3330
testl %eax, %eax
jne 0x38ac
movq 0x8(%r14,%rbp,8), %rsi
leaq 0x460(%rsp), %rdi
callq 0x3230
movb $0x1, %al
movq %rax, 0xf8(%rsp)
movq %r15, 0x1b0(%rsp)
movq %rbx, %rdi
leaq 0x5795(%rip), %rsi      # 0x9053
callq 0x3330
testl %eax, %eax
jne 0x38e3
movq 0x8(%r14,%rbp,8), %rsi
leaq 0x560(%rsp), %rdi
callq 0x3230
movb $0x1, %al
movq %rax, 0xf0(%rsp)
movq %rbx, %rdi
leaq 0x576b(%rip), %rsi      # 0x9058
callq 0x3330
testl %eax, %eax
jne 0x3923
movq 0x8(%r14,%rbp,8), %rbx
movq 0x98(%rsp), %r15
movq %rbx, %rdi
callq 0x3100
leaq 0x90(%rsp), %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %rbx, %rcx
movq %rax, %r8
callq 0x33f0
movq (%r14,%rbp,8), %rdi
leaq 0x5734(%rip), %rsi      # 0x9062
callq 0x3330
testl %eax, %eax
jne 0x396e
movq 0x8(%r14,%rbp,8), %rbx
movq 0x108(%rsp), %r15
movq %rbx, %rdi
callq 0x3100
movb $0x1, %cl
movq %rcx, 0xe8(%rsp)
leaq 0x100(%rsp), %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %rbx, %rcx
movq %rax, %r8
callq 0x33f0
movq %r12, %r13
movq (%r14,%rbp,8), %rbx
movq %rbx, %rdi
leaq 0x56ea(%rip), %rsi      # 0x9069
callq 0x3330
testl %eax, %eax
jne 0x3996
movq 0x8(%r14,%rbp,8), %rdi
callq 0x3400
movl %eax, 0x20(%rsp)
movq %rbx, %rdi
leaq 0x56d4(%rip), %rsi      # 0x9074
callq 0x3330
testl %eax, %eax
movl 0x1c(%rsp), %eax
movzbl %al, %eax
movl $0x1, %r15d
cmovel %r15d, %eax
movl %eax, 0x1c(%rsp)
movq %rbx, %rdi
leaq 0x56bc(%rip), %rsi      # 0x9082
callq 0x3330
testl %eax, %eax
movl 0x10(%rsp), %eax
movzbl %al, %eax
cmovel %r15d, %eax
movl %eax, 0x10(%rsp)
movq %rbx, %rdi
leaq 0x56ac(%rip), %rsi      # 0x9092
callq 0x3330
movl $0x1, %r12d
testl %eax, %eax
je 0x39fe
movzbl 0x1b8(%rsp), %r12d
movq %rbx, %rdi
leaq 0x569a(%rip), %rsi      # 0x90a2
callq 0x3330
testl %eax, %eax
je 0x3a1a
movzbl 0x1b0(%rsp), %r15d
movl %r12d, %eax
movq %r13, %r12
movq %rax, %r13
incq %rbp
cmpq %rbp, %r12
jne 0x3823
testb $0x1, 0xe8(%rsp)
sete %bpl
movq 0xf8(%rsp), %rbx
andb 0xf0(%rsp), %bl
xorb $0x1, %bl
jmp 0x3a72
xorl %r15d, %r15d
movb $0x1, %bpl
xorl %r13d, %r13d
movl $0x0, 0x10(%rsp)
movl $0x0, 0x1c(%rsp)
movl $0x0, 0x20(%rsp)
movb $0x1, %bl
testb %bpl, %bpl
je 0x3a97
leaq 0x100(%rsp), %rdi
movq 0x8(%rdi), %rdx
leaq 0x5623(%rip), %rcx      # 0x90ad
movl $0x3, %r8d
xorl %esi, %esi
callq 0x33f0
testb $0x1, %bl
jne 0x45a2
movq %r15, %r12
movq 0x98(%rsp), %rbx
testq %rbx, %rbx
je 0x3ad1
movq 0x90(%rsp), %r14
xorl %r15d, %r15d
movsbl (%r14,%r15), %edi
callq 0x3360
movb %al, (%r14,%r15)
incq %r15
cmpq %r15, %rbx
jne 0x3abb
leaq 0x1d0(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rdx
addq %rsi, %rdx
leaq 0x1c0(%rsp), %rdi
callq 0x4b1c
leaq 0x1e0(%rsp), %rdi
leaq 0x1c0(%rsp), %rsi
callq 0x5824
movq %r12, %r15
movq 0x1c0(%rsp), %rdi
cmpq %r14, %rdi
je 0x3b32
movq 0x1d0(%rsp), %rsi
incq %rsi
callq 0x3270
movq 0x949f(%rip), %rbx      # 0xcfd8
leaq 0x5589(%rip), %rsi      # 0x90c9
movl $0x11, %edx
movq %rbx, %rdi
callq 0x32b0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq 0x946d(%rip), %rdi      # 0xcfd8
callq 0x3040
movq %rax, %rdi
callq 0x3190
leaq 0x55a3(%rip), %rsi      # 0x9122
leaq 0x460(%rsp), %rdi
callq 0x3070
testq %rax, %rax
jne 0x3bae
leaq 0x5543(%rip), %rsi      # 0x90db
leaq 0x460(%rsp), %rdi
callq 0x3070
testq %rax, %rax
je 0x45d2
movq 0x9423(%rip), %rbx      # 0xcfd8
leaq 0x5526(%rip), %rsi      # 0x90e2
movl $0x11, %edx
movq %rbx, %rdi
callq 0x32b0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq 0x93f1(%rip), %rdi      # 0xcfd8
callq 0x3040
movq %rax, %rdi
callq 0x3190
testb %bpl, %bpl
je 0x3c27
movzbl 0x10(%rsp), %edx
andl $0x1, %edx
movzbl %r13b, %ecx
andl $0x1, %ecx
movzbl %r15b, %r8d
andl $0x1, %r8d
leaq 0x158(%rsp), %rdi
leaq 0x460(%rsp), %rsi
callq 0x68f2
jmp 0x3c5c
movzbl 0x10(%rsp), %ecx
andl $0x1, %ecx
movzbl %r13b, %r8d
andl $0x1, %r8d
movzbl %r15b, %r9d
andl $0x1, %r9d
leaq 0x158(%rsp), %rdi
leaq 0x460(%rsp), %rsi
leaq 0x100(%rsp), %rdx
callq 0x60ee
movq 0x9375(%rip), %rbx      # 0xcfd8
leaq 0x54bc(%rip), %rsi      # 0x9126
movl $0x17, %edx
movq %rbx, %rdi
callq 0x32b0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq 0x9343(%rip), %rdi      # 0xcfd8
callq 0x3040
movq %rax, %rdi
callq 0x3190
movq 0x168(%rsp), %rax
cmpq 0x160(%rsp), %rax
je 0x3d76
movl $0x1, %ebp
xorl %r13d, %r13d
movq 0x9311(%rip), %rbx      # 0xcfd8
leaq 0x5470(%rip), %r14      # 0x913e
leaq 0x546f(%rip), %r15      # 0x9144
movl $0x5, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x32b0
movq 0x160(%rsp), %rax
shlq $0x5, %r13
movq 0x8(%rax,%r13), %rsi
movq %rbx, %rdi
callq 0x3180
movq %rax, %r12
movl $0xa, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x32b0
movq 0x178(%rsp), %rax
movq (%rax,%r13), %rsi
movq 0x8(%rax,%r13), %rdx
movq %r12, %rdi
callq 0x32b0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq %r12, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3190
movq 0x168(%rsp), %rax
subq 0x160(%rsp), %rax
movl %ebp, %r13d
sarq $0x5, %rax
incl %ebp
cmpq %r13, %rax
ja 0x3cd5
movq 0x925b(%rip), %rbx      # 0xcfd8
leaq 0x53cb(%rip), %rsi      # 0x914f
movl $0x13, %edx
movq %rbx, %rdi
callq 0x32b0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq 0x9229(%rip), %rdi      # 0xcfd8
callq 0x3040
movq %rax, %rdi
callq 0x3190
xorps %xmm0, %xmm0
movaps %xmm0, 0x140(%rsp)
xorl %r12d, %r12d
movq %r12, 0x150(%rsp)
movq %r12, 0x80(%rsp)
movaps %xmm0, 0x70(%rsp)
movq %r12, 0xe0(%rsp)
movaps %xmm0, 0xd0(%rsp)
movq %r12, 0x130(%rsp)
movaps %xmm0, 0x120(%rsp)
movq %r12, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
movq %r12, 0xc0(%rsp)
movaps %xmm0, 0xb0(%rsp)
movq 0x160(%rsp), %rax
cmpq %rax, 0x168(%rsp)
je 0x3f70
leaq 0x260(%rsp), %r14
xorl %ebx, %ebx
shlq $0x5, %rbx
movq (%rax,%rbx), %rdx
movq 0x1e8(%rsp), %rcx
movq %r14, %rdi
leaq 0x1e0(%rsp), %rsi
movl 0x20(%rsp), %r8d
callq 0x5b1c
movq %r14, %rdi
movq 0x260(%rsp), %r15
movq 0x268(%rsp), %rbp
movq 0x270(%rsp), %rax
movq %rax, 0x10(%rsp)
movq %rbp, %r13
subq %r15, %r13
sarq $0x2, %r13
addq 0x178(%rsp), %rbx
movq %r13, %rsi
movq %rbx, %rdx
leaq 0x28(%rsp), %rbx
movq %rbx, %rcx
callq 0x48ae
movq 0x78(%rsp), %rsi
leaq 0x70(%rsp), %rdi
movq %r15, %rdx
movq %rbp, %rcx
callq 0x4d18
movq 0x148(%rsp), %rsi
movq 0x260(%rsp), %rdx
movq 0x268(%rsp), %rcx
leaq 0x140(%rsp), %rdi
callq 0x4f6c
movl %r12d, 0x4c(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
leaq 0x4c(%rsp), %rdx
leaq 0xf(%rsp), %rcx
callq 0x4942
movq 0xd8(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq 0x30(%rsp), %rcx
leaq 0xd0(%rsp), %rdi
callq 0x4d18
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x3f2d
movq 0x38(%rsp), %rsi
subq %rdi, %rsi
callq 0x3270
movq %r14, %rdi
callq 0x4ab6
testq %r15, %r15
je 0x3f4a
movq 0x10(%rsp), %rsi
subq %r15, %rsi
movq %r15, %rdi
callq 0x3270
incl %r12d
movq 0x160(%rsp), %rax
movq 0x168(%rsp), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
movq %r12, %rbx
cmpq %r12, %rcx
ja 0x3e39
movq 0x9061(%rip), %rbx      # 0xcfd8
leaq 0x51e5(%rip), %rsi      # 0x9163
movl $0x20, %edx
movq %rbx, %rdi
callq 0x32b0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq 0x902f(%rip), %rdi      # 0xcfd8
callq 0x3040
movq %rax, %rdi
callq 0x3190
movq 0x160(%rsp), %rax
cmpq %rax, 0x168(%rsp)
je 0x4111
xorl %r13d, %r13d
leaq 0x260(%rsp), %r14
xorl %r12d, %r12d
shlq $0x5, %r13
movq (%rax,%r13), %rdx
movq 0x208(%rsp), %rcx
movq %r14, %rdi
leaq 0x1e0(%rsp), %rsi
movl 0x20(%rsp), %r8d
callq 0x5b1c
movq %r14, %rdi
movq 0x260(%rsp), %r15
movq 0x268(%rsp), %rbp
movq 0x270(%rsp), %rax
movq %rax, 0x10(%rsp)
movq %rbp, %rbx
subq %r15, %rbx
sarq $0x2, %rbx
addq 0x178(%rsp), %r13
movq %rbx, %rsi
movq %r13, %rdx
leaq 0x28(%rsp), %r13
movq %r13, %rcx
callq 0x48ae
movq 0x58(%rsp), %rsi
leaq 0x50(%rsp), %rdi
movq %r15, %rdx
movq %rbp, %rcx
callq 0x4d18
movq 0x128(%rsp), %rsi
movq 0x260(%rsp), %rdx
movq 0x268(%rsp), %rcx
leaq 0x120(%rsp), %rdi
callq 0x4f6c
movl %r12d, 0x4c(%rsp)
movq %r13, %rdi
movq %rbx, %rsi
leaq 0x4c(%rsp), %rdx
leaq 0xf(%rsp), %rcx
callq 0x4942
movq 0xb8(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq 0x30(%rsp), %rcx
leaq 0xb0(%rsp), %rdi
callq 0x4d18
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x40ce
movq 0x38(%rsp), %rsi
subq %rdi, %rsi
callq 0x3270
movq %r14, %rdi
callq 0x4ab6
testq %r15, %r15
je 0x40eb
movq 0x10(%rsp), %rsi
subq %r15, %rsi
movq %r15, %rdi
callq 0x3270
incl %r12d
movq 0x160(%rsp), %rax
movq 0x168(%rsp), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
movq %r12, %r13
cmpq %r12, %rcx
ja 0x3fda
leaq 0x260(%rsp), %rdi
callq 0x3490
leaq 0x260(%rsp), %rbx
leaq 0x560(%rsp), %rsi
movq %rbx, %rdi
movl $0x10, %edx
callq 0x3060
movq 0x98(%rsp), %r12
movq 0x78(%rsp), %rax
cmpq 0x70(%rsp), %rax
je 0x42d0
movslq %r12d, %rax
movq %rax, 0x20(%rsp)
movl $0x1, %r13d
xorl %r14d, %r14d
leaq 0x501b(%rip), %r15      # 0x9186
movq 0x140(%rsp), %rax
movq %r14, %rcx
shlq $0x5, %rcx
movq (%rax,%rcx), %rsi
movq 0x8(%rax,%rcx), %rdx
movq %rbx, %rdi
callq 0x32b0
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x32b0
movq 0x70(%rsp), %rax
movl (%rax,%r14,4), %esi
movq %rbp, %rdi
callq 0x34a0
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x32b0
movq 0x70(%rsp), %rax
movl (%rax,%r14,4), %esi
addl %r12d, %esi
movq %rbp, %rdi
callq 0x34a0
movq %rax, %rbp
movl $0x3, %edx
movq %rax, %rdi
leaq 0x4f9c(%rip), %rsi      # 0x9184
callq 0x32b0
movq 0xd0(%rsp), %rax
movslq (%rax,%r14,4), %rsi
shlq $0x5, %rsi
addq 0x160(%rsp), %rsi
movq 0x70(%rsp), %rax
movslq (%rax,%r14,4), %rdx
leaq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rcx
callq 0x3290
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq %rbp, %rdi
callq 0x32b0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x424b
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3270
testb $0x1, 0x1c(%rsp)
je 0x4287
movl $0x1, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x32b0
movq 0xd0(%rsp), %rax
movslq (%rax,%r14,4), %rax
movq 0x160(%rsp), %rcx
shlq $0x5, %rax
movq 0x8(%rcx,%rax), %rsi
movq %rbx, %rdi
callq 0x3180
movq 0x260(%rsp), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3190
movq 0x78(%rsp), %rax
subq 0x70(%rsp), %rax
movl %r13d, %r14d
sarq $0x2, %rax
incl %r13d
cmpq %r14, %rax
ja 0x416b
movq 0x58(%rsp), %rax
cmpq 0x50(%rsp), %rax
je 0x445d
movslq %r12d, %rax
movq %rax, 0x20(%rsp)
movl $0x1, %r13d
xorl %r14d, %r14d
leaq 0x4e8e(%rip), %r15      # 0x9186
movq 0x120(%rsp), %rax
movq %r14, %rcx
shlq $0x5, %rcx
movq (%rax,%rcx), %rsi
movq 0x8(%rax,%rcx), %rdx
movq %rbx, %rdi
callq 0x32b0
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x32b0
movq 0x50(%rsp), %rax
movl (%rax,%r14,4), %esi
movq %rbp, %rdi
callq 0x34a0
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x32b0
movq 0x50(%rsp), %rax
movl (%rax,%r14,4), %esi
addl %r12d, %esi
movq %rbp, %rdi
callq 0x34a0
movq %rax, %rbp
movl $0x3, %edx
movq %rax, %rdi
leaq 0x4e13(%rip), %rsi      # 0x9188
callq 0x32b0
movq 0xb0(%rsp), %rax
movslq (%rax,%r14,4), %rsi
shlq $0x5, %rsi
addq 0x160(%rsp), %rsi
movq 0x50(%rsp), %rax
movslq (%rax,%r14,4), %rdx
leaq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rcx
callq 0x3290
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq %rbp, %rdi
callq 0x32b0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x43d8
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3270
testb $0x1, 0x1c(%rsp)
je 0x4414
movl $0x1, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x32b0
movq 0xb0(%rsp), %rax
movslq (%rax,%r14,4), %rax
movq 0x160(%rsp), %rcx
shlq $0x5, %rax
movq 0x8(%rcx,%rax), %rsi
movq %rbx, %rdi
callq 0x3180
movq 0x260(%rsp), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3190
movq 0x58(%rsp), %rax
subq 0x50(%rsp), %rax
movl %r13d, %r14d
sarq $0x2, %rax
incl %r13d
cmpq %r14, %rax
ja 0x42f8
leaq 0x260(%rsp), %rdi
callq 0x3350
movq 0x8b5f(%rip), %rax      # 0xcfd0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x268(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x260(%rsp,%rcx)
callq 0x31f0
leaq 0x358(%rsp), %rdi
callq 0x30d0
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x44bf
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x3270
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x44d6
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x3270
leaq 0x120(%rsp), %rdi
callq 0x4ab6
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x4500
movq 0xe0(%rsp), %rsi
subq %rdi, %rsi
callq 0x3270
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x451a
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x3270
leaq 0x140(%rsp), %rdi
callq 0x4ab6
leaq 0x1e0(%rsp), %rdi
callq 0x58f0
leaq 0x158(%rsp), %rdi
callq 0x609c
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
je 0x4566
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x3270
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x458b
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x3270
movl $0x1, %eax
addq $0x668, %rsp            # imm = 0x668
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8a2f(%rip), %rdi      # 0xcfd8
leaq 0x4b01(%rip), %rsi      # 0x90b1
movl $0x17, %edx
callq 0x32b0
movq 0x8a17(%rip), %rdi      # 0xcfd8
callq 0x3110
callq 0x47fb
xorl %edi, %edi
callq 0x32d0
movq 0x89ff(%rip), %rdi      # 0xcfd8
leaq 0x4b14(%rip), %rsi      # 0x90f4
movl $0x31, %edx
callq 0x32b0
movq 0x89e7(%rip), %rdi      # 0xcfd8
callq 0x3110
jmp 0x45cb
jmp 0x46fa
jmp 0x46fa
jmp 0x4641
movq %rax, %rbx
movq 0x1c0(%rsp), %rdi
cmpq %r14, %rdi
je 0x479c
movq 0x1d0(%rsp), %rsi
incq %rsi
callq 0x3270
jmp 0x479c
jmp 0x4649
movq %rax, %rbx
jmp 0x47a9
movq %rax, %rbx
jmp 0x47ce
jmp 0x4649
movq %rax, %rbx
jmp 0x470a
movq %rax, %rbx
jmp 0x479c
jmp 0x46f0
jmp 0x46fa
jmp 0x4662
jmp 0x46fa
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x46fd
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3270
jmp 0x46fd
jmp 0x4693
jmp 0x46a4
jmp 0x46ad
jmp 0x46ad
jmp 0x46ad
jmp 0x46d4
movq %rax, %rbx
movq $0x0, 0x10(%rsp)
xorl %r15d, %r15d
jmp 0x46bd
movq %rax, %rbx
jmp 0x46bd
jmp 0x46ad
jmp 0x46ad
movq %rax, %rbx
leaq 0x260(%rsp), %rdi
callq 0x4ab6
testq %r15, %r15
je 0x470a
movq 0x10(%rsp), %rsi
subq %r15, %rsi
movq %r15, %rdi
callq 0x3270
jmp 0x470a
movq %rax, %rbx
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x46b0
movq 0x38(%rsp), %rsi
subq %rdi, %rsi
callq 0x3270
jmp 0x46b0
movq %rax, %rbx
jmp 0x478f
jmp 0x46fa
movq %rax, %rbx
leaq 0x260(%rsp), %rdi
callq 0x33a0
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x4727
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x3270
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x473e
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x3270
leaq 0x120(%rsp), %rdi
callq 0x4ab6
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x4768
movq 0xe0(%rsp), %rsi
subq %rdi, %rsi
callq 0x3270
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x4782
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x3270
leaq 0x140(%rsp), %rdi
callq 0x4ab6
leaq 0x1e0(%rsp), %rdi
callq 0x58f0
leaq 0x158(%rsp), %rdi
callq 0x609c
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
je 0x47ce
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x3270
leaq 0xa0(%rsp), %rax
movq 0x90(%rsp), %rdi
cmpq %rax, %rdi
je 0x47f3
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x3270
movq %rbx, %rdi
callq 0x34d0