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

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ error(int /*<<< orphan*/, int /*<<< orphan*/, char *);
int gettimeofday_vdso(struct timeval *, struct timezone *);
void gettimeofday_vdso_nofail(struct timeval *tv, struct timezone *tz) {
  int err;
  err = gettimeofday_vdso(tv, tz);
  if (err)
    error(EXIT_FAILURE, errno, "gettimeofday");
}


x86 assembly (clang, -O0):
<gettimeofday_vdso_nofail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <gettimeofday_vdso@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1168 <gettimeofday_vdso_nofail+0x48>
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
mov    0x2e86(%rip),%rax
mov    (%rax),%esi
lea    0xe9d(%rip),%rdx
call   1040 <error@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gettimeofday_vdso_nofail>:
push   %rax
call   1030 <gettimeofday_vdso@plt>
test   %eax,%eax
je     1149 <gettimeofday_vdso_nofail+0x29>
mov    0x2ea7(%rip),%rax
mov    (%rax),%edi
mov    0x2ea6(%rip),%rax
mov    (%rax),%esi
lea    0xebd(%rip),%rdx
pop    %rax
jmp    1040 <error@plt>
pop    %rax
ret

LLVM IR (-O0):
%struct.timeval = type { i32 }
%struct.timezone = type { i32 }
@EXIT_FAILURE = global i32 0
@errno = global i32 0
@.str = [13 x i8] c"gettimeofday\00"
define void @gettimeofday_vdso_nofail(%struct.timeval* %0, %struct.timezone* %1) {
%3 = alloca %struct.timeval*
%4 = alloca %struct.timezone*
%5 = alloca i32
store %struct.timeval* %0, %struct.timeval** %3
store %struct.timezone* %1, %struct.timezone** %4
%6 = load %struct.timeval*, %struct.timeval** %3
%7 = load %struct.timezone*, %struct.timezone** %4
%8 = call i32 @gettimeofday_vdso(%struct.timeval* %6, %struct.timezone* %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i32, i32* @EXIT_FAILURE
%13 = load i32, i32* @errno
%14 = call i32 @error(i32 %12, i32 %13, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %11, %2
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
%struct.timezone = type { i32 }
@EXIT_FAILURE = global i32 0
@errno = global i32 0
@.str = [13 x i8] c"gettimeofday\00"
define void @gettimeofday_vdso_nofail(%struct.timeval* %0, %struct.timezone* %1) {
%3 = tail call i32 @gettimeofday_vdso(%struct.timeval* %0, %struct.timezone* %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = load i32, i32* @EXIT_FAILURE
%7 = load i32, i32* @errno
%8 = tail call i32 @error(i32 %6, i32 %7, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %5, %2
ret void
}