const char *oui_vendor(unsigned oui) {
  switch (oui) {
  case 0x00601d:
    return "Agere";
  case 0x001018:
    return "Broadcom";
  case 0x000347:
    return "Intel";
  case 0x004096:
    return "Aironet";
  case 0x00037f:
    return "Atheros";
  case 0x0050f2:
    return "Microsoft";
  default:
    return "(unknown)";
  }
}


x86 assembly (clang, -O0):
<oui_vendor>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x347,%eax
je     119c <oui_vendor+0x9c>
jmp    111d <oui_vendor+0x1d>
mov    -0x10(%rbp),%eax
sub    $0x37f,%eax
je     11bc <oui_vendor+0xbc>
jmp    1130 <oui_vendor+0x30>
mov    -0x10(%rbp),%eax
sub    $0x1018,%eax
je     118c <oui_vendor+0x8c>
jmp    1143 <oui_vendor+0x43>
mov    -0x10(%rbp),%eax
sub    $0x4096,%eax
je     11ac <oui_vendor+0xac>
jmp    1156 <oui_vendor+0x56>
mov    -0x10(%rbp),%eax
sub    $0x50f2,%eax
je     11cc <oui_vendor+0xcc>
jmp    1169 <oui_vendor+0x69>
mov    -0x10(%rbp),%eax
sub    $0x601d,%eax
jne    11dc <oui_vendor+0xdc>
jmp    117c <oui_vendor+0x7c>
lea    0xe7d(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e7 <oui_vendor+0xe7>
lea    0xe73(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e7 <oui_vendor+0xe7>
lea    0xe6c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e7 <oui_vendor+0xe7>
lea    0xe62(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e7 <oui_vendor+0xe7>
lea    0xe5a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e7 <oui_vendor+0xe7>
lea    0xe52(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e7 <oui_vendor+0xe7>
lea    0xe4c(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<oui_vendor>:
cmp    $0x4095,%edi
jg     1128 <oui_vendor+0x28>
cmp    $0x347,%edi
je     1148 <oui_vendor+0x48>
cmp    $0x37f,%edi
je     1150 <oui_vendor+0x50>
cmp    $0x1018,%edi
jne    1168 <oui_vendor+0x68>
lea    0xedf(%rip),%rax
ret
cmp    $0x4096,%edi
je     1158 <oui_vendor+0x58>
cmp    $0x50f2,%edi
je     1160 <oui_vendor+0x60>
cmp    $0x601d,%edi
jne    1168 <oui_vendor+0x68>
lea    0xeb9(%rip),%rax
ret
lea    0xec0(%rip),%rax
ret
lea    0xec6(%rip),%rax
ret
lea    0xeb6(%rip),%rax
ret
lea    0xebe(%rip),%rax
ret
lea    0xec0(%rip),%rax
ret

LLVM IR (-O0):
@.str = [6 x i8] c"Agere\00"
@.str.1 = [9 x i8] c"Broadcom\00"
@.str.2 = [6 x i8] c"Intel\00"
@.str.3 = [8 x i8] c"Aironet\00"
@.str.4 = [8 x i8] c"Atheros\00"
@.str.5 = [10 x i8] c"Microsoft\00"
@.str.6 = [10 x i8] c"(unknown)\00"
define i8* @oui_vendor(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %11 [
i32 24605, label %5
i32 4120, label %6
i32 839, label %7
i32 16534, label %8
i32 895, label %9
i32 20722, label %10
]
5: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %2
br label %12
6: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %12
7: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %12
8: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %12
9: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %12
10: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %12
11: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %12
12: ; preds = %11, %10, %9, %8, %7, %6, %5
%13 = load i8*, i8** %2
ret i8* %13
}

LLVM IR (-O2):
@.str = [6 x i8] c"Agere\00"
@.str.1 = [9 x i8] c"Broadcom\00"
@.str.2 = [6 x i8] c"Intel\00"
@.str.3 = [8 x i8] c"Aironet\00"
@.str.4 = [8 x i8] c"Atheros\00"
@.str.5 = [10 x i8] c"Microsoft\00"
@.str.6 = [10 x i8] c"(unknown)\00"
define i8* @oui_vendor(i32 %0) {
switch i32 %0, label %7 [
i32 24605, label %8
i32 4120, label %2
i32 839, label %3
i32 16534, label %4
i32 895, label %5
i32 20722, label %6
]
2: ; preds = %1
br label %8
3: ; preds = %1
br label %8
4: ; preds = %1
br label %8
5: ; preds = %1
br label %8
6: ; preds = %1
br label %8
7: ; preds = %1
br label %8
8: ; preds = %1, %7, %6, %5, %4, %3, %2
%9 = phi i8* [ getelementptr inbounds ([10 x i8], [10 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 ([8 x i8], [8 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 ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([9 x i8], [9 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* %9
}