// File: /workspace/github_cpp_makefile_star2_O2/simonrharris[P]SKA/src/DNA.cpp
// Function: readNextFastaSequence(igzstream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
int readNextFastaSequence(igzstream & gzfileStream, const std::string & filename, std::string & name, std::string & sequence){
	std::string line;
	line.reserve(10000);
	if (gzfileStream.get()!='>'){//check the fist character is a > and remove it
		std::cerr << "Error: " << filename << " is not in the correct format. Expecting header line to start with >." << std::endl << std::endl;
		return 1;
	}
  	std::getline(gzfileStream, line);//read the rest of the headerline
  	std::stringstream headerstream;
	headerstream << line;//convert the sequence to stringstream
	std::getline(headerstream, name, ' ');
  	while (gzfileStream.peek()!=EOF && gzfileStream.peek()!='>'){//read the sequence
  		std::getline(gzfileStream, line);
  		sequence.append(line);
  	}
	if (gzfileStream.fail()){
		std::cerr << filename << " is not in the correct format." << std::endl << std::endl;
		return 1;
	}
	sequence.erase(std::remove_if( sequence.begin(), sequence.end(), ::isspace ), sequence.end() );//remove any gaps from the sequence
	std::transform(sequence.begin(), sequence.end(), sequence.begin(), ::toupper);//change all letters in the string to upper case
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1b0, %rsp            # imm = 0x1B0
movq %rcx, %rbx
movq %rdx, %r13
movq %rsi, %r14
movq %rdi, %r15
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x8(%rsp), %rdi
movl $0x2710, %esi           # imm = 0x2710
callq 0x55f0
leaq 0x188(%r15), %r12
movq %r12, %rdi
callq 0x5490
cmpl $0x3e, %eax
jne 0x686e
leaq 0x8(%rsp), %rsi
movq %r12, %rdi
callq 0x5080
leaq 0x28(%rsp), %rdi
callq 0x52b0
leaq 0x38(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x53a0
leaq 0x28(%rsp), %rdi
pushq $0x20
popq %rdx
movq %r13, %rsi
callq 0x56e0
leaq 0x8(%rsp), %r13
movq %r12, %rdi
callq 0x5140
cmpl $-0x1, %eax
je 0x68b0
movq %r12, %rdi
callq 0x5140
cmpl $0x3e, %eax
je 0x68b0
movq %r12, %rdi
movq %r13, %rsi
callq 0x5080
movq %rbx, %rdi
movq %r13, %rsi
callq 0x5750
jmp 0x683c
movq 0x2f77b(%rip), %rdi     # 0x35ff0
leaq 0x1e7de(%rip), %rsi     # 0x2505a
callq 0x53f0
movq %rax, %rdi
movq %r14, %rsi
callq 0x53a0
leaq 0x1e7cf(%rip), %rsi     # 0x25062
movq %rax, %rdi
callq 0x53f0
movq %rax, %rdi
callq 0x51c0
movq %rax, %rdi
callq 0x51c0
pushq $0x1
popq %rbx
jmp 0x68fa
movq (%r15), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x20(%r15,%rax)
je 0x6917
movq 0x2f72a(%rip), %rdi     # 0x35ff0
movq %r14, %rsi
callq 0x53a0
leaq 0x1e7d3(%rip), %rsi     # 0x250a8
movq %rax, %rdi
callq 0x53f0
movq %rax, %rdi
callq 0x51c0
movq %rax, %rdi
callq 0x51c0
pushq $0x1
popq %rbx
leaq 0x28(%rsp), %rdi
callq 0x5320
leaq 0x8(%rsp), %rdi
callq 0x5778
movl %ebx, %eax
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
addq %rdi, %rsi
movq 0x2f670(%rip), %rdx     # 0x35f98
callq 0x71fd
movq (%rbx), %rdx
addq 0x8(%rbx), %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x50b0
movq (%rbx), %r14
movq 0x8(%rbx), %r15
xorl %ebx, %ebx
xorl %r12d, %r12d
cmpq %r12, %r15
je 0x68f0
movsbl (%r14,%r12), %edi
callq 0x56f0
movb %al, (%r14,%r12)
incq %r12
jmp 0x694b
jmp 0x6970
jmp 0x6970
jmp 0x696b
jmp 0x6970
movq %rax, %rbx
jmp 0x697d
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x5320
leaq 0x8(%rsp), %rdi
callq 0x5778
movq %rbx, %rdi
callq 0x56c0