const char *size_name(int size) {
  switch (size) {
  case 1:
    return "byte";
  case 2:
    return "word";
  case 4:
    return "dword";
  case 8:
    return "qword";
  case 10:
    return "tword";
  case 16:
    return "oword";
  case 32:
    return "yword";
  case 64:
    return "zword";
  default:
    return "???";
  }
}


x86 assembly (clang, -O0):
<size_name>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x3f,%eax
ja     11b0 <size_name+0xb0>
mov    -0x18(%rbp),%rax
lea    0xed9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xfc9(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11bb <size_name+0xbb>
lea    0xfbf(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11bb <size_name+0xbb>
lea    0xfae(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11bb <size_name+0xbb>
lea    0xfa4(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11bb <size_name+0xbb>
lea    0xf9a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11bb <size_name+0xbb>
lea    0xf90(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11bb <size_name+0xbb>
lea    0xf86(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11bb <size_name+0xbb>
lea    0xf7c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11bb <size_name+0xbb>
lea    0xf72(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<size_name>:
add    $0xffffffff,%edi
cmp    $0x3f,%edi
ja     1127 <size_name+0x27>
lea    0xff1(%rip),%rax
lea    0xeea(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
lea    0xfe0(%rip),%rax
ret
lea    0xffb(%rip),%rax
ret
lea    0xfcf(%rip),%rax
ret
lea    0xfcd(%rip),%rax
ret
lea    0xfcb(%rip),%rax
ret
lea    0xfc9(%rip),%rax
ret
lea    0xfc7(%rip),%rax
ret
lea    0xfc5(%rip),%rax
ret

LLVM IR (-O0):
@.str = [5 x i8] c"byte\00"
@.str.1 = [5 x i8] c"word\00"
@.str.2 = [6 x i8] c"dword\00"
@.str.3 = [6 x i8] c"qword\00"
@.str.4 = [6 x i8] c"tword\00"
@.str.5 = [6 x i8] c"oword\00"
@.str.6 = [6 x i8] c"yword\00"
@.str.7 = [6 x i8] c"zword\00"
@.str.8 = [4 x i8] c"???\00"
define i8* @size_name(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %13 [
i32 1, label %5
i32 2, label %6
i32 4, label %7
i32 8, label %8
i32 10, label %9
i32 16, label %10
i32 32, label %11
i32 64, label %12
]
5: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %2
br label %14
6: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %14
7: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %14
8: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %14
9: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %14
10: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %14
11: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %14
12: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %14
13: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %14
14: ; preds = %13, %12, %11, %10, %9, %8, %7, %6, %5
%15 = load i8*, i8** %2
ret i8* %15
}

LLVM IR (-O2):
@.str = [5 x i8] c"byte\00"
@.str.1 = [5 x i8] c"word\00"
@.str.2 = [6 x i8] c"dword\00"
@.str.3 = [6 x i8] c"qword\00"
@.str.4 = [6 x i8] c"tword\00"
@.str.5 = [6 x i8] c"oword\00"
@.str.6 = [6 x i8] c"yword\00"
@.str.7 = [6 x i8] c"zword\00"
@.str.8 = [4 x i8] c"???\00"
define i8* @size_name(i32 %0) {
switch i32 %0, label %9 [
i32 1, label %10
i32 2, label %2
i32 4, label %3
i32 8, label %4
i32 10, label %5
i32 16, label %6
i32 32, label %7
i32 64, label %8
]
2: ; preds = %1
br label %10
3: ; preds = %1
br label %10
4: ; preds = %1
br label %10
5: ; preds = %1
br label %10
6: ; preds = %1
br label %10
7: ; preds = %1
br label %10
8: ; preds = %1
br label %10
9: ; preds = %1
br label %10
10: ; preds = %1, %9, %8, %7, %6, %5, %4, %3, %2
%11 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), %9 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), %8 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), %7 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), %6 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %11
}