// File: /workspace/github_c_makefile_star2_O2/OpenGene[P]pecheck/src/fastqreader.cpp
// Function: FastqReader::getLine[abi:cxx11]()
string FastqReader::getLine(){
	int copied = 0;

	int start = mBufUsedLen;
	int end = start;

	while(end < mBufDataLen) {
		if(mBuf[end] != '\r' && mBuf[end] != '\n')
			end++;
		else
			break;
	}

	// this line well contained in this buf, or this is the last buf
	if(end < mBufDataLen || mBufDataLen < FQ_BUF_SIZE) {
		int len = end - start;
		string line(mBuf+start, len);

		// skip \n or \r
		end++;
		// handle \r\n
		if(end < mBufDataLen-1 && mBuf[end] == '\n')
			end++;

		mBufUsedLen = end;

		return line;
	}

	// this line is not contained in this buf, we need to read new buf
	string str(mBuf+start, mBufDataLen - start);

	while(true) {
		readToBuf();
		start = 0;
		end = 0;
		while(end < mBufDataLen) {
			if(mBuf[end] != '\r' && mBuf[end] != '\n')
				end++;
			else
				break;
		}
		// this line well contained in this buf, we need to read new buf
		if(end < mBufDataLen || mBufDataLen < FQ_BUF_SIZE) {
			int len = end - start;
			str.append(mBuf+start, len);

			// skip \n or \r
			end++;
			// handle \r\n
			if(end < mBufDataLen-1 && mBuf[end] == '\n')
				end++;

			mBufUsedLen = end;

			return str;
		}
		// even this new buf is not enough, although impossible
		str.append(mBuf+start, mBufDataLen);
	}

	return string();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movslq 0x44(%rsi), %rax
movslq 0x40(%rsi), %rcx
leal 0x2(%rax), %r15d
movq 0x38(%rsi), %rsi
addq %rax, %rsi
xorl %edx, %edx
leaq (%rax,%rdx), %rdi
cmpq %rcx, %rdi
jge 0x3ab4
movzbl (%rsi,%rdx), %edi
cmpl $0xa, %edi
je 0x3abc
cmpl $0xd, %edi
je 0x3abc
incl %r15d
incq %rdx
jmp 0x3a95
cmpl $0xfffff, %ecx          # imm = 0xFFFFF
jg 0x3b05
movslq %edx, %rdx
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x46c0
leal -0x1(%r15), %eax
movl 0x40(%r14), %ecx
decl %ecx
cmpl %ecx, %eax
jge 0x3af1
movq 0x38(%r14), %rcx
movslq %eax, %rdx
cmpb $0xa, (%rcx,%rdx)
cmovnel %eax, %r15d
movl %r15d, %eax
movl %eax, 0x44(%r14)
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
subl %eax, %ecx
movslq %ecx, %rdx
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
addq %rsi, %rdx
movq %rsp, %r15
movq %r15, %rdi
callq 0x46c0
movq %r14, %rdi
callq 0x3946
movl 0x40(%r14), %edx
movq 0x38(%r14), %rsi
testl %edx, %edx
movl $0x0, %ebp
cmovgl %edx, %ebp
movl %ebp, %eax
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0x3b58
movzbl (%rsi,%rcx), %edi
cmpl $0xa, %edi
je 0x3b6a
cmpl $0xd, %edi
je 0x3b6a
incq %rcx
jmp 0x3b40
cmpl $0x100000, %edx         # imm = 0x100000
jl 0x3b6f
movq %r15, %rdi
callq 0x3070
jmp 0x3b22
movq %rcx, %rax
movl %ecx, %ebp
movq %rsp, %rdi
movq %rax, %rdx
callq 0x3070
movl %ebp, %eax
incq %rax
movl 0x40(%r14), %ecx
decl %ecx
cmpl %ecx, %eax
jge 0x3b99
movq 0x38(%r14), %rcx
addl $0x2, %ebp
cmpb $0xa, (%rcx,%rax)
cmovnel %eax, %ebp
movl %ebp, %eax
movl %eax, 0x44(%r14)
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq (%rsp), %rcx
cmpq %r12, %rcx
je 0x3bbb
movq %rcx, (%rbx)
movq 0x10(%rsp), %rax
movq %rax, 0x10(%rbx)
jmp 0x3bc3
movups (%r12), %xmm0
movups %xmm0, (%rax)
movq %rsp, %rdi
movq 0x8(%rdi), %rax
movq %rax, 0x8(%rbx)
movq %r12, (%rdi)
andq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
callq 0x3568
jmp 0x3af5
jmp 0x3be6
movq %rax, %rbx
movq %rsp, %rdi
callq 0x3568
movq %rbx, %rdi
callq 0x34e0
nop