#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*/ cmd;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
int read(int /*<<< orphan*/, unsigned char *, int);
int main(int argc, char *argv[], char *envp[]) {
  char buffer[0x100] = {0};
  unsigned char cmd;
  buffer[0xfe] = 1;
  buffer[0xfc] = 1;
  buffer[0xfd] = 1;
  if (read(0, &cmd, sizeof(cmd)) != sizeof(cmd)) {
    printf("Error reading stdin!");
    exit(-1);
  }
  if (buffer[cmd]) {
    printf("Message: Found!\n");
  } else {
    printf("Message: Not Found!\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x120(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1040 <memset@plt>
movb   $0x1,-0x22(%rbp)
movb   $0x1,-0x24(%rbp)
movb   $0x1,-0x23(%rbp)
xor    %edi,%edi
lea    -0x121(%rbp),%rsi
mov    $0x1,%edx
call   1050 <read@plt>
cltq
cmp    $0x1,%rax
je     11b1 <main+0x71>
lea    0xe5e(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
movzbl -0x121(%rbp),%eax
cmpb   $0x0,-0x120(%rbp,%rax,1)
je     11d7 <main+0x97>
lea    0xe48(%rip),%rdi
call   1030 <printf@plt>
jmp    11e3 <main+0xa3>
lea    0xe48(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x118,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x100(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movb   $0x1,0x10e(%rsp)
01
movw   $0x101,0x10c(%rsp)
lea    0xf(%rsp),%rsi
xor    %edi,%edi
mov    $0x1,%edx
call   1050 <read@plt>
cmp    $0x1,%eax
jne    1208 <main+0xc8>
movzbl 0xf(%rsp),%eax
cmpb   $0x0,0x10(%rsp,%rax,1)
lea    0xe27(%rip),%rax
lea    0xe34(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x118,%rsp
ret
lea    0xdf1(%rip),%rdi
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"Error reading stdin!\00"
@.str.1 = [17 x i8] c"Message: Found!\0A\00"
@.str.2 = [21 x i8] c"Message: Not Found!\0A\00"
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca [256 x i8]
%9 = alloca i8
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%10 = bitcast [256 x i8]* %8 to i8*
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 254
store i8 1, i8* %11
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 252
store i8 1, i8* %12
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 253
store i8 1, i8* %13
%14 = call i32 @read(i32 0, i8* %9, i32 1)
%15 = sext i32 %14 to i64
%16 = icmp ne i64 %15, 1
br i1 %16, label %17, label %20
17: ; preds = %3
%18 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%19 = call i32 @exit(i32 -1)
unreachable
20: ; preds = %3
%21 = load i8, i8* %9
%22 = zext i8 %21 to i64
%23 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = icmp ne i8 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %20
%27 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %30
28: ; preds = %20
%29 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %30
30: ; preds = %28, %26
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"Error reading stdin!\00"
@str = [20 x i8] c"Message: Not Found!\00"
@str.3 = [16 x i8] c"Message: Found!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
%4 = alloca [256 x i8]
%5 = alloca i8
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 254
store i8 1, i8* %7
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 252
store i8 1, i8* %8
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 253
store i8 1, i8* %9
%10 = call i32 @read(i32 0, i8* %5, i32 1)
%11 = icmp eq i32 %10, 1
br i1 %11, label %15, label %12
12: ; preds = %3
%13 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%14 = tail call i32 @exit(i32 -1)
unreachable
15: ; preds = %3
%16 = load i8, i8* %5
%17 = zext i8 %16 to i64
%18 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 0
%21 = select i1 %20, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @str.3, i64 0, i64 0)
%22 = tail call i32 @puts(i8* dereferenceable(1) %21)
ret i32 0
}