// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/classes/io/instream.cpp
// Function: smooth::IO::InStream::ReadData()
S::Bool S::IO::InStream::ReadData()
{
	if (streamType == STREAM_NONE) { lastError = IO_ERROR_NOTOPEN; return False; }

	if (streamType != STREAM_DRIVER) return True;

	/* Loop until we have some data.
	 */
	Int	 decsize = 0;

	do
	{
		packageSize    = stdpacksize;
		size	       = origsize;
		currentFilePos = origfilepos;

		if (filter == NIL)
		{
			/* Read unfiltered data.
			 */
			driver->Seek(currentFilePos);

			if (size != -1)	dataBuffer.Resize(packageSize < size - currentFilePos ? packageSize : size - currentFilePos);
			else		dataBuffer.Resize(packageSize);

			decsize = driver->ReadData(dataBuffer, dataBuffer.Size());
		}
		else
		{
			/* Read filtered data.
			 */
			if (filter->GetPackageSize() > 0) packageSize = filter->GetPackageSize();

			dataBuffer.Resize(packageSize);

			decsize = filter->ReadData(dataBuffer);
		}

		/* Update package size and buffer positions.
		 */
		if (packageSize <= size - currentFilePos || filter != NIL || size == -1)
		{
			if (decsize == -1) { packageSize = 0; return False; }

			packageSize = decsize;
			origfilepos = currentFilePos + packageSize;

			if (packageSize + currentFilePos > size && size != -1) size = packageSize + currentFilePos;
		}
		else
		{
			packageSize = decsize;

			if (decsize <= 0) { packageSize = 0; return False; }
		}

		currentBufferPos = 0;

		/* Bail out if more data is requested, but we do not have any more.
		 */
		if (packageSize == 0 && driver->GetPos() == driver->GetSize()) return False;
	}
	while (packageSize == 0);

	return True;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movswl 0x8(%rax), %eax
cmpl $0x0, %eax
jne 0xe5823
movq -0x20(%rbp), %rax
movw $0x5, 0xf8(%rax)
movb $0x0, -0x1(%rbp)
jmp 0xe5a90
movq -0x20(%rbp), %rax
movswl 0x8(%rax), %eax
cmpl $0x2, %eax
je 0xe5839
movb $0x1, -0x1(%rbp)
jmp 0xe5a90
movl $0x0, -0x14(%rbp)
movq -0x20(%rbp), %rax
movl 0x3c(%rax), %ecx
movl %ecx, 0x38(%rax)
movq 0x18(%rax), %rcx
movq %rcx, 0x10(%rax)
movq 0x58(%rax), %rcx
movq %rcx, 0x48(%rax)
cmpq $0x0, 0xf0(%rax)
jne 0xe5928
movq -0x20(%rbp), %rax
movq 0xe8(%rax), %rdi
movq 0x48(%rax), %rsi
movq (%rdi), %rax
callq *0x20(%rax)
movq -0x20(%rbp), %rax
cmpq $-0x1, 0x10(%rax)
je 0xe58d7
movq -0x20(%rbp), %rdx
movq %rdx, %rax
addq $0x20, %rax
movq %rax, -0x28(%rbp)
movslq 0x38(%rdx), %rax
movq 0x10(%rdx), %rcx
subq 0x48(%rdx), %rcx
cmpq %rcx, %rax
jge 0xe58b6
movq -0x20(%rbp), %rax
movslq 0x38(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0xe58c6
movq -0x20(%rbp), %rcx
movq 0x10(%rcx), %rax
subq 0x48(%rcx), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rax
movl %eax, %esi
callq 0x72e00
jmp 0xe58ea
movq -0x20(%rbp), %rax
movq %rax, %rdi
addq $0x20, %rdi
movl 0x38(%rax), %esi
callq 0x72e00
movq -0x20(%rbp), %rdi
movq 0xe8(%rdi), %rax
movq %rax, -0x40(%rbp)
addq $0x20, %rdi
callq 0x71100
movq -0x20(%rbp), %rdi
movq %rax, -0x38(%rbp)
addq $0x20, %rdi
callq 0x71140
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rsi
movl %eax, %edx
movq (%rdi), %rax
callq *0x10(%rax)
movl %eax, -0x14(%rbp)
jmp 0xe5981
movq -0x20(%rbp), %rax
movq 0xf0(%rax), %rdi
callq 0x5b7a0
cmpl $0x0, %eax
jle 0xe5956
movq -0x20(%rbp), %rax
movq 0xf0(%rax), %rdi
callq 0x5b7a0
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x38(%rax)
movq -0x20(%rbp), %rax
movq %rax, %rdi
addq $0x20, %rdi
movl 0x38(%rax), %esi
callq 0x72e00
movq -0x20(%rbp), %rsi
movq 0xf0(%rsi), %rdi
addq $0x20, %rsi
movq (%rdi), %rax
callq *0x28(%rax)
movl %eax, -0x14(%rbp)
movq -0x20(%rbp), %rdx
movslq 0x38(%rdx), %rax
movq 0x10(%rdx), %rcx
subq 0x48(%rdx), %rcx
cmpq %rcx, %rax
jle 0xe59af
movq -0x20(%rbp), %rax
cmpq $0x0, 0xf0(%rax)
jne 0xe59af
movq -0x20(%rbp), %rax
cmpq $-0x1, 0x10(%rax)
jne 0xe5a0d
cmpl $-0x1, -0x14(%rbp)
jne 0xe59c9
movq -0x20(%rbp), %rax
movl $0x0, 0x38(%rax)
movb $0x0, -0x1(%rbp)
jmp 0xe5a90
movq -0x20(%rbp), %rcx
movl -0x14(%rbp), %eax
movl %eax, 0x38(%rcx)
movq 0x48(%rcx), %rax
movslq 0x38(%rcx), %rdx
addq %rdx, %rax
movq %rax, 0x58(%rcx)
movslq 0x38(%rcx), %rax
addq 0x48(%rcx), %rax
cmpq 0x10(%rcx), %rax
jle 0xe5a0b
movq -0x20(%rbp), %rax
cmpq $-0x1, 0x10(%rax)
je 0xe5a0b
movq -0x20(%rbp), %rax
movslq 0x38(%rax), %rcx
addq 0x48(%rax), %rcx
movq %rcx, 0x10(%rax)
jmp 0xe5a30
movq -0x20(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %ecx, 0x38(%rax)
cmpl $0x0, -0x14(%rbp)
jg 0xe5a2e
movq -0x20(%rbp), %rax
movl $0x0, 0x38(%rax)
movb $0x0, -0x1(%rbp)
jmp 0xe5a90
jmp 0xe5a30
movq -0x20(%rbp), %rax
movl $0x0, 0x50(%rax)
cmpl $0x0, 0x38(%rax)
jne 0xe5a7c
movq -0x20(%rbp), %rax
movq 0xe8(%rax), %rdi
movq (%rdi), %rax
callq *0x48(%rax)
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, -0x48(%rbp)
movq 0xe8(%rax), %rdi
movq (%rdi), %rax
callq *0x40(%rax)
movq %rax, %rcx
movq -0x48(%rbp), %rax
cmpq %rcx, %rax
jne 0xe5a7c
movb $0x0, -0x1(%rbp)
jmp 0xe5a90
jmp 0xe5a7e
movq -0x20(%rbp), %rax
cmpl $0x0, 0x38(%rax)
je 0xe5840
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)