#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*/ printf(char *, ...);
void emit(int t, int tval) {
  switch (t) {
  case '+':
  case '-':
  case '*':
  case '/':
    printf("Token: %c\n", t);
    break;
  case 257:
    printf("Token: DIV\n");
    break;
  case 258:
    printf("Token: MOD\n");
    break;
  case 256:
    printf("Token: NUM\n");
    break;
  case 259:
    printf("Token: ID\n");
    break;
  default:
    printf("token %d, tokenval %d\n", t, tval);
  }
}


x86 assembly (clang, -O0):
<emit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
add    $0xffffffd6,%eax
sub    $0x2,%eax
jb     11a3 <emit+0x93>
jmp    1135 <emit+0x25>
mov    -0xc(%rbp),%eax
sub    $0x2d,%eax
je     11a3 <emit+0x93>
jmp    1146 <emit+0x36>
mov    -0xc(%rbp),%eax
sub    $0x2f,%eax
je     11a3 <emit+0x93>
jmp    1157 <emit+0x47>
mov    -0xc(%rbp),%eax
sub    $0x100,%eax
je     11df <emit+0xcf>
jmp    116a <emit+0x5a>
mov    -0xc(%rbp),%eax
sub    $0x101,%eax
je     11b9 <emit+0xa9>
jmp    117d <emit+0x6d>
mov    -0xc(%rbp),%eax
sub    $0x102,%eax
je     11cc <emit+0xbc>
jmp    1190 <emit+0x80>
mov    -0xc(%rbp),%eax
sub    $0x103,%eax
je     11f2 <emit+0xe2>
jmp    1205 <emit+0xf5>
mov    -0x4(%rbp),%esi
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1219 <emit+0x109>
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1219 <emit+0x109>
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1219 <emit+0x109>
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1219 <emit+0x109>
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1219 <emit+0x109>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit>:
mov    %esi,%edx
mov    %edi,%esi
cmp    $0x2f,%edi
jbe    1150 <emit+0x30>
lea    -0x100(%rsi),%eax
cmp    $0x3,%eax
ja     1170 <emit+0x50>
lea    0xec5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xef1(%rip),%rdi
jmp    1030 <puts@plt>
mov    %esi,%eax
movabs $0xac0000000000,%rcx
bt     %rax,%rcx
jae    1129 <emit+0x9>
lea    0xea7(%rip),%rdi
xor    %eax,%eax
jmp    1040 <printf@plt>
lea    0xea4(%rip),%rdi
xor    %eax,%eax
jmp    1040 <printf@plt>
lea    0xec2(%rip),%rdi
jmp    1030 <puts@plt>
lea    0xea1(%rip),%rdi
jmp    1030 <puts@plt>
lea    0xeb5(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"Token: %c\0A\00"
@.str.1 = [12 x i8] c"Token: DIV\0A\00"
@.str.2 = [12 x i8] c"Token: MOD\0A\00"
@.str.3 = [12 x i8] c"Token: NUM\0A\00"
@.str.4 = [11 x i8] c"Token: ID\0A\00"
@.str.5 = [23 x i8] c"token %d, tokenval %d\0A\00"
define void @emit(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
switch i32 %5, label %17 [
i32 43, label %6
i32 45, label %6
i32 42, label %6
i32 47, label %6
i32 257, label %9
i32 258, label %11
i32 256, label %13
i32 259, label %15
]
6: ; preds = %2, %2, %2, %2
%7 = load i32, i32* %3
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %21
9: ; preds = %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %21
11: ; preds = %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %21
13: ; preds = %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
br label %21
15: ; preds = %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
br label %21
17: ; preds = %2
%18 = load i32, i32* %3
%19 = load i32, i32* %4
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i32 %18, i32 %19)
br label %21
21: ; preds = %17, %15, %13, %11, %9, %6
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"Token: %c\0A\00"
@.str.5 = [23 x i8] c"token %d, tokenval %d\0A\00"
@str = [10 x i8] c"Token: ID\00"
@str.6 = [11 x i8] c"Token: NUM\00"
@str.7 = [11 x i8] c"Token: MOD\00"
@str.8 = [11 x i8] c"Token: DIV\00"
define void @emit(i32 %0, i32 %1) {
switch i32 %0, label %13 [
i32 43, label %3
i32 45, label %3
i32 42, label %3
i32 47, label %3
i32 257, label %5
i32 258, label %7
i32 256, label %9
i32 259, label %11
]
3: ; preds = %2, %2, %2, %2
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %15
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.8, i64 0, i64 0))
br label %15
7: ; preds = %2
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.7, i64 0, i64 0))
br label %15
9: ; preds = %2
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.6, i64 0, i64 0))
br label %15
11: ; preds = %2
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
br label %15
13: ; preds = %2
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i32 %0, i32 %1)
br label %15
15: ; preds = %13, %11, %9, %7, %5, %3
ret void
}