// File: /workspace/github_cpp_makefile_star2_O1/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, 0x3c(%rsp)
movl %ecx, 0xc(%rsp)
movl %edx, 0x6c(%rsp)
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x28(%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 0x18(%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 0x737c
leaq 0x360(%rsp), %rdi
callq 0x737c
movl $0x0, 0x50(%rbx)
leaq 0x360(%rsp), %rdi
movq %r14, %rsi
movl $0x8, %edx
callq 0x88ca
movq %r14, 0x10(%rsp)
movq %rbx, 0x60(%rsp)
movq 0x360(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x380(%rsp,%rax)
jne 0x717f
movq 0x360(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x380(%rsp,%rax)
jne 0x6b60
leaq 0x4e8(%rsp), %r15
leaq 0x50(%rsp), %rbp
leaq 0x600(%rsp), %r12
leaq 0x40(%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 0x6b46
movq %rbp, 0x40(%rsp)
movq %r12, %rdi
callq 0x3100
leaq (%rsp,%rax), %rdx
addq $0x600, %rdx            # imm = 0x600
movq %r13, %rdi
movq %r12, %rsi
callq 0x4bac
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
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x6a91
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x3270
cmpb $0x0, 0x3c(%rsp)
je 0x6ae7
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
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x6ae7
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x3270
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq 0x64e0(%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 0x40(%rsp), %rdi
cmpq %rbp, %rdi
je 0x6b46
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3270
movq 0x360(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x380(%rsp,%rax)
je 0x69ed
movq 0x60(%rsp), %rbx
leaq 0x20(%rbx), %rdi
movslq 0x50(%rbx), %rsi
movq %rdi, 0x98(%rsp)
callq 0x734c
movq 0x10(%rsp), %r14
leaq 0x8(%rbx), %rdi
movslq 0x50(%rbx), %rsi
movq %rdi, 0x90(%rsp)
callq 0x734c
movq 0x643d(%rip), %rdi      # 0xcfd8
leaq 0x25e4(%rip), %rsi      # 0x9186
movl $0x1, %edx
callq 0x32b0
movl 0x50(%rbx), %esi
movq 0x6422(%rip), %rdi      # 0xcfd8
callq 0x34a0
movq %rax, %rbx
leaq 0x2afe(%rip), %rsi      # 0x96c3
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 0x8abc
leaq 0xc0(%rsp), %rdi
movq %r14, %rsi
movl $0x8, %edx
callq 0x88ca
leaq 0x248(%rsp), %rbp
movq (%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %ecx
leaq 0x600(%rsp), %rsi
movl $0x1400, %edx           # imm = 0x1400
movq %rbp, %rdi
callq 0x3510
leaq 0x18(%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 0x18(%rsp), %rax
cmpb $0x3e, (%rax)
jne 0x71b5
leaq 0x18(%rsp), %rsi
callq 0x6020
movq 0xc0(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0xe0(%rsp,%rax)
jne 0x7058
xorl %r12d, %r12d
leaq 0x18(%rsp), %r15
movzbl 0x6c(%rsp), %eax
movl %eax, 0x10(%rsp)
movzbl 0xc(%rsp), %eax
movl %eax, 0xc(%rsp)
movq 0x6309(%rip), %rbx      # 0xcfd8
movq 0x18(%rsp), %rax
cmpb $0x3e, (%rax)
jne 0x6e77
cmpb $0x0, 0x3c(%rsp)
je 0x6e39
movq %r15, %rdi
movl $0x20, %esi
xorl %edx, %edx
callq 0x3300
leaq 0x40(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
movq %rax, %rcx
callq 0x3290
movq %r15, %rdi
movq %r14, %rsi
callq 0x32e0
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x6d33
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3270
movq 0x98(%rsp), %rax
movq (%rax), %r14
movl $0x1, %edx
leaq 0x40(%rsp), %rdi
movq %r15, %rsi
movq $-0x1, %rcx
callq 0x3290
movslq %r12d, %rax
shlq $0x5, %rax
addq %rax, %r14
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq %r14, %rdi
callq 0x30c0
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x6d8f
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3270
movq 0x248(%rsp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %ecx
movl $0x1400, %edx           # imm = 0x1400
movq %rbp, %rdi
leaq 0x600(%rsp), %rsi
callq 0x3510
movq 0x20(%rsp), %r14
leaq 0x600(%rsp), %r13
movq %r13, %rdi
callq 0x3100
movq %r15, %rdi
xorl %esi, %esi
movq %r14, %rdx
movq %r13, %rcx
movq %rax, %r8
callq 0x33f0
movq %r15, %rsi
movl 0x10(%rsp), %edx
movl 0xc(%rsp), %ecx
callq 0x6802
movq 0x20(%rsp), %r14
testq %r14, %r14
je 0x6e21
movq 0x18(%rsp), %r13
xorl %ebp, %ebp
movsbl (%r13,%rbp), %edi
callq 0x3360
movb %al, (%r13,%rbp)
incq %rbp
cmpq %rbp, %r14
jne 0x6e09
movq %r15, %rsi
callq 0x6020
leaq 0x248(%rsp), %rbp
incl %r12d
jmp 0x703e
movl $0x1, %ecx
movq %r15, %rdi
leaq 0x27e8(%rip), %rsi      # 0x9630
xorl %edx, %edx
callq 0x34b0
cmpl $-0x1, %eax
je 0x6d33
movslq %eax, %rsi
movl $0x1, %edx
movl $0x1, %r8d
movq %r15, %rdi
leaq 0x2883(%rip), %rcx      # 0x96f3
callq 0x32a0
jmp 0x6e39
movq 0x78(%rsp), %rdx
leaq 0x70(%rsp), %rdi
xorl %esi, %esi
leaq 0x22fd(%rip), %rcx      # 0x9187
xorl %r8d, %r8d
callq 0x33f0
movq 0x18(%rsp), %rsi
cmpb $0x3e, (%rsi)
je 0x7015
movq 0xc0(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0xe0(%rsp,%rax)
jne 0x7015
movq 0x20(%rsp), %rdx
leaq 0x70(%rsp), %rdi
callq 0x30c0
movq 0x248(%rsp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %ecx
movl $0x1400, %edx           # imm = 0x1400
movq %rbp, %rdi
leaq 0x600(%rsp), %rsi
callq 0x3510
movq 0x20(%rsp), %r14
leaq 0x600(%rsp), %r13
movq %r13, %rdi
callq 0x3100
movq %r15, %rdi
xorl %esi, %esi
movq %r14, %rdx
movq %r13, %rcx
movq %rax, %r8
callq 0x33f0
movq %r15, %rsi
callq 0x6020
movq 0x18(%rsp), %rax
cmpb $0x3e, (%rax)
je 0x6e92
movq %r15, %rsi
movl 0x10(%rsp), %edx
movl 0xc(%rsp), %ecx
callq 0x6802
movq 0x20(%rsp), %r14
testq %r14, %r14
je 0x6f71
movq 0x18(%rsp), %r13
xorl %ebp, %ebp
movsbl (%r13,%rbp), %edi
callq 0x3360
movb %al, (%r13,%rbp)
incq %rbp
cmpq %rbp, %r14
jne 0x6f59
movl $0xc, %ecx
movq %r15, %rdi
leaq 0x2775(%rip), %rsi      # 0x96f5
xorl %edx, %edx
callq 0x3460
movq %rax, %r14
cmpl $-0x1, %r14d
leaq 0x248(%rsp), %rbp
je 0x6e92
movl $0x25, %edx
movq %rbx, %rdi
leaq 0x2757(%rip), %rsi      # 0x9702
callq 0x32b0
movq %rbx, %rdi
movl %r12d, %esi
callq 0x34a0
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq %r13, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3190
movslq %r14d, %rax
movq 0x18(%rsp), %rcx
movb $0x6e, (%rcx,%rax)
movl $0xc, %ecx
movq %r15, %rdi
leaq 0x26f5(%rip), %rsi      # 0x96f5
xorl %edx, %edx
callq 0x3460
movq %rax, %r14
cmpl $-0x1, %r14d
jne 0x6f9c
jmp 0x6e92
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 0x6ccf
leaq 0xc0(%rsp), %rdi
callq 0x8abc
movq 0x60(%rsp), %rbx
leaq 0x38(%rbx), %r14
movslq 0x50(%rbx), %rsi
movq %r14, %rdi
callq 0x7466
cmpl $0x0, 0x50(%rbx)
jle 0x70a9
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 0x7094
leaq 0x5b50(%rip), %r13      # 0xcc00
movq %r13, 0x4e8(%rsp)
movl $0x198, %r14d           # imm = 0x198
leaq 0x360(%rsp), %rdi
leaq (%rdi,%r14), %r15
leaq 0x5b57(%rip), %rbp      # 0xcc28
movq %rbp, 0x4f8(%rsp)
xorl %ebx, %ebx
movq %rbx, 0x4f0(%rsp)
leaq 0x5a7e(%rip), %r12      # 0xcb68
movq %r12, %rsi
callq 0x89fe
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 0x89fe
movq %r14, %rdi
callq 0x30d0
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x714f
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x3270
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x716b
movq 0x28(%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 0x5e52(%rip), %rdi      # 0xcfd8
leaq 0x259b(%rip), %rsi      # 0x9728
movl $0x15, %edx
callq 0x32b0
movq 0x10(%rsp), %rsi
movq 0x5e35(%rip), %rdi      # 0xcfd8
callq 0x3250
movq %rax, %rdi
callq 0x3110
callq 0x3160
movq 0x5e1c(%rip), %rdi      # 0xcfd8
leaq 0x250b(%rip), %rsi      # 0x96ce
movl $0x24, %edx
callq 0x32b0
movq 0x5e04(%rip), %rdi      # 0xcfd8
callq 0x3110
xorl %edi, %edi
callq 0x32d0
movq %rax, %rbx
jmp 0x7240
jmp 0x71e7
movq %rax, %rbx
jmp 0x724d
jmp 0x7230
jmp 0x720e
jmp 0x7230
movq %rax, %rbx
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
jne 0x721b
jmp 0x7233
jmp 0x720e
jmp 0x7230
jmp 0x7230
jmp 0x7230
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %rbp, %rdi
je 0x7233
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3270
jmp 0x7233
jmp 0x7230
jmp 0x7230
jmp 0x7230
movq %rax, %rbx
leaq 0x360(%rsp), %rdi
callq 0x7498
leaq 0xc0(%rsp), %rdi
callq 0x7498
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x726f
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x3270
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x728b
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3270
movq %rbx, %rdi
callq 0x34d0
nop