#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 */
struct host1x_bo {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, int);
struct host1x_bo *host1x_bo_wrap(struct host1x_bo *, unsigned long, size_t);
int /*<<< orphan*/ stderr;
struct host1x_bo *host1x_bo_wrap_helper(struct host1x_bo *bo,
                                        unsigned long offset, size_t size,
                                        const char *file, int line) {
  struct host1x_bo *wrap = host1x_bo_wrap(bo, offset, size);
  if (!wrap)
    fprintf(stderr, "ERROR: %s:%d: host1x_bo_wrap() failed\n", file, line);
  return wrap;
}


x86 assembly (clang, -O0):
<host1x_bo_wrap_helper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <host1x_bo_wrap@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1178 <host1x_bo_wrap_helper+0x58>
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%ecx
lea    0xe8d(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x30(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<host1x_bo_wrap_helper>:
push   %rbp
push   %r14
push   %rbx
mov    %r8d,%r14d
mov    %rcx,%rbx
call   1030 <host1x_bo_wrap@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    1152 <host1x_bo_wrap_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 }
@stderr = global i32 0
@.str = [39 x i8] c"ERROR: %s:%d: host1x_bo_wrap() failed\0A\00"
define %struct.host1x_bo* @host1x_bo_wrap_helper(%struct.host1x_bo* %0, i64 %1, i64 %2, i8* %3, i32 %4) {
%6 = alloca %struct.host1x_bo*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i32
%11 = alloca %struct.host1x_bo*
store %struct.host1x_bo* %0, %struct.host1x_bo** %6
store i64 %1, i64* %7
store i64 %2, i64* %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%12 = load %struct.host1x_bo*, %struct.host1x_bo** %6
%13 = load i64, i64* %7
%14 = load i64, i64* %8
%15 = call %struct.host1x_bo* @host1x_bo_wrap(%struct.host1x_bo* %12, i64 %13, i64 %14)
store %struct.host1x_bo* %15, %struct.host1x_bo** %11
%16 = load %struct.host1x_bo*, %struct.host1x_bo** %11
%17 = icmp ne %struct.host1x_bo* %16, null
br i1 %17, label %23, label %18
18: ; preds = %5
%19 = load i32, i32* @stderr
%20 = load i8*, i8** %9
%21 = load i32, i32* %10
%22 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %20, i32 %21)
br label %23
23: ; preds = %18, %5
%24 = load %struct.host1x_bo*, %struct.host1x_bo** %11
ret %struct.host1x_bo* %24
}

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