// File: /workspace/github_cpp_makefile_star2_O1/auton1[P]motiflocation/DNA.cpp
// Function: DNA::readFASTA(char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, bool, bool, bool)
bool DNA::readFASTA(const char* filename, const string &header_name, bool uppercase_only, bool lowercase_only, bool KG_ref=false)
{
	bool output = true;
	char buffer[5120];
	int bufsize = 5120;
	string junk, junk2;
	junk.reserve(bufsize);
	junk2.reserve(bufsize);
	igzstream in;

	NSeqs = 0;
	in.open(filename, ios::in);
	if (in.good())
	{
		while(!in.eof())
		{
			in.getline(buffer, bufsize);
			if (buffer[0] == '>')
			{
				NSeqs++;
				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;
				if (s == header_name)
					break;
			}
		}
		header.resize(1);
		sequence.resize(1);

		junk = buffer;
		if (KG_ref == true)
		{
			string::size_type pos=junk.find(' ',0);
			junk = junk.substr(0,pos);
		}
		header[0].append(junk.substr(1));

		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);
		while(!in.eof())
		{
			if (junk[0] == '>')
			{
				break;
			}
			else
			{
				junk2 = "";
				while ((junk[0] != '>') && (!in.eof()))
				{
					junk2.append(junk);
					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);
				}
				sequence[0].append(junk2);
			}
		}
		in.close();

		SeqLength.resize(1);
		SeqLength[0] = (unsigned int)(sequence[0].length());
	}
	else
	{
		cout << "Unable to read file: " << filename << endl;
		abort();
	}

	return output;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1748, %rsp           # imm = 0x1748
