// File: /workspace/github_cpp_makefile_star2_O2/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, 0xc(%rsp)
movl %r8d, %ebp
movl %ecx, %r14d
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, (%rsp)
leaq 0x20(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
movb %cl, (%rax)
leaq 0x70(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
leaq 0x10(%rsp), %rdi
movl $0x1400, %esi           # imm = 0x1400
callq 0x33d0
leaq 0x60(%rsp), %rdi
movl $0x1400, %esi           # imm = 0x1400
callq 0x33d0
movl %r14d, 0x34(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x63be
movl %ebp, 0x30(%rsp)
movq (%rsp), %rax
andl $0x0, 0x50(%rax)
leaq 0xa0(%rsp), %rdi
pushq $0x8
popq %rdx
movq %rbx, %rsi
callq 0x7748
movq 0xa0(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0xc0(%rsp,%rax)
jne 0x5b60
leaq 0x228(%rsp), %r14
leaq 0x340(%rsp), %rbp
leaq 0x40(%rsp), %r15
leaq 0x80(%rsp), %rbx
testb $0x2, 0xc0(%rsp,%rax)
jne 0x591d
movl $0x1400, %edx           # imm = 0x1400
movq %r14, %rdi
movq %rbp, %rsi
callq 0x30a0
cmpb $0x3e, 0x340(%rsp)
jne 0x590c
movq (%rsp), %rax
incl 0x50(%rax)
movq %r15, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x437a
movq %rbx, %rdi
movq %r15, %rsi
pushq $0x1
popq %rdx
pushq $-0x1
popq %rcx
callq 0x3280
movq %r15, %rdi
movq %rbx, %rsi
callq 0x32b0
movq %rbx, %rdi
callq 0x3110
cmpb $0x0, 0xc(%rsp)
je 0x58da
movq %r15, %rdi
pushq $0x20
popq %rsi
xorl %edx, %edx
callq 0x32e0
movq %rbx, %rdi
movq %r15, %rsi
xorl %edx, %edx
movq %rax, %rcx
callq 0x3280
movq %r15, %rdi
movq %rbx, %rsi
callq 0x32b0
movq %rbx, %rdi
callq 0x3110
movq 0x66f7(%rip), %rdi      # 0xbfd8
movq %r15, %rsi
callq 0x3220
movq %rax, %rdi
callq 0x3120
movq %r15, %rdi
movq %r12, %rsi
callq 0x6467
movl %eax, %r13d
movq %r15, %rdi
callq 0x3110
testb %r13b, %r13b
jne 0x591d
movq 0xa0(%rsp), %rax
movq -0x18(%rax), %rax
jmp 0x583e
movq (%rsp), %rax
leaq 0x20(%rax), %rbx
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x638e
movq (%rsp), %rax
leaq 0x8(%rax), %rdi
pushq $0x1
popq %rsi
movq %rdi, 0x38(%rsp)
callq 0x638e
leaq 0x10(%rsp), %rdi
leaq 0x340(%rsp), %rsi
callq 0x34c0
cmpb $0x0, 0xc(%rsp)
je 0x599c
leaq 0x10(%rsp), %r15
pushq $0x20
popq %rsi
movq %r15, %rdi
xorl %edx, %edx
callq 0x32e0
leaq 0x40(%rsp), %rdi
movq %r15, %rsi
xorl %edx, %edx
movq %rax, %rcx
callq 0x3280
leaq 0x10(%rsp), %rdi
leaq 0x40(%rsp), %r15
movq %r15, %rsi
callq 0x32b0
movq %r15, %rdi
callq 0x3110
movq (%rbx), %rbx
leaq 0x40(%rsp), %rdi
leaq 0x10(%rsp), %rsi
pushq $0x1
popq %rdx
pushq $-0x1
popq %rcx
callq 0x3280
leaq 0x40(%rsp), %rsi
movq %rbx, %rdi
callq 0x34d0
leaq 0x40(%rsp), %rdi
callq 0x3110
leaq 0x340(%rsp), %rsi
movl $0x1400, %edx           # imm = 0x1400
movq %r14, %rdi
callq 0x30a0
leaq 0x10(%rsp), %rdi
leaq 0x340(%rsp), %rsi
callq 0x34c0
movzbl 0x34(%rsp), %r15d
movzbl 0x30(%rsp), %ebp
leaq 0x10(%rsp), %rsi
movl %r15d, %edx
movl %ebp, %ecx
callq 0x5be0
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
addq %rdi, %rsi
movq %rdi, %rdx
callq 0x635f
leaq 0x10(%rsp), %rsi
callq 0x56dc
leaq 0x60(%rsp), %r13
leaq 0x10(%rsp), %r12
leaq 0x340(%rsp), %rbx
movq 0xa0(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0xc0(%rsp,%rax)
jne 0x5afb
movq 0x10(%rsp), %rax
cmpb $0x3e, (%rax)
je 0x5afb
movq %r13, %rdi
leaq 0x26f2(%rip), %rsi      # 0x8161
callq 0x34c0
movq 0x10(%rsp), %rax
cmpb $0x3e, (%rax)
je 0x5ae6
movq 0xa0(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0xc0(%rsp,%rax)
jne 0x5ae6
movq %r13, %rdi
movq %r12, %rsi
callq 0x34d0
movl $0x1400, %edx           # imm = 0x1400
movq %r14, %rdi
movq %rbx, %rsi
callq 0x30a0
movq %r12, %rdi
movq %rbx, %rsi
callq 0x34c0
movq %r12, %rsi
movl %r15d, %edx
movl %ebp, %ecx
callq 0x5be0
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
addq %rdi, %rsi
movq %rdi, %rdx
callq 0x635f
movq %r12, %rsi
callq 0x56dc
jmp 0x5a74
movq 0x38(%rsp), %rax
movq (%rax), %rdi
movq %r13, %rsi
callq 0x34d0
jmp 0x5a3d
leaq 0xa0(%rsp), %rdi
callq 0x7888
movq (%rsp), %rdi
addq $0x38, %rdi
pushq $0x1
popq %rsi
movq %rdi, %rbx
callq 0x6490
movq 0x38(%rsp), %rax
movq (%rax), %rax
movl 0x8(%rax), %eax
movq (%rbx), %rcx
movl %eax, (%rcx)
leaq 0xa0(%rsp), %rdi
callq 0x64c2
leaq 0x60(%rsp), %rdi
callq 0x3110
leaq 0x10(%rsp), %rdi
callq 0x3110
movb $0x1, %al
addq $0x1748, %rsp           # imm = 0x1748
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x6471(%rip), %rdi      # 0xbfd8
leaq 0x2af7(%rip), %rsi      # 0x8665
callq 0x3250
movq %rax, %rdi
movq %rbx, %rsi
callq 0x3250
movq %rax, %rdi
callq 0x3120
callq 0x3170
jmp 0x5bb3
jmp 0x5ba2
jmp 0x5bb3
jmp 0x5b93
movq %rax, %rbx
jmp 0x5bc3
jmp 0x5ba2
jmp 0x5ba2
jmp 0x5bb3
jmp 0x5bb3
jmp 0x5bb3
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x3110
jmp 0x5bb6
jmp 0x5bb3
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x64c2
leaq 0x60(%rsp), %rdi
callq 0x3110
leaq 0x10(%rsp), %rdi
callq 0x3110
movq %rbx, %rdi
callq 0x3470
nop