#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*/ R_OK;
int /*<<< orphan*/ W_OK;
scalar_t__ access(char *, int /*<<< orphan*/);
int check_driver_sysfs() {
  if (access("/sys/devices/platform/brtablet/data", W_OK) != 0) {
    return (-1);
  }
  if (access("/sys/devices/platform/brtablet/operation", W_OK) != 0) {
    return (-1);
  }
  if (access("/sys/devices/platform/brtablet/point", R_OK) != 0) {
    return (-1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<check_driver_sysfs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
lea    0xed8(%rip),%rdi
call   1030 <access@plt>
cmp    $0x0,%rax
je     1143 <check_driver_sysfs+0x33>
movl   $0xffffffff,-0x4(%rbp)
jmp    11a0 <check_driver_sysfs+0x90>
mov    0x2e9e(%rip),%rax
mov    (%rax),%esi
lea    0xed1(%rip),%rdi
call   1030 <access@plt>
cmp    $0x0,%rax
je     116e <check_driver_sysfs+0x5e>
movl   $0xffffffff,-0x4(%rbp)
jmp    11a0 <check_driver_sysfs+0x90>
mov    0x2e63(%rip),%rax
mov    (%rax),%esi
lea    0xecf(%rip),%rdi
call   1030 <access@plt>
cmp    $0x0,%rax
je     1199 <check_driver_sysfs+0x89>
movl   $0xffffffff,-0x4(%rbp)
jmp    11a0 <check_driver_sysfs+0x90>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_driver_sysfs>:
push   %r14
push   %rbx
push   %rax
mov    0x2ecd(%rip),%r14
mov    (%r14),%esi
lea    0xedb(%rip),%rdi
call   1030 <access@plt>
mov    $0xffffffff,%ebx
test   %rax,%rax
jne    1162 <check_driver_sysfs+0x52>
mov    (%r14),%esi
lea    0xee6(%rip),%rdi
call   1030 <access@plt>
test   %rax,%rax
jne    1162 <check_driver_sysfs+0x52>
mov    0x2e89(%rip),%rax
mov    (%rax),%esi
lea    0xef5(%rip),%rdi
call   1030 <access@plt>
neg    %rax
sbb    %ebx,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [36 x i8] c"/sys/devices/platform/brtablet/data\00"
@W_OK = global i32 0
@.str.1 = [41 x i8] c"/sys/devices/platform/brtablet/operation\00"
@.str.2 = [37 x i8] c"/sys/devices/platform/brtablet/point\00"
@R_OK = global i32 0
define i32 @check_driver_sysfs() {
%1 = alloca i32
%2 = load i32, i32* @W_OK
%3 = call i64 @access(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %0
store i32 -1, i32* %1
br label %17
6: ; preds = %0
%7 = load i32, i32* @W_OK
%8 = call i64 @access(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %6
store i32 -1, i32* %1
br label %17
11: ; preds = %6
%12 = load i32, i32* @R_OK
%13 = call i64 @access(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %11
store i32 -1, i32* %1
br label %17
16: ; preds = %11
store i32 0, i32* %1
br label %17
17: ; preds = %16, %15, %10, %5
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
@.str = [36 x i8] c"/sys/devices/platform/brtablet/data\00"
@W_OK = global i32 0
@.str.1 = [41 x i8] c"/sys/devices/platform/brtablet/operation\00"
@.str.2 = [37 x i8] c"/sys/devices/platform/brtablet/point\00"
@R_OK = global i32 0
define i32 @check_driver_sysfs() {
%1 = load i32, i32* @W_OK
%2 = tail call i64 @access(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %13
4: ; preds = %0
%5 = load i32, i32* @W_OK
%6 = tail call i64 @access(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %4
%9 = load i32, i32* @R_OK
%10 = tail call i64 @access(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %9)
%11 = icmp ne i64 %10, 0
%12 = sext i1 %11 to i32
br label %13
13: ; preds = %8, %4, %0
%14 = phi i32 [ -1, %0 ], [ -1, %4 ], [ %12, %8 ]
ret i32 %14
}