#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 */
struct stat {
  int dummy;
};

/* Variables and functions */
scalar_t__ EEXIST;
scalar_t__ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int stat(char *, struct stat *);
int /*<<< orphan*/ stderr;
void turn_off_avfs() {
  struct stat stbuf;
  if (stat("/@avfs-off", &stbuf) == -1 && errno == EEXIST)
    fprintf(stderr, "Succesfuly turned off AVFS\n");
  else
    fprintf(stderr, "AVFS cannot be turned off\n");
}


x86 assembly (clang, -O0):
<turn_off_avfs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <stat@plt>
cmp    $0xffffffff,%eax
jne    1175 <turn_off_avfs+0x55>
mov    0x2e88(%rip),%rax
mov    (%rax),%rax
mov    0x2e8e(%rip),%rcx
cmp    (%rcx),%rax
jne    1175 <turn_off_avfs+0x55>
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
lea    0xea0(%rip),%rsi
call   1030 <fprintf@plt>
jmp    118a <turn_off_avfs+0x6a>
mov    0x2e5c(%rip),%rax
mov    (%rax),%edi
lea    0xea2(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<turn_off_avfs>:
push   %rax
lea    0xed8(%rip),%rdi
mov    %rsp,%rsi
call   1040 <stat@plt>
cmp    $0xffffffff,%eax
jne    1154 <turn_off_avfs+0x34>
mov    0x2e94(%rip),%rax
mov    (%rax),%rax
mov    0x2e9a(%rip),%rcx
cmp    (%rcx),%rax
jne    1154 <turn_off_avfs+0x34>
lea    0xeb9(%rip),%rsi
jmp    115b <turn_off_avfs+0x3b>
lea    0xecc(%rip),%rsi
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [11 x i8] c"/@avfs-off\00"
@errno = global i64 0
@EEXIST = global i64 0
@stderr = global i32 0
@.str.1 = [28 x i8] c"Succesfuly turned off AVFS\0A\00"
@.str.2 = [27 x i8] c"AVFS cannot be turned off\0A\00"
define void @turn_off_avfs() {
%1 = alloca %struct.stat
%2 = call i32 @stat(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), %struct.stat* %1)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %11
4: ; preds = %0
%5 = load i64, i64* @errno
%6 = load i64, i64* @EEXIST
%7 = icmp eq i64 %5, %6
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
br label %14
11: ; preds = %4, %0
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
br label %14
14: ; preds = %11, %8
ret void
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [11 x i8] c"/@avfs-off\00"
@errno = global i64 0
@EEXIST = global i64 0
@stderr = global i32 0
@.str.1 = [28 x i8] c"Succesfuly turned off AVFS\0A\00"
@.str.2 = [27 x i8] c"AVFS cannot be turned off\0A\00"
define void @turn_off_avfs() {
%1 = alloca %struct.stat
%2 = bitcast %struct.stat* %1 to i8*
%3 = call i32 @stat(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), %struct.stat* %1)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %9
5: ; preds = %0
%6 = load i64, i64* @errno
%7 = load i64, i64* @EEXIST
%8 = icmp eq i64 %6, %7
br i1 %8, label %10, label %9
9: ; preds = %5, %0
br label %10
10: ; preds = %5, %9
%11 = phi i8* [ getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), %9 ], [ getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), %5 ]
%12 = load i32, i32* @stderr
%13 = tail call i32 @fprintf(i32 %12, i8* %11)
ret void
}