#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*/ printf(char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ usleep(int);
int main(int argc, char **argv) {
  int error = 0;
  int help = 0;
  if ((argc > 2) || ((argc == 2) && (atoi(argv[1]) <= 0))) {
    error = 1;
    help = 1;
  }
  if ((argc == 2) &&
      ((strcmp(argv[1], "--help") == 0) || (strcmp(argv[1], "-h") == 0))) {
    help = 1;
  }
  if (help) {
    printf("Usage : %s [Nbr millisecond]\n", argv[0]);
    return error;
  }
  int delay = ((argc == 2) ? atoi(argv[1]) : 10);
  usleep(delay * 1000);
  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)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x2,-0x8(%rbp)
jg     118e <main+0x4e>
cmpl   $0x2,-0x8(%rbp)
jne    119c <main+0x5c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
cmp    $0x0,%eax
jg     119c <main+0x5c>
movl   $0x1,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    11e9 <main+0xa9>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe4b(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11e2 <main+0xa2>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe34(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11e9 <main+0xa9>
movl   $0x1,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     1211 <main+0xd1>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe09(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1256 <main+0x116>
cmpl   $0x2,-0x8(%rbp)
jne    1230 <main+0xf0>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x20(%rbp)
jmp    123d <main+0xfd>
mov    $0xa,%eax
mov    %eax,-0x20(%rbp)
jmp    123d <main+0xfd>
mov    -0x20(%rbp),%eax
mov    %eax,-0x1c(%rbp)
imul   $0x3e8,-0x1c(%rbp),%edi
call   1060 <usleep@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r15
mov    $0x1,%bl
cmp    $0x2,%edi
jle    1165 <main+0x25>
movzbl %bl,%ebp
mov    (%r15),%rsi
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
jmp    11c4 <main+0x84>
mov    $0x2710,%edi
jne    11bd <main+0x7d>
mov    0x8(%r15),%rbp
mov    %rbp,%rdi
call   1050 <atoi@plt>
mov    %eax,%r14d
test   %eax,%eax
setle  %bl
lea    0xe79(%rip),%rsi
mov    %rbp,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1151 <main+0x11>
mov    0x8(%r15),%rdi
lea    0xe68(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1151 <main+0x11>
test   %r14d,%r14d
jle    1151 <main+0x11>
mov    0x8(%r15),%rdi
call   1050 <atoi@plt>
imul   $0x3e8,%eax,%edi
call   1060 <usleep@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"--help\00"
@.str.1 = [3 x i8] c"-h\00"
@.str.2 = [30 x i8] c"Usage : %s [Nbr millisecond]\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
%9 = load i32, i32* %4
%10 = icmp sgt i32 %9, 2
br i1 %10, label %20, label %11
11: ; preds = %2
%12 = load i32, i32* %4
%13 = icmp eq i32 %12, 2
br i1 %13, label %14, label %21
14: ; preds = %11
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @atoi(i8* %17)
%19 = icmp sle i32 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %14, %2
store i32 1, i32* %6
store i32 1, i32* %7
br label %21
21: ; preds = %20, %14, %11
%22 = load i32, i32* %4
%23 = icmp eq i32 %22, 2
br i1 %23, label %24, label %37
24: ; preds = %21
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i64 @strcmp(i8* %27, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %36, label %30
30: ; preds = %24
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = call i64 @strcmp(i8* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %37
36: ; preds = %30, %24
store i32 1, i32* %7
br label %37
37: ; preds = %36, %30, %21
%38 = load i32, i32* %7
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %46
40: ; preds = %37
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 0
%43 = load i8*, i8** %42
%44 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %43)
%45 = load i32, i32* %6
store i32 %45, i32* %3
br label %60
46: ; preds = %37
%47 = load i32, i32* %4
%48 = icmp eq i32 %47, 2
br i1 %48, label %49, label %54
49: ; preds = %46
%50 = load i8**, i8*** %5
%51 = getelementptr inbounds i8*, i8** %50, i64 1
%52 = load i8*, i8** %51
%53 = call i32 @atoi(i8* %52)
br label %55
54: ; preds = %46
br label %55
55: ; preds = %54, %49
%56 = phi i32 [ %53, %49 ], [ 10, %54 ]
store i32 %56, i32* %8
%57 = load i32, i32* %8
%58 = mul nsw i32 %57, 1000
%59 = call i32 @usleep(i32 %58)
store i32 0, i32* %3
br label %60
60: ; preds = %55, %40
%61 = load i32, i32* %3
ret i32 %61
}

LLVM IR (-O2):
@.str = [7 x i8] c"--help\00"
@.str.1 = [3 x i8] c"-h\00"
@.str.2 = [30 x i8] c"Usage : %s [Nbr millisecond]\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 2
br i1 %3, label %19, label %4
4: ; preds = %2
%5 = icmp eq i32 %0, 2
br i1 %5, label %6, label %28
6: ; preds = %4
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @atoi(i8* %8)
%10 = icmp slt i32 %9, 1
%11 = tail call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %19, label %13
13: ; preds = %6
%14 = load i8*, i8** %7
%15 = tail call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp ne i64 %15, 0
%17 = xor i1 %10, true
%18 = select i1 %16, i1 %17, i1 false
br i1 %18, label %24, label %19
19: ; preds = %6, %13, %2
%20 = phi i1 [ true, %2 ], [ %10, %13 ], [ %10, %6 ]
%21 = zext i1 %20 to i32
%22 = load i8*, i8** %1
%23 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %22)
br label %31
24: ; preds = %13
%25 = load i8*, i8** %7
%26 = tail call i32 @atoi(i8* %25)
%27 = mul i32 %26, 1000
br label %28
28: ; preds = %4, %24
%29 = phi i32 [ %27, %24 ], [ 10000, %4 ]
%30 = tail call i32 @usleep(i32 %29)
br label %31
31: ; preds = %28, %19
%32 = phi i32 [ %21, %19 ], [ 0, %28 ]
ret i32 %32
}