#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 scalar_t__ uint32_t;
struct statfs {
  scalar_t__ f_type;
};

/* Variables and functions */
scalar_t__ EINTR;
scalar_t__ errno;
int statfs(char *, struct statfs *);
int verify_smackmnt(void) {
  struct statfs sfbuf;
  int rc;
  do {
    rc = statfs("/smack/", &sfbuf);
  } while (rc < 0 && errno == EINTR);
  if (rc == 0 && (uint32_t)sfbuf.f_type == (uint32_t)0x43415d53)
    return 0;
  return -1;
}


x86 assembly (clang, -O0):
<verify_smackmnt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xee1(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <statfs@plt>
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x14(%rbp)
mov    %al,-0x15(%rbp)
jge    1154 <verify_smackmnt+0x44>
mov    0x2e9f(%rip),%rax
mov    (%rax),%rax
mov    0x2e8d(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1118 <verify_smackmnt+0x8>
cmpl   $0x0,-0x14(%rbp)
jne    1183 <verify_smackmnt+0x73>
cmpq   $0x43415d53,-0x10(%rbp)
43
jne    1183 <verify_smackmnt+0x73>
movl   $0x0,-0x4(%rbp)
jmp    118a <verify_smackmnt+0x7a>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<verify_smackmnt>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xee1(%rip),%r14
mov    %rsp,%r12
mov    0x2eb7(%rip),%r15
mov    0x2ea8(%rip),%rbx
mov    %r14,%rdi
mov    %r12,%rsi
call   1030 <statfs@plt>
test   %eax,%eax
jns    1147 <verify_smackmnt+0x37>
mov    (%rbx),%rcx
cmp    %rcx,(%r15)
je     1130 <verify_smackmnt+0x20>
test   %eax,%eax
setne  %al
cmpq   $0x43415d53,(%rsp)
43
setne  %cl
or     %al,%cl
movzbl %cl,%eax
neg    %eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.statfs = type { i64 }
@.str = [8 x i8] c"/smack/\00"
@errno = global i64 0
@EINTR = global i64 0
define i32 @verify_smackmnt() {
%1 = alloca i32
%2 = alloca %struct.statfs
%3 = alloca i32
br label %4
4: ; preds = %13, %0
%5 = call i32 @statfs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), %struct.statfs* %2)
store i32 %5, i32* %3
br label %6
6: ; preds = %4
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %6
%10 = load i64, i64* @errno
%11 = load i64, i64* @EINTR
%12 = icmp eq i64 %10, %11
br label %13
13: ; preds = %9, %6
%14 = phi i1 [ false, %6 ], [ %12, %9 ]
br i1 %14, label %4, label %15
15: ; preds = %13
%16 = load i32, i32* %3
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %23
18: ; preds = %15
%19 = getelementptr inbounds %struct.statfs, %struct.statfs* %2, i32 0, i32 0
%20 = load i64, i64* %19
%21 = icmp eq i64 %20, 1128357203
br i1 %21, label %22, label %23
22: ; preds = %18
store i32 0, i32* %1
br label %24
23: ; preds = %18, %15
store i32 -1, i32* %1
br label %24
24: ; preds = %23, %22
%25 = load i32, i32* %1
ret i32 %25
}

LLVM IR (-O2):
%struct.statfs = type { i64 }
@.str = [8 x i8] c"/smack/\00"
@errno = global i64 0
@EINTR = global i64 0
define i32 @verify_smackmnt() {
%1 = alloca %struct.statfs
%2 = bitcast %struct.statfs* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = call i32 @statfs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), %struct.statfs* %1)
%5 = icmp slt i32 %4, 0
%6 = load i64, i64* @errno
%7 = load i64, i64* @EINTR
%8 = icmp eq i64 %6, %7
%9 = select i1 %5, i1 %8, i1 false
br i1 %9, label %3, label %10
10: ; preds = %3
%11 = icmp ne i32 %4, 0
%12 = getelementptr inbounds %struct.statfs, %struct.statfs* %1, i64 0, i32 0
%13 = load i64, i64* %12
%14 = icmp ne i64 %13, 1128357203
%15 = select i1 %11, i1 true, i1 %14
%16 = sext i1 %15 to i32
ret i32 %16
}