#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 atoi(char *);
int /*<<< orphan*/ bu_extra_argument(char *);
scalar_t__ bu_handle_version(int, char **);
int /*<<< orphan*/ bu_missing_argument(char *);
scalar_t__ has_arg(int, char **, char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ sleep(unsigned int);
int main(int argc, char **argv) {
  if (has_arg(argc, argv, "-h") || has_arg(argc, argv, "--help")) {
    puts("Usage: sleep TIME");
    puts("Wait at least TIME seconds, then exit.");
    return 1;
  }
  if (bu_handle_version(argc, argv)) {
    return 0;
  }
  if (argc < 2) {
    bu_missing_argument(argv[0]);
    return 1;
  }
  if (argc > 2) {
    bu_extra_argument(argv[0]);
    return 1;
  }
  int time_i = atoi(argv[1]);
  unsigned int time = (unsigned int)(time_i < 0 ? -time_i : time_i);
  sleep(time);
  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)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe6c(%rip),%rdx
call   1040 <has_arg@plt>
cmp    $0x0,%rax
jne    11c0 <main+0x50>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe52(%rip),%rdx
call   1040 <has_arg@plt>
cmp    $0x0,%rax
je     11e4 <main+0x74>
lea    0xe43(%rip),%rdi
call   1030 <puts@plt>
lea    0xe49(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,-0x4(%rbp)
jmp    128c <main+0x11c>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1070 <bu_handle_version@plt>
cmp    $0x0,%rax
je     1206 <main+0x96>
movl   $0x0,-0x4(%rbp)
jmp    128c <main+0x11c>
cmpl   $0x2,-0x8(%rbp)
jge    1228 <main+0xb8>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1090 <bu_missing_argument@plt>
movl   $0x1,-0x4(%rbp)
jmp    128c <main+0x11c>
cmpl   $0x2,-0x8(%rbp)
jle    124a <main+0xda>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <bu_extra_argument@plt>
movl   $0x1,-0x4(%rbp)
jmp    128c <main+0x11c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1271 <main+0x101>
xor    %eax,%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1277 <main+0x107>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
call   1080 <sleep@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xe80(%rip),%rdx
call   1040 <has_arg@plt>
test   %rax,%rax
jne    11a0 <main+0x30>
lea    0xe72(%rip),%rdx
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <has_arg@plt>
test   %rax,%rax
je     11c6 <main+0x56>
lea    0xe63(%rip),%rdi
call   1030 <puts@plt>
lea    0xe69(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %ebp,%edi
mov    %rbx,%rsi
call   1070 <bu_handle_version@plt>
xor    %r14d,%r14d
test   %rax,%rax
jne    11be <main+0x4e>
cmp    $0x1,%ebp
jg     11e7 <main+0x77>
mov    (%rbx),%rdi
call   1090 <bu_missing_argument@plt>
jmp    11b8 <main+0x48>
cmp    $0x2,%ebp
jne    1203 <main+0x93>
mov    0x8(%rbx),%rdi
call   1060 <atoi@plt>
mov    %eax,%edi
neg    %edi
cmovs  %eax,%edi
call   1080 <sleep@plt>
jmp    11be <main+0x4e>
mov    (%rbx),%rdi
call   1050 <bu_extra_argument@plt>
jmp    11b8 <main+0x48>

LLVM IR (-O0):
@.str = [3 x i8] c"-h\00"
@.str.1 = [7 x i8] c"--help\00"
@.str.2 = [18 x i8] c"Usage: sleep TIME\00"
@.str.3 = [39 x i8] c"Wait at least TIME seconds, then exit.\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = load i8**, i8*** %5
%10 = call i64 @has_arg(i32 %8, i8** %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%11 = icmp ne i64 %10, 0
br i1 %11, label %17, label %12
12: ; preds = %2
%13 = load i32, i32* %4
%14 = load i8**, i8*** %5
%15 = call i64 @has_arg(i32 %13, i8** %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %12, %2
%18 = call i32 @puts(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%19 = call i32 @puts(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %58
20: ; preds = %12
%21 = load i32, i32* %4
%22 = load i8**, i8*** %5
%23 = call i64 @bu_handle_version(i32 %21, i8** %22)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %20
store i32 0, i32* %3
br label %58
26: ; preds = %20
%27 = load i32, i32* %4
%28 = icmp slt i32 %27, 2
br i1 %28, label %29, label %34
29: ; preds = %26
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 0
%32 = load i8*, i8** %31
%33 = call i32 @bu_missing_argument(i8* %32)
store i32 1, i32* %3
br label %58
34: ; preds = %26
%35 = load i32, i32* %4
%36 = icmp sgt i32 %35, 2
br i1 %36, label %37, label %42
37: ; preds = %34
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 0
%40 = load i8*, i8** %39
%41 = call i32 @bu_extra_argument(i8* %40)
store i32 1, i32* %3
br label %58
42: ; preds = %34
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 1
%45 = load i8*, i8** %44
%46 = call i32 @atoi(i8* %45)
store i32 %46, i32* %6
%47 = load i32, i32* %6
%48 = icmp slt i32 %47, 0
br i1 %48, label %49, label %52
49: ; preds = %42
%50 = load i32, i32* %6
%51 = sub nsw i32 0, %50
br label %54
52: ; preds = %42
%53 = load i32, i32* %6
br label %54
54: ; preds = %52, %49
%55 = phi i32 [ %51, %49 ], [ %53, %52 ]
store i32 %55, i32* %7
%56 = load i32, i32* %7
%57 = call i32 @sleep(i32 %56)
store i32 0, i32* %3
br label %58
58: ; preds = %54, %37, %29, %25, %17
%59 = load i32, i32* %3
ret i32 %59
}

LLVM IR (-O2):
@.str = [3 x i8] c"-h\00"
@.str.1 = [7 x i8] c"--help\00"
@.str.2 = [18 x i8] c"Usage: sleep TIME\00"
@.str.3 = [39 x i8] c"Wait at least TIME seconds, then exit.\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i64 @has_arg(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i64 @has_arg(i32 %0, i8** %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %5, %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
br label %30
11: ; preds = %5
%12 = tail call i64 @bu_handle_version(i32 %0, i8** %1)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %30
14: ; preds = %11
%15 = icmp slt i32 %0, 2
br i1 %15, label %16, label %19
16: ; preds = %14
%17 = load i8*, i8** %1
%18 = tail call i32 @bu_missing_argument(i8* %17)
br label %30
19: ; preds = %14
%20 = icmp eq i32 %0, 2
br i1 %20, label %24, label %21
21: ; preds = %19
%22 = load i8*, i8** %1
%23 = tail call i32 @bu_extra_argument(i8* %22)
br label %30
24: ; preds = %19
%25 = getelementptr inbounds i8*, i8** %1, i64 1
%26 = load i8*, i8** %25
%27 = tail call i32 @atoi(i8* %26)
%28 = tail call i32 @llvm.abs.i32(i32 %27, i1 true)
%29 = tail call i32 @sleep(i32 %28)
br label %30
30: ; preds = %11, %24, %21, %16, %8
%31 = phi i32 [ 1, %8 ], [ 1, %16 ], [ 1, %21 ], [ 0, %24 ], [ 0, %11 ]
ret i32 %31
}