#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 */
int /*<<< orphan*/ lldp_print_cap_one(char *, unsigned int *);
void lldp_print_cap(uint16_t cap) {
  unsigned int prev = 0;
  if (cap & (1 << 0))
    lldp_print_cap_one("Other", &prev);
  if (cap & (1 << 1))
    lldp_print_cap_one("Repeater", &prev);
  if (cap & (1 << 2))
    lldp_print_cap_one("Bridge", &prev);
  if (cap & (1 << 3))
    lldp_print_cap_one("WLAN AP", &prev);
  if (cap & (1 << 4))
    lldp_print_cap_one("Router", &prev);
  if (cap & (1 << 5))
    lldp_print_cap_one("Telephone", &prev);
  if (cap & (1 << 6))
    lldp_print_cap_one("DOCSIS", &prev);
  if (cap & (1 << 7))
    lldp_print_cap_one("Station only", &prev);
}


x86 assembly (clang, -O0):
<lldp_print_cap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1141 <lldp_print_cap+0x31>
lea    0xec8(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <lldp_print_cap_one@plt>
mov    -0x4(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     1160 <lldp_print_cap+0x50>
lea    0xeaf(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <lldp_print_cap_one@plt>
mov    -0x4(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     117f <lldp_print_cap+0x6f>
lea    0xe99(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <lldp_print_cap_one@plt>
mov    -0x4(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     119e <lldp_print_cap+0x8e>
lea    0xe81(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <lldp_print_cap_one@plt>
mov    -0x4(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     11bd <lldp_print_cap+0xad>
lea    0xe6a(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <lldp_print_cap_one@plt>
mov    -0x4(%rbp),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     11dc <lldp_print_cap+0xcc>
lea    0xe52(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <lldp_print_cap_one@plt>
mov    -0x4(%rbp),%eax
and    $0x40,%eax
cmp    $0x0,%eax
je     11fb <lldp_print_cap+0xeb>
lea    0xe3d(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <lldp_print_cap_one@plt>
mov    -0x4(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     121c <lldp_print_cap+0x10c>
lea    0xe23(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <lldp_print_cap_one@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lldp_print_cap>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
movl   $0x0,0xc(%rsp)
test   $0x1,%bl
jne    116a <lldp_print_cap+0x5a>
test   $0x2,%bl
jne    1180 <lldp_print_cap+0x70>
test   $0x4,%bl
jne    1196 <lldp_print_cap+0x86>
test   $0x8,%bl
jne    11ac <lldp_print_cap+0x9c>
test   $0x10,%bl
jne    11c6 <lldp_print_cap+0xb6>
test   $0x20,%bl
jne    11e0 <lldp_print_cap+0xd0>
test   $0x40,%bl
jne    11fa <lldp_print_cap+0xea>
test   $0x80,%bl
je     1164 <lldp_print_cap+0x54>
lea    0xedc(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1030 <lldp_print_cap_one@plt>
add    $0x10,%rsp
pop    %rbx
ret
lea    0xe8f(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1030 <lldp_print_cap_one@plt>
test   $0x2,%bl
je     1129 <lldp_print_cap+0x19>
lea    0xe7f(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1030 <lldp_print_cap_one@plt>
test   $0x4,%bl
je     112e <lldp_print_cap+0x1e>
lea    0xe72(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1030 <lldp_print_cap_one@plt>
test   $0x8,%bl
je     1133 <lldp_print_cap+0x23>
lea    0xe63(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1030 <lldp_print_cap_one@plt>
test   $0x10,%bl
je     113c <lldp_print_cap+0x2c>
lea    0xe51(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1030 <lldp_print_cap_one@plt>
test   $0x20,%bl
je     1145 <lldp_print_cap+0x35>
lea    0xe3e(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1030 <lldp_print_cap_one@plt>
test   $0x40,%bl
je     114e <lldp_print_cap+0x3e>
lea    0xe2e(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1030 <lldp_print_cap_one@plt>
test   $0x80,%bl
jne    1153 <lldp_print_cap+0x43>
jmp    1164 <lldp_print_cap+0x54>

LLVM IR (-O0):
@.str = [6 x i8] c"Other\00"
@.str.1 = [9 x i8] c"Repeater\00"
@.str.2 = [7 x i8] c"Bridge\00"
@.str.3 = [8 x i8] c"WLAN AP\00"
@.str.4 = [7 x i8] c"Router\00"
@.str.5 = [10 x i8] c"Telephone\00"
@.str.6 = [7 x i8] c"DOCSIS\00"
@.str.7 = [13 x i8] c"Station only\00"
define void @lldp_print_cap(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %2
%5 = and i32 %4, 1
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @lldp_print_cap_one(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %3)
br label %9
9: ; preds = %7, %1
%10 = load i32, i32* %2
%11 = and i32 %10, 2
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = call i32 @lldp_print_cap_one(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %3)
br label %15
15: ; preds = %13, %9
%16 = load i32, i32* %2
%17 = and i32 %16, 4
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = call i32 @lldp_print_cap_one(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32* %3)
br label %21
21: ; preds = %19, %15
%22 = load i32, i32* %2
%23 = and i32 %22, 8
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = call i32 @lldp_print_cap_one(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32* %3)
br label %27
27: ; preds = %25, %21
%28 = load i32, i32* %2
%29 = and i32 %28, 16
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = call i32 @lldp_print_cap_one(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32* %3)
br label %33
33: ; preds = %31, %27
%34 = load i32, i32* %2
%35 = and i32 %34, 32
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %33
%38 = call i32 @lldp_print_cap_one(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i32* %3)
br label %39
39: ; preds = %37, %33
%40 = load i32, i32* %2
%41 = and i32 %40, 64
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %39
%44 = call i32 @lldp_print_cap_one(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i32* %3)
br label %45
45: ; preds = %43, %39
%46 = load i32, i32* %2
%47 = and i32 %46, 128
%48 = icmp ne i32 %47, 0
br i1 %48, label %49, label %51
49: ; preds = %45
%50 = call i32 @lldp_print_cap_one(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32* %3)
br label %51
51: ; preds = %49, %45
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"Other\00"
@.str.1 = [9 x i8] c"Repeater\00"
@.str.2 = [7 x i8] c"Bridge\00"
@.str.3 = [8 x i8] c"WLAN AP\00"
@.str.4 = [7 x i8] c"Router\00"
@.str.5 = [10 x i8] c"Telephone\00"
@.str.6 = [7 x i8] c"DOCSIS\00"
@.str.7 = [13 x i8] c"Station only\00"
define void @lldp_print_cap(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%4 = and i32 %0, 1
%5 = icmp eq i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = call i32 @lldp_print_cap_one(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %8
8: ; preds = %6, %1
%9 = and i32 %0, 2
%10 = icmp eq i32 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %8
%12 = call i32 @lldp_print_cap_one(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %13
13: ; preds = %11, %8
%14 = and i32 %0, 4
%15 = icmp eq i32 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %13
%17 = call i32 @lldp_print_cap_one(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32* %2)
br label %18
18: ; preds = %16, %13
%19 = and i32 %0, 8
%20 = icmp eq i32 %19, 0
br i1 %20, label %23, label %21
21: ; preds = %18
%22 = call i32 @lldp_print_cap_one(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32* %2)
br label %23
23: ; preds = %21, %18
%24 = and i32 %0, 16
%25 = icmp eq i32 %24, 0
br i1 %25, label %28, label %26
26: ; preds = %23
%27 = call i32 @lldp_print_cap_one(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32* %2)
br label %28
28: ; preds = %26, %23
%29 = and i32 %0, 32
%30 = icmp eq i32 %29, 0
br i1 %30, label %33, label %31
31: ; preds = %28
%32 = call i32 @lldp_print_cap_one(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i32* %2)
br label %33
33: ; preds = %31, %28
%34 = and i32 %0, 64
%35 = icmp eq i32 %34, 0
br i1 %35, label %38, label %36
36: ; preds = %33
%37 = call i32 @lldp_print_cap_one(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i32* %2)
br label %38
38: ; preds = %36, %33
%39 = and i32 %0, 128
%40 = icmp eq i32 %39, 0
br i1 %40, label %43, label %41
41: ; preds = %38
%42 = call i32 @lldp_print_cap_one(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32* %2)
br label %43
43: ; preds = %41, %38
ret void
}