// File: /workspace/github_c_makefile_star2_O3/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 %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movl 0x40(%rsi), %edx
movl 0x44(%rsi), %ebp
movslq %ebp, %rsi
movl %edx, %ecx
subl %esi, %ecx
jle 0x3c12
movq 0x38(%r14), %rax
leaq (%rax,%rsi), %rdi
movzbl (%rdi), %r8d
cmpl $0xa, %r8d
je 0x3c1e
cmpl $0xd, %r8d
je 0x3c1e
incl %ebp
incq %rdi
cmpl %ebp, %edx
jne 0x3bf7
movl %edx, %ebp
cmpl $0xfffff, %edx          # imm = 0xFFFFF
jg 0x3c66
movq 0x38(%r14), %rax
movl %ebp, %ecx
subl %esi, %ecx
addq %rsi, %rax
movslq %ecx, %rdx
leaq 0x10(%rbx), %rcx
movq %rcx, (%rbx)
addq %rax, %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x4ce4
movslq %ebp, %rax
incq %rax
movl 0x40(%r14), %ecx
decl %ecx
cmpl %ecx, %eax
jge 0x3c5d
movq 0x38(%r14), %rcx
addl $0x2, %ebp
cmpb $0xa, (%rcx,%rax)
cmovnel %eax, %ebp
movl %ebp, %eax
movl %eax, 0x44(%r14)
jmp 0x3d3a
addq 0x38(%r14), %rsi
movslq %ecx, %rdx
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
addq %rsi, %rdx
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x4ce4
movq %r14, %rdi
callq 0x3a6c
movl 0x40(%r14), %edx
testl %edx, %edx
jle 0x3ccb
movq 0x38(%r14), %rsi
xorl %r13d, %r13d
movzbl (%rsi,%r13), %eax
cmpl $0xa, %eax
je 0x3cd4
cmpl $0xd, %eax
je 0x3cd4
incq %r13
cmpq %r13, %rdx
jne 0x3c9e
cmpl $0x100000, %edx         # imm = 0x100000
jl 0x3ccd
movq 0x38(%r14), %rsi
movq %r15, %rdi
callq 0x3080
jmp 0x3c87
xorl %edx, %edx
movq 0x38(%r14), %rsi
movl %edx, %r13d
movl %r13d, %r15d
leaq 0x8(%rsp), %rdi
movq %r15, %rdx
callq 0x3080
incq %r15
movl 0x40(%r14), %eax
decl %eax
cmpl %eax, %r15d
jge 0x3d06
movq 0x38(%r14), %rax
addl $0x2, %r13d
cmpb $0xa, (%rax,%r15)
cmovnel %r15d, %r13d
movl %r13d, %r15d
movl %r15d, 0x44(%r14)
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq 0x8(%rsp), %rcx
cmpq %r12, %rcx
je 0x3d29
movq %rcx, (%rbx)
movq 0x18(%rsp), %rax
movq %rax, 0x10(%rbx)
jmp 0x3d31
movups (%r12), %xmm0
movups %xmm0, (%rax)
movq 0x10(%rsp), %rax
movq %rax, 0x8(%rbx)
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3d4e
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x3d68
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x32d0
movq %rbx, %rdi
callq 0x3500