#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*/ execlp(char *, char *, char *, char *, ...);
int /*<<< orphan*/ printf(char *);
int main(int na, char *arg[]) {
  int f;
  if (na != 2) {
    printf("Usage: -m = mount; -u = umount.\n");
    return 0;
  }
  if (arg[1][0] == '-') {
    if (arg[1][1] == 'm') {
      execlp("mount", "mount", "/dev/sr0", "/mnt/cdrom", NULL);
      printf("Mount cd/dvd rom\n");
    }
    if (arg[1][1] == 'u') {
      execlp("umount", "umount", "/mnt/cdrom", NULL);
      printf("Umount cd/dvd rom\n");
    }
  } else {
    printf("Usage: -m = mount; -u = umount.\n");
    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)
cmpl   $0x2,-0x8(%rbp)
je     1158 <main+0x38>
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1206 <main+0xe6>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    11f3 <main+0xd3>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl 0x1(%rax),%eax
cmp    $0x6d,%eax
jne    11b1 <main+0x91>
lea    0xec0(%rip),%rsi
lea    0xe92(%rip),%rdx
lea    0xe94(%rip),%rcx
xor    %eax,%eax
mov    %eax,%r8d
mov    %rsi,%rdi
mov    $0x0,%al
call   1040 <execlp@plt>
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl 0x1(%rax),%eax
cmp    $0x75,%eax
jne    11ee <main+0xce>
lea    0xe7a(%rip),%rsi
lea    0xe56(%rip),%rdx
xor    %eax,%eax
mov    %eax,%ecx
mov    %rsi,%rdi
mov    $0x0,%al
call   1040 <execlp@plt>
lea    0xe65(%rip),%rdi
call   1030 <printf@plt>
jmp    1206 <main+0xe6>
lea    0xe06(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %edi,%eax
lea    0xf14(%rip),%rdi
cmp    $0x2,%eax
jne    119c <main+0x7c>
mov    %rsi,%rbx
mov    0x8(%rsi),%rax
cmpb   $0x2d,(%rax)
jne    119c <main+0x7c>
mov    0x1(%rax),%al
cmp    $0x6d,%al
jne    1177 <main+0x57>
lea    0xecc(%rip),%rdi
lea    0xeb0(%rip),%rdx
lea    0xeb2(%rip),%rcx
mov    %rdi,%rsi
xor    %r8d,%r8d
xor    %eax,%eax
call   1040 <execlp@plt>
lea    0xec2(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rbx),%rax
mov    0x1(%rax),%al
cmp    $0x75,%al
jne    11a1 <main+0x81>
lea    0xe92(%rip),%rdi
lea    0xe80(%rip),%rdx
mov    %rdi,%rsi
xor    %ecx,%ecx
xor    %eax,%eax
call   1040 <execlp@plt>
lea    0xe7f(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Usage: -m = mount; -u = umount.\0A\00"
@.str.1 = [6 x i8] c"mount\00"
@.str.2 = [9 x i8] c"/dev/sr0\00"
@.str.3 = [11 x i8] c"/mnt/cdrom\00"
@.str.4 = [18 x i8] c"Mount cd/dvd rom\0A\00"
@.str.5 = [7 x i8] c"umount\00"
@.str.6 = [19 x i8] c"Umount cd/dvd rom\0A\00"
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 ne i32 %7, 2
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %44
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = getelementptr inbounds i8, i8* %14, i64 0
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 45
br i1 %18, label %19, label %42
19: ; preds = %11
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = getelementptr inbounds i8, i8* %22, i64 1
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 109
br i1 %26, label %27, label %30
27: ; preds = %19
%28 = call i32 (i8*, i8*, i8*, i8*, ...) @execlp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* null)
%29 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
br label %30
30: ; preds = %27, %19
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = getelementptr inbounds i8, i8* %33, i64 1
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 117
br i1 %37, label %38, label %41
38: ; preds = %30
%39 = call i32 (i8*, i8*, i8*, i8*, ...) @execlp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* null)
%40 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
br label %41
41: ; preds = %38, %30
br label %44
42: ; preds = %11
%43 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %44
44: ; preds = %9, %42, %41
%45 = load i32, i32* %3
ret i32 %45
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"mount\00"
@.str.2 = [9 x i8] c"/dev/sr0\00"
@.str.3 = [11 x i8] c"/mnt/cdrom\00"
@.str.5 = [7 x i8] c"umount\00"
@str.7 = [18 x i8] c"Umount cd/dvd rom\00"
@str.8 = [17 x i8] c"Mount cd/dvd rom\00"
@str.9 = [32 x i8] c"Usage: -m = mount; -u = umount.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %24
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 45
br i1 %8, label %9, label %24
9: ; preds = %4
%10 = getelementptr inbounds i8, i8* %6, i64 1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 109
br i1 %12, label %13, label %19
13: ; preds = %9
%14 = tail call i32 (i8*, i8*, i8*, i8*, ...) @execlp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* null)
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.8, i64 0, i64 0))
%16 = load i8*, i8** %5
%17 = getelementptr inbounds i8, i8* %16, i64 1
%18 = load i8, i8* %17
br label %19
19: ; preds = %13, %9
%20 = phi i8 [ %18, %13 ], [ %11, %9 ]
%21 = icmp eq i8 %20, 117
br i1 %21, label %22, label %27
22: ; preds = %19
%23 = tail call i32 (i8*, i8*, i8*, i8*, ...) @execlp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* null)
br label %24
24: ; preds = %4, %2, %22
%25 = phi i8* [ getelementptr inbounds ([18 x i8], [18 x i8]* @str.7, i64 0, i64 0), %22 ], [ getelementptr inbounds ([32 x i8], [32 x i8]* @str.9, i64 0, i64 0), %2 ], [ getelementptr inbounds ([32 x i8], [32 x i8]* @str.9, i64 0, i64 0), %4 ]
%26 = tail call i32 @puts(i8* dereferenceable(1) %25)
br label %27
27: ; preds = %24, %19
ret i32 0
}