#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*/ O_RDONLY;
int /*<<< orphan*/ close(int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ read(int, char *, int);
int getKathreinUfs910BoxType() {
  char vType;
  int vFdBox = open("/proc/boxtype", O_RDONLY);
  read(vFdBox, &vType, 1);
  close(vFdBox);
  return vType == '0' ? 0 : vType == '1' || vType == '3' ? 1 : -1;
}


x86 assembly (clang, -O0):
<getKathreinUfs910BoxType>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea9(%rip),%rax
mov    (%rax),%esi
lea    0xeb8(%rip),%rdi
call   1050 <open@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x1(%rbp),%rsi
mov    $0x1,%edx
call   1040 <read@plt>
mov    -0x8(%rbp),%edi
call   1030 <close@plt>
movsbl -0x1(%rbp),%eax
cmp    $0x30,%eax
jne    1180 <getKathreinUfs910BoxType+0x50>
xor    %eax,%eax
mov    %eax,-0xc(%rbp)
jmp    11b5 <getKathreinUfs910BoxType+0x85>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x31,%ecx
mov    %al,-0xd(%rbp)
je     119f <getKathreinUfs910BoxType+0x6f>
movsbl -0x1(%rbp),%eax
cmp    $0x33,%eax
sete   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%dl
mov    $0xffffffff,%eax
mov    $0x1,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getKathreinUfs910BoxType>:
push   %rbx
sub    $0x10,%rsp
mov    0x2eac(%rip),%rax
mov    (%rax),%esi
lea    0xebb(%rip),%rdi
call   1050 <open@plt>
mov    %eax,%ebx
lea    0xf(%rsp),%rsi
mov    %eax,%edi
mov    $0x1,%edx
call   1040 <read@plt>
mov    %ebx,%edi
call   1030 <close@plt>
mov    0xf(%rsp),%al
mov    %eax,%ecx
and    $0xfd,%cl
xor    %edx,%edx
cmp    $0x31,%cl
sete   %dl
xor    %ecx,%ecx
cmp    $0x30,%al
lea    -0x1(%rdx,%rdx,1),%eax
cmove  %ecx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"/proc/boxtype\00"
@O_RDONLY = global i32 0
define i32 @getKathreinUfs910BoxType() {
%1 = alloca i8
%2 = alloca i32
%3 = load i32, i32* @O_RDONLY
%4 = call i32 @open(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %3)
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = call i32 @read(i32 %5, i8* %1, i32 1)
%7 = load i32, i32* %2
%8 = call i32 @close(i32 %7)
%9 = load i8, i8* %1
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 48
br i1 %11, label %12, label %13
12: ; preds = %0
br label %25
13: ; preds = %0
%14 = load i8, i8* %1
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 49
br i1 %16, label %21, label %17
17: ; preds = %13
%18 = load i8, i8* %1
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 51
br label %21
21: ; preds = %17, %13
%22 = phi i1 [ true, %13 ], [ %20, %17 ]
%23 = zext i1 %22 to i64
%24 = select i1 %22, i32 1, i32 -1
br label %25
25: ; preds = %21, %12
%26 = phi i32 [ 0, %12 ], [ %24, %21 ]
ret i32 %26
}

LLVM IR (-O2):
@.str = [14 x i8] c"/proc/boxtype\00"
@O_RDONLY = global i32 0
define i32 @getKathreinUfs910BoxType() {
%1 = alloca i8
%2 = load i32, i32* @O_RDONLY
%3 = tail call i32 @open(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = call i32 @read(i32 %3, i8* %1, i32 1)
%5 = tail call i32 @close(i32 %3)
%6 = load i8, i8* %1
%7 = icmp eq i8 %6, 48
%8 = and i8 %6, -3
%9 = icmp eq i8 %8, 49
%10 = select i1 %9, i32 1, i32 -1
%11 = select i1 %7, i32 0, i32 %10
ret i32 %11
}