#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 */

/* Variables and functions */
scalar_t__ checkadd();
scalar_t__ checkcpuid(int);
scalar_t__ checkcrc32();
scalar_t__ checkpopcnt();
int /*<<< orphan*/ printf(char *);
int main() {
  if (0 == checkcpuid(20)) {
    printf("CRC32 not supported\n");
  } else {
    if (checkcrc32()) {
      printf("Error: CRC32\n");
    }
  }
  if (0 == checkcpuid(23)) {
    printf("POPCNT not supported\n");
  } else {
    if (checkpopcnt()) {
      printf("Error: POPCNT\n");
    }
  }
  if (checkadd()) {
    printf("Error: ADD\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x14,%edi
call   1050 <checkcpuid@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    1188 <main+0x38>
lea    0xe82(%rip),%rdi
call   1040 <printf@plt>
jmp    11aa <main+0x5a>
mov    $0x0,%al
call   1060 <checkcrc32@plt>
cmp    $0x0,%rax
je     11a5 <main+0x55>
lea    0xe75(%rip),%rdi
call   1040 <printf@plt>
jmp    11aa <main+0x5a>
mov    $0x17,%edi
call   1050 <checkcpuid@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    11d3 <main+0x83>
lea    0xe5a(%rip),%rdi
call   1040 <printf@plt>
jmp    11f5 <main+0xa5>
mov    $0x0,%al
call   1030 <checkpopcnt@plt>
cmp    $0x0,%rax
je     11f0 <main+0xa0>
lea    0xe4e(%rip),%rdi
call   1040 <printf@plt>
jmp    11f5 <main+0xa5>
mov    $0x0,%al
call   1070 <checkadd@plt>
cmp    $0x0,%rax
je     1212 <main+0xc2>
lea    0xe3b(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x14,%edi
call   1050 <checkcpuid@plt>
test   %rax,%rax
je     1175 <main+0x25>
xor    %eax,%eax
call   1060 <checkcrc32@plt>
test   %rax,%rax
je     1181 <main+0x31>
lea    0xebb(%rip),%rdi
jmp    117c <main+0x2c>
lea    0xebf(%rip),%rdi
call   1030 <puts@plt>
mov    $0x17,%edi
call   1050 <checkcpuid@plt>
test   %rax,%rax
je     11a5 <main+0x55>
xor    %eax,%eax
call   1040 <checkpopcnt@plt>
test   %rax,%rax
je     11b1 <main+0x61>
lea    0xe68(%rip),%rdi
jmp    11ac <main+0x5c>
lea    0xe6d(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1070 <checkadd@plt>
test   %rax,%rax
je     11c9 <main+0x79>
lea    0xe3c(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"CRC32 not supported\0A\00"
@.str.1 = [14 x i8] c"Error: CRC32\0A\00"
@.str.2 = [22 x i8] c"POPCNT not supported\0A\00"
@.str.3 = [15 x i8] c"Error: POPCNT\0A\00"
@.str.4 = [12 x i8] c"Error: ADD\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 @checkcpuid(i32 20)
%3 = icmp eq i64 0, %2
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %12
6: ; preds = %0
%7 = call i64 (...) @checkcrc32()
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9, %6
br label %12
12: ; preds = %11, %4
%13 = call i64 @checkcpuid(i32 23)
%14 = icmp eq i64 0, %13
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
br label %23
17: ; preds = %12
%18 = call i64 (...) @checkpopcnt()
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %22
22: ; preds = %20, %17
br label %23
23: ; preds = %22, %15
%24 = call i64 (...) @checkadd()
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
br label %28
28: ; preds = %26, %23
ret i32 0
}

LLVM IR (-O2):
@str = [11 x i8] c"Error: ADD\00"
@str.5 = [14 x i8] c"Error: POPCNT\00"
@str.6 = [21 x i8] c"POPCNT not supported\00"
@str.7 = [13 x i8] c"Error: CRC32\00"
@str.8 = [20 x i8] c"CRC32 not supported\00"
define i32 @main() {
%1 = tail call i64 @checkcpuid(i32 20)
%2 = icmp eq i64 %1, 0
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = tail call i64 (...) @checkcrc32()
%5 = icmp eq i64 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %3, %0
%7 = phi i8* [ getelementptr inbounds ([20 x i8], [20 x i8]* @str.8, i64 0, i64 0), %0 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @str.7, i64 0, i64 0), %3 ]
%8 = tail call i32 @puts(i8* dereferenceable(1) %7)
br label %9
9: ; preds = %6, %3
%10 = tail call i64 @checkcpuid(i32 23)
%11 = icmp eq i64 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %9
%13 = tail call i64 (...) @checkpopcnt()
%14 = icmp eq i64 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %12, %9
%16 = phi i8* [ getelementptr inbounds ([21 x i8], [21 x i8]* @str.6, i64 0, i64 0), %9 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @str.5, i64 0, i64 0), %12 ]
%17 = tail call i32 @puts(i8* dereferenceable(1) %16)
br label %18
18: ; preds = %15, %12
%19 = tail call i64 (...) @checkadd()
%20 = icmp eq i64 %19, 0
br i1 %20, label %23, label %21
21: ; preds = %18
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
br label %23
23: ; preds = %21, %18
ret i32 0
}