#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 unsigned int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_features(const char *name, uint32_t bits,
                    const char *const cpuidstr[32]) {
  unsigned int i;
  printf("%s:\n", name);
  for (i = 0; i < 32; i++) {
    if (cpuidstr[i]) {
      printf("  [%2u] %c%s\n", i, (bits & (1U << i)) ? '+' : '-', cpuidstr[i]);
    } else if (bits & (1U << i)) {
      printf("  [%2u] +?\n", i);
    }
  }
}


x86 assembly (clang, -O0):
<print_features>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x20,-0x1c(%rbp)
jae    11e1 <print_features+0xd1>
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
cmpq   $0x0,(%rax,%rcx,8)
je     119e <print_features+0x8e>
mov    -0x1c(%rbp),%esi
mov    -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    -0x20(%rbp),%ecx
and    %eax,%ecx
mov    $0x2d,%edx
mov    $0x2b,%eax
cmp    $0x0,%ecx
cmovne %eax,%edx
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    (%rax,%rcx,8),%rcx
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ce <print_features+0xbe>
mov    -0xc(%rbp),%eax
mov    -0x1c(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     11c9 <print_features+0xb9>
mov    -0x1c(%rbp),%esi
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ce <print_features+0xbe>
jmp    11d3 <print_features+0xc3>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113c <print_features+0x2c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_features>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%r12
mov    %esi,%ebp
mov    %rdi,%rsi
lea    0xed9(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xede(%rip),%r14
lea    0xec9(%rip),%r15
xor    %ebx,%ebx
jmp    1162 <print_features+0x52>
xor    %edx,%edx
test   %eax,%eax
sete   %dl
add    %edx,%edx
add    $0x2b,%edx
mov    %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    $0x20,%rbx
je     1188 <print_features+0x78>
mov    $0x1,%eax
mov    %ebx,%ecx
shl    %cl,%eax
mov    (%r12,%rbx,8),%rcx
and    %ebp,%eax
test   %rcx,%rcx
jne    1140 <print_features+0x30>
test   %eax,%eax
je     1158 <print_features+0x48>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1158 <print_features+0x48>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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