// File: /workspace/github_cpp_makefile_star2_O3/auton1[P]motiflocation/DNA.cpp
// Function: DNA::readFASTA(char const*, bool, bool, bool)
bool DNA::readFASTA(const char* filename, bool uppercase_only, bool lowercase_only, bool KG_ref=false)
{
	bool output = true;
	int count;
	int i;
	char buffer[5120];
	int bufsize = 5120;
	int nonstandard;
	string junk, junk2;
	junk.reserve(bufsize);
	junk2.reserve(bufsize);
	igzstream in, in2;

	NSeqs = 0;
	in2.open(filename, ios::in);
	if (in2.good())
	{
		while(!in2.eof())
		{
			in2.getline(buffer, bufsize);
			if (buffer[0] == '>')
			{
				string s = buffer;
				s = s.substr(1);
				if (KG_ref == true)
				{
					string::size_type pos=s.find(' ',0);
					s = s.substr(0,pos);
				}
				cout << s << endl;
				NSeqs++;
			}
		}
		header.resize(NSeqs);
		sequence.resize(NSeqs);
		cout << "\t" << NSeqs << " sequences" << endl;

		in2.close();

		in.open(filename, ios::in);
		in.getline(buffer, bufsize);
		junk = buffer;
		if (junk[0] != '>')
		{
			cout << "Error first line is not a headerline" << endl;
			exit(0);
		}
		Trim(junk);
		i=0;
		while(!in.eof())
		{
			if (junk[0] == '>')
			{
				if (KG_ref == false)
				{
					int pos = junk.find(" ");
					while (pos != -1)
					{
						junk.replace(pos,1,"_");
						pos = junk.find(" ");
					}
				}
				else
				{
					string::size_type pos=junk.find(' ',0);
					junk = junk.substr(0,pos);
				}
				header[i].append(junk.substr(1));
				i++;
				count = 0;
				in.getline(buffer, bufsize);
				junk = buffer;
				remove_upper_or_lowercase(junk, uppercase_only, lowercase_only);
				std::transform (junk.begin(), junk.end(), junk.begin(), ToLower());
				Trim(junk);
			}
			else
			{
				junk2 = "";
				while ((junk[0] != '>') && (!in.eof()))
				{
					junk2.append(junk);
					in.getline(buffer, bufsize);
					junk = buffer;
					Trim(junk);
					if (junk[0] != '>')
					{
						remove_upper_or_lowercase(junk, uppercase_only, lowercase_only);
						std::transform (junk.begin(), junk.end(), junk.begin(), ToLower());
						nonstandard = 1;
						while (nonstandard != -1)
						{
							nonstandard = (int)junk.find_first_not_of(" /t/nacgtn/0");
							if (nonstandard != -1)
							{
								cout << "Non-standard character found on line " << i << endl;
								junk[nonstandard] = 'n';
							}
						}
					}
				}
				sequence[i-1].append(junk2);
			}
		}
		in.close();

		SeqLength.resize(NSeqs);
		for (i=0; i < NSeqs; i++)
		{
			SeqLength[i] = (unsigned int)(sequence[i].length());
		}
	}
	else
	{
		cout << "Unable to open file: " << filename << endl;
		abort();
	}

	return output;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a08, %rsp           # imm = 0x1A08
movl %r8d, 0x5c(%rsp)
movl %ecx, 0xc(%rsp)
movl %edx, 0x6c(%rsp)
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x48(%rsp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x80(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x38(%rsp), %rdi
movl $0x1400, %esi           # imm = 0x1400
callq 0x3410
leaq 0x70(%rsp), %rdi
movl $0x1400, %esi           # imm = 0x1400
callq 0x3410
leaq 0xc0(%rsp), %rdi
callq 0x72ac
leaq 0x360(%rsp), %rdi
callq 0x72ac
movl $0x0, 0x50(%rbx)
leaq 0x360(%rsp), %rdi
movq %r14, %rsi
movl $0x8, %edx
callq 0x87ea
movq %r14, 0x10(%rsp)
movq %rbx, 0x60(%rsp)
movq 0x360(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x380(%rsp,%rax)
jne 0x70bc
leaq 0x4e8(%rsp), %r15
leaq 0xb0(%rsp), %rbp
leaq 0x600(%rsp), %r12
leaq 0x18(%rsp), %r13
leaq 0xa0(%rsp), %rbx
movq 0x4e8(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %ecx
movl $0x1400, %edx           # imm = 0x1400
movq %r15, %rdi
movq %r12, %rsi
callq 0x3510
cmpb $0x3e, 0x600(%rsp)
jne 0x6a9d
leaq 0x28(%rsp), %rax
movq %rax, 0x18(%rsp)
movq %r12, %rdi
callq 0x3100
leaq (%rsp,%rax), %rdx
addq $0x600, %rdx            # imm = 0x600
movq %r13, %rdi
movq %r12, %rsi
callq 0x4b96
movl $0x1, %edx
movq %rbx, %rdi
movq %r13, %rsi
movq $-0x1, %rcx
callq 0x3290
movq %r13, %rdi
movq %rbx, %rsi
callq 0x32e0
movq 0xa0(%rsp), %rdi
cmpq %rbp, %rdi
je 0x69eb
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x3270
cmpb $0x0, 0x5c(%rsp)
je 0x6a39
movq %r13, %rdi
movl $0x20, %esi
xorl %edx, %edx
callq 0x3300
movq %rbx, %rdi
movq %r13, %rsi
xorl %edx, %edx
movq %rax, %rcx
callq 0x3290
movq %r13, %rdi
movq %rbx, %rsi
callq 0x32e0
movq 0xa0(%rsp), %rdi
cmpq %rbp, %rdi
je 0x6a39
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x3270
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq 0x658e(%rip), %rdi      # 0xcfd8
callq 0x32b0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3190
movq 0x60(%rsp), %rax
incl 0x50(%rax)
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x6a9d
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3270
movq 0x360(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x380(%rsp,%rax)
je 0x694a
movq 0x60(%rsp), %rbx
leaq 0x20(%rbx), %rdi
movslq 0x50(%rbx), %rsi
movq %rdi, 0x98(%rsp)
callq 0x727c
movq 0x10(%rsp), %r14
leaq 0x8(%rbx), %rdi
movslq 0x50(%rbx), %rsi
movq %rdi, 0x90(%rsp)
callq 0x727c
movq 0x64e6(%rip), %rdi      # 0xcfd8
leaq 0x2687(%rip), %rsi      # 0x9180
movl $0x1, %edx
callq 0x32b0
movl 0x50(%rbx), %esi
movq 0x64cb(%rip), %rdi      # 0xcfd8
callq 0x34a0
movq %rax, %rbx
leaq 0x2b7f(%rip), %rsi      # 0x969b
movl $0xa, %edx
movq %rax, %rdi
callq 0x32b0
movq (%rbx), %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
leaq 0x360(%rsp), %rdi
callq 0x89dc
leaq 0xc0(%rsp), %rdi
movq %r14, %rsi
movl $0x8, %edx
callq 0x87ea
leaq 0x248(%rsp), %r13
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %ecx
leaq 0x600(%rsp), %rsi
movl $0x1400, %edx           # imm = 0x1400
movq %r13, %rdi
callq 0x3510
leaq 0x38(%rsp), %rbx
movq 0x8(%rbx), %r14
leaq 0x600(%rsp), %r15
movq %r15, %rdi
callq 0x3100
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
movq %r15, %rcx
movq %rax, %r8
callq 0x33f0
movq 0x38(%rsp), %rax
cmpb $0x3e, (%rax)
jne 0x70f2
leaq 0x38(%rsp), %rsi
callq 0x5fac
movq 0xc0(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0xe0(%rsp,%rax)
jne 0x6f95
xorl %r12d, %r12d
leaq 0x38(%rsp), %r15
movzbl 0x6c(%rsp), %eax
movl %eax, 0x10(%rsp)
movzbl 0xc(%rsp), %eax
movl %eax, 0xc(%rsp)
movq 0x63b2(%rip), %rbp      # 0xcfd8
movq 0x38(%rsp), %rax
cmpb $0x3e, (%rax)
jne 0x6dcd
cmpb $0x0, 0x5c(%rsp)
je 0x6d8f
movq %r15, %rdi
movl $0x20, %esi
xorl %edx, %edx
callq 0x3300
leaq 0x18(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
xorl %edx, %edx
movq %rax, %rcx
callq 0x3290
movq %r15, %rdi
movq %rbx, %rsi
callq 0x32e0
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x6c8a
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3270
movq 0x98(%rsp), %rax
movq (%rax), %r14
movl $0x1, %edx
leaq 0x18(%rsp), %rdi
movq %r15, %rsi
movq $-0x1, %rcx
callq 0x3290
movslq %r12d, %rax
shlq $0x5, %rax
addq %rax, %r14
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq %r14, %rdi
callq 0x30c0
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x6ce6
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3270
movq 0x248(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %ecx
movl $0x1400, %edx           # imm = 0x1400
movq %r13, %rdi
leaq 0x600(%rsp), %rsi
callq 0x3510
movq 0x40(%rsp), %rbx
leaq 0x600(%rsp), %r14
movq %r14, %rdi
callq 0x3100
movq %r15, %rdi
xorl %esi, %esi
movq %rbx, %rdx
movq %r14, %rcx
movq %rax, %r8
callq 0x33f0
movq %r15, %rsi
movl 0x10(%rsp), %edx
movl 0xc(%rsp), %ecx
callq 0x6776
movq 0x40(%rsp), %rbx
testq %rbx, %rbx
je 0x6d77
movq 0x38(%rsp), %r14
xorl %r13d, %r13d
movsbl (%r14,%r13), %edi
callq 0x3360
movb %al, (%r14,%r13)
incq %r13
cmpq %r13, %rbx
jne 0x6d61
movq %r15, %rsi
callq 0x5fac
leaq 0x248(%rsp), %r13
incl %r12d
jmp 0x6f7b
movl $0x1, %ecx
movq %r15, %rdi
leaq 0x286a(%rip), %rsi      # 0x9608
xorl %edx, %edx
callq 0x34b0
cmpl $-0x1, %eax
je 0x6c8a
movslq %eax, %rsi
movl $0x1, %edx
movl $0x1, %r8d
movq %r15, %rdi
leaq 0x2905(%rip), %rcx      # 0x96cb
callq 0x32a0
jmp 0x6d8f
movq 0x78(%rsp), %rdx
leaq 0x70(%rsp), %rdi
xorl %esi, %esi
leaq 0x23a1(%rip), %rcx      # 0x9181
xorl %r8d, %r8d
callq 0x33f0
movq 0x38(%rsp), %rsi
cmpb $0x3e, (%rsi)
je 0x6f52
movq 0xc0(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0xe0(%rsp,%rax)
jne 0x6f52
movq 0x40(%rsp), %rdx
leaq 0x70(%rsp), %rdi
callq 0x30c0
movq 0x248(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %ecx
movl $0x1400, %edx           # imm = 0x1400
movq %r13, %rdi
leaq 0x600(%rsp), %rsi
callq 0x3510
movq 0x40(%rsp), %rbx
leaq 0x600(%rsp), %r14
movq %r14, %rdi
callq 0x3100
movq %r15, %rdi
xorl %esi, %esi
movq %rbx, %rdx
movq %r14, %rcx
movq %rax, %r8
callq 0x33f0
movq %r15, %rsi
callq 0x5fac
movq 0x38(%rsp), %rax
cmpb $0x3e, (%rax)
je 0x6f52
movq %r15, %rsi
movl 0x10(%rsp), %edx
movl 0xc(%rsp), %ecx
callq 0x6776
movq 0x40(%rsp), %rbx
testq %rbx, %rbx
je 0x6f1d
movq 0x38(%rsp), %r14
xorl %r13d, %r13d
movsbl (%r14,%r13), %edi
callq 0x3360
movb %al, (%r14,%r13)
incq %r13
cmpq %r13, %rbx
jne 0x6eb0
jmp 0x6f1d
movl $0x25, %edx
movq %rbp, %rdi
leaq 0x2803(%rip), %rsi      # 0x96da
callq 0x32b0
movq %rbp, %rdi
movl %r12d, %esi
callq 0x34a0
movq %rax, %rbx
movq (%rax), %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
movslq %r14d, %rax
movq 0x38(%rsp), %rcx
movb $0x6e, (%rcx,%rax)
movl $0xc, %ecx
movq %r15, %rdi
leaq 0x27a1(%rip), %rsi      # 0x96cd
xorl %edx, %edx
callq 0x3460
movq %rax, %r14
cmpl $-0x1, %r14d
jne 0x6ec8
movq 0x38(%rsp), %rsi
cmpb $0x3e, (%rsi)
leaq 0x248(%rsp), %r13
jne 0x6df6
movq 0x90(%rsp), %rax
movq (%rax), %rax
movslq %r12d, %rcx
shlq $0x5, %rcx
leaq (%rax,%rcx), %rdi
addq $-0x20, %rdi
movq 0x70(%rsp), %rsi
movq 0x78(%rsp), %rdx
callq 0x30c0
movq 0xc0(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0xe0(%rsp,%rax)
je 0x6c26
leaq 0xc0(%rsp), %rdi
callq 0x89dc
movq 0x60(%rsp), %rbx
leaq 0x38(%rbx), %r14
movslq 0x50(%rbx), %rsi
movq %r14, %rdi
callq 0x7396
cmpl $0x0, 0x50(%rbx)
jle 0x6fe6
movq 0x90(%rsp), %rax
movq (%rax), %rax
movq (%r14), %rcx
addq $0x8, %rax
xorl %edx, %edx
movl (%rax), %esi
movl %esi, (%rcx,%rdx,4)
incq %rdx
movslq 0x50(%rbx), %rsi
addq $0x20, %rax
cmpq %rsi, %rdx
jl 0x6fd1
leaq 0x5c13(%rip), %r13      # 0xcc00
movq %r13, 0x4e8(%rsp)
movl $0x198, %r14d           # imm = 0x198
leaq 0x360(%rsp), %rdi
leaq (%rdi,%r14), %r15
leaq 0x5c1a(%rip), %rbp      # 0xcc28
movq %rbp, 0x4f8(%rsp)
xorl %ebx, %ebx
movq %rbx, 0x4f0(%rsp)
leaq 0x5b41(%rip), %r12      # 0xcb68
movq %r12, %rsi
callq 0x891e
movq %r15, %rdi
callq 0x30d0
movq %r13, 0x248(%rsp)
leaq 0xc0(%rsp), %rdi
addq %rdi, %r14
movq %rbp, 0x258(%rsp)
movq %rbx, 0x250(%rsp)
movq %r12, %rsi
callq 0x891e
movq %r14, %rdi
callq 0x30d0
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x708c
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x3270
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x70a8
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x3270
movb $0x1, %al
addq $0x1a08, %rsp           # imm = 0x1A08
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x5f15(%rip), %rdi      # 0xcfd8
leaq 0x2636(%rip), %rsi      # 0x9700
movl $0x15, %edx
callq 0x32b0
movq 0x10(%rsp), %rsi
movq 0x5ef8(%rip), %rdi      # 0xcfd8
callq 0x3250
movq %rax, %rdi
callq 0x3110
callq 0x3160
movq 0x5edf(%rip), %rdi      # 0xcfd8
leaq 0x25a6(%rip), %rsi      # 0x96a6
movl $0x24, %edx
callq 0x32b0
movq 0x5ec7(%rip), %rdi      # 0xcfd8
callq 0x3110
xorl %edi, %edi
callq 0x32d0
movq %rax, %rbx
jmp 0x7170
jmp 0x7124
movq %rax, %rbx
jmp 0x717d
jmp 0x7160
jmp 0x713d
jmp 0x7160
jmp 0x713d
jmp 0x713d
jmp 0x7160
jmp 0x7160
jmp 0x7160
jmp 0x7160
jmp 0x7160
movq %rax, %rbx
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x7163
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3270
jmp 0x7163
jmp 0x7160
movq %rax, %rbx
leaq 0x360(%rsp), %rdi
callq 0x73c8
leaq 0xc0(%rsp), %rdi
callq 0x73c8
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x719f
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x3270
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x71bb
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x3270
movq %rbx, %rdi
callq 0x34d0
nop