#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 */
typedef int /*<<< orphan*/ buf;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ strstr(char *, char *);
int fuse_mnt_check_fuseblk(void) {
  char buf[256];
  FILE *f = fopen("/proc/filesystems", "r");
  if (!f)
    return 1;
  while (fgets(buf, sizeof(buf), f))
    if (strstr(buf, "fuseblk\n")) {
      fclose(f);
      return 1;
    }
  fclose(f);
  return 0;
}


x86 assembly (clang, -O0):
<fuse_mnt_check_fuseblk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
lea    0xeae(%rip),%rdi
lea    0xeb9(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x118(%rbp)
cmpq   $0x0,-0x118(%rbp)
jne    117f <fuse_mnt_check_fuseblk+0x3f>
movl   $0x1,-0x4(%rbp)
jmp    11f3 <fuse_mnt_check_fuseblk+0xb3>
jmp    1184 <fuse_mnt_check_fuseblk+0x44>
lea    -0x110(%rbp),%rdi
mov    -0x118(%rbp),%rdx
mov    $0x100,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     11e0 <fuse_mnt_check_fuseblk+0xa0>
lea    -0x110(%rbp),%rdi
lea    0xe60(%rip),%rsi
call   1060 <strstr@plt>
cmp    $0x0,%rax
je     11db <fuse_mnt_check_fuseblk+0x9b>
mov    -0x118(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x1,-0x4(%rbp)
jmp    11f3 <fuse_mnt_check_fuseblk+0xb3>
jmp    1184 <fuse_mnt_check_fuseblk+0x44>
mov    -0x118(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fuse_mnt_check_fuseblk>:
push   %r15
push   %r14
push   %rbx
sub    $0x100,%rsp
lea    0xead(%rip),%rdi
lea    0xeb8(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     11ac <fuse_mnt_check_fuseblk+0x6c>
mov    %rax,%r14
mov    %rsp,%rbx
lea    0xea3(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %r14,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     11b3 <fuse_mnt_check_fuseblk+0x73>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <strstr@plt>
test   %rax,%rax
je     1180 <fuse_mnt_check_fuseblk+0x40>
mov    $0x1,%ebx
jmp    11b5 <fuse_mnt_check_fuseblk+0x75>
mov    $0x1,%ebx
jmp    11bd <fuse_mnt_check_fuseblk+0x7d>
xor    %ebx,%ebx
mov    %r14,%rdi
call   1030 <fclose@plt>
mov    %ebx,%eax
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [18 x i8] c"/proc/filesystems\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [9 x i8] c"fuseblk\0A\00"
define i32 @fuse_mnt_check_fuseblk() {
%1 = alloca i32
%2 = alloca [256 x i8]
%3 = alloca i32*
%4 = call i32* @fopen(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %4, i32** %3
%5 = load i32*, i32** %3
%6 = icmp ne i32* %5, null
br i1 %6, label %8, label %7
7: ; preds = %0
store i32 1, i32* %1
br label %25
8: ; preds = %0
br label %9
9: ; preds = %21, %8
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%11 = load i32*, i32** %3
%12 = call i64 @fgets(i8* %10, i32 256, i32* %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %22
14: ; preds = %9
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%16 = call i64 @strstr(i8* %15, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %14
%19 = load i32*, i32** %3
%20 = call i32 @fclose(i32* %19)
store i32 1, i32* %1
br label %25
21: ; preds = %14
br label %9
22: ; preds = %9
%23 = load i32*, i32** %3
%24 = call i32 @fclose(i32* %23)
store i32 0, i32* %1
br label %25
25: ; preds = %22, %18, %7
%26 = load i32, i32* %1
ret i32 %26
}

LLVM IR (-O2):
@.str = [18 x i8] c"/proc/filesystems\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [9 x i8] c"fuseblk\0A\00"
define i32 @fuse_mnt_check_fuseblk() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %14, label %5
5: ; preds = %0, %8
%6 = call i64 @fgets(i8* %2, i32 256, i32* %3)
%7 = icmp eq i64 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %5
%9 = call i64 @strstr(i8* %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %5, label %11
11: ; preds = %5, %8
%12 = phi i32 [ 1, %8 ], [ 0, %5 ]
%13 = call i32 @fclose(i32* %3)
br label %14
14: ; preds = %11, %0
%15 = phi i32 [ 1, %0 ], [ %12, %11 ]
ret i32 %15
}