char *get_name_for_eltorito_platform(int id) {
  if (id == 0)
    return "x86";
  if (id == 1)
    return "PowerPC";
  if (id == 2)
    return "Macintosh";
  if (id == 0xEF)
    return "EFI";
  return "unknown";
}


x86 assembly (clang, -O0):
<get_name_for_eltorito_platform>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1121 <get_name_for_eltorito_platform+0x21>
lea    0xee8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    117d <get_name_for_eltorito_platform+0x7d>
cmpl   $0x1,-0xc(%rbp)
jne    113b <get_name_for_eltorito_platform+0x3b>
lea    0xed2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    117d <get_name_for_eltorito_platform+0x7d>
cmpl   $0x2,-0xc(%rbp)
jne    1155 <get_name_for_eltorito_platform+0x55>
lea    0xec0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    117d <get_name_for_eltorito_platform+0x7d>
cmpl   $0xef,-0xc(%rbp)
jne    1172 <get_name_for_eltorito_platform+0x72>
lea    0xead(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    117d <get_name_for_eltorito_platform+0x7d>
lea    0xea1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_name_for_eltorito_platform>:
cmp    $0x1,%edi
jg     1116 <get_name_for_eltorito_platform+0x16>
test   %edi,%edi
je     1133 <get_name_for_eltorito_platform+0x33>
cmp    $0x1,%edi
jne    112b <get_name_for_eltorito_platform+0x2b>
lea    0xeef(%rip),%rax
ret
cmp    $0x2,%edi
je     113b <get_name_for_eltorito_platform+0x3b>
cmp    $0xef,%edi
jne    112b <get_name_for_eltorito_platform+0x2b>
lea    0xeec(%rip),%rax
ret
lea    0xee8(%rip),%rax
ret
lea    0xec6(%rip),%rax
ret
lea    0xeca(%rip),%rax
ret

LLVM IR (-O0):
@.str = [4 x i8] c"x86\00"
@.str.1 = [8 x i8] c"PowerPC\00"
@.str.2 = [10 x i8] c"Macintosh\00"
@.str.3 = [4 x i8] c"EFI\00"
@.str.4 = [8 x i8] c"unknown\00"
define i8* @get_name_for_eltorito_platform(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %2
br label %20
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %11
10: ; preds = %7
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %20
11: ; preds = %7
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, 2
br i1 %13, label %14, label %15
14: ; preds = %11
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %20
15: ; preds = %11
%16 = load i32, i32* %3
%17 = icmp eq i32 %16, 239
br i1 %17, label %18, label %19
18: ; preds = %15
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %20
19: ; preds = %15
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %20
20: ; preds = %19, %18, %14, %10, %6
%21 = load i8*, i8** %2
ret i8* %21
}

LLVM IR (-O2):
@.str = [4 x i8] c"x86\00"
@.str.1 = [8 x i8] c"PowerPC\00"
@.str.2 = [10 x i8] c"Macintosh\00"
@.str.3 = [4 x i8] c"EFI\00"
@.str.4 = [8 x i8] c"unknown\00"
define i8* @get_name_for_eltorito_platform(i32 %0) {
switch i32 %0, label %5 [
i32 0, label %6
i32 1, label %2
i32 2, label %3
i32 239, label %4
]
2: ; preds = %1
br label %6
3: ; preds = %1
br label %6
4: ; preds = %1
br label %6
5: ; preds = %1
br label %6
6: ; preds = %1, %5, %4, %3, %2
%7 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %7
}