#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 _sleep(long);
int _usage();
long strtol(char *, char **, int);
int main(int argc, char *argv[]) {
  long time;
  char *p;
  if (argc != 2)
    return _usage();
  time = strtol(argv[1], &p, 10);
  if (argv[1][0] == '\0' || *p != '\0' || time < 0)
    return _usage();
  return _sleep(time);
}


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)
je     115f <main+0x2f>
mov    $0x0,%al
call   1040 <_usage@plt>
mov    %eax,-0x4(%rbp)
jmp    11c3 <main+0x93>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x20(%rbp),%rsi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11a8 <main+0x78>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    11a8 <main+0x78>
cmpq   $0x0,-0x18(%rbp)
jge    11b7 <main+0x87>
mov    $0x0,%al
call   1040 <_usage@plt>
mov    %eax,-0x4(%rbp)
jmp    11c3 <main+0x93>
mov    -0x18(%rbp),%rdi
call   1030 <_sleep@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
cmp    $0x2,%edi
jne    1175 <main+0x45>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0x8(%rsp),%rsi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    0x8(%rbx),%rcx
cmpb   $0x0,(%rcx)
je     1175 <main+0x45>
mov    0x8(%rsp),%rcx
cmpb   $0x0,(%rcx)
jne    1175 <main+0x45>
test   %rax,%rax
js     1175 <main+0x45>
mov    %rax,%rdi
add    $0x10,%rsp
pop    %rbx
jmp    1030 <_sleep@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
jmp    1040 <_usage@plt>

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 2
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 (...) @_usage()
store i32 %11, i32* %3
br label %37
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i64 @strtol(i8* %15, i8** %7, i32 10)
store i64 %16, i64* %6
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = getelementptr inbounds i8, i8* %19, i64 0
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 0
br i1 %23, label %32, label %24
24: ; preds = %12
%25 = load i8*, i8** %7
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp ne i32 %27, 0
br i1 %28, label %32, label %29
29: ; preds = %24
%30 = load i64, i64* %6
%31 = icmp slt i64 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %29, %24, %12
%33 = call i32 (...) @_usage()
store i32 %33, i32* %3
br label %37
34: ; preds = %29
%35 = load i64, i64* %6
%36 = call i32 @_sleep(i64 %35)
store i32 %36, i32* %3
br label %37
37: ; preds = %34, %32, %10
%38 = load i32, i32* %3
ret i32 %38
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = icmp eq i32 %0, 2
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 (...) @_usage()
br label %25
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = call i64 @strtol(i8* %10, i8** %3, i32 10)
%12 = load i8*, i8** %9
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %21, label %15
15: ; preds = %8
%16 = load i8*, i8** %3
%17 = load i8, i8* %16
%18 = icmp ne i8 %17, 0
%19 = icmp slt i64 %11, 0
%20 = select i1 %18, i1 true, i1 %19
br i1 %20, label %21, label %23
21: ; preds = %15, %8
%22 = tail call i32 (...) @_usage()
br label %25
23: ; preds = %15
%24 = tail call i32 @_sleep(i64 %11)
br label %25
25: ; preds = %23, %21, %6
%26 = phi i32 [ %7, %6 ], [ %22, %21 ], [ %24, %23 ]
ret i32 %26
}