#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
struct host1x_bo {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, int, int);
int host1x_bo_export(struct host1x_bo *, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int host1x_bo_export_helper(struct host1x_bo *bo, uint32_t *handle,
                            const char *file, int line) {
  int err = host1x_bo_export(bo, handle);
  if (err)
    fprintf(stderr, "ERROR: %s:%d: host1x_bo_export() failed %d\n", file, line,
            err);
  return err;
}


x86 assembly (clang, -O0):
<host1x_bo_export_helper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <host1x_bo_export@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     1171 <host1x_bo_export_helper+0x51>
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
lea    0xe94(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x20(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<host1x_bo_export_helper>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%r14d
mov    %rdx,%rbx
call   1040 <host1x_bo_export@plt>
mov    %eax,%ebp
test   %eax,%eax
je     1153 <host1x_bo_export_helper+0x33>
mov    0x2ea4(%rip),%rax
mov    (%rax),%edi
lea    0xebb(%rip),%rsi
mov    %rbx,%rdx
mov    %r14d,%ecx
mov    %ebp,%r8d
call   1030 <fprintf@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.host1x_bo = type { i32 }
@stderr = global i32 0
@.str = [44 x i8] c"ERROR: %s:%d: host1x_bo_export() failed %d\0A\00"
define i32 @host1x_bo_export_helper(%struct.host1x_bo* %0, i32* %1, i8* %2, i32 %3) {
%5 = alloca %struct.host1x_bo*
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
store %struct.host1x_bo* %0, %struct.host1x_bo** %5
store i32* %1, i32** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%10 = load %struct.host1x_bo*, %struct.host1x_bo** %5
%11 = load i32*, i32** %6
%12 = call i32 @host1x_bo_export(%struct.host1x_bo* %10, i32* %11)
store i32 %12, i32* %9
%13 = load i32, i32* %9
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %21
15: ; preds = %4
%16 = load i32, i32* @stderr
%17 = load i8*, i8** %7
%18 = load i32, i32* %8
%19 = load i32, i32* %9
%20 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %17, i32 %18, i32 %19)
br label %21
21: ; preds = %15, %4
%22 = load i32, i32* %9
ret i32 %22
}

LLVM IR (-O2):
%struct.host1x_bo = type { i32 }
@stderr = global i32 0
@.str = [44 x i8] c"ERROR: %s:%d: host1x_bo_export() failed %d\0A\00"
define i32 @host1x_bo_export_helper(%struct.host1x_bo* %0, i32* %1, i8* %2, i32 %3) {
%5 = tail call i32 @host1x_bo_export(%struct.host1x_bo* %0, i32* %1)
%6 = icmp eq i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %4
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %2, i32 %3, i32 %5)
br label %10
10: ; preds = %7, %4
ret i32 %5
}