#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;
};
struct host1x {
  int dummy;
};

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


x86 assembly (clang, -O0):
<host1x_bo_import_helper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <host1x_bo_import@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    116d <host1x_bo_import_helper+0x4d>
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
lea    0xe98(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<host1x_bo_import_helper>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%r14d
mov    %rdx,%rbx
call   1030 <host1x_bo_import@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    1152 <host1x_bo_import_helper+0x32>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
lea    0xeb9(%rip),%rsi
mov    %rbx,%rdx
mov    %r14d,%ecx
call   1040 <fprintf@plt>
mov    %rbp,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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