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

	if (bitstreamActive && !keepBits) CompleteBitstream();

	/* Convert the string to char * here once to avoid
	 * having to convert it again and again later.
	 */
	const char	*value		= string;

	Int		 bytesleft	= strlen(value);
	Int		 databufferpos	= 0;

	while (bytesleft)
	{
		Int	 amount = ((packageSize - currentBufferPos) < (bytesleft)) ? (packageSize - currentBufferPos) : (bytesleft);

		memcpy((UnsignedByte *) dataBuffer + currentBufferPos, value + databufferpos, amount);

		bytesleft	 -= amount;
		databufferpos	 += amount;
		currentBufferPos += amount;
		currentFilePos	 += amount;

		if (size < currentFilePos) size = currentFilePos;

		if (!WriteData()) { lastError = IO_ERROR_UNKNOWN; return False; }
	}

	return True;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movswl 0x8(%rax), %eax
cmpl $0x0, %eax
jne 0xe7f47
movq -0x38(%rbp), %rax
movw $0x5, 0xf8(%rax)
movb $0x0, -0x1(%rbp)
jmp 0xe809a
movq -0x38(%rbp), %rax
cmpl $0x0, 0x38(%rax)
jg 0xe7f67
movq -0x38(%rbp), %rax
movw $0x4, 0xf8(%rax)
movb $0x0, -0x1(%rbp)
jmp 0xe809a
movq -0x18(%rbp), %rdi
xorl %esi, %esi
callq 0x59320
testb $0x1, %al
jne 0xe7f78
jmp 0xe7f8e
movq -0x38(%rbp), %rax
movw $0x2, 0xf8(%rax)
movb $0x0, -0x1(%rbp)
jmp 0xe809a
movq -0x38(%rbp), %rax
testb $0x1, 0x60(%rax)
je 0xe7fab
movq -0x38(%rbp), %rax
testb $0x1, 0x61(%rax)
jne 0xe7fab
movq -0x38(%rbp), %rdi
callq 0x5a7a0
movq -0x18(%rbp), %rdi
callq 0x5d090
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x5a790
movl %eax, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0xe8096
movq -0x38(%rbp), %rcx
movl 0x38(%rcx), %eax
subl 0x50(%rcx), %eax
cmpl -0x24(%rbp), %eax
jge 0xe7ff3
movq -0x38(%rbp), %rcx
movl 0x38(%rcx), %eax
subl 0x50(%rcx), %eax
movl %eax, -0x3c(%rbp)
jmp 0xe7ff9
movl -0x24(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x38(%rbp), %rdi
movl -0x3c(%rbp), %eax
movl %eax, -0x2c(%rbp)
addq $0x20, %rdi
callq 0x71100
movq %rax, %rdi
movq -0x38(%rbp), %rax
movslq 0x50(%rax), %rax
addq %rax, %rdi
movq -0x20(%rbp), %rsi
movslq -0x28(%rbp), %rax
addq %rax, %rsi
movslq -0x2c(%rbp), %rdx
callq 0x593a0
movq -0x38(%rbp), %rcx
movl -0x2c(%rbp), %edx
movl -0x24(%rbp), %eax
subl %edx, %eax
movl %eax, -0x24(%rbp)
movl -0x2c(%rbp), %eax
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x2c(%rbp), %eax
addl 0x50(%rcx), %eax
movl %eax, 0x50(%rcx)
movslq -0x2c(%rbp), %rax
addq 0x48(%rcx), %rax
movq %rax, 0x48(%rcx)
movq 0x10(%rcx), %rax
cmpq 0x48(%rcx), %rax
jge 0xe8071
movq -0x38(%rbp), %rax
movq 0x48(%rax), %rcx
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rdi
callq 0x5be10
testb $0x1, %al
jne 0xe8091
movq -0x38(%rbp), %rax
movw $0x4, 0xf8(%rax)
movb $0x0, -0x1(%rbp)
jmp 0xe809a
jmp 0xe7fcb
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)