#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 errno;
int /*<<< orphan*/ getchar();
int mount(char const *, char const *, char const *, unsigned long const,
          char const *);
int /*<<< orphan*/ printf(char *, ...);
char *strerror(int);
int /*<<< orphan*/ umount(char const *);
int main() {
  const char *src = "none";
  const char *trgt = "/var/tmp";
  const char *type = "tmpfs";
  const unsigned long mntflags = 0;
  const char *opts = "mode=0700,uid=65534";
  int result = mount(src, trgt, type, mntflags, opts);
  if (result == 0) {
    printf("Mount created at %s...\n", trgt);
    printf("Press <return> to unmount the volume: ");
    getchar();
    umount(trgt);
  } else {
    printf("Error : Failed to mount %s\n"
           "Reason: %s [%d]\n",
           src, strerror(errno), errno);
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xe94(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xe92(%rip),%rax
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
lea    0xe85(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x30(%rbp),%r8
xor    %eax,%eax
mov    %eax,%ecx
call   1040 <mount@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jne    11ee <main+0x9e>
mov    -0x18(%rbp),%rsi
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    -0x18(%rbp),%rdi
call   1030 <umount@plt>
jmp    122e <main+0xde>
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    0x2de3(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
mov    -0x40(%rbp),%rsi
mov    %rax,%rdx
mov    0x2dce(%rip),%rax
mov    (%rax),%ecx
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1235 <main+0xe5>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xea5(%rip),%rdi
lea    0xea3(%rip),%rsi
lea    0xea5(%rip),%rdx
lea    0xea4(%rip),%r8
xor    %ebx,%ebx
xor    %ecx,%ecx
call   1040 <mount@plt>
test   %eax,%eax
je     11ac <main+0x5c>
mov    0x2e5c(%rip),%rbx
mov    (%rbx),%edi
call   1070 <strerror@plt>
mov    (%rbx),%ecx
lea    0xed3(%rip),%rdi
lea    0xe65(%rip),%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xffffffff,%ebx
jmp    11e1 <main+0x91>
lea    0xe75(%rip),%rdi
lea    0xe4b(%rip),%r14
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe75(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %r14,%rdi
call   1030 <umount@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"none\00"
@.str.1 = [9 x i8] c"/var/tmp\00"
@.str.2 = [6 x i8] c"tmpfs\00"
@.str.3 = [20 x i8] c"mode=0700,uid=65534\00"
@.str.4 = [24 x i8] c"Mount created at %s...\0A\00"
@.str.5 = [39 x i8] c"Press <return> to unmount the volume: \00"
@.str.6 = [44 x i8] c"Error : Failed to mount %s\0AReason: %s [%d]\0A\00"
@errno = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
%7 = alloca i32
store i32 0, i32* %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8** %3
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8** %4
store i64 0, i64* %5
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8** %6
%8 = load i8*, i8** %2
%9 = load i8*, i8** %3
%10 = load i8*, i8** %4
%11 = load i8*, i8** %6
%12 = call i32 @mount(i8* %8, i8* %9, i8* %10, i64 0, i8* %11)
store i32 %12, i32* %7
%13 = load i32, i32* %7
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %22
15: ; preds = %0
%16 = load i8*, i8** %3
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i8* %16)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0))
%19 = call i32 (...) @getchar()
%20 = load i8*, i8** %3
%21 = call i32 @umount(i8* %20)
br label %28
22: ; preds = %0
%23 = load i8*, i8** %2
%24 = load i32, i32* @errno
%25 = call i8* @strerror(i32 %24)
%26 = load i32, i32* @errno
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0), i8* %23, i8* %25, i32 %26)
store i32 -1, i32* %1
br label %29
28: ; preds = %15
store i32 0, i32* %1
br label %29
29: ; preds = %28, %22
%30 = load i32, i32* %1
ret i32 %30
}

LLVM IR (-O2):
@.str = [5 x i8] c"none\00"
@.str.1 = [9 x i8] c"/var/tmp\00"
@.str.2 = [6 x i8] c"tmpfs\00"
@.str.3 = [20 x i8] c"mode=0700,uid=65534\00"
@.str.4 = [24 x i8] c"Mount created at %s...\0A\00"
@.str.5 = [39 x i8] c"Press <return> to unmount the volume: \00"
@.str.6 = [44 x i8] c"Error : Failed to mount %s\0AReason: %s [%d]\0A\00"
@errno = global i32 0
define i32 @main() {
%1 = tail call i32 @mount(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i64 0, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %8
3: ; preds = %0
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0))
%6 = tail call i32 (...) @getchar()
%7 = tail call i32 @umount(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %13
8: ; preds = %0
%9 = load i32, i32* @errno
%10 = tail call i8* @strerror(i32 %9)
%11 = load i32, i32* @errno
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %10, i32 %11)
br label %13
13: ; preds = %3, %8
%14 = phi i32 [ 0, %3 ], [ -1, %8 ]
ret i32 %14
}