#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 */
int /*<<< orphan*/ display_version();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ print_uptime();
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  if (argc == 1) {
    print_uptime();
    return 0;
  }
  if ((argc == 2) && (!strcmp(argv[1], "-V"))) {
    display_version();
    return 0;
  }
  fprintf(stderr, "usage: uptime [-V]\n    -V    display version\n");
  return 1;
}


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   $0x1,-0x8(%rbp)
jne    1173 <main+0x33>
mov    $0x0,%al
call   1030 <print_uptime@plt>
movl   $0x0,-0x4(%rbp)
jmp    11c9 <main+0x89>
cmpl   $0x2,-0x8(%rbp)
jne    11ad <main+0x6d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe74(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11ad <main+0x6d>
mov    $0x0,%al
call   1040 <display_version@plt>
movl   $0x0,-0x4(%rbp)
jmp    11c9 <main+0x89>
mov    0x2e2c(%rip),%rax
mov    (%rax),%edi
lea    0xe46(%rip),%rsi
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
je     1156 <main+0x16>
cmp    $0x1,%edi
jne    116a <main+0x2a>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <print_uptime@plt>
jmp    118f <main+0x4f>
mov    0x8(%rsi),%rdi
lea    0xe9f(%rip),%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1186 <main+0x46>
mov    0x2e6f(%rip),%rax
mov    (%rax),%edi
lea    0xe89(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x1,%ebx
jmp    118f <main+0x4f>
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <display_version@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"-V\00"
@stderr = global i32 0
@.str.1 = [46 x i8] c"usage: uptime [-V]\0A -V display version\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 eq i32 %6, 1
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 (...) @print_uptime()
store i32 0, i32* %3
br label %24
10: ; preds = %2
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 2
br i1 %12, label %13, label %21
13: ; preds = %10
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @strcmp(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%18 = icmp ne i32 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %13
%20 = call i32 (...) @display_version()
store i32 0, i32* %3
br label %24
21: ; preds = %13, %10
%22 = load i32, i32* @stderr
%23 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %24
24: ; preds = %21, %19, %8
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
@.str = [3 x i8] c"-V\00"
@stderr = global i32 0
@.str.1 = [46 x i8] c"usage: uptime [-V]\0A -V display version\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
switch i32 %0, label %12 [
i32 1, label %3
i32 2, label %5
]
3: ; preds = %2
%4 = tail call i32 (...) @print_uptime()
br label %15
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i32 @strcmp(i8* dereferenceable(1) %7, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %5
%11 = tail call i32 (...) @display_version()
br label %15
12: ; preds = %2, %5
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %12, %10, %3
%16 = phi i32 [ 0, %3 ], [ 1, %12 ], [ 0, %10 ]
ret i32 %16
}