#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 tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
scalar_t__ adjtime(struct timeval *, int /*<<< orphan*/);
int atof(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  if (argc < 2) {
    fprintf(stderr, "usage: %s <delta>\n", argv[0]);
    return 1;
  }
  struct timeval tv;
  tv.tv_sec = 0;
  tv.tv_usec = atof(argv[1]) * 1000;
  if (0 != adjtime(&tv, 0)) {
    perror("adjtime");
    return 1;
  }
  return 0;
}


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)
cmpl   $0x2,-0x8(%rbp)
jge    1188 <main+0x48>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe89(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11de <main+0x9e>
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <atof@plt>
imul   $0x3e8,%eax,%eax
mov    %eax,-0x20(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
call   1040 <adjtime@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     11d7 <main+0x97>
lea    0xe4d(%rip),%rdi
call   1060 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    11de <main+0x9e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
cmp    $0x1,%edi
jg     1169 <main+0x29>
mov    0x2e8f(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xea3(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%ebx
jmp    1195 <main+0x55>
movq   $0x0,0x8(%rsp)
mov    0x8(%rsi),%rdi
call   1030 <atof@plt>
imul   $0x3e8,%eax,%eax
mov    %eax,(%rsp)
mov    %rsp,%rdi
xor    %ebx,%ebx
xor    %esi,%esi
call   1040 <adjtime@plt>
test   %rax,%rax
jne    119d <main+0x5d>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret
lea    0xe6f(%rip),%rdi
call   1060 <perror@plt>
jmp    1162 <main+0x22>

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
@stderr = global i32 0
@.str = [19 x i8] c"usage: %s <delta>\0A\00"
@.str.1 = [8 x i8] c"adjtime\00"
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 = load i32, i32* %4
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %15
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %13)
store i32 1, i32* %3
br label %28
15: ; preds = %2
%16 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 1
store i64 0, i64* %16
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @atof(i8* %19)
%21 = mul nsw i32 %20, 1000
%22 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 0
store i32 %21, i32* %22
%23 = call i64 @adjtime(%struct.timeval* %6, i32 0)
%24 = icmp ne i64 0, %23
br i1 %24, label %25, label %27
25: ; preds = %15
%26 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %28
27: ; preds = %15
store i32 0, i32* %3
br label %28
28: ; preds = %27, %25, %9
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
@stderr = global i32 0
@.str = [19 x i8] c"usage: %s <delta>\0A\00"
@.str.1 = [8 x i8] c"adjtime\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.timeval
%4 = icmp slt i32 %0, 2
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = load i8*, i8** %1
%8 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %23
9: ; preds = %2
%10 = bitcast %struct.timeval* %3 to i8*
%11 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 1
store i64 0, i64* %11
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i32 @atof(i8* %13)
%15 = mul nsw i32 %14, 1000
%16 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 0
store i32 %15, i32* %16
%17 = call i64 @adjtime(%struct.timeval* %3, i32 0)
%18 = icmp eq i64 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %9
%20 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %21
21: ; preds = %9, %19
%22 = phi i32 [ 1, %19 ], [ 0, %9 ]
br label %23
23: ; preds = %21, %5
%24 = phi i32 [ 1, %5 ], [ %22, %21 ]
ret i32 %24
}