#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 */
#define ENODEV 128
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ SIG_BLOCK;
int /*<<< orphan*/ SIG_UNBLOCK;
int /*<<< orphan*/ block_signals(int /*<<< orphan*/);
int errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ modprobe();
scalar_t__ mount(char *, char const *, char *, int, char *);
char *mount_resolve_src(char const *);
int parse_arguments(int, char **, char const **, char const **, char const **);
char *parse_options(char const *, int *);
int /*<<< orphan*/ printf(char *, ...);
char *strerror(int);
int /*<<< orphan*/ update_mtab_entry(char *, char const *, char *, char *, int,
                                     int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ usage(char *);
int main(int argc, char *argv[]) {
  const char *src, *node, *opts;
  char *rsrc = NULL;
  char *popts = NULL;
  int flags = 0;
  int retval = 0;
  retval = parse_arguments(argc, argv, &src, &node, &opts);
  if (retval) {
    usage(argv[0]);
    exit((retval > 0) ? EXIT_SUCCESS : EXIT_FAILURE);
  }
  rsrc = mount_resolve_src(src);
  if (!rsrc) {
    printf("failed to resolve source\n");
    exit(1);
  }
  modprobe();
  popts = parse_options(opts, &flags);
  if (!popts) {
    printf("failed to parse ceph_options\n");
    exit(1);
  }
  block_signals(SIG_BLOCK);
  if (mount(rsrc, node, "ceph", flags, popts)) {
    retval = errno;
    switch (errno) {
    case ENODEV:
      printf("mount error: ceph filesystem not supported by the system\n");
      break;
    default:
      printf("mount error %d = %s\n", errno, strerror(errno));
    }
  } else {
    update_mtab_entry(rsrc, node, "ceph", popts, flags, 0, 0);
  }
  block_signals(SIG_UNBLOCK);
  free(popts);
  free(rsrc);
  exit(retval);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rcx
lea    -0x28(%rbp),%r8
call   1090 <parse_arguments@plt>
mov    %eax,-0x40(%rbp)
cmpl   $0x0,-0x40(%rbp)
je     1254 <main+0x94>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10c0 <usage@plt>
cmpl   $0x0,-0x40(%rbp)
jle    1240 <main+0x80>
mov    0x2d8a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
jmp    124c <main+0x8c>
mov    0x2d81(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%edi
call   10d0 <exit@plt>
mov    -0x18(%rbp),%rdi
call   1060 <mount_resolve_src@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1284 <main+0xc4>
lea    0xd8d(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    $0x0,%al
call   1040 <modprobe@plt>
mov    -0x28(%rbp),%rdi
lea    -0x3c(%rbp),%rsi
call   1050 <parse_options@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    12bf <main+0xff>
lea    0xd6c(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    0x2d0a(%rip),%rax
mov    (%rax),%edi
call   10b0 <block_signals@plt>
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x3c(%rbp),%ecx
mov    -0x38(%rbp),%r8
lea    0xd55(%rip),%rdx
call   1070 <mount@plt>
cmp    $0x0,%rax
je     1356 <main+0x196>
mov    0x2cdf(%rip),%rax
mov    (%rax),%ecx
mov    %ecx,-0x40(%rbp)
mov    (%rax),%eax
sub    $0x80,%eax
jne    1323 <main+0x163>
jmp    1310 <main+0x150>
lea    0xd26(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
jmp    1351 <main+0x191>
mov    0x2cae(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    0x2ca2(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0x48(%rbp),%esi
mov    %rax,%rdx
lea    0xd2d(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
jmp    137c <main+0x1bc>
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x38(%rbp),%rcx
mov    -0x3c(%rbp),%r8d
lea    0xccb(%rip),%rdx
xor    %r9d,%r9d
movl   $0x0,(%rsp)
call   10a0 <update_mtab_entry@plt>
mov    0x2c65(%rip),%rax
mov    (%rax),%edi
call   10b0 <block_signals@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%edi
call   10d0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    %rsi,%rbx
movl   $0x0,0x14(%rsp)
lea    0x28(%rsp),%rdx
lea    0x18(%rsp),%rcx
lea    0x20(%rsp),%r8
call   10a0 <parse_arguments@plt>
test   %eax,%eax
jne    1213 <main+0x43>
mov    0x28(%rsp),%rdi
call   1070 <mount_resolve_src@plt>
test   %rax,%rax
jne    122f <main+0x5f>
lea    0xe09(%rip),%rdi
jmp    1254 <main+0x84>
mov    %eax,%ebp
mov    (%rbx),%rdi
call   10d0 <usage@plt>
test   %ebp,%ebp
jle    1263 <main+0x93>
mov    0x2d98(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1040 <modprobe@plt>
mov    0x20(%rsp),%rdi
lea    0x14(%rsp),%rsi
call   1060 <parse_options@plt>
test   %rax,%rax
jne    1271 <main+0xa1>
lea    0xddf(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    0x2d5e(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    %rax,%r14
mov    0x2d55(%rip),%rax
mov    (%rax),%edi
call   10c0 <block_signals@plt>
mov    0x18(%rsp),%rsi
mov    0x14(%rsp),%ecx
lea    0xd6e(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%r8
call   1080 <mount@plt>
test   %rax,%rax
jne    12cc <main+0xfc>
mov    0x18(%rsp),%rsi
mov    0x14(%rsp),%r8d
movl   $0x0,(%rsp)
lea    0xd46(%rip),%rdx
xor    %ebp,%ebp
mov    %rbx,%rdi
mov    %r14,%rcx
xor    %r9d,%r9d
call   10b0 <update_mtab_entry@plt>
jmp    130a <main+0x13a>
mov    0x2d05(%rip),%rax
mov    (%rax),%ebp
cmp    $0x80,%ebp
jne    12f0 <main+0x120>
lea    0xd6c(%rip),%rdi
call   1050 <puts@plt>
mov    $0x80,%ebp
jmp    130a <main+0x13a>
mov    %ebp,%edi
call   10f0 <strerror@plt>
lea    0xd07(%rip),%rdi
mov    %ebp,%esi
mov    %rax,%rdx
xor    %eax,%eax
call   1090 <printf@plt>
mov    0x2cd7(%rip),%rax
mov    (%rax),%edi
call   10c0 <block_signals@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
@EXIT_FAILURE = global i32 0
@.str = [26 x i8] c"failed to resolve source\0A\00"
@.str.1 = [30 x i8] c"failed to parse ceph_options\0A\00"
@SIG_BLOCK = global i32 0
@.str.2 = [5 x i8] c"ceph\00"
@errno = global i32 0
@.str.3 = [58 x i8] c"mount error: ceph filesystem not supported by the system\0A\00"
@.str.4 = [21 x i8] c"mount error %d = %s\0A\00"
@SIG_UNBLOCK = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %9
store i8* null, i8** %10
store i32 0, i32* %11
store i32 0, i32* %12
%13 = load i32, i32* %4
%14 = load i8**, i8*** %5
%15 = call i32 @parse_arguments(i32 %13, i8** %14, i8** %6, i8** %7, i8** %8)
store i32 %15, i32* %12
%16 = load i32, i32* %12
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %32
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 0
%21 = load i8*, i8** %20
%22 = call i32 @usage(i8* %21)
%23 = load i32, i32* %12
%24 = icmp sgt i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %18
%26 = load i32, i32* @EXIT_SUCCESS
br label %29
27: ; preds = %18
%28 = load i32, i32* @EXIT_FAILURE
br label %29
29: ; preds = %27, %25
%30 = phi i32 [ %26, %25 ], [ %28, %27 ]
%31 = call i32 @exit(i32 %30)
unreachable
32: ; preds = %2
%33 = load i8*, i8** %6
%34 = call i8* @mount_resolve_src(i8* %33)
store i8* %34, i8** %9
%35 = load i8*, i8** %9
%36 = icmp ne i8* %35, null
br i1 %36, label %40, label %37
37: ; preds = %32
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%39 = call i32 @exit(i32 1)
unreachable
40: ; preds = %32
%41 = call i32 (...) @modprobe()
%42 = load i8*, i8** %8
%43 = call i8* @parse_options(i8* %42, i32* %11)
store i8* %43, i8** %10
%44 = load i8*, i8** %10
%45 = icmp ne i8* %44, null
br i1 %45, label %49, label %46
46: ; preds = %40
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%48 = call i32 @exit(i32 1)
unreachable
49: ; preds = %40
%50 = load i32, i32* @SIG_BLOCK
%51 = call i32 @block_signals(i32 %50)
%52 = load i8*, i8** %9
%53 = load i8*, i8** %7
%54 = load i32, i32* %11
%55 = load i8*, i8** %10
%56 = call i64 @mount(i8* %52, i8* %53, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %54, i8* %55)
%57 = icmp ne i64 %56, 0
br i1 %57, label %58, label %69
58: ; preds = %49
%59 = load i32, i32* @errno
store i32 %59, i32* %12
%60 = load i32, i32* @errno
switch i32 %60, label %63 [
i32 128, label %61
]
61: ; preds = %58
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.3, i64 0, i64 0))
br label %68
63: ; preds = %58
%64 = load i32, i32* @errno
%65 = load i32, i32* @errno
%66 = call i8* @strerror(i32 %65)
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %64, i8* %66)
br label %68
68: ; preds = %63, %61
br label %75
69: ; preds = %49
%70 = load i8*, i8** %9
%71 = load i8*, i8** %7
%72 = load i8*, i8** %10
%73 = load i32, i32* %11
%74 = call i32 @update_mtab_entry(i8* %70, i8* %71, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %72, i32 %73, i32 0, i32 0)
br label %75
75: ; preds = %69, %68
%76 = load i32, i32* @SIG_UNBLOCK
%77 = call i32 @block_signals(i32 %76)
%78 = load i8*, i8** %10
%79 = call i32 @free(i8* %78)
%80 = load i8*, i8** %9
%81 = call i32 @free(i8* %80)
%82 = load i32, i32* %12
%83 = call i32 @exit(i32 %82)
unreachable
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@EXIT_FAILURE = global i32 0
@SIG_BLOCK = global i32 0
@.str.2 = [5 x i8] c"ceph\00"
@errno = global i32 0
@.str.4 = [21 x i8] c"mount error %d = %s\0A\00"
@SIG_UNBLOCK = global i32 0
@str = [25 x i8] c"failed to resolve source\00"
@str.5 = [29 x i8] c"failed to parse ceph_options\00"
@str.6 = [57 x i8] c"mount error: ceph filesystem not supported by the system\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = bitcast i8** %3 to i8*
%8 = bitcast i8** %4 to i8*
%9 = bitcast i8** %5 to i8*
%10 = bitcast i32* %6 to i8*
store i32 0, i32* %6
%11 = call i32 @parse_arguments(i32 %0, i8** %1, i8** %3, i8** %4, i8** %5)
%12 = icmp eq i32 %11, 0
br i1 %12, label %21, label %13
13: ; preds = %2
%14 = load i8*, i8** %1
%15 = call i32 @usage(i8* %14)
%16 = icmp sgt i32 %11, 0
%17 = load i32, i32* @EXIT_SUCCESS
%18 = load i32, i32* @EXIT_FAILURE
%19 = select i1 %16, i32 %17, i32 %18
%20 = call i32 @exit(i32 %19)
unreachable
21: ; preds = %2
%22 = load i8*, i8** %3
%23 = call i8* @mount_resolve_src(i8* %22)
%24 = icmp eq i8* %23, null
br i1 %24, label %25, label %28
25: ; preds = %21
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%27 = call i32 @exit(i32 1)
unreachable
28: ; preds = %21
%29 = call i32 (...) @modprobe()
%30 = load i8*, i8** %5
%31 = call i8* @parse_options(i8* %30, i32* %6)
%32 = icmp eq i8* %31, null
br i1 %32, label %33, label %36
33: ; preds = %28
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.5, i64 0, i64 0))
%35 = call i32 @exit(i32 1)
unreachable
36: ; preds = %28
%37 = load i32, i32* @SIG_BLOCK
%38 = call i32 @block_signals(i32 %37)
%39 = load i8*, i8** %4
%40 = load i32, i32* %6
%41 = call i64 @mount(i8* %23, i8* %39, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %40, i8* %31)
%42 = icmp eq i64 %41, 0
br i1 %42, label %51, label %43
43: ; preds = %36
%44 = load i32, i32* @errno
%45 = icmp eq i32 %44, 128
br i1 %45, label %46, label %48
46: ; preds = %43
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str.6, i64 0, i64 0))
br label %55
48: ; preds = %43
%49 = call i8* @strerror(i32 %44)
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %44, i8* %49)
br label %55
51: ; preds = %36
%52 = load i8*, i8** %4
%53 = load i32, i32* %6
%54 = call i32 @update_mtab_entry(i8* %23, i8* %52, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %31, i32 %53, i32 0, i32 0)
br label %55
55: ; preds = %46, %48, %51
%56 = phi i32 [ 128, %46 ], [ %44, %48 ], [ 0, %51 ]
%57 = load i32, i32* @SIG_UNBLOCK
%58 = call i32 @block_signals(i32 %57)
%59 = call i32 @free(i8* %31)
%60 = call i32 @free(i8* %23)
%61 = call i32 @exit(i32 %56)
unreachable
}