char *pizza_name(int pizza) {
  pizza ^= 32;
  switch (pizza) {
  case 3:
    return "Garlic Bread";
  case 11:
    return "Cheesy Garlic Bread";
  case 13:
    return "Cheese Pizza";
  case 29:
    return "Pepperoni Pizza";
  default:
    return "WTF";
  }
}


x86 assembly (clang, -O0):
<pizza_name>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%al
xor    $0x20,%al
mov    %al,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xfffffffd,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x1a,%eax
ja     1178 <pizza_name+0x78>
mov    -0x18(%rbp),%rax
lea    0xed1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf34(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1183 <pizza_name+0x83>
lea    0xf1d(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1183 <pizza_name+0x83>
lea    0xf21(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1183 <pizza_name+0x83>
lea    0xf1e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1183 <pizza_name+0x83>
lea    0xf1e(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pizza_name>:
xor    $0x20,%edi
add    $0xfffffffd,%edi
cmp    $0x1a,%edi
ja     112a <pizza_name+0x2a>
lea    0xf61(%rip),%rax
lea    0xee7(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
lea    0xf43(%rip),%rax
ret
lea    0xf6c(%rip),%rax
ret
lea    0xf47(%rip),%rax
ret
lea    0xf4c(%rip),%rax
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Garlic Bread\00"
@.str.1 = [20 x i8] c"Cheesy Garlic Bread\00"
@.str.2 = [13 x i8] c"Cheese Pizza\00"
@.str.3 = [16 x i8] c"Pepperoni Pizza\00"
@.str.4 = [4 x i8] c"WTF\00"
define i8* @pizza_name(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = xor i32 %4, 32
store i32 %5, i32* %3
%6 = load i32, i32* %3
switch i32 %6, label %11 [
i32 3, label %7
i32 11, label %8
i32 13, label %9
i32 29, label %10
]
7: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8** %2
br label %12
8: ; preds = %1
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %12
9: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %12
10: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %12
11: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %12
12: ; preds = %11, %10, %9, %8, %7
%13 = load i8*, i8** %2
ret i8* %13
}

LLVM IR (-O2):
@.str = [13 x i8] c"Garlic Bread\00"
@.str.1 = [20 x i8] c"Cheesy Garlic Bread\00"
@.str.2 = [13 x i8] c"Cheese Pizza\00"
@.str.3 = [16 x i8] c"Pepperoni Pizza\00"
@.str.4 = [4 x i8] c"WTF\00"
define i8* @pizza_name(i32 %0) {
%2 = xor i32 %0, 32
switch i32 %2, label %6 [
i32 3, label %7
i32 11, label %3
i32 13, label %4
i32 29, label %5
]
3: ; preds = %1
br label %7
4: ; preds = %1
br label %7
5: ; preds = %1
br label %7
6: ; preds = %1
br label %7
7: ; preds = %1, %6, %5, %4, %3
%8 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), %6 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), %5 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), %4 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), %3 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %8
}