#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 */
char getchar();
int readinput(char *c) {
  int i = 0;
  char d;
  while ((d = getchar()) != '\n') {
    c[i] = d;
    i++;
    if (i > 9) {
      return -2;
    }
  }
  c[i] = '\0';
  if (c[0] == 'n' && c[1] == 'e') {
    return 0;
  } else if (c[0] == 'o' && c[1] == 'x' && c[2] == 'i') {
    return 1;
  }
  return -1;
}


x86 assembly (clang, -O0):
<readinput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %al,-0x15(%rbp)
movsbl %al,%eax
cmp    $0xa,%eax
je     116b <readinput+0x5b>
mov    -0x15(%rbp),%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x9,-0x14(%rbp)
jle    1166 <readinput+0x56>
movl   $0xfffffffe,-0x4(%rbp)
jmp    11ee <readinput+0xde>
jmp    1123 <readinput+0x13>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x6e,%eax
jne    11a4 <readinput+0x94>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x65,%eax
jne    11a4 <readinput+0x94>
movl   $0x0,-0x4(%rbp)
jmp    11ee <readinput+0xde>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x6f,%eax
jne    11e2 <readinput+0xd2>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x78,%eax
jne    11e2 <readinput+0xd2>
mov    -0x10(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x69,%eax
jne    11e2 <readinput+0xd2>
movl   $0x1,-0x4(%rbp)
jmp    11ee <readinput+0xde>
jmp    11e7 <readinput+0xd7>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readinput>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xa,%al
je     11e3 <readinput+0xd3>
mov    %al,(%r14)
xor    %eax,%eax
call   1030 <getchar@plt>
mov    $0x1,%ebx
cmp    $0xa,%al
je     11e3 <readinput+0xd3>
mov    %al,0x1(%r14)
xor    %eax,%eax
call   1030 <getchar@plt>
mov    $0x2,%ebx
cmp    $0xa,%al
je     11e3 <readinput+0xd3>
mov    %al,0x2(%r14)
xor    %eax,%eax
call   1030 <getchar@plt>
mov    $0x3,%ebx
cmp    $0xa,%al
je     11e3 <readinput+0xd3>
mov    %al,0x3(%r14)
xor    %eax,%eax
call   1030 <getchar@plt>
mov    $0x4,%ebx
cmp    $0xa,%al
je     11e3 <readinput+0xd3>
mov    %al,0x4(%r14)
xor    %eax,%eax
call   1030 <getchar@plt>
mov    $0x5,%ebx
cmp    $0xa,%al
je     11e3 <readinput+0xd3>
mov    %al,0x5(%r14)
xor    %eax,%eax
call   1030 <getchar@plt>
mov    $0x6,%ebx
cmp    $0xa,%al
je     11e3 <readinput+0xd3>
mov    %al,0x6(%r14)
xor    %eax,%eax
call   1030 <getchar@plt>
mov    $0x7,%ebx
cmp    $0xa,%al
je     11e3 <readinput+0xd3>
mov    %al,0x7(%r14)
xor    %eax,%eax
call   1030 <getchar@plt>
mov    $0x8,%ebx
cmp    $0xa,%al
je     11e3 <readinput+0xd3>
mov    %al,0x8(%r14)
xor    %eax,%eax
call   1030 <getchar@plt>
mov    $0x9,%ebx
cmp    $0xa,%al
jne    121e <readinput+0x10e>
movb   $0x0,(%r14,%rbx,1)
mov    (%r14),%al
cmp    $0x6f,%al
je     11fe <readinput+0xee>
cmp    $0x6e,%al
jne    1211 <readinput+0x101>
xor    %eax,%eax
cmpb   $0x65,0x1(%r14)
jne    1211 <readinput+0x101>
jmp    1216 <readinput+0x106>
cmpb   $0x78,0x1(%r14)
jne    1211 <readinput+0x101>
mov    $0x1,%eax
cmpb   $0x69,0x2(%r14)
je     1216 <readinput+0x106>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %al,0x9(%r14)
mov    $0xfffffffe,%eax
jmp    1216 <readinput+0x106>

LLVM IR (-O0):
define i32 @readinput(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8
store i8* %0, i8** %3
store i32 0, i32* %4
br label %6
6: ; preds = %21, %1
%7 = call signext i8 (...) @getchar()
store i8 %7, i8* %5
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 10
br i1 %9, label %10, label %22
10: ; preds = %6
%11 = load i8, i8* %5
%12 = load i8*, i8** %3
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
store i8 %11, i8* %15
%16 = load i32, i32* %4
%17 = add nsw i32 %16, 1
store i32 %17, i32* %4
%18 = load i32, i32* %4
%19 = icmp sgt i32 %18, 9
br i1 %19, label %20, label %21
20: ; preds = %10
store i32 -2, i32* %2
br label %60
21: ; preds = %10
br label %6
22: ; preds = %6
%23 = load i8*, i8** %3
%24 = load i32, i32* %4
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %23, i64 %25
store i8 0, i8* %26
%27 = load i8*, i8** %3
%28 = getelementptr inbounds i8, i8* %27, i64 0
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 110
br i1 %31, label %32, label %39
32: ; preds = %22
%33 = load i8*, i8** %3
%34 = getelementptr inbounds i8, i8* %33, i64 1
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 101
br i1 %37, label %38, label %39
38: ; preds = %32
store i32 0, i32* %2
br label %60
39: ; preds = %32, %22
%40 = load i8*, i8** %3
%41 = getelementptr inbounds i8, i8* %40, i64 0
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 111
br i1 %44, label %45, label %58
45: ; preds = %39
%46 = load i8*, i8** %3
%47 = getelementptr inbounds i8, i8* %46, i64 1
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
%50 = icmp eq i32 %49, 120
br i1 %50, label %51, label %58
51: ; preds = %45
%52 = load i8*, i8** %3
%53 = getelementptr inbounds i8, i8* %52, i64 2
%54 = load i8, i8* %53
%55 = sext i8 %54 to i32
%56 = icmp eq i32 %55, 105
br i1 %56, label %57, label %58
57: ; preds = %51
store i32 1, i32* %2
br label %60
58: ; preds = %51, %45, %39
br label %59
59: ; preds = %58
store i32 -1, i32* %2
br label %60
60: ; preds = %59, %57, %38, %20
%61 = load i32, i32* %2
ret i32 %61
}

LLVM IR (-O2):
define i32 @readinput(i8* nocapture %0) {
%2 = tail call signext i8 (...) @getchar()
%3 = icmp eq i8 %2, 10
br i1 %3, label %41, label %4
4: ; preds = %1
store i8 %2, i8* %0
%5 = tail call signext i8 (...) @getchar()
%6 = icmp eq i8 %5, 10
br i1 %6, label %41, label %7
7: ; preds = %4
%8 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %5, i8* %8
%9 = tail call signext i8 (...) @getchar()
%10 = icmp eq i8 %9, 10
br i1 %10, label %41, label %11
11: ; preds = %7
%12 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %9, i8* %12
%13 = tail call signext i8 (...) @getchar()
%14 = icmp eq i8 %13, 10
br i1 %14, label %41, label %15
15: ; preds = %11
%16 = getelementptr inbounds i8, i8* %0, i64 3
store i8 %13, i8* %16
%17 = tail call signext i8 (...) @getchar()
%18 = icmp eq i8 %17, 10
br i1 %18, label %41, label %19
19: ; preds = %15
%20 = getelementptr inbounds i8, i8* %0, i64 4
store i8 %17, i8* %20
%21 = tail call signext i8 (...) @getchar()
%22 = icmp eq i8 %21, 10
br i1 %22, label %41, label %23
23: ; preds = %19
%24 = getelementptr inbounds i8, i8* %0, i64 5
store i8 %21, i8* %24
%25 = tail call signext i8 (...) @getchar()
%26 = icmp eq i8 %25, 10
br i1 %26, label %41, label %27
27: ; preds = %23
%28 = getelementptr inbounds i8, i8* %0, i64 6
store i8 %25, i8* %28
%29 = tail call signext i8 (...) @getchar()
%30 = icmp eq i8 %29, 10
br i1 %30, label %41, label %31
31: ; preds = %27
%32 = getelementptr inbounds i8, i8* %0, i64 7
store i8 %29, i8* %32
%33 = tail call signext i8 (...) @getchar()
%34 = icmp eq i8 %33, 10
br i1 %34, label %41, label %35
35: ; preds = %31
%36 = getelementptr inbounds i8, i8* %0, i64 8
store i8 %33, i8* %36
%37 = tail call signext i8 (...) @getchar()
%38 = icmp eq i8 %37, 10
br i1 %38, label %41, label %39
39: ; preds = %35
%40 = getelementptr inbounds i8, i8* %0, i64 9
store i8 %37, i8* %40
br label %58
41: ; preds = %35, %31, %27, %23, %19, %15, %11, %7, %4, %1
%42 = phi i64 [ 0, %1 ], [ 1, %4 ], [ 2, %7 ], [ 3, %11 ], [ 4, %15 ], [ 5, %19 ], [ 6, %23 ], [ 7, %27 ], [ 8, %31 ], [ 9, %35 ]
%43 = getelementptr inbounds i8, i8* %0, i64 %42
store i8 0, i8* %43
%44 = load i8, i8* %0
switch i8 %44, label %57 [
i8 110, label %45
i8 111, label %49
]
45: ; preds = %41
%46 = getelementptr inbounds i8, i8* %0, i64 1
%47 = load i8, i8* %46
%48 = icmp eq i8 %47, 101
br i1 %48, label %58, label %57
49: ; preds = %41
%50 = getelementptr inbounds i8, i8* %0, i64 1
%51 = load i8, i8* %50
%52 = icmp eq i8 %51, 120
br i1 %52, label %53, label %57
53: ; preds = %49
%54 = getelementptr inbounds i8, i8* %0, i64 2
%55 = load i8, i8* %54
%56 = icmp eq i8 %55, 105
br i1 %56, label %58, label %57
57: ; preds = %41, %45, %49, %53
br label %58
58: ; preds = %39, %53, %45, %57
%59 = phi i32 [ -1, %57 ], [ 0, %45 ], [ 1, %53 ], [ -2, %39 ]
ret i32 %59
}