#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, int);
int host1x_bo_invalidate(struct host1x_bo *, unsigned long, size_t);
int /*<<< orphan*/ stderr;
int host1x_bo_invalidate_helper(struct host1x_bo *bo, unsigned long offset,
                                size_t length, const char *file, int line) {
  int err = host1x_bo_invalidate(bo, offset, length);
  if (err)
    fprintf(stderr, "ERROR: %s:%d: host1x_bo_invalidate() failed %d\n", file,
            line, err);
  return err;
}


x86 assembly (clang, -O0):
<host1x_bo_invalidate_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_invalidate@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
je     117a <host1x_bo_invalidate_helper+0x5a>
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%ecx
mov    -0x28(%rbp),%r8d
lea    0xe8b(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x28(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<host1x_bo_invalidate_helper>:
push   %rbp
push   %r14
push   %rbx
mov    %r8d,%r14d
mov    %rcx,%rbx
call   1030 <host1x_bo_invalidate@plt>
mov    %eax,%ebp
test   %eax,%eax
je     1153 <host1x_bo_invalidate_helper+0x33>
mov    0x2ea4(%rip),%rax
mov    (%rax),%edi
lea    0xebb(%rip),%rsi
mov    %rbx,%rdx
mov    %r14d,%ecx
mov    %ebp,%r8d
call   1040 <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 = [48 x i8] c"ERROR: %s:%d: host1x_bo_invalidate() failed %d\0A\00"
define i32 @host1x_bo_invalidate_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 i32
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 i32 @host1x_bo_invalidate(%struct.host1x_bo* %12, i64 %13, i64 %14)
store i32 %15, i32* %11
%16 = load i32, i32* %11
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %24
18: ; preds = %5
%19 = load i32, i32* @stderr
%20 = load i8*, i8** %9
%21 = load i32, i32* %10
%22 = load i32, i32* %11
%23 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* %20, i32 %21, i32 %22)
br label %24
24: ; preds = %18, %5
%25 = load i32, i32* %11
ret i32 %25
}

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