#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};
struct timex {
  TYPE_1__ time;
  int /*<<< orphan*/ modes;
};

/* Variables and functions */
int /*<<< orphan*/ ADJ_SETOFFSET;
scalar_t__ adjtimex(struct timex *);
int /*<<< orphan*/ ksft_exit_fail();
int /*<<< orphan*/ perror(char *);
void reset_ntp_error(void) {
  struct timex txc;
  txc.modes = ADJ_SETOFFSET;
  txc.time.tv_sec = 0;
  txc.time.tv_usec = 0;
  if (adjtimex(&txc) < 0) {
    perror("[FAIL] adjtimex");
    ksft_exit_fail();
  }
}


x86 assembly (clang, -O0):
<reset_ntp_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2ea1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
lea    -0x18(%rbp),%rdi
call   1050 <adjtimex@plt>
cmp    $0x0,%rax
jge    117a <reset_ntp_error+0x4a>
lea    0xe92(%rip),%rdi
call   1040 <perror@plt>
mov    $0x0,%al
call   1030 <ksft_exit_fail@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reset_ntp_error>:
sub    $0x18,%rsp
mov    0x2ea5(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x10(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
call   1050 <adjtimex@plt>
test   %rax,%rax
js     115a <reset_ntp_error+0x2a>
add    $0x18,%rsp
ret
lea    0xe9f(%rip),%rdi
call   1040 <perror@plt>
xor    %eax,%eax
call   1030 <ksft_exit_fail@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timex = type { %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i64, i64 }
@ADJ_SETOFFSET = global i32 0
@.str = [16 x i8] c"[FAIL] adjtimex\00"
define void @reset_ntp_error() {
%1 = alloca %struct.timex
%2 = load i32, i32* @ADJ_SETOFFSET
%3 = getelementptr inbounds %struct.timex, %struct.timex* %1, i32 0, i32 1
store i32 %2, i32* %3
%4 = getelementptr inbounds %struct.timex, %struct.timex* %1, i32 0, i32 0
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 1
store i64 0, i64* %5
%6 = getelementptr inbounds %struct.timex, %struct.timex* %1, i32 0, i32 0
%7 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %6, i32 0, i32 0
store i64 0, i64* %7
%8 = call i64 @adjtimex(%struct.timex* %1)
%9 = icmp slt i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %0
%11 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%12 = call i32 (...) @ksft_exit_fail()
br label %13
13: ; preds = %10, %0
ret void
}

LLVM IR (-O2):
%struct.timex = type { %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i64, i64 }
@ADJ_SETOFFSET = global i32 0
@.str = [16 x i8] c"[FAIL] adjtimex\00"
define void @reset_ntp_error() {
%1 = alloca %struct.timex
%2 = bitcast %struct.timex* %1 to i8*
%3 = load i32, i32* @ADJ_SETOFFSET
%4 = getelementptr inbounds %struct.timex, %struct.timex* %1, i64 0, i32 1
store i32 %3, i32* %4
%5 = bitcast %struct.timex* %1 to i8*
%6 = call i64 @adjtimex(%struct.timex* %1)
%7 = icmp slt i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %0
%9 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (...) @ksft_exit_fail()
br label %11
11: ; preds = %8, %0
ret void
}