char *str_VgaMode(unsigned long dwVgaMode) {
  switch (dwVgaMode) {
  case 0x0001:
    return "640x480";
  case 0x0002:
    return "720x487";
  case 0x0004:
    return "720x576";
  case 0x0008:
    return "800x600";
  case 0x0010:
    return "1024x768";
  default:
    return "???";
  }
}


x86 assembly (clang, -O0):
<str_VgaMode>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
sub    $0xf,%rax
ja     1182 <str_VgaMode+0x82>
mov    -0x18(%rbp),%rax
lea    0xed7(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf07(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    118d <str_VgaMode+0x8d>
lea    0xeff(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    118d <str_VgaMode+0x8d>
lea    0xef7(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    118d <str_VgaMode+0x8d>
lea    0xeef(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    118d <str_VgaMode+0x8d>
lea    0xee7(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    118d <str_VgaMode+0x8d>
lea    0xee0(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_VgaMode>:
add    $0xffffffffffffffff,%rdi
cmp    $0xf,%rdi
ja     1129 <str_VgaMode+0x29>
lea    0xf2f(%rip),%rax
lea    0xee8(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
lea    0xf20(%rip),%rax
ret
lea    0xf39(%rip),%rax
ret
lea    0xf18(%rip),%rax
ret
lea    0xf18(%rip),%rax
ret
lea    0xf18(%rip),%rax
ret

LLVM IR (-O0):
@.str = [8 x i8] c"640x480\00"
@.str.1 = [8 x i8] c"720x487\00"
@.str.2 = [8 x i8] c"720x576\00"
@.str.3 = [8 x i8] c"800x600\00"
@.str.4 = [9 x i8] c"1024x768\00"
@.str.5 = [4 x i8] c"???\00"
define i8* @str_VgaMode(i64 %0) {
%2 = alloca i8*
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
switch i64 %4, label %10 [
i64 1, label %5
i64 2, label %6
i64 4, label %7
i64 8, label %8
i64 16, label %9
]
5: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %2
br label %11
6: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %11
7: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %11
8: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %11
9: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %11
10: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %11
11: ; preds = %10, %9, %8, %7, %6, %5
%12 = load i8*, i8** %2
ret i8* %12
}

LLVM IR (-O2):
@.str = [8 x i8] c"640x480\00"
@.str.1 = [8 x i8] c"720x487\00"
@.str.2 = [8 x i8] c"720x576\00"
@.str.3 = [8 x i8] c"800x600\00"
@.str.4 = [9 x i8] c"1024x768\00"
@.str.5 = [4 x i8] c"???\00"
define i8* @str_VgaMode(i64 %0) {
switch i64 %0, label %6 [
i64 1, label %7
i64 2, label %2
i64 4, label %3
i64 8, label %4
i64 16, label %5
]
2: ; preds = %1
br label %7
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, %2
%8 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), %6 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %8
}