// File: simonrharris[P]SKA/src/DNA.cpp
// Function: readNextFastqSequence(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 readNextFastqSequence(igzstream & gzfileStream, const std::string & filename, std::string & sequence, std::string & quality){
	std::string line;
	line.reserve(1000);
	if (gzfileStream.peek()!='@'){
		std::cerr << "Error: " << filename << " is not in the correct format. Expecting header line to start with @." << std::endl << std::endl;
		return 1;
	}
  	getline(gzfileStream, line);
  	getline(gzfileStream, sequence);
  	if (gzfileStream.peek()!='+'){
		std::cerr << "Error: " << filename << " is not in the correct format. Expecting separator line to start with +." << std::endl << std::endl;
		return 1;
	}
  	getline(gzfileStream, line);
  	getline(gzfileStream, quality);
  	if (quality.length()!=sequence.length()){
  		std::cerr << "Error: " << filename << " is not in the correct format. Sequence and quality lines must be of equal length." << std::endl << std::endl;
		return 1;
  	}
	if (gzfileStream.fail()){
		std::cerr << "Error: " << filename << " is not in the correct format. Expecting a multiple of 4 lines." << std::endl << std::endl;
		return 1;
	}
	std::transform(sequence.begin(), sequence.end(), sequence.begin(), ::toupper);//change all letters in the string to upper case	
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
leaq -0x48(%rbp), %rdi
movq %rdi, -0x80(%rbp)
callq 0x6730
movq -0x80(%rbp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x6810
jmp 0x88f8
movq -0x10(%rbp), %rdi
addq $0x188, %rdi            # imm = 0x188
callq 0x61c0
movl %eax, -0x84(%rbp)
jmp 0x8910
movl -0x84(%rbp), %eax
cmpl $0x40, %eax
je 0x89ce
movq 0x706ca(%rip), %rdi     # 0x78ff0
leaq 0x5073d(%rip), %rsi     # 0x5906a
callq 0x6520
movq %rax, -0x90(%rbp)
jmp 0x893b
movq -0x90(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x64d0
movq %rax, -0x98(%rbp)
jmp 0x8954
movq -0x98(%rbp), %rdi
leaq 0x50775(%rip), %rsi     # 0x590d7
callq 0x6520
movq %rax, -0xa0(%rbp)
jmp 0x8970
movq -0xa0(%rbp), %rdi
movq 0x70612(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0xa8(%rbp)
jmp 0x898c
movq -0xa8(%rbp), %rdi
movq 0x705f6(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x89a1
movl $0x1, -0x4(%rbp)
movl $0x1, -0x58(%rbp)
jmp 0x8cc0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x6a08
jmp 0x8cd5
movq -0x10(%rbp), %rdi
addq $0x188, %rdi            # imm = 0x188
leaq -0x48(%rbp), %rsi
callq 0x60d0
jmp 0x89e4
movq -0x10(%rbp), %rdi
addq $0x188, %rdi            # imm = 0x188
movq -0x20(%rbp), %rsi
callq 0x60d0
jmp 0x89fa
movq -0x10(%rbp), %rdi
addq $0x188, %rdi            # imm = 0x188
callq 0x61c0
movl %eax, -0xac(%rbp)
jmp 0x8a12
movl -0xac(%rbp), %eax
cmpl $0x2b, %eax
je 0x8ab6
movq 0x705c8(%rip), %rdi     # 0x78ff0
leaq 0x5063b(%rip), %rsi     # 0x5906a
callq 0x6520
movq %rax, -0xb8(%rbp)
jmp 0x8a3d
movq -0xb8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x64d0
movq %rax, -0xc0(%rbp)
jmp 0x8a56
movq -0xc0(%rbp), %rdi
leaq 0x506b9(%rip), %rsi     # 0x5911d
callq 0x6520
movq %rax, -0xc8(%rbp)
jmp 0x8a72
movq -0xc8(%rbp), %rdi
movq 0x70510(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0xd0(%rbp)
jmp 0x8a8e
movq -0xd0(%rbp), %rdi
movq 0x704f4(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x8aa3
movl $0x1, -0x4(%rbp)
movl $0x1, -0x58(%rbp)
jmp 0x8cc0
movq -0x10(%rbp), %rdi
addq $0x188, %rdi            # imm = 0x188
leaq -0x48(%rbp), %rsi
callq 0x60d0
jmp 0x8acc
movq -0x10(%rbp), %rdi
addq $0x188, %rdi            # imm = 0x188
movq -0x28(%rbp), %rsi
callq 0x60d0
jmp 0x8ae2
movq -0x28(%rbp), %rdi
callq 0x67e0
movq %rax, -0xd8(%rbp)
movq -0x20(%rbp), %rdi
callq 0x67e0
movq %rax, %rcx
movq -0xd8(%rbp), %rax
cmpq %rcx, %rax
je 0x8ba3
movq 0x704db(%rip), %rdi     # 0x78ff0
leaq 0x5054e(%rip), %rsi     # 0x5906a
callq 0x6520
movq %rax, -0xe0(%rbp)
jmp 0x8b2a
movq -0xe0(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x64d0
movq %rax, -0xe8(%rbp)
jmp 0x8b43
movq -0xe8(%rbp), %rdi
leaq 0x50615(%rip), %rsi     # 0x59166
callq 0x6520
movq %rax, -0xf0(%rbp)
jmp 0x8b5f
movq -0xf0(%rbp), %rdi
movq 0x70423(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0xf8(%rbp)
jmp 0x8b7b
movq -0xf8(%rbp), %rdi
movq 0x70407(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x8b90
movl $0x1, -0x4(%rbp)
movl $0x1, -0x58(%rbp)
jmp 0x8cc0
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x6030
movb %al, -0xf9(%rbp)
jmp 0x8bbe
movb -0xf9(%rbp), %al
testb $0x1, %al
jne 0x8bcd
jmp 0x8c5f
movq 0x7041c(%rip), %rdi     # 0x78ff0
leaq 0x5048f(%rip), %rsi     # 0x5906a
callq 0x6520
movq %rax, -0x108(%rbp)
jmp 0x8be9
movq -0x108(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x64d0
movq %rax, -0x110(%rbp)
jmp 0x8c02
movq -0x110(%rbp), %rdi
leaq 0x505a9(%rip), %rsi     # 0x591b9
callq 0x6520
movq %rax, -0x118(%rbp)
jmp 0x8c1e
movq -0x118(%rbp), %rdi
movq 0x70364(%rip), %rsi     # 0x78f90
callq 0x6570
movq %rax, -0x120(%rbp)
jmp 0x8c3a
movq -0x120(%rbp), %rdi
movq 0x70348(%rip), %rsi     # 0x78f90
callq 0x6570
jmp 0x8c4f
movl $0x1, -0x4(%rbp)
movl $0x1, -0x58(%rbp)
jmp 0x8cc0
movq -0x20(%rbp), %rdi
callq 0x64a0
movq %rax, -0x60(%rbp)
movq -0x20(%rbp), %rdi
callq 0x62e0
movq %rax, -0x68(%rbp)
movq -0x20(%rbp), %rdi
callq 0x64a0
movq %rax, -0x70(%rbp)
movq -0x60(%rbp), %rdi
movq -0x68(%rbp), %rsi
movq -0x70(%rbp), %rdx
movq 0x7033f(%rip), %rcx     # 0x78fd8
callq 0x9250
movq %rax, -0x128(%rbp)
jmp 0x8ca7
movq -0x128(%rbp), %rax
movq %rax, -0x78(%rbp)
movl $0x0, -0x4(%rbp)
movl $0x1, -0x58(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x6a08
movl -0x4(%rbp), %eax
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x6900
nop