// File: /workspace/github_c_makefile_star2_O1/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), %eax
movslq %eax, %rsi
movl %edx, %ecx
subl %esi, %ecx
setg %dil
jle 0x3c54
movslq %edx, %r8
movq 0x38(%r14), %r9
leaq 0x1(%rsi), %r10
movl %eax, %ebp
movzbl -0x1(%r9,%r10), %r11d
cmpl $0xa, %r11d
je 0x3c56
cmpl $0xd, %r11d
je 0x3c56
cmpq %r8, %r10
setl %dil
incl %ebp
incq %r10
cmpl %ebp, %edx
jne 0x3c2e
movl %edx, %ebp
jmp 0x3c56
movl %eax, %ebp
cmpl $0x100000, %edx         # imm = 0x100000
setge %dl
notb %dil
testb %dl, %dil
jne 0x3cad
movl %ebp, %ecx
subl %eax, %ecx
addq 0x38(%r14), %rsi
movslq %ecx, %rdx
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x4e10
movslq %ebp, %rax
incq %rax
movl 0x40(%r14), %ecx
decl %ecx
cmpl %ecx, %eax
jge 0x3ca4
movq 0x38(%r14), %rcx
addl $0x2, %ebp
cmpb $0xa, (%rcx,%rax)
cmovnel %eax, %ebp
movl %ebp, %eax
movl %eax, 0x44(%r14)
jmp 0x3d8d
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 0x4e10
movq %r14, %rdi
callq 0x3a9a
movl 0x40(%r14), %edx
testl %edx, %edx
setg %al
jle 0x3d0a
movq 0x38(%r14), %rcx
xorl %r13d, %r13d
movzbl (%rcx,%r13), %esi
cmpl $0xa, %esi
je 0x3d0d
cmpl $0xd, %esi
je 0x3d0d
incq %r13
cmpq %rdx, %r13
setb %al
cmpq %r13, %rdx
jne 0x3ce8
movl %edx, %r13d
jmp 0x3d0d
xorl %r13d, %r13d
movq 0x38(%r14), %rsi
testb $0x1, %al
jne 0x3d27
cmpl $0xfffff, %edx          # imm = 0xFFFFF
jle 0x3d27
movq %r15, %rdi
callq 0x3080
jmp 0x3cce
movl %r13d, %r15d
leaq 0x8(%rsp), %rdi
movq %r15, %rdx
callq 0x3080
incq %r15
movl 0x40(%r14), %eax
decl %eax
cmpl %eax, %r15d
jge 0x3d59
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 0x3d7c
movq %rcx, (%rbx)
movq 0x18(%rsp), %rax
movq %rax, 0x10(%rbx)
jmp 0x3d84
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 0x3da1
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x3dbb
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x32e0
movq %rbx, %rdi
callq 0x3510
nop