#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 /*<<< orphan*/ logger(int, int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ quota_ctl(unsigned int, int);
int quota_off(unsigned int, int /*<<< orphan*/);
scalar_t__ umount(char const *);
int fsumount(unsigned int veid, const char *root) {
  if (umount(root) != 0) {
    logger(-1, errno, "Can't umount %s", root);
    return 51;
  }
  if (!quota_ctl(veid, 2))
    return quota_off(veid, 0);
  return 0;
}


x86 assembly (clang, -O0):
<fsumount>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <umount@plt>
cmp    $0x0,%rax
je     118c <fsumount+0x4c>
mov    0x2e77(%rip),%rax
mov    (%rax),%esi
mov    -0x10(%rbp),%rcx
mov    $0xffffffff,%edi
lea    0xe85(%rip),%rdx
call   1050 <logger@plt>
movl   $0x33,-0x4(%rbp)
jmp    11bb <fsumount+0x7b>
mov    -0x8(%rbp),%edi
mov    $0x2,%esi
call   1060 <quota_ctl@plt>
cmp    $0x0,%eax
jne    11b4 <fsumount+0x74>
mov    -0x8(%rbp),%edi
xor    %esi,%esi
call   1030 <quota_off@plt>
mov    %eax,-0x4(%rbp)
jmp    11bb <fsumount+0x7b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fsumount>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
call   1040 <umount@plt>
test   %rax,%rax
je     1179 <fsumount+0x39>
mov    0x2e84(%rip),%rax
mov    (%rax),%esi
lea    0xe9b(%rip),%rdx
mov    $0xffffffff,%edi
mov    %rbx,%rcx
call   1050 <logger@plt>
mov    $0x33,%eax
jmp    118d <fsumount+0x4d>
mov    %ebp,%edi
mov    $0x2,%esi
call   1060 <quota_ctl@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
je     1194 <fsumount+0x54>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    %ebp,%edi
xor    %esi,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <quota_off@plt>

LLVM IR (-O0):
@errno = global i32 0
@.str = [16 x i8] c"Can't umount %s\00"
define i32 @fsumount(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
%6 = load i8*, i8** %5
%7 = call i64 @umount(i8* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i32, i32* @errno
%11 = load i8*, i8** %5
%12 = call i32 @logger(i32 -1, i32 %10, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %11)
store i32 51, i32* %3
br label %21
13: ; preds = %2
%14 = load i32, i32* %4
%15 = call i32 @quota_ctl(i32 %14, i32 2)
%16 = icmp ne i32 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %13
%18 = load i32, i32* %4
%19 = call i32 @quota_off(i32 %18, i32 0)
store i32 %19, i32* %3
br label %21
20: ; preds = %13
store i32 0, i32* %3
br label %21
21: ; preds = %20, %17, %9
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
@errno = global i32 0
@.str = [16 x i8] c"Can't umount %s\00"
define i32 @fsumount(i32 %0, i8* %1) {
%3 = tail call i64 @umount(i8* %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = load i32, i32* @errno
%7 = tail call i32 @logger(i32 -1, i32 %6, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %13
8: ; preds = %2
%9 = tail call i32 @quota_ctl(i32 %0, i32 2)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = tail call i32 @quota_off(i32 %0, i32 0)
br label %13
13: ; preds = %8, %11, %5
%14 = phi i32 [ 51, %5 ], [ %12, %11 ], [ 0, %8 ]
ret i32 %14
}