#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*/ MNT_DETACH;
int /*<<< orphan*/ perror(char *);
scalar_t__ umount2(char *, int /*<<< orphan*/);
scalar_t__ unlink(char *);
int clean_enviroment(void) {
  int ret = 0;
  if (umount2("/lib/bootchart/tmpfs/proc", MNT_DETACH) < 0) {
    perror("umount "
           "/lib/bootchart/tmpfs/proc");
    ret = 1;
  }
  if (unlink("/lib/bootchart/tmpfs"
             "/kmsg") < 0) {
    perror("unlinking "
           "/lib/bootchart/tmpfs"
           "/kmsg");
    ret = 1;
  }
  if (umount2("/lib/bootchart/tmpfs", MNT_DETACH) < 0) {
    perror("umount "
           "/lib/bootchart/tmpfs");
    ret = 1;
  }
  return ret;
}


x86 assembly (clang, -O0):
<clean_enviroment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%esi
lea    0xeb8(%rip),%rdi
call   1040 <umount2@plt>
cmp    $0x0,%rax
jge    1171 <clean_enviroment+0x41>
lea    0xe9b(%rip),%rdi
call   1050 <perror@plt>
movl   $0x1,-0x4(%rbp)
lea    0xeb3(%rip),%rdi
call   1030 <unlink@plt>
cmp    $0x0,%rax
jge    119a <clean_enviroment+0x6a>
lea    0xe93(%rip),%rdi
call   1050 <perror@plt>
movl   $0x1,-0x4(%rbp)
mov    0x2e3f(%rip),%rax
mov    (%rax),%esi
lea    0xea2(%rip),%rdi
call   1040 <umount2@plt>
cmp    $0x0,%rax
jge    11cc <clean_enviroment+0x9c>
lea    0xe85(%rip),%rdi
call   1050 <perror@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clean_enviroment>:
push   %r14
push   %rbx
push   %rax
mov    0x2ea5(%rip),%r14
mov    (%r14),%esi
lea    0xec2(%rip),%rdi
call   1040 <umount2@plt>
xor    %ebx,%ebx
test   %rax,%rax
js     1180 <clean_enviroment+0x50>
lea    0xed3(%rip),%rdi
call   1030 <unlink@plt>
test   %rax,%rax
js     1193 <clean_enviroment+0x63>
mov    (%r14),%esi
lea    0xee0(%rip),%rdi
call   1040 <umount2@plt>
test   %rax,%rax
js     11a6 <clean_enviroment+0x76>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe79(%rip),%rdi
call   1050 <perror@plt>
mov    $0x1,%ebx
jmp    1151 <clean_enviroment+0x21>
lea    0xe87(%rip),%rdi
call   1050 <perror@plt>
mov    $0x1,%ebx
jmp    1162 <clean_enviroment+0x32>
lea    0xe98(%rip),%rdi
call   1050 <perror@plt>
mov    $0x1,%ebx
jmp    1176 <clean_enviroment+0x46>

LLVM IR (-O0):
@.str = [26 x i8] c"/lib/bootchart/tmpfs/proc\00"
@MNT_DETACH = global i32 0
@.str.1 = [33 x i8] c"umount /lib/bootchart/tmpfs/proc\00"
@.str.2 = [26 x i8] c"/lib/bootchart/tmpfs/kmsg\00"
@.str.3 = [36 x i8] c"unlinking /lib/bootchart/tmpfs/kmsg\00"
@.str.4 = [21 x i8] c"/lib/bootchart/tmpfs\00"
@.str.5 = [28 x i8] c"umount /lib/bootchart/tmpfs\00"
define i32 @clean_enviroment() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @MNT_DETACH
%3 = call i64 @umount2(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 @perror(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %1
br label %7
7: ; preds = %5, %0
%8 = call i64 @unlink(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%9 = icmp slt i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 @perror(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %1
br label %12
12: ; preds = %10, %7
%13 = load i32, i32* @MNT_DETACH
%14 = call i64 @umount2(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %13)
%15 = icmp slt i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = call i32 @perror(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %1
br label %18
18: ; preds = %16, %12
%19 = load i32, i32* %1
ret i32 %19
}

LLVM IR (-O2):
@.str = [26 x i8] c"/lib/bootchart/tmpfs/proc\00"
@MNT_DETACH = global i32 0
@.str.1 = [33 x i8] c"umount /lib/bootchart/tmpfs/proc\00"
@.str.2 = [26 x i8] c"/lib/bootchart/tmpfs/kmsg\00"
@.str.3 = [36 x i8] c"unlinking /lib/bootchart/tmpfs/kmsg\00"
@.str.4 = [21 x i8] c"/lib/bootchart/tmpfs\00"
@.str.5 = [28 x i8] c"umount /lib/bootchart/tmpfs\00"
define i32 @clean_enviroment() {
%1 = load i32, i32* @MNT_DETACH
%2 = tail call i64 @umount2(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = icmp slt i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = tail call i32 @perror(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
br label %6
6: ; preds = %4, %0
%7 = phi i32 [ 1, %4 ], [ 0, %0 ]
%8 = tail call i64 @unlink(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%9 = icmp slt i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = tail call i32 @perror(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0))
br label %12
12: ; preds = %10, %6
%13 = phi i32 [ 1, %10 ], [ %7, %6 ]
%14 = load i32, i32* @MNT_DETACH
%15 = tail call i64 @umount2(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %14)
%16 = icmp slt i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %12
%18 = tail call i32 @perror(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0))
br label %19
19: ; preds = %17, %12
%20 = phi i32 [ 1, %17 ], [ %13, %12 ]
ret i32 %20
}