// File: 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:
subq $0x18f8, %rsp           # imm = 0x18F8
movl %r8d, 0xa0(%rsp)
movl %ecx, %eax
movl 0xa0(%rsp), %ecx
movl %eax, 0xa4(%rsp)
movq %rdx, %rax
movl 0xa4(%rsp), %edx
movq %rax, 0xa8(%rsp)
movq %rsi, %rax
movq 0xa8(%rsp), %rsi
movq %rax, 0xb0(%rsp)
movq %rdi, %r8
movq 0xb0(%rsp), %rdi
movb %r9b, %al
movq %r8, 0x18f0(%rsp)
movq %rdi, 0x18e8(%rsp)
movq %rsi, 0x18e0(%rsp)
andb $0x1, %dl
movb %dl, 0x18df(%rsp)
andb $0x1, %cl
movb %cl, 0x18de(%rsp)
andb $0x1, %al
movb %al, 0x18dd(%rsp)
movq 0x18f0(%rsp), %rax
movq %rax, 0xb8(%rsp)
movb $0x1, 0x18dc(%rsp)
movl $0x1400, 0x4cc(%rsp) # imm = 0x1400
leaq 0x4a8(%rsp), %rdi
movq %rdi, 0xc0(%rsp)
callq 0x4450
leaq 0x488(%rsp), %rdi
callq 0x4450
movq 0xc0(%rsp), %rdi
movslq 0x4cc(%rsp), %rsi
callq 0x4530
jmp 0xc083
movslq 0x4cc(%rsp), %rsi
leaq 0x488(%rsp), %rdi
callq 0x4530
jmp 0xc09a
leaq 0x1d8(%rsp), %rdi
callq 0xd8c0
jmp 0xc0a9
movq 0xb8(%rsp), %rax
movl $0x0, 0x50(%rax)
movq 0x18e8(%rsp), %rsi
leaq 0x1d8(%rsp), %rdi
movl $0x8, %edx
callq 0xd9d0
jmp 0xc0d4
movq 0x1d8(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0x1d8(%rsp,%rax), %rdi
callq 0x45b0
movb %al, 0x9f(%rsp)
jmp 0xc0f6
movb 0x9f(%rsp), %al
testb $0x1, %al
jne 0xc106
jmp 0xc82d
jmp 0xc108
movq 0x1d8(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0x1d8(%rsp,%rax), %rdi
callq 0x4660
movb %al, 0x9e(%rsp)
jmp 0xc12a
movb 0x9e(%rsp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0xc13c
jmp 0xc392
leaq 0x360(%rsp), %rdi
movslq 0x4cc(%rsp), %rdx
leaq 0x4d0(%rsp), %rsi
callq 0x40f0
jmp 0xc15b
movsbl 0x4d0(%rsp), %eax
cmpl $0x3e, %eax
jne 0xc38d
movq 0xb8(%rsp), %rax
movl 0x50(%rax), %ecx
incl %ecx
movl %ecx, 0x50(%rax)
leaq 0x1b7(%rsp), %rdi
movq %rdi, 0x90(%rsp)
callq 0x4610
movq 0x90(%rsp), %rdx
leaq 0x1b8(%rsp), %rdi
leaq 0x4d0(%rsp), %rsi
callq 0x6300
jmp 0xc1b0
leaq 0x1b7(%rsp), %rdi
callq 0x4380
leaq 0x190(%rsp), %rdi
leaq 0x1b8(%rsp), %rsi
movl $0x1, %edx
movq $-0x1, %rcx
callq 0x4350
jmp 0xc1e0
leaq 0x1b8(%rsp), %rdi
leaq 0x190(%rsp), %rsi
callq 0x43d0
leaq 0x190(%rsp), %rdi
callq 0x4220
movb 0x18dd(%rsp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0xc30e
xorl %eax, %eax
movl %eax, %edx
movq %rdx, 0x88(%rsp)
leaq 0x1b8(%rsp), %rdi
movq %rdi, 0x80(%rsp)
movl $0x20, %esi
callq 0x4410
movq 0x80(%rsp), %rsi
movq 0x88(%rsp), %rdx
movq %rax, 0x188(%rsp)
movq 0x188(%rsp), %rcx
leaq 0x168(%rsp), %rdi
callq 0x4350
jmp 0xc26c
leaq 0x1b8(%rsp), %rdi
leaq 0x168(%rsp), %rsi
callq 0x43d0
leaq 0x168(%rsp), %rdi
callq 0x4220
jmp 0xc30e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x480(%rsp)
movl %eax, 0x47c(%rsp)
jmp 0xc8d0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x480(%rsp)
movl %eax, 0x47c(%rsp)
jmp 0xc8c3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x480(%rsp)
movl %eax, 0x47c(%rsp)
leaq 0x1b7(%rsp), %rdi
callq 0x4380
jmp 0xc8c3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x480(%rsp)
movl %eax, 0x47c(%rsp)
leaq 0x1b8(%rsp), %rdi
callq 0x4220
jmp 0xc8c3
movq 0xacc3(%rip), %rdi      # 0x16fd8
leaq 0x1b8(%rsp), %rsi
callq 0x42f0
movq %rax, 0x78(%rsp)
jmp 0xc329
movq 0x78(%rsp), %rdi
movq 0xac93(%rip), %rsi      # 0x16fc8
callq 0x4360
jmp 0xc33c
movq 0x18e0(%rsp), %rsi
leaq 0x1b8(%rsp), %rdi
callq 0xda00
testb $0x1, %al
jne 0xc357
jmp 0xc364
movl $0x3, 0x164(%rsp)
jmp 0xc36f
movl $0x0, 0x164(%rsp)
leaq 0x1b8(%rsp), %rdi
callq 0x4220
movl 0x164(%rsp), %eax
testl %eax, %eax
je 0xc38b
jmp 0xc389
jmp 0xc392
jmp 0xc38d
jmp 0xc108
movq 0xb8(%rsp), %rdi
addq $0x20, %rdi
movl $0x1, %esi
callq 0xd7c0
jmp 0xc3aa
movq 0xb8(%rsp), %rdi
addq $0x8, %rdi
movl $0x1, %esi
callq 0xd7c0
jmp 0xc3c2
leaq 0x4a8(%rsp), %rdi
leaq 0x4d0(%rsp), %rsi
callq 0x4430
jmp 0xc3d9
movb 0x18dd(%rsp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0xc455
xorl %eax, %eax
movl %eax, %edx
movq %rdx, 0x70(%rsp)
leaq 0x4a8(%rsp), %rdi
movq %rdi, 0x68(%rsp)
movl $0x20, %esi
callq 0x4410
movq 0x68(%rsp), %rsi
movq 0x70(%rsp), %rdx
movq %rax, 0x158(%rsp)
movq 0x158(%rsp), %rcx
leaq 0x138(%rsp), %rdi
callq 0x4350
jmp 0xc433
leaq 0x4a8(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0x43d0
leaq 0x138(%rsp), %rdi
callq 0x4220
movq 0xb8(%rsp), %rdi
addq $0x20, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x6460
movq %rax, 0x60(%rsp)
leaq 0x118(%rsp), %rdi
leaq 0x4a8(%rsp), %rsi
movl $0x1, %edx
movq $-0x1, %rcx
callq 0x4350
jmp 0xc492
movq 0x60(%rsp), %rdi
leaq 0x118(%rsp), %rsi
callq 0x4680
jmp 0xc4a6
leaq 0x118(%rsp), %rdi
callq 0x4220
leaq 0x360(%rsp), %rdi
movslq 0x4cc(%rsp), %rdx
leaq 0x4d0(%rsp), %rsi
callq 0x40f0
jmp 0xc4d2
leaq 0x4a8(%rsp), %rdi
leaq 0x4d0(%rsp), %rsi
callq 0x4430
jmp 0xc4e9
movq 0xb8(%rsp), %rdi
movzbl 0x18de(%rsp), %ecx
movzbl 0x18df(%rsp), %edx
andl $0x1, %edx
andl $0x1, %ecx
leaq 0x4a8(%rsp), %rsi
callq 0xc900
jmp 0xc516
leaq 0x4a8(%rsp), %rdi
movq %rdi, 0x50(%rsp)
callq 0x42c0
movq 0x50(%rsp), %rdi
movq %rax, 0x110(%rsp)
callq 0x41f0
movq 0x50(%rsp), %rdi
movq %rax, 0x108(%rsp)
callq 0x42c0
movq %rax, 0x100(%rsp)
movq 0x110(%rsp), %rdi
movq 0x108(%rsp), %rsi
movq 0x100(%rsp), %rdx
callq 0xd740
movq %rax, 0x58(%rsp)
jmp 0xc578
movq 0xb8(%rsp), %rdi
movq 0x58(%rsp), %rax
movq %rax, 0xf0(%rsp)
leaq 0x4a8(%rsp), %rsi
callq 0xbea0
jmp 0xc59c
jmp 0xc59e
movq 0x1d8(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0x1d8(%rsp,%rax), %rdi
callq 0x4660
movb %al, 0x4f(%rsp)
jmp 0xc5bd
movb 0x4f(%rsp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0xc5cc
jmp 0xc7c8
xorl %eax, %eax
movl %eax, %esi
leaq 0x4a8(%rsp), %rdi
callq 0x46b0
movq %rax, 0x40(%rsp)
jmp 0xc5e4
movq 0x40(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x3e, %eax
jne 0xc61c
jmp 0xc7c8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x480(%rsp)
movl %eax, 0x47c(%rsp)
leaq 0x118(%rsp), %rdi
callq 0x4220
jmp 0xc8c3
leaq 0x4b28(%rip), %rsi      # 0x1114b
leaq 0x488(%rsp), %rdi
callq 0x4430
jmp 0xc632
jmp 0xc634
xorl %eax, %eax
movl %eax, %esi
leaq 0x4a8(%rsp), %rdi
callq 0x46b0
movq %rax, 0x38(%rsp)
jmp 0xc64c
movq 0x38(%rsp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x3e, %ecx
movb %al, 0x37(%rsp)
je 0xc688
movq 0x1d8(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0x1d8(%rsp,%rax), %rdi
callq 0x4660
movb %al, 0x36(%rsp)
jmp 0xc67e
movb 0x36(%rsp), %al
xorb $-0x1, %al
movb %al, 0x37(%rsp)
movb 0x37(%rsp), %al
testb $0x1, %al
jne 0xc695
jmp 0xc79a
leaq 0x488(%rsp), %rdi
leaq 0x4a8(%rsp), %rsi
callq 0x4680
jmp 0xc6ac
leaq 0x360(%rsp), %rdi
movslq 0x4cc(%rsp), %rdx
leaq 0x4d0(%rsp), %rsi
callq 0x40f0
jmp 0xc6cb
leaq 0x4a8(%rsp), %rdi
leaq 0x4d0(%rsp), %rsi
callq 0x4430
jmp 0xc6e2
movq 0xb8(%rsp), %rdi
movzbl 0x18de(%rsp), %ecx
movzbl 0x18df(%rsp), %edx
andl $0x1, %edx
andl $0x1, %ecx
leaq 0x4a8(%rsp), %rsi
callq 0xc900
jmp 0xc70f
leaq 0x4a8(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x42c0
movq 0x20(%rsp), %rdi
movq %rax, 0xe8(%rsp)
callq 0x41f0
movq 0x20(%rsp), %rdi
movq %rax, 0xe0(%rsp)
callq 0x42c0
movq %rax, 0xd8(%rsp)
movq 0xe8(%rsp), %rdi
movq 0xe0(%rsp), %rsi
movq 0xd8(%rsp), %rdx
callq 0xd740
movq %rax, 0x28(%rsp)
jmp 0xc771
movq 0xb8(%rsp), %rdi
movq 0x28(%rsp), %rax
movq %rax, 0xc8(%rsp)
leaq 0x4a8(%rsp), %rsi
callq 0xbea0
jmp 0xc795
jmp 0xc634
movq 0xb8(%rsp), %rdi
addq $0x8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x6460
movq %rax, %rdi
leaq 0x488(%rsp), %rsi
callq 0x4680
jmp 0xc7c1
jmp 0xc7c3
jmp 0xc59e
leaq 0x1d8(%rsp), %rdi
callq 0x10a60
jmp 0xc7d7
movq 0xb8(%rsp), %rdi
addq $0x38, %rdi
movl $0x1, %esi
callq 0xdaa0
jmp 0xc7ef
movq 0xb8(%rsp), %rdi
addq $0x8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x6460
movq %rax, %rdi
callq 0x4500
movq 0xb8(%rsp), %rdi
movl %eax, 0x1c(%rsp)
addq $0x38, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xdb40
movl 0x1c(%rsp), %ecx
movl %ecx, (%rax)
jmp 0xc878
movq 0xa7a4(%rip), %rdi      # 0x16fd8
leaq 0x4ff4(%rip), %rsi      # 0x1182f
callq 0x4320
movq %rax, 0x10(%rsp)
jmp 0xc847
movq 0x10(%rsp), %rdi
movq 0x18e8(%rsp), %rsi
callq 0x4320
movq %rax, 0x8(%rsp)
jmp 0xc860
movq 0x8(%rsp), %rdi
movq 0xa75c(%rip), %rsi      # 0x16fc8
callq 0x4360
jmp 0xc873
callq 0x41c0
movb 0x18dc(%rsp), %al
movb %al, 0x7(%rsp)
movl $0x1, 0x164(%rsp)
leaq 0x1d8(%rsp), %rdi
callq 0xdb60
leaq 0x488(%rsp), %rdi
callq 0x4220
leaq 0x4a8(%rsp), %rdi
callq 0x4220
movb 0x7(%rsp), %al
andb $0x1, %al
addq $0x18f8, %rsp           # imm = 0x18F8
retq
leaq 0x1d8(%rsp), %rdi
callq 0xdb60
leaq 0x488(%rsp), %rdi
callq 0x4220
leaq 0x4a8(%rsp), %rdi
callq 0x4220
movq 0x480(%rsp), %rdi
callq 0x4600
nopw (%rax,%rax)