#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*/ atoi(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int /*<<< orphan*/);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ usleep(int /*<<< orphan*/);
int main(int argc, char **argv) {
  if (argc != 3)
    printf("Usage : sleep unit duration\n");
  if (strcmp("ms", argv[1]) == 0)
    sleep(atoi(argv[2]));
  else if (strcmp("us", argv[1]) == 0)
    usleep(atoi(argv[2]));
  exit(0);
}


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   $0x3,-0x8(%rbp)
je     118c <main+0x2c>
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe82(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11c3 <main+0x63>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,%edi
call   1070 <sleep@plt>
jmp    11fa <main+0x9a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe4e(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11f5 <main+0x95>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,%edi
call   1080 <usleep@plt>
jmp    11fa <main+0x9a>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x3,%edi
je     1175 <main+0x15>
lea    0xe96(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rbx),%rsi
lea    0xe80(%rip),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    11a1 <main+0x41>
mov    0x10(%rbx),%rdi
call   1050 <atoi@plt>
mov    %eax,%edi
call   1070 <sleep@plt>
xor    %edi,%edi
call   1060 <exit@plt>
mov    0x8(%rbx),%rsi
lea    0xe57(%rip),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    11c6 <main+0x66>
mov    0x10(%rbx),%rdi
call   1050 <atoi@plt>
mov    %eax,%edi
call   1080 <usleep@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"Usage : sleep unit duration\0A\00"
@.str.1 = [3 x i8] c"ms\00"
@.str.2 = [3 x i8] c"us\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 ne i32 %6, 3
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %22
16: ; preds = %10
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
%20 = call i32 @atoi(i8* %19)
%21 = call i32 @sleep(i32 %20)
br label %35
22: ; preds = %10
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %25)
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %34
28: ; preds = %22
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 2
%31 = load i8*, i8** %30
%32 = call i32 @atoi(i8* %31)
%33 = call i32 @usleep(i32 %32)
br label %34
34: ; preds = %28, %22
br label %35
35: ; preds = %34, %16
%36 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"ms\00"
@.str.2 = [3 x i8] c"us\00"
@str = [28 x i8] c"Usage : sleep unit duration\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
br label %6
6: ; preds = %4, %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %6
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = tail call i32 @atoi(i8* %13)
%15 = tail call i32 @sleep(i32 %14)
br label %25
16: ; preds = %6
%17 = load i8*, i8** %7
%18 = tail call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %17)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %25
20: ; preds = %16
%21 = getelementptr inbounds i8*, i8** %1, i64 2
%22 = load i8*, i8** %21
%23 = tail call i32 @atoi(i8* %22)
%24 = tail call i32 @usleep(i32 %23)
br label %25
25: ; preds = %16, %20, %11
%26 = tail call i32 @exit(i32 0)
unreachable
}