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

/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ err_exit(char *, int /*<<< orphan*/);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int settimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  struct timeval tv;
  if (gettimeofday(&tv, NULL) == -1) {
    err_exit("Errron on gettimeoftheday %s\n", strerror(errno));
  }
  if (settimeofday(&tv, NULL) == -1) {
    err_exit("Errron on settimeoftheday %s\n", strerror(errno));
  }
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
cmp    $0xffffffff,%eax
jne    1198 <main+0x48>
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
mov    %eax,%esi
lea    0xe6d(%rip),%rdi
call   1050 <err_exit@plt>
lea    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <settimeofday@plt>
cmp    $0xffffffff,%eax
jne    11ca <main+0x7a>
mov    0x2e2b(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
mov    %eax,%esi
lea    0xe59(%rip),%rdi
call   1050 <err_exit@plt>
mov    0x2e07(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
cmp    $0xffffffff,%eax
jne    117c <main+0x2c>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
lea    0xe8b(%rip),%rdi
mov    %eax,%esi
call   1050 <err_exit@plt>
mov    %rsp,%rdi
xor    %esi,%esi
call   1040 <settimeofday@plt>
cmp    $0xffffffff,%eax
jne    11a7 <main+0x57>
mov    0x2e4e(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
lea    0xe7e(%rip),%rdi
mov    %eax,%esi
call   1050 <err_exit@plt>
mov    0x2e2a(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
%struct.timeval = type { i32 }
@.str = [30 x i8] c"Errron on gettimeoftheday %s\0A\00"
@errno = global i32 0
@.str.1 = [30 x i8] c"Errron on settimeoftheday %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.timeval
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @gettimeofday(%struct.timeval* %6, i32* null)
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i32, i32* @errno
%11 = call i32 @strerror(i32 %10)
%12 = call i32 @err_exit(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %9, %2
%14 = call i32 @settimeofday(%struct.timeval* %6, i32* null)
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = load i32, i32* @errno
%18 = call i32 @strerror(i32 %17)
%19 = call i32 @err_exit(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %18)
br label %20
20: ; preds = %16, %13
%21 = load i32, i32* @EXIT_SUCCESS
%22 = call i32 @exit(i32 %21)
unreachable
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
@.str = [30 x i8] c"Errron on gettimeoftheday %s\0A\00"
@errno = global i32 0
@.str.1 = [30 x i8] c"Errron on settimeoftheday %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.timeval
%4 = bitcast %struct.timeval* %3 to i8*
%5 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load i32, i32* @errno
%9 = tail call i32 @strerror(i32 %8)
%10 = tail call i32 @err_exit(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %9)
br label %11
11: ; preds = %7, %2
%12 = call i32 @settimeofday(%struct.timeval* %3, i32* null)
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %18
14: ; preds = %11
%15 = load i32, i32* @errno
%16 = call i32 @strerror(i32 %15)
%17 = call i32 @err_exit(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %14, %11
%19 = load i32, i32* @EXIT_SUCCESS
%20 = call i32 @exit(i32 %19)
unreachable
}