#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 */
#define EOF 128
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int getc(int /*<<< orphan*/);
int read_int(int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int get_token(void) {
  int peek;
  int tok = -10;
  do {
    peek = getc(stdin);
  } while (peek == ' ' || peek == '\t');
  switch (peek) {
  case '0':
  case '1':
  case '2':
  case '3':
  case '4':
  case '5':
  case '6':
  case '7':
  case '8':
  case '9':
    tok = read_int(peek);
    break;
  case '%':
    tok = 100;
    break;
  case 'd':
  case 'D':
    tok = -1;
    break;
  case 'k':
  case 'K':
    tok = -2;
    break;
  case '*':
    tok = -3;
    break;
  case '/':
    tok = -4;
    break;
  case '+':
    tok = -5;
    break;
  case '-':
    tok = -6;
    break;
  case '(':
    tok = -7;
    break;
  case ')':
    tok = -8;
    break;
  case '\n':
    tok = -9;
    break;
  case EOF:
    tok = -10;
    break;
  default:
    fprintf(stderr, "unrecognized character\n");
  }
  return tok;
}


x86 assembly (clang, -O0):
<get_token>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0xfffffff6,-0x8(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
call   1050 <getc@plt>
mov    %eax,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x20,-0x4(%rbp)
mov    %al,-0x9(%rbp)
je     1169 <get_token+0x39>
cmpl   $0x9,-0x4(%rbp)
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    113f <get_token+0xf>
mov    -0x4(%rbp),%eax
add    $0xfffffff6,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x76,%eax
ja     1231 <get_token+0x101>
mov    -0x18(%rbp),%rax
lea    0xe6c(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x4(%rbp),%edi
call   1040 <read_int@plt>
mov    %eax,-0x8(%rbp)
jmp    1246 <get_token+0x116>
movl   $0x64,-0x8(%rbp)
jmp    1246 <get_token+0x116>
movl   $0xffffffff,-0x8(%rbp)
jmp    1246 <get_token+0x116>
movl   $0xfffffffe,-0x8(%rbp)
jmp    1246 <get_token+0x116>
movl   $0xfffffffd,-0x8(%rbp)
jmp    1246 <get_token+0x116>
movl   $0xfffffffc,-0x8(%rbp)
jmp    1246 <get_token+0x116>
movl   $0xfffffffb,-0x8(%rbp)
jmp    1246 <get_token+0x116>
movl   $0xfffffffa,-0x8(%rbp)
jmp    1246 <get_token+0x116>
movl   $0xfffffff9,-0x8(%rbp)
jmp    1246 <get_token+0x116>
movl   $0xfffffff8,-0x8(%rbp)
jmp    1246 <get_token+0x116>
movl   $0xfffffff7,-0x8(%rbp)
jmp    1246 <get_token+0x116>
movl   $0xfffffff6,-0x8(%rbp)
jmp    1246 <get_token+0x116>
mov    0x2da0(%rip),%rax
mov    (%rax),%edi
lea    0xf9b(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_token>:
push   %r14
push   %rbx
push   %rax
mov    0x2ead(%rip),%r14
lea    0xebe(%rip),%rbx
mov    (%r14),%edi
call   1050 <getc@plt>
lea    -0x9(%rax),%ecx
cmp    $0x77,%ecx
ja     117e <get_token+0x4e>
movslq (%rbx,%rcx,4),%rcx
add    %rbx,%rcx
jmp    *%rcx
mov    %eax,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <read_int@plt>
mov    $0xffffffff,%eax
jmp    11c9 <get_token+0x99>
mov    $0xfffffffe,%eax
jmp    11c9 <get_token+0x99>
mov    $0xfffffff7,%eax
jmp    11c9 <get_token+0x99>
mov    0x2e53(%rip),%rax
mov    (%rax),%edi
lea    0x1052(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xfffffff6,%eax
jmp    11c9 <get_token+0x99>
mov    $0x64,%eax
jmp    11c9 <get_token+0x99>
mov    $0xfffffff9,%eax
jmp    11c9 <get_token+0x99>
mov    $0xfffffff8,%eax
jmp    11c9 <get_token+0x99>
mov    $0xfffffffd,%eax
jmp    11c9 <get_token+0x99>
mov    $0xfffffffb,%eax
jmp    11c9 <get_token+0x99>
mov    $0xfffffffa,%eax
jmp    11c9 <get_token+0x99>
mov    $0xfffffffc,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stdin = global i32 0
@stderr = global i32 0
@.str = [24 x i8] c"unrecognized character\0A\00"
define i32 @get_token() {
%1 = alloca i32
%2 = alloca i32
store i32 -10, i32* %2
br label %3
3: ; preds = %12, %0
%4 = load i32, i32* @stdin
%5 = call i32 @getc(i32 %4)
store i32 %5, i32* %1
br label %6
6: ; preds = %3
%7 = load i32, i32* %1
%8 = icmp eq i32 %7, 32
br i1 %8, label %12, label %9
9: ; preds = %6
%10 = load i32, i32* %1
%11 = icmp eq i32 %10, 9
br label %12
12: ; preds = %9, %6
%13 = phi i1 [ true, %6 ], [ %11, %9 ]
br i1 %13, label %3, label %14
14: ; preds = %12
%15 = load i32, i32* %1
switch i32 %15, label %30 [
i32 48, label %16
i32 49, label %16
i32 50, label %16
i32 51, label %16
i32 52, label %16
i32 53, label %16
i32 54, label %16
i32 55, label %16
i32 56, label %16
i32 57, label %16
i32 37, label %19
i32 100, label %20
i32 68, label %20
i32 107, label %21
i32 75, label %21
i32 42, label %22
i32 47, label %23
i32 43, label %24
i32 45, label %25
i32 40, label %26
i32 41, label %27
i32 10, label %28
i32 128, label %29
]
16: ; preds = %14, %14, %14, %14, %14, %14, %14, %14, %14, %14
%17 = load i32, i32* %1
%18 = call i32 @read_int(i32 %17)
store i32 %18, i32* %2
br label %33
19: ; preds = %14
store i32 100, i32* %2
br label %33
20: ; preds = %14, %14
store i32 -1, i32* %2
br label %33
21: ; preds = %14, %14
store i32 -2, i32* %2
br label %33
22: ; preds = %14
store i32 -3, i32* %2
br label %33
23: ; preds = %14
store i32 -4, i32* %2
br label %33
24: ; preds = %14
store i32 -5, i32* %2
br label %33
25: ; preds = %14
store i32 -6, i32* %2
br label %33
26: ; preds = %14
store i32 -7, i32* %2
br label %33
27: ; preds = %14
store i32 -8, i32* %2
br label %33
28: ; preds = %14
store i32 -9, i32* %2
br label %33
29: ; preds = %14
store i32 -10, i32* %2
br label %33
30: ; preds = %14
%31 = load i32, i32* @stderr
%32 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %33
33: ; preds = %30, %29, %28, %27, %26, %25, %24, %23, %22, %21, %20, %19, %16
%34 = load i32, i32* %2
ret i32 %34
}

LLVM IR (-O2):
@stdin = global i32 0
@stderr = global i32 0
@.str = [24 x i8] c"unrecognized character\0A\00"
define i32 @get_token() {
br label %1
1: ; preds = %4, %0
%2 = load i32, i32* @stdin
%3 = tail call i32 @getc(i32 %2)
switch i32 %3, label %12 [
i32 32, label %4
i32 9, label %4
i32 48, label %5
i32 49, label %5
i32 50, label %5
i32 51, label %5
i32 52, label %5
i32 53, label %5
i32 54, label %5
i32 55, label %5
i32 56, label %5
i32 57, label %5
i32 37, label %15
i32 100, label %16
i32 68, label %16
i32 107, label %17
i32 75, label %17
i32 42, label %18
i32 47, label %19
i32 43, label %20
i32 45, label %7
i32 40, label %8
i32 41, label %9
i32 10, label %10
i32 128, label %11
]
4: ; preds = %1, %1
br label %1
5: ; preds = %1, %1, %1, %1, %1, %1, %1, %1, %1, %1
%6 = tail call i32 @read_int(i32 %3)
br label %20
7: ; preds = %1
br label %20
8: ; preds = %1
br label %20
9: ; preds = %1
br label %20
10: ; preds = %1
br label %20
11: ; preds = %1
br label %20
12: ; preds = %1
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %20
15: ; preds = %1
br label %20
16: ; preds = %1, %1
br label %20
17: ; preds = %1, %1
br label %20
18: ; preds = %1
br label %20
19: ; preds = %1
br label %20
20: ; preds = %1, %19, %18, %17, %16, %15, %12, %11, %10, %9, %8, %7, %5
%21 = phi i32 [ -10, %12 ], [ -10, %11 ], [ -9, %10 ], [ -8, %9 ], [ -7, %8 ], [ -6, %7 ], [ %6, %5 ], [ 100, %15 ], [ -1, %16 ], [ -2, %17 ], [ -3, %18 ], [ -4, %19 ], [ -5, %1 ]
ret i32 %21
}