#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 */
typedef int uint16_t;

/* Variables and functions */
char *capability_name(uint16_t capability) {
  switch (capability) {
  case 1:
    return "Other";
  case 2:
    return "Repeater/Hub";
  case 4:
    return "Bridge/Switch";
  case 8:
    return "Wireless LAN";
  case 16:
    return "Router";
  case 32:
    return "Telephone";
  case 64:
    return "DOCSIS/Cable Modem";
  case 128:
    return "Station";
  default:
    return "Unknown";
  };
}


x86 assembly (clang, -O0):
<capability_name>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x1,%eax
je     1194 <capability_name+0x94>
jmp    111b <capability_name+0x1b>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     11a4 <capability_name+0xa4>
jmp    112c <capability_name+0x2c>
mov    -0x10(%rbp),%eax
sub    $0x4,%eax
je     11b4 <capability_name+0xb4>
jmp    113d <capability_name+0x3d>
mov    -0x10(%rbp),%eax
sub    $0x8,%eax
je     11c4 <capability_name+0xc4>
jmp    114e <capability_name+0x4e>
mov    -0x10(%rbp),%eax
sub    $0x10,%eax
je     11d4 <capability_name+0xd4>
jmp    115f <capability_name+0x5f>
mov    -0x10(%rbp),%eax
sub    $0x20,%eax
je     11e4 <capability_name+0xe4>
jmp    1170 <capability_name+0x70>
mov    -0x10(%rbp),%eax
sub    $0x40,%eax
je     11f4 <capability_name+0xf4>
jmp    1181 <capability_name+0x81>
mov    -0x10(%rbp),%eax
sub    $0x80,%eax
je     1204 <capability_name+0x104>
jmp    1214 <capability_name+0x114>
lea    0xe65(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    121f <capability_name+0x11f>
lea    0xe5b(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    121f <capability_name+0x11f>
lea    0xe58(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    121f <capability_name+0x11f>
lea    0xe56(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    121f <capability_name+0x11f>
lea    0xe53(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    121f <capability_name+0x11f>
lea    0xe4a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    121f <capability_name+0x11f>
lea    0xe44(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    121f <capability_name+0x11f>
lea    0xe47(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    121f <capability_name+0x11f>
lea    0xe3f(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<capability_name>:
lea    -0x1(%rdi),%ecx
cmp    $0x3f,%ecx
ja     1127 <capability_name+0x27>
lea    0xff1(%rip),%rax
lea    0xeea(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
lea    0xfe0(%rip),%rax
ret
cmp    $0x80,%edi
jne    1137 <capability_name+0x37>
lea    0x101c(%rip),%rax
ret
lea    0x101c(%rip),%rax
ret
lea    0xfcd(%rip),%rax
ret
lea    0xfd3(%rip),%rax
ret
lea    0xfd8(%rip),%rax
ret
lea    0xfd7(%rip),%rax
ret
lea    0xfd9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [6 x i8] c"Other\00"
@.str.1 = [13 x i8] c"Repeater/Hub\00"
@.str.2 = [14 x i8] c"Bridge/Switch\00"
@.str.3 = [13 x i8] c"Wireless LAN\00"
@.str.4 = [7 x i8] c"Router\00"
@.str.5 = [10 x i8] c"Telephone\00"
@.str.6 = [19 x i8] c"DOCSIS/Cable Modem\00"
@.str.7 = [8 x i8] c"Station\00"
@.str.8 = [8 x i8] c"Unknown\00"
define i8* @capability_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 16, label %9
i32 32, label %10
i32 64, label %11
i32 128, label %12
]
5: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %2
br label %14
6: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %14
7: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %14
8: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %14
9: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %14
10: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %14
11: ; preds = %1
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %14
12: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %14
13: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 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 = [6 x i8] c"Other\00"
@.str.1 = [13 x i8] c"Repeater/Hub\00"
@.str.2 = [14 x i8] c"Bridge/Switch\00"
@.str.3 = [13 x i8] c"Wireless LAN\00"
@.str.4 = [7 x i8] c"Router\00"
@.str.5 = [10 x i8] c"Telephone\00"
@.str.6 = [19 x i8] c"DOCSIS/Cable Modem\00"
@.str.7 = [8 x i8] c"Station\00"
@.str.8 = [8 x i8] c"Unknown\00"
define i8* @capability_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 16, label %5
i32 32, label %6
i32 64, label %7
i32 128, 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 ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), %9 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), %8 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), %7 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), %6 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %11
}