#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 EOF;
int getop(char *);
int /*<<< orphan*/ printf(char *);
void main() {
  int type;
  double op2;
  char s[100];
  while ((type = getop(s)) != EOF) {
    if (type == '0') {
      printf("type = NUMBER;\n");
    } else if (type == '+') {
      printf("type = +;\n");
    } else if (type == '-') {
      printf("type = -;\n");
    } else if (type == '*') {
      printf("type = *;\n");
    } else if (type == '/') {
      printf("type = /;\n");
    } else if (type == 'a')
      printf("type = WORDS;\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
lea    -0x80(%rbp),%rdi
call   1040 <getop@plt>
mov    %eax,-0x4(%rbp)
mov    0x2eaa(%rip),%rcx
cmp    (%rcx),%eax
je     1201 <main+0xe1>
cmpl   $0x30,-0x4(%rbp)
jne    1161 <main+0x41>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
jmp    11fc <main+0xdc>
cmpl   $0x2b,-0x4(%rbp)
jne    117c <main+0x5c>
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
jmp    11f7 <main+0xd7>
cmpl   $0x2d,-0x4(%rbp)
jne    1197 <main+0x77>
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
jmp    11f2 <main+0xd2>
cmpl   $0x2a,-0x4(%rbp)
jne    11b2 <main+0x92>
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
jmp    11ed <main+0xcd>
cmpl   $0x2f,-0x4(%rbp)
jne    11cd <main+0xad>
lea    0xe6e(%rip),%rdi
call   1030 <printf@plt>
jmp    11e8 <main+0xc8>
cmpl   $0x61,-0x4(%rbp)
jne    11e3 <main+0xc3>
lea    0xe5e(%rip),%rdi
call   1030 <printf@plt>
jmp    11e8 <main+0xc8>
jmp    11ed <main+0xcd>
jmp    11f2 <main+0xd2>
jmp    11f7 <main+0xd7>
jmp    11fc <main+0xdc>
jmp    112b <main+0xb>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %rsp,%rdi
call   1040 <getop@plt>
mov    0x2eab(%rip),%r14
cmp    (%r14),%eax
jne    1151 <main+0x31>
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xfbe(%rip),%r15
mov    %rsp,%r12
lea    0xe9e(%rip),%rbx
lea    0xf85(%rip),%rbp
lea    0xf70(%rip),%r13
jmp    1192 <main+0x72>
mov    %r13,%rdi
cs nopw 0x0(%rax,%rax,1)
nop
call   1030 <puts@plt>
mov    %r12,%rdi
call   1040 <getop@plt>
cmp    (%r14),%eax
je     1142 <main+0x22>
add    $0xffffffd6,%eax
cmp    $0x37,%eax
ja     1185 <main+0x65>
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
mov    %r15,%rdi
jmp    *%rax
lea    0xf4b(%rip),%rdi
jmp    1180 <main+0x60>
lea    0xf56(%rip),%rdi
jmp    1180 <main+0x60>
lea    0xf43(%rip),%rdi
jmp    1180 <main+0x60>
mov    %rbp,%rdi
jmp    1180 <main+0x60>

LLVM IR (-O0):
@EOF = global i32 0
@.str = [16 x i8] c"type = NUMBER;\0A\00"
@.str.1 = [11 x i8] c"type = +;\0A\00"
@.str.2 = [11 x i8] c"type = -;\0A\00"
@.str.3 = [11 x i8] c"type = *;\0A\00"
@.str.4 = [11 x i8] c"type = /;\0A\00"
@.str.5 = [15 x i8] c"type = WORDS;\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca [100 x i8]
br label %4
4: ; preds = %44, %0
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%6 = call i32 @getop(i8* %5)
store i32 %6, i32* %1
%7 = load i32, i32* @EOF
%8 = icmp ne i32 %6, %7
br i1 %8, label %9, label %45
9: ; preds = %4
%10 = load i32, i32* %1
%11 = icmp eq i32 %10, 48
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %44
14: ; preds = %9
%15 = load i32, i32* %1
%16 = icmp eq i32 %15, 43
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %43
19: ; preds = %14
%20 = load i32, i32* %1
%21 = icmp eq i32 %20, 45
br i1 %21, label %22, label %24
22: ; preds = %19
%23 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
br label %42
24: ; preds = %19
%25 = load i32, i32* %1
%26 = icmp eq i32 %25, 42
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
br label %41
29: ; preds = %24
%30 = load i32, i32* %1
%31 = icmp eq i32 %30, 47
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
br label %40
34: ; preds = %29
%35 = load i32, i32* %1
%36 = icmp eq i32 %35, 97
br i1 %36, label %37, label %39
37: ; preds = %34
%38 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
br label %39
39: ; preds = %37, %34
br label %40
40: ; preds = %39, %32
br label %41
41: ; preds = %40, %27
br label %42
42: ; preds = %41, %22
br label %43
43: ; preds = %42, %17
br label %44
44: ; preds = %43, %12
br label %4
45: ; preds = %4
ret void
}

LLVM IR (-O2):
@EOF = global i32 0
@str = [14 x i8] c"type = WORDS;\00"
@str.6 = [10 x i8] c"type = /;\00"
@str.7 = [10 x i8] c"type = *;\00"
@str.8 = [10 x i8] c"type = -;\00"
@str.9 = [10 x i8] c"type = +;\00"
@str.10 = [15 x i8] c"type = NUMBER;\00"
define void @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @getop(i8* %2)
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %20, label %6
6: ; preds = %0, %16
%7 = phi i32 [ %17, %16 ], [ %3, %0 ]
switch i32 %7, label %16 [
i32 48, label %13
i32 43, label %8
i32 45, label %9
i32 42, label %10
i32 47, label %11
i32 97, label %12
]
8: ; preds = %6
br label %13
9: ; preds = %6
br label %13
10: ; preds = %6
br label %13
11: ; preds = %6
br label %13
12: ; preds = %6
br label %13
13: ; preds = %6, %9, %11, %12, %10, %8
%14 = phi i8* [ getelementptr inbounds ([10 x i8], [10 x i8]* @str.9, i64 0, i64 0), %8 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @str.7, i64 0, i64 0), %10 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0), %12 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @str.6, i64 0, i64 0), %11 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @str.8, i64 0, i64 0), %9 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @str.10, i64 0, i64 0), %6 ]
%15 = call i32 @puts(i8* dereferenceable(1) %14)
br label %16
16: ; preds = %13, %6
%17 = call i32 @getop(i8* %2)
%18 = load i32, i32* @EOF
%19 = icmp eq i32 %17, %18
br i1 %19, label %20, label %6
20: ; preds = %16, %0
ret void
}