movl %r9d, 0x4(%rsp)
movl %r8d, %ebp
movl %ecx, %r14d
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, 0x8(%rsp)
leaq 0x20(%rsp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x68(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x10(%rsp), %rdi
movl $0x1400, %esi           # imm = 0x1400
callq 0x3410
leaq 0x58(%rsp), %rdi
movl $0x1400, %esi           # imm = 0x1400
callq 0x3410
movl %r14d, 0x50(%rsp)
movl %ebp, 0x54(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x737c
movq 0x8(%rsp), %rax
movl $0x0, 0x50(%rax)
leaq 0xa0(%rsp), %rdi
movq %rbx, %rsi
movl $0x8, %edx
callq 0x88ca
movq 0xa0(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0xc0(%rsp,%rax)
jne 0x6738
leaq 0x228(%rsp), %r13
movq -0x188(%r13), %rax
movq -0x18(%rax), %rax
testb $0x2, 0xc0(%rsp,%rax)
jne 0x638e
leaq 0x40(%rsp), %r14
leaq 0x340(%rsp), %rbp
leaq 0x30(%rsp), %r15
leaq 0x80(%rsp), %rbx
movq 0x228(%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
movq %rbp, %rsi
callq 0x3510
cmpb $0x3e, 0x340(%rsp)
jne 0x6374
movq 0x8(%rsp), %rax
incl 0x50(%rax)
movq %r14, 0x30(%rsp)
movq %rbp, %rdi
callq 0x3100
leaq (%rsp,%rax), %rdx
addq $0x340, %rdx            # imm = 0x340
movq %r15, %rdi
movq %rbp, %rsi
callq 0x4bac
movl $0x1, %edx
movq %rbx, %rdi
movq %r15, %rsi
movq $-0x1, %rcx
callq 0x3290
movq %r15, %rdi
movq %rbx, %rsi
callq 0x32e0
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x628b
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x3270
cmpb $0x0, 0x4(%rsp)
je 0x62e1
movq %r15, %rdi
movl $0x20, %esi
xorl %edx, %edx
callq 0x3300
movq %rbx, %rdi
movq %r15, %rsi
xorl %edx, %edx
movq %rax, %rcx
callq 0x3290
movq %r15, %rdi
movq %rbx, %rsi
callq 0x32e0
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x62e1
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x3270
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq 0x6ce6(%rip), %rdi      # 0xcfd8
callq 0x32b0
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
movq 0x38(%rsp), %rdx
cmpq 0x8(%r12), %rdx
jne 0x6348
testq %rdx, %rdx
je 0x634d
movq (%r12), %rsi
movq 0x30(%rsp), %rdi
callq 0x3280
testl %eax, %eax
sete %r13b
jmp 0x6350
xorl %r13d, %r13d
jmp 0x6350
movb $0x1, %r13b
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0x6367
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3270
testb %r13b, %r13b
leaq 0x228(%rsp), %r13
jne 0x638e
movq 0xa0(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0xc0(%rsp,%rax)
je 0x61df
movq 0x8(%rsp), %rax
leaq 0x20(%rax), %rbx
movl $0x1, %esi
movq %rbx, %rdi
callq 0x734c
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rdi
movl $0x1, %esi
movq %rdi, 0x78(%rsp)
callq 0x734c
leaq 0x10(%rsp), %r15
movq 0x8(%r15), %r12
leaq 0x340(%rsp), %r13
movq %r13, %rdi
callq 0x3100
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
movq %r13, %rcx
leaq 0x228(%rsp), %r13
movq %rax, %r8
callq 0x33f0
cmpb $0x0, 0x4(%rsp)
je 0x6449
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movl $0x20, %esi
xorl %edx, %edx
callq 0x3300
leaq 0x30(%rsp), %rdi
movq %r15, %rsi
xorl %edx, %edx
movq %rax, %rcx
callq 0x3290
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %r15
movq %r15, %rsi
callq 0x32e0
movq (%r15), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x6449
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3270
movq (%rbx), %rbx
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
movl $0x1, %edx
movq $-0x1, %rcx
callq 0x3290
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq %rbx, %rdi
callq 0x30c0
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6494
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3270
movq 0x228(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %ecx
leaq 0x340(%rsp), %rsi
movl $0x1400, %edx           # imm = 0x1400
movq %r13, %rdi
callq 0x3510
leaq 0x10(%rsp), %rbx
movq 0x8(%rbx), %r15
leaq 0x340(%rsp), %r12
movq %r12, %rdi
callq 0x3100
movq %rbx, %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %r12, %rcx
movq %rax, %r8
callq 0x33f0
movzbl 0x50(%rsp), %edx
movzbl 0x54(%rsp), %ecx
leaq 0x10(%rsp), %rsi
movl %edx, 0x4(%rsp)
movl %ecx, %ebp
callq 0x6802
movq 0x18(%rsp), %r14
testq %r14, %r14
je 0x6533
movq 0x10(%rsp), %r15
xorl %r12d, %r12d
movsbl (%r15,%r12), %edi
callq 0x3360
movb %al, (%r15,%r12)
incq %r12
cmpq %r12, %r14
jne 0x651d
leaq 0x10(%rsp), %rsi
callq 0x6020
leaq 0x340(%rsp), %r12
leaq 0x10(%rsp), %r15
movq 0xa0(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0xc0(%rsp,%rax)
jne 0x6678
movq 0x10(%rsp), %rax
cmpb $0x3e, (%rax)
je 0x6678
movq 0x60(%rsp), %rdx
leaq 0x58(%rsp), %rdi
xorl %esi, %esi
leaq 0x2c02(%rip), %rcx      # 0x9187
xorl %r8d, %r8d
callq 0x33f0
movq 0x10(%rsp), %rsi
cmpb $0x3e, (%rsi)
je 0x665c
movq 0xa0(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0xc0(%rsp,%rax)
jne 0x665c
movq 0x18(%rsp), %rdx
leaq 0x58(%rsp), %rdi
callq 0x30c0
movq 0x228(%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
movq %r12, %rsi
callq 0x3510
movq 0x18(%rsp), %r14
movq %r12, %rdi
callq 0x3100
movq %r15, %rdi
xorl %esi, %esi
movq %r14, %rdx
movq %r12, %rcx
movq %rax, %r8
callq 0x33f0
movq %r15, %rsi
movl 0x4(%rsp), %edx
movl %ebp, %ecx
callq 0x6802
movq 0x18(%rsp), %r14
testq %r14, %r14
je 0x6647
movq 0x10(%rsp), %r13
xorl %ebx, %ebx
movsbl (%r13,%rbx), %edi
callq 0x3360
movb %al, (%r13,%rbx)
incq %rbx
cmpq %rbx, %r14
jne 0x662f
movq %r15, %rsi
callq 0x6020
leaq 0x228(%rsp), %r13
jmp 0x658d
movq 0x78(%rsp), %rax
movq (%rax), %rdi
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
callq 0x30c0
jmp 0x654a
leaq 0xa0(%rsp), %rdi
callq 0x8abc
movq 0x8(%rsp), %rdi
addq $0x38, %rdi
movl $0x1, %esi
movq %rdi, %rbx
callq 0x7466
movq 0x78(%rsp), %rax
movq (%rax), %rax
movl 0x8(%rax), %eax
movq (%rbx), %rcx
movl %eax, (%rcx)
leaq 0x654e(%rip), %rax      # 0xcc00
leaq 0x238(%rsp), %rbx
movq %rax, -0x10(%rbx)
leaq 0x6563(%rip), %rax      # 0xcc28
movq %rax, (%rbx)
movq $0x0, -0x8(%rbx)
leaq 0x6491(%rip), %rsi      # 0xcb68
leaq 0xa0(%rsp), %rdi
callq 0x89fe
movq %rbx, %rdi
callq 0x30d0
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x6708
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x3270
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x6724
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3270
movb $0x1, %al
addq $0x1748, %rsp           # imm = 0x1748
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x6899(%rip), %rdi      # 0xcfd8
leaq 0x2f67(%rip), %rsi      # 0x96ad
movl $0x15, %edx
callq 0x32b0
movq 0x6881(%rip), %rdi      # 0xcfd8
movq %rbx, %rsi
callq 0x3250
movq %rax, %rdi
callq 0x3110
callq 0x3160
jmp 0x67b2
movq %rax, %rbx
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x67a1
jmp 0x67b5
jmp 0x67b2
jmp 0x6785
movq %rax, %rbx
jmp 0x67c2
jmp 0x6794
jmp 0x6794
jmp 0x67b2
jmp 0x67b2
jmp 0x67b2
movq %rax, %rbx
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0x67b5
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3270
jmp 0x67b5
jmp 0x67b2
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x7498
leaq 0x68(%rsp), %rax
movq 0x58(%rsp), %rdi
cmpq %rax, %rdi
je 0x67de
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x3270
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x67fa
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3270
movq %rbx, %rdi
callq 0x34d0