#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 */
char *getdev(char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ rm_mtab(char *);
scalar_t__ umount(char *);
int main(int argc, char *argv[]) {
  char *dev;
  if (argc != 2) {
    printf("usage: umount device\n");
    return 1;
  }
  dev = getdev(argv[1]);
  if (!dev)
    dev = argv[1];
  if (umount(dev) == 0) {
    rm_mtab(dev);
  } else {
    perror("umount");
    return 1;
  }
  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     1188 <main+0x38>
lea    0xe89(%rip),%rdi
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11f0 <main+0xa0>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <getdev@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11b0 <main+0x60>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <umount@plt>
cmp    $0x0,%rax
jne    11d1 <main+0x81>
mov    -0x18(%rbp),%rdi
call   1060 <rm_mtab@plt>
jmp    11e9 <main+0x99>
lea    0xe3e(%rip),%rdi
call   1070 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    11f0 <main+0xa0>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%edi
jne    118a <main+0x3a>
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
call   1050 <getdev@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1171 <main+0x21>
mov    0x8(%r14),%rbx
mov    %rbx,%rdi
call   1040 <umount@plt>
test   %rax,%rax
jne    11a3 <main+0x53>
mov    %rbx,%rdi
call   1060 <rm_mtab@plt>
xor    %eax,%eax
jmp    119b <main+0x4b>
lea    0xe76(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe56(%rip),%rdi
call   1070 <perror@plt>
jmp    1196 <main+0x46>

LLVM IR (-O0):
@.str = [22 x i8] c"usage: umount device\0A\00"
@.str.1 = [7 x i8] c"umount\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
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 ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %32
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i8* @getdev(i8* %14)
store i8* %15, i8** %6
%16 = load i8*, i8** %6
%17 = icmp ne i8* %16, null
br i1 %17, label %22, label %18
18: ; preds = %11
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
store i8* %21, i8** %6
br label %22
22: ; preds = %18, %11
%23 = load i8*, i8** %6
%24 = call i64 @umount(i8* %23)
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %22
%27 = load i8*, i8** %6
%28 = call i32 @rm_mtab(i8* %27)
br label %31
29: ; preds = %22
%30 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %32
31: ; preds = %26
store i32 0, i32* %3
br label %32
32: ; preds = %31, %29, %9
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
@.str.1 = [7 x i8] c"umount\00"
@str = [21 x i8] c"usage: umount device\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
br label %21
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i8* @getdev(i8* %8)
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %13
11: ; preds = %6
%12 = load i8*, i8** %7
br label %13
13: ; preds = %11, %6
%14 = phi i8* [ %9, %6 ], [ %12, %11 ]
%15 = tail call i64 @umount(i8* %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = tail call i32 @rm_mtab(i8* %14)
br label %21
19: ; preds = %13
%20 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %21
21: ; preds = %17, %19, %4
%22 = phi i32 [ 1, %4 ], [ 0, %17 ], [ 1, %19 ]
ret i32 %22
}