#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 */

/* Variables and functions */
char *basename(char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ sync_time(char *, int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  if (argc < 2) {
    printf("usage: %s <device>\n", basename(argv[0]));
    return 1;
  }
  if (sync_time(argv[1], NULL)) {
    printf("Error occured while syncing time.\n");
  } else {
    printf("Time was synced!\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1179 <main+0x49>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <basename@plt>
mov    %rax,%rsi
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11bc <main+0x8c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <sync_time@plt>
cmp    $0x0,%rax
je     11a7 <main+0x77>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b5 <main+0x85>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x1,%edi
jg     1166 <main+0x26>
mov    (%rsi),%rdi
call   1050 <basename@plt>
lea    0xeab(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%ebx
jmp    118d <main+0x4d>
mov    0x8(%rsi),%rdi
xor    %ebx,%ebx
xor    %esi,%esi
call   1060 <sync_time@plt>
test   %rax,%rax
je     1181 <main+0x41>
lea    0xea6(%rip),%rdi
jmp    1188 <main+0x48>
lea    0xe8c(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"usage: %s <device>\0A\00"
@.str.1 = [35 x i8] c"Error occured while syncing time.\0A\00"
@.str.2 = [18 x i8] c"Time was synced!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 2
br i1 %7, label %8, label %14
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = call i8* @basename(i8* %11)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %12)
store i32 1, i32* %3
br label %25
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i64 @sync_time(i8* %17, i32* null)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %14
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
br label %24
22: ; preds = %14
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %24
24: ; preds = %22, %20
store i32 0, i32* %3
br label %25
25: ; preds = %24, %8
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
@.str = [20 x i8] c"usage: %s <device>\0A\00"
@str = [17 x i8] c"Time was synced!\00"
@str.3 = [34 x i8] c"Error occured while syncing time.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i8* @basename(i8* %5)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %17
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i64 @sync_time(i8* %10, i32* null)
%12 = icmp eq i64 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %8
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.3, i64 0, i64 0))
br label %17
15: ; preds = %8
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
br label %17
17: ; preds = %13, %15, %4
%18 = phi i32 [ 1, %4 ], [ 0, %15 ], [ 0, %13 ]
ret i32 %18
}