#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*/ errno;
int exec_umount(char const *, char const *, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *,
                           char const *, char *);
int /*<<< orphan*/ mtab_needs_update(char const *);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int umount2(char const *, int);
int fuse_mnt_umount(const char *progname, const char *abs_mnt,
                    const char *rel_mnt, int lazy) {
  int res;
  if (!mtab_needs_update(abs_mnt)) {
    res = umount2(rel_mnt, lazy ? 2 : 0);
    if (res == -1)
      fprintf(stderr, "%s: failed to unmount %s: %s\n", progname, abs_mnt,
              strerror(errno));
    return res;
  }
  return exec_umount(progname, rel_mnt, lazy);
}


x86 assembly (clang, -O0):
<fuse_mnt_umount>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <mtab_needs_update@plt>
cmp    $0x0,%eax
jne    11ee <fuse_mnt_umount+0x9e>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%ecx
xor    %esi,%esi
mov    $0x2,%eax
cmp    $0x0,%ecx
cmovne %eax,%esi
call   1030 <umount2@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0xffffffff,-0x28(%rbp)
jne    11e3 <fuse_mnt_umount+0x93>
mov    0x2e3a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    0x2e16(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
mov    -0x3c(%rbp),%edi
mov    -0x38(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    %rax,%r8
lea    0xe22(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x28(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1201 <fuse_mnt_umount+0xb1>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1070 <exec_umount@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fuse_mnt_umount>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%ebp
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rsi,%rdi
call   1050 <mtab_needs_update@plt>
test   %eax,%eax
je     1185 <fuse_mnt_umount+0x35>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <exec_umount@plt>
xor    %esi,%esi
test   %ebp,%ebp
setne  %sil
add    %esi,%esi
mov    %rbx,%rdi
call   1030 <umount2@plt>
cmp    $0xffffffff,%eax
jne    11cf <fuse_mnt_umount+0x7f>
mov    0x2e3d(%rip),%rax
mov    (%rax),%ebx
mov    0x2e2c(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
lea    0xe46(%rip),%rsi
mov    %ebx,%edi
mov    %r14,%rdx
mov    %r15,%rcx
mov    %rax,%r8
call   1040 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [30 x i8] c"%s: failed to unmount %s: %s\0A\00"
@errno = global i32 0
define i32 @fuse_mnt_umount(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i32 %3, i32* %9
%11 = load i8*, i8** %7
%12 = call i32 @mtab_needs_update(i8* %11)
%13 = icmp ne i32 %12, 0
br i1 %13, label %32, label %14
14: ; preds = %4
%15 = load i8*, i8** %8
%16 = load i32, i32* %9
%17 = icmp ne i32 %16, 0
%18 = zext i1 %17 to i64
%19 = select i1 %17, i32 2, i32 0
%20 = call i32 @umount2(i8* %15, i32 %19)
store i32 %20, i32* %10
%21 = load i32, i32* %10
%22 = icmp eq i32 %21, -1
br i1 %22, label %23, label %30
23: ; preds = %14
%24 = load i32, i32* @stderr
%25 = load i8*, i8** %6
%26 = load i8*, i8** %7
%27 = load i32, i32* @errno
%28 = call i8* @strerror(i32 %27)
%29 = call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %25, i8* %26, i8* %28)
br label %30
30: ; preds = %23, %14
%31 = load i32, i32* %10
store i32 %31, i32* %5
br label %37
32: ; preds = %4
%33 = load i8*, i8** %6
%34 = load i8*, i8** %8
%35 = load i32, i32* %9
%36 = call i32 @exec_umount(i8* %33, i8* %34, i32 %35)
store i32 %36, i32* %5
br label %37
37: ; preds = %32, %30
%38 = load i32, i32* %5
ret i32 %38
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [30 x i8] c"%s: failed to unmount %s: %s\0A\00"
@errno = global i32 0
define i32 @fuse_mnt_umount(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = tail call i32 @mtab_needs_update(i8* %1)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %17
7: ; preds = %4
%8 = icmp eq i32 %3, 0
%9 = select i1 %8, i32 0, i32 2
%10 = tail call i32 @umount2(i8* %2, i32 %9)
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %19
12: ; preds = %7
%13 = load i32, i32* @stderr
%14 = load i32, i32* @errno
%15 = tail call i8* @strerror(i32 %14)
%16 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1, i8* %15)
br label %19
17: ; preds = %4
%18 = tail call i32 @exec_umount(i8* %0, i8* %2, i32 %3)
br label %19
19: ; preds = %7, %12, %17
%20 = phi i32 [ %18, %17 ], [ -1, %12 ], [ %10, %7 ]
ret i32 %20
}