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

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, int);
struct host1x_job *host1x_job_create(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
struct host1x_job *host1x_job_create_helper(uint32_t syncpt,
                                            uint32_t increments,
                                            const char *file, int line) {
  struct host1x_job *job = host1x_job_create(syncpt, increments);
  if (!job)
    fprintf(stderr, "ERROR: %s:%d: host1x_job_create() failed\n", file, line);
  return job;
}


x86 assembly (clang, -O0):
<host1x_job_create_helper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <host1x_job_create@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    116b <host1x_job_create_helper+0x4b>
mov    0x2e8a(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
lea    0xe9a(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.host1x_job = type { i32 }
@stderr = global i32 0
@.str = [42 x i8] c"ERROR: %s:%d: host1x_job_create() failed\0A\00"
define %struct.host1x_job* @host1x_job_create_helper(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca %struct.host1x_job*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%10 = load i32, i32* %5
%11 = load i32, i32* %6
%12 = call %struct.host1x_job* @host1x_job_create(i32 %10, i32 %11)
store %struct.host1x_job* %12, %struct.host1x_job** %9
%13 = load %struct.host1x_job*, %struct.host1x_job** %9
%14 = icmp ne %struct.host1x_job* %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 ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %17, i32 %18)
br label %20
20: ; preds = %15, %4
%21 = load %struct.host1x_job*, %struct.host1x_job** %9
ret %struct.host1x_job* %21
}

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