#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[]) {
  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/sdg1", "/mnt/memory", NULL);
      printf("Mount flash\n");
    }
    if (arg[1][1] == 'u') {
      execlp("umount", "umount", "/mnt/memory", NULL);
      printf("Umount flash\n");
    }
  } else {
    printf("Usage: -m = mount; -u = umount.\n");
    return 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   $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    0xebd(%rip),%rsi
lea    0xe92(%rip),%rdx
lea    0xe95(%rip),%rcx
xor    %eax,%eax
mov    %eax,%r8d
mov    %rsi,%rdi
mov    $0x0,%al
call   1040 <execlp@plt>
lea    0xe8b(%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    0xe77(%rip),%rsi
lea    0xe57(%rip),%rdx
xor    %eax,%eax
mov    %eax,%ecx
mov    %rsi,%rdi
mov    $0x0,%al
call   1040 <execlp@plt>
lea    0xe62(%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    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %edi,%eax
lea    0xf0c(%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    0xece(%rip),%rdi
lea    0xeb0(%rip),%rdx
lea    0xeb3(%rip),%rcx
mov    %rdi,%rsi
xor    %r8d,%r8d
xor    %eax,%eax
call   1040 <execlp@plt>
lea    0xebf(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rbx),%rax
mov    0x1(%rax),%al
cmp    $0x75,%al
jne    11a1 <main+0x81>
lea    0xe94(%rip),%rdi
lea    0xe81(%rip),%rdx
mov    %rdi,%rsi
xor    %ecx,%ecx
xor    %eax,%eax
call   1040 <execlp@plt>
lea    0xe81(%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 = [10 x i8] c"/dev/sdg1\00"
@.str.3 = [12 x i8] c"/mnt/memory\00"
@.str.4 = [13 x i8] c"Mount flash\0A\00"
@.str.5 = [7 x i8] c"umount\00"
@.str.6 = [14 x i8] c"Umount flash\0A\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, 2
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %43
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = getelementptr inbounds i8, i8* %13, i64 0
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 45
br i1 %17, label %18, label %41
18: ; preds = %10
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = getelementptr inbounds i8, i8* %21, i64 1
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 109
br i1 %25, label %26, label %29
26: ; preds = %18
%27 = 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 ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* null)
%28 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
br label %29
29: ; preds = %26, %18
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
%33 = getelementptr inbounds i8, i8* %32, i64 1
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = icmp eq i32 %35, 117
br i1 %36, label %37, label %40
37: ; preds = %29
%38 = 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 ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* null)
%39 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
br label %40
40: ; preds = %37, %29
br label %43
41: ; preds = %10
%42 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %43
43: ; preds = %8, %41, %40
%44 = load i32, i32* %3
ret i32 %44
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"mount\00"
@.str.2 = [10 x i8] c"/dev/sdg1\00"
@.str.3 = [12 x i8] c"/mnt/memory\00"
@.str.5 = [7 x i8] c"umount\00"
@str.7 = [13 x i8] c"Umount flash\00"
@str.8 = [12 x i8] c"Mount flash\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 ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* null)
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 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 ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* null)
br label %24
24: ; preds = %4, %2, %22
%25 = phi i8* [ getelementptr inbounds ([13 x i8], [13 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
}