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

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, int);
struct host1x_pushbuf *host1x_job_append(struct host1x_job *,
                                         struct host1x_bo *, unsigned long);
int /*<<< orphan*/ stderr;
struct host1x_pushbuf *host1x_job_append_helper(struct host1x_job *job,
                                                struct host1x_bo *bo,
                                                unsigned long offset,
                                                const char *file, int line) {
  struct host1x_pushbuf *pb = host1x_job_append(job, bo, offset);
  if (!pb)
    fprintf(stderr, "ERROR: %s:%d: host1x_job_append() failed\n", file, line);
  return pb;
}


x86 assembly (clang, -O0):
<host1x_job_append_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_job_append@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1178 <host1x_job_append_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_job_append_helper>:
push   %rbp
push   %r14
push   %rbx
mov    %r8d,%r14d
mov    %rcx,%rbx
call   1030 <host1x_job_append@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    1152 <host1x_job_append_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_pushbuf = type { i32 }
%struct.host1x_job = type { i32 }
%struct.host1x_bo = type { i32 }
@stderr = global i32 0
@.str = [42 x i8] c"ERROR: %s:%d: host1x_job_append() failed\0A\00"
define %struct.host1x_pushbuf* @host1x_job_append_helper(%struct.host1x_job* %0, %struct.host1x_bo* %1, i64 %2, i8* %3, i32 %4) {
%6 = alloca %struct.host1x_job*
%7 = alloca %struct.host1x_bo*
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i32
%11 = alloca %struct.host1x_pushbuf*
store %struct.host1x_job* %0, %struct.host1x_job** %6
store %struct.host1x_bo* %1, %struct.host1x_bo** %7
store i64 %2, i64* %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%12 = load %struct.host1x_job*, %struct.host1x_job** %6
%13 = load %struct.host1x_bo*, %struct.host1x_bo** %7
%14 = load i64, i64* %8
%15 = call %struct.host1x_pushbuf* @host1x_job_append(%struct.host1x_job* %12, %struct.host1x_bo* %13, i64 %14)
store %struct.host1x_pushbuf* %15, %struct.host1x_pushbuf** %11
%16 = load %struct.host1x_pushbuf*, %struct.host1x_pushbuf** %11
%17 = icmp ne %struct.host1x_pushbuf* %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 ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %20, i32 %21)
br label %23
23: ; preds = %18, %5
%24 = load %struct.host1x_pushbuf*, %struct.host1x_pushbuf** %11
ret %struct.host1x_pushbuf* %24
}

LLVM IR (-O2):
%struct.host1x_pushbuf = type { i32 }
%struct.host1x_job = type { i32 }
%struct.host1x_bo = type { i32 }
@stderr = global i32 0
@.str = [42 x i8] c"ERROR: %s:%d: host1x_job_append() failed\0A\00"
define %struct.host1x_pushbuf* @host1x_job_append_helper(%struct.host1x_job* %0, %struct.host1x_bo* %1, i64 %2, i8* %3, i32 %4) {
%6 = tail call %struct.host1x_pushbuf* @host1x_job_append(%struct.host1x_job* %0, %struct.host1x_bo* %1, i64 %2)
%7 = icmp eq %struct.host1x_pushbuf* %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 ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %3, i32 %4)
br label %11
11: ; preds = %8, %5
ret %struct.host1x_pushbuf* %6
}