// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/classes/io/outstream.cpp
// Function: smooth::IO::OutStream::WriteData()
S::Bool S::IO::OutStream::WriteData()
{
	if (streamType == STREAM_NONE)	{ lastError = IO_ERROR_NOTOPEN; return False; }
	if (packageSize <= 0)		{ lastError = IO_ERROR_UNKNOWN; return False; }

	if (currentBufferPos < packageSize) return True;

	if (filter != NIL && filter->GetPackageSize() == -1)
	{
		dataBuffer.Resize(packageSize + defaultPackageSize);

		packageSize += defaultPackageSize;
		stdpacksize = packageSize;

		return True;
	}

	if (streamType == STREAM_DRIVER)
	{
		Int	 encsize = 0;

		dataBuffer.Resize(packageSize);

		if (filter == NIL) encsize = driver->WriteData(dataBuffer, packageSize);
		else		   encsize = filter->WriteData(dataBuffer);

		if (encsize == -1)
		{
			packageSize = 0;

			return False;
		}

		driver->Flush();

		if (size == currentFilePos) size -= (packageSize - encsize);

		currentFilePos	 -= (packageSize - encsize);
		currentBufferPos -= packageSize;
	}

	return True;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movswl 0x8(%rax), %eax
cmpl $0x0, %eax
jne 0xe7983
movq -0x20(%rbp), %rax
movw $0x5, 0xf8(%rax)
movb $0x0, -0x1(%rbp)
jmp 0xe7b10
movq -0x20(%rbp), %rax
cmpl $0x0, 0x38(%rax)
jg 0xe79a3
movq -0x20(%rbp), %rax
movw $0x4, 0xf8(%rax)
movb $0x0, -0x1(%rbp)
jmp 0xe7b10
movq -0x20(%rbp), %rcx
movl 0x50(%rcx), %eax
cmpl 0x38(%rcx), %eax
jge 0xe79b8
movb $0x1, -0x1(%rbp)
jmp 0xe7b10
movq -0x20(%rbp), %rax
cmpq $0x0, 0xf0(%rax)
je 0xe7a19
movq -0x20(%rbp), %rax
movq 0xf0(%rax), %rdi
callq 0x5b7a0
cmpl $-0x1, %eax
jne 0xe7a19
movq -0x20(%rbp), %rax
movq %rax, %rdi
addq $0x20, %rdi
movl 0x38(%rax), %esi
movq 0x120db0(%rip), %rax    # 0x2087a0
addl (%rax), %esi
callq 0x72e00
movq -0x20(%rbp), %rax
movq 0x120d9e(%rip), %rcx    # 0x2087a0
movl (%rcx), %ecx
addl 0x38(%rax), %ecx
movl %ecx, 0x38(%rax)
movl 0x38(%rax), %ecx
movl %ecx, 0x3c(%rax)
movb $0x1, -0x1(%rbp)
jmp 0xe7b10
movq -0x20(%rbp), %rax
movswl 0x8(%rax), %eax
cmpl $0x2, %eax
jne 0xe7b0c
movq -0x20(%rbp), %rax
movl $0x0, -0x14(%rbp)
movq %rax, %rdi
addq $0x20, %rdi
movl 0x38(%rax), %esi
callq 0x72e00
movq -0x20(%rbp), %rax
cmpq $0x0, 0xf0(%rax)
jne 0xe7a83
movq -0x20(%rbp), %rdi
movq 0xe8(%rdi), %rax
movq %rax, -0x28(%rbp)
addq $0x20, %rdi
callq 0x71100
movq -0x28(%rbp), %rdi
movq %rax, %rsi
movq -0x20(%rbp), %rax
movl 0x38(%rax), %edx
movq (%rdi), %rax
callq *0x18(%rax)
movl %eax, -0x14(%rbp)
jmp 0xe7a9b
movq -0x20(%rbp), %rsi
movq 0xf0(%rsi), %rdi
addq $0x20, %rsi
movq (%rdi), %rax
callq *0x20(%rax)
movl %eax, -0x14(%rbp)
cmpl $-0x1, -0x14(%rbp)
jne 0xe7ab2
movq -0x20(%rbp), %rax
movl $0x0, 0x38(%rax)
movb $0x0, -0x1(%rbp)
jmp 0xe7b10
movq -0x20(%rbp), %rax
movq 0xe8(%rax), %rdi
movq (%rdi), %rax
callq *0x30(%rax)
movq -0x20(%rbp), %rcx
movq 0x10(%rcx), %rax
cmpq 0x48(%rcx), %rax
jne 0xe7ae9
movq -0x20(%rbp), %rax
movl 0x38(%rax), %ecx
subl -0x14(%rbp), %ecx
movslq %ecx, %rdx
movq 0x10(%rax), %rcx
subq %rdx, %rcx
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movl 0x38(%rax), %ecx
subl -0x14(%rbp), %ecx
movslq %ecx, %rdx
movq 0x48(%rax), %rcx
subq %rdx, %rcx
movq %rcx, 0x48(%rax)
movl 0x38(%rax), %edx
movl 0x50(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x50(%rax)
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)