// File: /workspace/github_c_makefile_star2_O0/inflex[P]ripMIME/ripOLE/ole.c
// Function: OLE_store_stream
int OLE_store_stream( struct OLE_object *ole, char *stream_name, char *directory, char *stream, size_t stream_size )
{
	char *full_path = NULL;

	full_path = PLD_dprintf("%s/%s", directory, stream_name);
	if (full_path == NULL)
	{
		LOGGER_log("%s:%d:OLE_store_stream:ERROR: Cannot compose full filename string from '%s' and '%s'", FL, directory, stream_name);
		return -1;
	} else {
		FILE *f;

		f = fopen(full_path,"w");
		if (f == NULL)
		{
			LOGGER_log("%s:%d:OLE_store_stream:ERROR: Cannot open %s for writing (%s)",FL, full_path, strerror(errno));
			if (full_path) free(full_path);
			return -1;
		} else {
			size_t written_bytes;

			written_bytes = fwrite( stream, 1, stream_size, f );
			if (written_bytes != stream_size)
			{
				LOGGER_log("%s:%d:OLE_store_stream:WARNING: Only wrote %d of %d bytes to file %s",FL,written_bytes,stream_size,full_path);
			}
			fclose(f);

			if ((OLE_VNORMAL(ole->verbose))&&(ole->filename_report_fn != NULL))
			{
				ole->filename_report_fn( stream_name );
			}
		} // if file is valid
	} // if full_path is valid

	if (full_path) free(full_path);

	return OLE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x20(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq 0x2c19(%rip), %rdi      # 0x194fc
movb $0x0, %al
callq 0x11330
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x16923
movq -0x20(%rbp), %rcx
movq -0x18(%rbp), %r8
leaq 0xa218(%rip), %rdi      # 0x20b1c
leaq 0x9340(%rip), %rsi      # 0x1fc4b
movl $0x5eb, %edx            # imm = 0x5EB
movb $0x0, %al
callq 0x117c0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x16a29
movq -0x38(%rbp), %rdi
leaq 0x349d(%rip), %rsi      # 0x19dcb
callq 0x2330
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x1698f
movq -0x38(%rbp), %rax
movq %rax, -0x50(%rbp)
callq 0x2050
movl (%rax), %edi
callq 0x23a0
movq -0x50(%rbp), %rcx
movq %rax, %r8
leaq 0xa211(%rip), %rdi      # 0x20b71
leaq 0x92e4(%rip), %rsi      # 0x1fc4b
movl $0x5f3, %edx            # imm = 0x5F3
movb $0x0, %al
callq 0x117c0
cmpq $0x0, -0x38(%rbp)
je 0x16983
movq -0x38(%rbp), %rdi
callq 0x2030
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x16a29
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rdx
movq -0x40(%rbp), %rcx
movl $0x1, %esi
callq 0x2380
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x30(%rbp), %rax
je 0x169d9
movq -0x48(%rbp), %rcx
movq -0x30(%rbp), %r8
movq -0x38(%rbp), %r9
leaq 0xa1e9(%rip), %rdi      # 0x20baf
leaq 0x927e(%rip), %rsi      # 0x1fc4b
movl $0x5fc, %edx            # imm = 0x5FC
movb $0x0, %al
callq 0x117c0
movq -0x40(%rbp), %rdi
callq 0x20e0
movq -0x10(%rbp), %rax
cmpl $0x0, 0x448(%rax)
je 0x16a0e
movq -0x10(%rbp), %rax
cmpq $0x0, 0x470(%rax)
je 0x16a0e
movq -0x10(%rbp), %rax
movq 0x470(%rax), %rax
movq -0x18(%rbp), %rdi
callq *%rax
jmp 0x16a10
jmp 0x16a12
cmpq $0x0, -0x38(%rbp)
je 0x16a22
movq -0x38(%rbp), %rdi
callq 0x2030
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)