#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 {
  int modes;
  TYPE_1__ time;
};

/* Variables and functions */
scalar_t__ adjtimex(struct timex *);
int /*<<< orphan*/ ksft_exit_fail();
int /*<<< orphan*/ perror(char *);
void reset_ntp_error(void) {
  struct timex txc;
  txc.modes = 0x0100;
  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
movl   $0x100,-0x18(%rbp)
movq   $0x0,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
call   1050 <adjtimex@plt>
cmp    $0x0,%rax
jge    1175 <reset_ntp_error+0x45>
lea    0xe97(%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
movl   $0x100,(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0x8(%rsp)
mov    %rsp,%rdi
call   1050 <adjtimex@plt>
test   %rax,%rax
js     1155 <reset_ntp_error+0x25>
add    $0x18,%rsp
ret
lea    0xea4(%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 { i32, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i64, i64 }
@.str = [16 x i8] c"[FAIL] adjtimex\00"
define void @reset_ntp_error() {
%1 = alloca %struct.timex
%2 = getelementptr inbounds %struct.timex, %struct.timex* %1, i32 0, i32 0
store i32 256, i32* %2
%3 = getelementptr inbounds %struct.timex, %struct.timex* %1, i32 0, i32 1
%4 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %3, i32 0, i32 1
store i64 0, i64* %4
%5 = getelementptr inbounds %struct.timex, %struct.timex* %1, i32 0, i32 1
%6 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %5, i32 0, i32 0
store i64 0, i64* %6
%7 = call i64 @adjtimex(%struct.timex* %1)
%8 = icmp slt i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %0
%10 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (...) @ksft_exit_fail()
br label %12
12: ; preds = %9, %0
ret void
}

LLVM IR (-O2):
%struct.timex = type { i32, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i64, i64 }
@.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 = getelementptr inbounds %struct.timex, %struct.timex* %1, i64 0, i32 0
store i32 256, i32* %3
%4 = getelementptr inbounds %struct.timex, %struct.timex* %1, i64 0, i32 1, i32 0
%5 = bitcast i64* %4 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
}