#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 EXIT_SUCCESS;
int convert(char *, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ sleep(unsigned int);
int main(int argc, char *argv[]) {
  if (argc > 1) {
    int duration = convert(argv[1], 10);
    if (duration > 0) {
      sleep((unsigned int)duration);
    }
  } else {
    printf("usage: %s duration\n", argv[0]);
  }
  return EXIT_SUCCESS;
}


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   $0x1,-0x8(%rbp)
jle    117c <main+0x4c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    $0xa,%esi
call   1030 <convert@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    1177 <main+0x47>
mov    -0x14(%rbp),%edi
call   1050 <sleep@plt>
jmp    118f <main+0x5f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe76(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e4a(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jl     1151 <main+0x21>
mov    0x8(%rsi),%rdi
mov    $0xa,%esi
call   1030 <convert@plt>
test   %eax,%eax
jle    1160 <main+0x30>
mov    %eax,%edi
call   1050 <sleep@plt>
jmp    1160 <main+0x30>
mov    (%rsi),%rsi
lea    0xea5(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e79(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"usage: %s duration\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %20
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @convert(i8* %12, i32 10)
store i32 %13, i32* %6
%14 = load i32, i32* %6
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %9
%17 = load i32, i32* %6
%18 = call i32 @sleep(i32 %17)
br label %19
19: ; preds = %16, %9
br label %25
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 0
%23 = load i8*, i8** %22
%24 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %23)
br label %25
25: ; preds = %20, %19
%26 = load i32, i32* @EXIT_SUCCESS
ret i32 %26
}

LLVM IR (-O2):
@.str = [20 x i8] c"usage: %s duration\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %11
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @convert(i8* %6, i32 10)
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %4
%10 = tail call i32 @sleep(i32 %7)
br label %14
11: ; preds = %2
%12 = load i8*, i8** %1
%13 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %12)
br label %14
14: ; preds = %4, %9, %11
%15 = load i32, i32* @EXIT_SUCCESS
ret i32 %15
}