#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 */
unsigned int atoi(char *);
int /*<<< orphan*/ show_help();
int /*<<< orphan*/ sleep(unsigned int);
int strlen(char *);
int main(int argc, char *argv[]) {
  if (argc == 1) {
    show_help();
    return 0;
  }
  char tmp = argv[1][strlen(argv[1]) - 1];
  unsigned int factor = 0;
  switch (tmp) {
  case 's':
  case 'S':
    factor = 1;
    break;
  case 'm':
  case 'M':
    factor = 60;
    break;
  case 'h':
  case 'H':
    factor = 3600;
    break;
  case 'd':
  case 'D':
    factor = 86400;
    break;
  default:
    show_help();
    return -1;
  }
  argv[1][strlen(argv[1]) - 1] = 0;
  sleep(atoi(argv[1]) * factor);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1173 <main+0x33>
mov    $0x0,%al
call   1040 <show_help@plt>
movl   $0x0,-0x4(%rbp)
jmp    1252 <main+0x112>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    %rdi,-0x28(%rbp)
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
add    $0xffffffff,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x11(%rbp)
movl   $0x0,-0x18(%rbp)
movsbl -0x11(%rbp),%eax
add    $0xffffffbc,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x2f,%eax
ja     11f7 <main+0xb7>
mov    -0x20(%rbp),%rax
lea    0xe42(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x18(%rbp)
jmp    120a <main+0xca>
movl   $0x3c,-0x18(%rbp)
jmp    120a <main+0xca>
movl   $0xe10,-0x18(%rbp)
jmp    120a <main+0xca>
movl   $0x15180,-0x18(%rbp)
jmp    120a <main+0xca>
mov    $0x0,%al
call   1040 <show_help@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1252 <main+0x112>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,%edi
imul   -0x18(%rbp),%edi
call   1060 <sleep@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x1,%edi
jne    1154 <main+0x14>
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <show_help@plt>
jmp    11c2 <main+0x82>
mov    %rsi,%r14
mov    0x8(%rsi),%rbp
mov    %rbp,%rdi
call   1030 <strlen@plt>
cltq
movsbl -0x1(%rax,%rbp,1),%eax
add    $0xffffffbc,%eax
cmp    $0x2f,%eax
ja     11c9 <main+0x89>
mov    $0x1,%ebp
lea    0xe82(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x15180,%ebp
jmp    119a <main+0x5a>
mov    $0xe10,%ebp
jmp    119a <main+0x5a>
mov    $0x3c,%ebp
mov    0x8(%r14),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
mov    0x8(%r14),%rdi
call   1050 <atoi@plt>
imul   %eax,%ebp
mov    %ebp,%edi
call   1060 <sleep@plt>
xor    %ebx,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
xor    %eax,%eax
call   1040 <show_help@plt>
mov    $0xffffffff,%ebx
jmp    11c2 <main+0x82>

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 (...) @show_help()
store i32 0, i32* %3
br label %50
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @strlen(i8* %18)
%20 = sub nsw i32 %19, 1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %15, i64 %21
%23 = load i8, i8* %22
store i8 %23, i8* %6
store i32 0, i32* %7
%24 = load i8, i8* %6
%25 = sext i8 %24 to i32
switch i32 %25, label %30 [
i32 115, label %26
i32 83, label %26
i32 109, label %27
i32 77, label %27
i32 104, label %28
i32 72, label %28
i32 100, label %29
i32 68, label %29
]
26: ; preds = %12, %12
store i32 1, i32* %7
br label %32
27: ; preds = %12, %12
store i32 60, i32* %7
br label %32
28: ; preds = %12, %12
store i32 3600, i32* %7
br label %32
29: ; preds = %12, %12
store i32 86400, i32* %7
br label %32
30: ; preds = %12
%31 = call i32 (...) @show_help()
store i32 -1, i32* %3
br label %50
32: ; preds = %29, %28, %27, %26
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = load i8*, i8** %34
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 1
%38 = load i8*, i8** %37
%39 = call i32 @strlen(i8* %38)
%40 = sub nsw i32 %39, 1
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8, i8* %35, i64 %41
store i8 0, i8* %42
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 1
%45 = load i8*, i8** %44
%46 = call i32 @atoi(i8* %45)
%47 = load i32, i32* %7
%48 = mul i32 %46, %47
%49 = call i32 @sleep(i32 %48)
store i32 0, i32* %3
br label %50
50: ; preds = %32, %30, %10
%51 = load i32, i32* %3
ret i32 %51
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (...) @show_help()
br label %31
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @strlen(i8* %8)
%10 = add nsw i32 %9, -1
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %8, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
switch i32 %14, label %18 [
i32 115, label %20
i32 83, label %20
i32 109, label %15
i32 77, label %15
i32 104, label %16
i32 72, label %16
i32 100, label %17
i32 68, label %17
]
15: ; preds = %6, %6
br label %20
16: ; preds = %6, %6
br label %20
17: ; preds = %6, %6
br label %20
18: ; preds = %6
%19 = tail call i32 (...) @show_help()
br label %31
20: ; preds = %6, %6, %17, %16, %15
%21 = phi i32 [ 86400, %17 ], [ 3600, %16 ], [ 60, %15 ], [ 1, %6 ], [ 1, %6 ]
%22 = load i8*, i8** %7
%23 = tail call i32 @strlen(i8* %22)
%24 = add nsw i32 %23, -1
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %22, i64 %25
store i8 0, i8* %26
%27 = load i8*, i8** %7
%28 = tail call i32 @atoi(i8* %27)
%29 = mul i32 %28, %21
%30 = tail call i32 @sleep(i32 %29)
br label %31
31: ; preds = %18, %20, %4
%32 = phi i32 [ 0, %4 ], [ -1, %18 ], [ 0, %20 ]
ret i32 %32
}