#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 *tree_operator(char operator) {
  switch (operator) {
  case '*':
    return "*";
  case '/':
    return "/";
  case '+':
    return "+";
  case '-':
    return "-";
  default:
    return NULL;
  }
}


x86 assembly (clang, -O0):
<tree_operator>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
add    $0xffffffd6,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x5,%eax
ja     1174 <tree_operator+0x74>
mov    -0x18(%rbp),%rax
lea    0xed5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xedd(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    117c <tree_operator+0x7c>
lea    0xecf(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    117c <tree_operator+0x7c>
lea    0xec1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    117c <tree_operator+0x7c>
lea    0xeb3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    117c <tree_operator+0x7c>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tree_operator>:
add    $0xffffffd6,%edi
cmp    $0x5,%edi
ja     1117 <tree_operator+0x17>
movslq %edi,%rax
lea    0x2d0e(%rip),%rcx
mov    (%rcx,%rax,8),%rax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [2 x i8] c"*\00"
@.str.1 = [2 x i8] c"/\00"
@.str.2 = [2 x i8] c"+\00"
@.str.3 = [2 x i8] c"-\00"
define i8* @tree_operator(i8 signext %0) {
%2 = alloca i8*
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %10 [
i32 42, label %6
i32 47, label %7
i32 43, label %8
i32 45, label %9
]
6: ; preds = %1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %2
br label %11
7: ; preds = %1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %11
8: ; preds = %1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %11
9: ; preds = %1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %11
10: ; preds = %1
store i8* null, i8** %2
br label %11
11: ; preds = %10, %9, %8, %7, %6
%12 = load i8*, i8** %2
ret i8* %12
}

LLVM IR (-O2):
@.str = [2 x i8] c"*\00"
@.str.1 = [2 x i8] c"/\00"
@.str.2 = [2 x i8] c"+\00"
@.str.3 = [2 x i8] c"-\00"
@switch.table.tree_operator = [6 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0)]
define i8* @tree_operator(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add nsw i32 %2, -42
%4 = icmp ult i32 %3, 6
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = sext i32 %3 to i64
%7 = getelementptr inbounds [6 x i8*], [6 x i8*]* @switch.table.tree_operator, i64 0, i64 %6
%8 = load i8*, i8** %7
br label %9
9: ; preds = %1, %5
%10 = phi i8* [ %8, %5 ], [ null, %1 ]
ret i8* %10
}