#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 __u16;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char, char const *);
void print_features(__u16 supported, __u16 enabled, const char *names[]) {
  int i;
  for (i = 0; i < 16; ++i) {
    __u16 mask = 1 << i;
    if ((supported & mask) && names[15 - i])
      printf("\t   %c\t%s\n", (enabled & mask) ? '*' : ' ', names[15 - i]);
  }
}


x86 assembly (clang, -O0):
<print_features>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x10,-0x14(%rbp)
jge    11b4 <print_features+0xa4>
mov    -0x14(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
and    -0x18(%rbp),%eax
cmp    $0x0,%eax
je     11a1 <print_features+0x91>
mov    -0x10(%rbp),%rax
mov    $0xf,%ecx
sub    -0x14(%rbp),%ecx
movslq %ecx,%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     11a1 <print_features+0x91>
mov    -0x8(%rbp),%edx
and    -0x18(%rbp),%edx
mov    $0x20,%eax
mov    $0x2a,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    -0x10(%rbp),%rcx
mov    $0xf,%edx
sub    -0x14(%rbp),%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,8),%rdx
lea    0xe67(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
jmp    11a6 <print_features+0x96>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1129 <print_features+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_features>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %esi,%r14d
mov    %edi,%r15d
add    $0x78,%rbx
xor    %ebp,%ebp
mov    $0x20,%r13d
lea    0xec9(%rip),%r12
jmp    114e <print_features+0x3e>
nopl   0x0(%rax)
add    $0x1,%rbp
add    $0xfffffffffffffff8,%rbx
cmp    $0x10,%rbp
je     117b <print_features+0x6b>
mov    $0x1,%eax
mov    %ebp,%ecx
shl    %cl,%eax
bt     %ebp,%r15d
jae    1140 <print_features+0x30>
mov    (%rbx),%rdx
test   %rdx,%rdx
je     1140 <print_features+0x30>
test   %r14d,%eax
mov    $0x2a,%esi
cmove  %r13d,%esi
mov    %r12,%rdi
call   1030 <printf@plt>
jmp    1140 <print_features+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"\09 %c\09%s\0A\00"
define void @print_features(i32 %0, i32 %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8** %2, i8*** %6
store i32 0, i32* %7
br label %9
9: ; preds = %43, %3
%10 = load i32, i32* %7
%11 = icmp slt i32 %10, 16
br i1 %11, label %12, label %46
12: ; preds = %9
%13 = load i32, i32* %7
%14 = shl i32 1, %13
store i32 %14, i32* %8
%15 = load i32, i32* %4
%16 = load i32, i32* %8
%17 = and i32 %15, %16
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %42
19: ; preds = %12
%20 = load i8**, i8*** %6
%21 = load i32, i32* %7
%22 = sub nsw i32 15, %21
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8*, i8** %20, i64 %23
%25 = load i8*, i8** %24
%26 = icmp ne i8* %25, null
br i1 %26, label %27, label %42
27: ; preds = %19
%28 = load i32, i32* %5
%29 = load i32, i32* %8
%30 = and i32 %28, %29
%31 = icmp ne i32 %30, 0
%32 = zext i1 %31 to i64
%33 = select i1 %31, i32 42, i32 32
%34 = trunc i32 %33 to i8
%35 = load i8**, i8*** %6
%36 = load i32, i32* %7
%37 = sub nsw i32 15, %36
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8*, i8** %35, i64 %38
%40 = load i8*, i8** %39
%41 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8 signext %34, i8* %40)
br label %42
42: ; preds = %27, %19, %12
br label %43
43: ; preds = %42
%44 = load i32, i32* %7
%45 = add nsw i32 %44, 1
store i32 %45, i32* %7
br label %9
46: ; preds = %9
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"\09 %c\09%s\0A\00"
define void @print_features(i32 %0, i32 %1, i8** nocapture %2) {
br label %4
4: ; preds = %3, %20
%5 = phi i64 [ 0, %3 ], [ %21, %20 ]
%6 = trunc i64 %5 to i32
%7 = shl nuw nsw i32 1, %6
%8 = and i32 %7, %0
%9 = icmp eq i32 %8, 0
br i1 %9, label %20, label %10
10: ; preds = %4
%11 = sub nuw nsw i64 15, %5
%12 = getelementptr inbounds i8*, i8** %2, i64 %11
%13 = load i8*, i8** %12
%14 = icmp eq i8* %13, null
br i1 %14, label %20, label %15
15: ; preds = %10
%16 = and i32 %7, %1
%17 = icmp eq i32 %16, 0
%18 = select i1 %17, i8 32, i8 42
%19 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8 signext %18, i8* %13)
br label %20
20: ; preds = %15, %10, %4
%21 = add nuw nsw i64 %5, 1
%22 = icmp eq i64 %21, 16
br i1 %22, label %23, label %4
23: ; preds = %20
ret void
}