// File: /workspace/github_cpp_makefile_star2_O3/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, 0x28(%rsp)
leaq 0x40(%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 0x30(%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 0x72ac
movq 0x28(%rsp), %rax
movl $0x0, 0x50(%rax)
leaq 0xa0(%rsp), %rdi
movq %rbx, %rsi
movl $0x8, %edx
callq 0x87ea
movq 0xa0(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0xc0(%rsp,%rax)
jne 0x66b7
leaq 0x228(%rsp), %r14
leaq 0x340(%rsp), %rbp
leaq 0x8(%rsp), %r15
leaq 0x80(%rsp), %rbx
movq 0x228(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %ecx
movl $0x1400, %edx           # imm = 0x1400
movq %r14, %rdi
movq %rbp, %rsi
callq 0x3510
cmpb $0x3e, 0x340(%rsp)
jne 0x62f2
movq 0x28(%rsp), %rax
incl 0x50(%rax)
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %rbp, %rdi
callq 0x3100
leaq (%rsp,%rax), %rdx
addq $0x340, %rdx            # imm = 0x340
movq %r15, %rdi
movq %rbp, %rsi
callq 0x4b96
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 0x61fe
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x3270
cmpb $0x0, 0x4(%rsp)
je 0x6254
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 0x6254
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x3270
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0x6d73(%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 0x10(%rsp), %rdx
cmpq 0x8(%r12), %rdx
jne 0x62be
movq 0x8(%rsp), %r13
testq %rdx, %rdx
je 0x62c8
movq (%r12), %rsi
movq %r13, %rdi
callq 0x3280
testl %eax, %eax
sete %r14b
jmp 0x62cb
movq 0x8(%rsp), %r13
xorl %r14d, %r14d
jmp 0x62cb
movb $0x1, %r14b
leaq 0x18(%rsp), %rax
cmpq %rax, %r13
je 0x62e5
movq 0x18(%rsp), %rsi
incq %rsi
movq %r13, %rdi
callq 0x3270
testb %r14b, %r14b
leaq 0x228(%rsp), %r14
jne 0x630c
movq 0xa0(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0xc0(%rsp,%rax)
je 0x614d
movq 0x28(%rsp), %rax
leaq 0x20(%rax), %rbx
movl $0x1, %esi
movq %rbx, %rdi
callq 0x727c
movq 0x28(%rsp), %rax
leaq 0x8(%rax), %rdi
movl $0x1, %esi
movq %rdi, 0x78(%rsp)
callq 0x727c
leaq 0x30(%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 0x63c7
leaq 0x30(%rsp), %r15
movq %r15, %rdi
movl $0x20, %esi
xorl %edx, %edx
callq 0x3300
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
xorl %edx, %edx
movq %rax, %rcx
callq 0x3290
leaq 0x30(%rsp), %rdi
leaq 0x8(%rsp), %r15
movq %r15, %rsi
callq 0x32e0
movq (%r15), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x63c7
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3270
movq (%rbx), %rbx
leaq 0x8(%rsp), %rdi
leaq 0x30(%rsp), %rsi
movl $0x1, %edx
movq $-0x1, %rcx
callq 0x3290
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x30c0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x6413
movq 0x18(%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 0x30(%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 0x30(%rsp), %rsi
movl %edx, 0x4(%rsp)
movl %ecx, %ebp
callq 0x6776
movq 0x38(%rsp), %r14
testq %r14, %r14
je 0x64b2
movq 0x30(%rsp), %r15
xorl %r12d, %r12d
movsbl (%r15,%r12), %edi
callq 0x3360
movb %al, (%r15,%r12)
incq %r12
cmpq %r12, %r14
jne 0x649c
leaq 0x30(%rsp), %rsi
callq 0x5fac
leaq 0x340(%rsp), %r12
leaq 0x30(%rsp), %r15
movq 0xa0(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0xc0(%rsp,%rax)
jne 0x65f7
movq 0x30(%rsp), %rax
cmpb $0x3e, (%rax)
je 0x65f7
movq 0x60(%rsp), %rdx
leaq 0x58(%rsp), %rdi
xorl %esi, %esi
leaq 0x2c7d(%rip), %rcx      # 0x9181
xorl %r8d, %r8d
callq 0x33f0
movq 0x30(%rsp), %rsi
cmpb $0x3e, (%rsi)
je 0x65db
movq 0xa0(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0xc0(%rsp,%rax)
jne 0x65db
movq 0x38(%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 0x38(%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 0x6776
movq 0x38(%rsp), %r14
testq %r14, %r14
je 0x65c6
movq 0x30(%rsp), %r13
xorl %ebx, %ebx
movsbl (%r13,%rbx), %edi
callq 0x3360
movb %al, (%r13,%rbx)
incq %rbx
cmpq %rbx, %r14
jne 0x65ae
movq %r15, %rsi
callq 0x5fac
leaq 0x228(%rsp), %r13
jmp 0x650c
movq 0x78(%rsp), %rax
movq (%rax), %rdi
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
callq 0x30c0
jmp 0x64c9
leaq 0xa0(%rsp), %rdi
callq 0x89dc
movq 0x28(%rsp), %rdi
addq $0x38, %rdi
movl $0x1, %esi
movq %rdi, %rbx
callq 0x7396
movq 0x78(%rsp), %rax
movq (%rax), %rax
movl 0x8(%rax), %eax
movq (%rbx), %rcx
movl %eax, (%rcx)
leaq 0x65cf(%rip), %rax      # 0xcc00
leaq 0x238(%rsp), %rbx
movq %rax, -0x10(%rbx)
leaq 0x65e4(%rip), %rax      # 0xcc28
movq %rax, (%rbx)
movq $0x0, -0x8(%rbx)
leaq 0x6512(%rip), %rsi      # 0xcb68
leaq 0xa0(%rsp), %rdi
callq 0x891e
movq %rbx, %rdi
callq 0x30d0
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x6687
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x3270
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x66a3
movq 0x40(%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 0x691a(%rip), %rdi      # 0xcfd8
leaq 0x2fc0(%rip), %rsi      # 0x9685
movl $0x15, %edx
callq 0x32b0
movq 0x6902(%rip), %rdi      # 0xcfd8
movq %rbx, %rsi
callq 0x3250
movq %rax, %rdi
callq 0x3110
callq 0x3160
jmp 0x6725
jmp 0x6704
jmp 0x6725
jmp 0x66f3
movq %rax, %rbx
jmp 0x6735
jmp 0x6704
jmp 0x6704
jmp 0x6725
jmp 0x6725
jmp 0x6725
jmp 0x6725
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x6728
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3270
jmp 0x6728
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x73c8
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x6751
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x3270
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x676d
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3270
movq %rbx, %rdi
callq 0x34d0
nop