#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*/ scanf(char *, char *);
int readinput(char *c) {
  scanf("%s", c);
  if (c[0] == 'n' && c[1] == 'e' && c[2] == '\0') {
    return 0;
  } else if (c[0] == 'o' && c[1] == 'x' && c[2] == 'i' && c[3] == '\0') {
    return 1;
  }
  return -1;
}


x86 assembly (clang, -O0):
<readinput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xed9(%rip),%rdi
call   1030 <scanf@plt>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x6e,%eax
jne    116a <readinput+0x5a>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x65,%eax
jne    116a <readinput+0x5a>
mov    -0x10(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x0,%eax
jne    116a <readinput+0x5a>
movl   $0x0,-0x4(%rbp)
jmp    11c5 <readinput+0xb5>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x6f,%eax
jne    11b9 <readinput+0xa9>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x78,%eax
jne    11b9 <readinput+0xa9>
mov    -0x10(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x69,%eax
jne    11b9 <readinput+0xa9>
mov    -0x10(%rbp),%rax
movsbl 0x3(%rax),%eax
cmp    $0x0,%eax
jne    11b9 <readinput+0xa9>
movl   $0x1,-0x4(%rbp)
jmp    11c5 <readinput+0xb5>
jmp    11be <readinput+0xae>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readinput>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
mov    %rbx,%rsi
call   1030 <scanf@plt>
mov    (%rbx),%al
cmp    $0x6f,%al
je     113d <readinput+0x2d>
cmp    $0x6e,%al
jne    114f <readinput+0x3f>
cmpb   $0x65,0x1(%rbx)
jne    114f <readinput+0x3f>
cmpb   $0x0,0x2(%rbx)
jne    114f <readinput+0x3f>
xor    %eax,%eax
pop    %rbx
ret
cmpb   $0x78,0x1(%rbx)
jne    114f <readinput+0x3f>
cmpb   $0x69,0x2(%rbx)
jne    114f <readinput+0x3f>
cmpb   $0x0,0x3(%rbx)
je     1156 <readinput+0x46>
mov    $0xffffffff,%eax
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i32 @readinput(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 110
br i1 %10, label %11, label %24
11: ; preds = %1
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i64 1
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 101
br i1 %16, label %17, label %24
17: ; preds = %11
%18 = load i8*, i8** %3
%19 = getelementptr inbounds i8, i8* %18, i64 2
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %17
store i32 0, i32* %2
br label %51
24: ; preds = %17, %11, %1
%25 = load i8*, i8** %3
%26 = getelementptr inbounds i8, i8* %25, i64 0
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 111
br i1 %29, label %30, label %49
30: ; preds = %24
%31 = load i8*, i8** %3
%32 = getelementptr inbounds i8, i8* %31, i64 1
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 120
br i1 %35, label %36, label %49
36: ; preds = %30
%37 = load i8*, i8** %3
%38 = getelementptr inbounds i8, i8* %37, i64 2
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %40, 105
br i1 %41, label %42, label %49
42: ; preds = %36
%43 = load i8*, i8** %3
%44 = getelementptr inbounds i8, i8* %43, i64 3
%45 = load i8, i8* %44
%46 = sext i8 %45 to i32
%47 = icmp eq i32 %46, 0
br i1 %47, label %48, label %49
48: ; preds = %42
store i32 1, i32* %2
br label %51
49: ; preds = %42, %36, %30, %24
br label %50
50: ; preds = %49
store i32 -1, i32* %2
br label %51
51: ; preds = %50, %48, %23
%52 = load i32, i32* %2
ret i32 %52
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @readinput(i8* %0) {
%2 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = load i8, i8* %0
switch i8 %3, label %24 [
i8 110, label %4
i8 111, label %12
]
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 101
br i1 %7, label %8, label %24
8: ; preds = %4
%9 = getelementptr inbounds i8, i8* %0, i64 2
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %25, label %24
12: ; preds = %1
%13 = getelementptr inbounds i8, i8* %0, i64 1
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 120
br i1 %15, label %16, label %24
16: ; preds = %12
%17 = getelementptr inbounds i8, i8* %0, i64 2
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 105
br i1 %19, label %20, label %24
20: ; preds = %16
%21 = getelementptr inbounds i8, i8* %0, i64 3
%22 = load i8, i8* %21
%23 = icmp eq i8 %22, 0
br i1 %23, label %25, label %24
24: ; preds = %1, %4, %8, %12, %16, %20
br label %25
25: ; preds = %20, %8, %24
%26 = phi i32 [ -1, %24 ], [ 0, %8 ], [ 1, %20 ]
ret i32 %26
}