#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 EXIT_SUCCESS;
int errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
char *strerror(int);
scalar_t__ strstart(char *, char *);
scalar_t__ umount(char *);
int /*<<< orphan*/ usage(int);
int main(int argc, char **argv) {
  char *resource;
  if (argc != 2) {
    fprintf(stderr, "%s: Bad usage\n", "manually-umount");
    usage(148);
  }
  if (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0)
    usage(EXIT_SUCCESS);
  else if (strstart(argv[1], "-")) {
    fprintf(stderr, "%s: Unknown option %s\n", "manually-umount", argv[1]);
    usage(147);
  }
  resource = argv[1];
  if (umount(resource) != 0) {
    fprintf(stderr, "%s: Failed umounting resource %s\n", "manually-umount",
            resource);
    fprintf(stderr, "Error (%d) info: %s\n", errno, strerror(errno));
    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     11a8 <main+0x48>
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
lea    0xe70(%rip),%rsi
lea    0xe78(%rip),%rdx
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x94,%edi
call   1070 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe68(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     11e4 <main+0x84>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe4d(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11f7 <main+0x97>
mov    0x2de5(%rip),%rax
mov    (%rax),%edi
call   1070 <usage@plt>
jmp    124a <main+0xea>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe23(%rip),%rsi
call   1030 <strstart@plt>
cmp    $0x0,%rax
je     1245 <main+0xe5>
mov    0x2dc4(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xdfe(%rip),%rsi
lea    0xddb(%rip),%rdx
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x93,%edi
call   1070 <usage@plt>
jmp    124a <main+0xea>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <umount@plt>
cmp    $0x0,%rax
je     12d4 <main+0x174>
mov    0x2d70(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rcx
lea    0xdc5(%rip),%rsi
lea    0xd8b(%rip),%rdx
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2d4e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    0x2d3a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    0x2d2e(%rip),%rax
mov    (%rax),%edi
call   1080 <strerror@plt>
mov    -0x20(%rbp),%edi
mov    -0x1c(%rbp),%edx
mov    %rax,%rcx
lea    0xda3(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12db <main+0x17b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x2,%edi
je     1193 <main+0x33>
mov    0x2e6e(%rip),%rax
mov    (%rax),%edi
lea    0xe85(%rip),%rsi
lea    0xe8d(%rip),%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x94,%edi
call   1070 <usage@plt>
mov    0x8(%rbx),%rdi
lea    0xe81(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11fb <main+0x9b>
mov    0x8(%rbx),%rdi
lea    0xe6f(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11fb <main+0x9b>
mov    0x8(%rbx),%rdi
lea    0xe61(%rip),%rsi
call   1030 <strstart@plt>
test   %rax,%rax
je     1209 <main+0xa9>
mov    0x2e07(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rcx
lea    0xe45(%rip),%rsi
lea    0xe22(%rip),%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x93,%edi
jmp    1204 <main+0xa4>
mov    0x2dce(%rip),%rax
mov    (%rax),%edi
call   1070 <usage@plt>
mov    0x8(%rbx),%rbx
mov    %rbx,%rdi
call   1040 <umount@plt>
test   %rax,%rax
je     126b <main+0x10b>
mov    0x2dbf(%rip),%rbp
mov    0x0(%rbp),%edi
lea    0xe17(%rip),%rsi
lea    0xddd(%rip),%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    0x0(%rbp),%ebx
mov    0x2d92(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   1080 <strerror@plt>
lea    0xe0e(%rip),%rsi
mov    %ebx,%edi
mov    %ebp,%edx
mov    %rax,%rcx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%eax
jmp    126d <main+0x10d>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [15 x i8] c"%s: Bad usage\0A\00"
@.str.1 = [16 x i8] c"manually-umount\00"
@.str.2 = [3 x i8] c"-h\00"
@.str.3 = [7 x i8] c"--help\00"
@EXIT_SUCCESS = global i32 0
@.str.4 = [2 x i8] c"-\00"
@.str.5 = [23 x i8] c"%s: Unknown option %s\0A\00"
@.str.6 = [34 x i8] c"%s: Failed umounting resource %s\0A\00"
@.str.7 = [21 x i8] c"Error (%d) info: %s\0A\00"
@errno = global i32 0
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 %13
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @usage(i32 148)
br label %13
13: ; preds = %9, %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %25, label %19
19: ; preds = %13
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %19, %13
%26 = load i32, i32* @EXIT_SUCCESS
%27 = call i32 @usage(i32 %26)
br label %42
28: ; preds = %19
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = call i64 @strstart(i8* %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%33 = icmp ne i64 %32, 0
br i1 %33, label %34, label %41
34: ; preds = %28
%35 = load i32, i32* @stderr
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 1
%38 = load i8*, i8** %37
%39 = call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %38)
%40 = call i32 @usage(i32 147)
br label %41
41: ; preds = %34, %28
br label %42
42: ; preds = %41, %25
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 1
%45 = load i8*, i8** %44
store i8* %45, i8** %6
%46 = load i8*, i8** %6
%47 = call i64 @umount(i8* %46)
%48 = icmp ne i64 %47, 0
br i1 %48, label %49, label %58
49: ; preds = %42
%50 = load i32, i32* @stderr
%51 = load i8*, i8** %6
%52 = call i32 (i32, i8*, ...) @fprintf(i32 %50, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %51)
%53 = load i32, i32* @stderr
%54 = load i32, i32* @errno
%55 = load i32, i32* @errno
%56 = call i8* @strerror(i32 %55)
%57 = call i32 (i32, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i32 %54, i8* %56)
store i32 1, i32* %3
br label %59
58: ; preds = %42
store i32 0, i32* %3
br label %59
59: ; preds = %58, %49
%60 = load i32, i32* %3
ret i32 %60
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [15 x i8] c"%s: Bad usage\0A\00"
@.str.1 = [16 x i8] c"manually-umount\00"
@.str.2 = [3 x i8] c"-h\00"
@.str.3 = [7 x i8] c"--help\00"
@EXIT_SUCCESS = global i32 0
@.str.4 = [2 x i8] c"-\00"
@.str.5 = [23 x i8] c"%s: Unknown option %s\0A\00"
@.str.6 = [34 x i8] c"%s: Failed umounting resource %s\0A\00"
@.str.7 = [21 x i8] c"Error (%d) info: %s\0A\00"
@errno = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @usage(i32 148)
br label %8
8: ; preds = %4, %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %17, label %13
13: ; preds = %8
%14 = load i8*, i8** %9
%15 = tail call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %13, %8
%18 = load i32, i32* @EXIT_SUCCESS
br label %27
19: ; preds = %13
%20 = load i8*, i8** %9
%21 = tail call i64 @strstart(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %30, label %23
23: ; preds = %19
%24 = load i32, i32* @stderr
%25 = load i8*, i8** %9
%26 = tail call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %25)
br label %27
27: ; preds = %17, %23
%28 = phi i32 [ 147, %23 ], [ %18, %17 ]
%29 = tail call i32 @usage(i32 %28)
br label %30
30: ; preds = %27, %19
%31 = load i8*, i8** %9
%32 = tail call i64 @umount(i8* %31)
%33 = icmp eq i64 %32, 0
br i1 %33, label %41, label %34
34: ; preds = %30
%35 = load i32, i32* @stderr
%36 = tail call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %31)
%37 = load i32, i32* @stderr
%38 = load i32, i32* @errno
%39 = tail call i8* @strerror(i32 %38)
%40 = tail call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i32 %38, i8* %39)
br label %41
41: ; preds = %30, %34
%42 = phi i32 [ 1, %34 ], [ 0, %30 ]
ret i32 %42
}