#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 */
int /*<<< orphan*/ cpuid(int, unsigned int *, unsigned int *, unsigned int *,
                         unsigned int *);
int /*<<< orphan*/ cpuid_count(int, int /*<<< orphan*/, unsigned int *,
                               unsigned int *, unsigned int *, unsigned int *);
int verify_cpu(void) {
  unsigned int eax, ebx, ecx, edx;
  cpuid(1, &eax, &ebx, &ecx, &edx);
  if (!(ecx & (1u << 26)))
    return -1;
  cpuid_count(0xd, 0, &eax, &ebx, &ecx, &edx);
  if ((eax & (0x4)) != 0x4)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<verify_cpu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x1,%edi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
call   1040 <cpuid@plt>
mov    -0x10(%rbp),%eax
and    $0x4000000,%eax
cmp    $0x0,%eax
jne    115f <verify_cpu+0x3f>
movl   $0xffffffff,-0x4(%rbp)
jmp    119d <verify_cpu+0x7d>
mov    $0xd,%edi
xor    %esi,%esi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
lea    -0x10(%rbp),%r8
lea    -0x14(%rbp),%r9
call   1030 <cpuid_count@plt>
mov    -0x8(%rbp),%eax
and    $0x4,%eax
cmp    $0x4,%eax
je     1196 <verify_cpu+0x76>
movl   $0xffffffff,-0x4(%rbp)
jmp    119d <verify_cpu+0x7d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<verify_cpu>:
sub    $0x18,%rsp
lea    0xc(%rsp),%rsi
lea    0x14(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x10(%rsp),%r8
mov    $0x1,%edi
call   1040 <cpuid@plt>
mov    $0xffffffff,%eax
testb  $0x4,0xb(%rsp)
je     117b <verify_cpu+0x5b>
lea    0xc(%rsp),%rdx
lea    0x14(%rsp),%rcx
lea    0x8(%rsp),%r8
lea    0x10(%rsp),%r9
mov    $0xd,%edi
xor    %esi,%esi
call   1030 <cpuid_count@plt>
mov    0xc(%rsp),%eax
shr    $0x2,%eax
and    $0x1,%eax
add    $0xffffffff,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @verify_cpu() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = call i32 @cpuid(i32 1, i32* %2, i32* %3, i32* %4, i32* %5)
%7 = load i32, i32* %4
%8 = and i32 %7, 67108864
%9 = icmp ne i32 %8, 0
br i1 %9, label %11, label %10
10: ; preds = %0
store i32 -1, i32* %1
br label %18
11: ; preds = %0
%12 = call i32 @cpuid_count(i32 13, i32 0, i32* %2, i32* %3, i32* %4, i32* %5)
%13 = load i32, i32* %2
%14 = and i32 %13, 4
%15 = icmp ne i32 %14, 4
br i1 %15, label %16, label %17
16: ; preds = %11
store i32 -1, i32* %1
br label %18
17: ; preds = %11
store i32 0, i32* %1
br label %18
18: ; preds = %17, %16, %10
%19 = load i32, i32* %1
ret i32 %19
}

LLVM IR (-O2):
define i32 @verify_cpu() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = call i32 @cpuid(i32 1, i32* %1, i32* %2, i32* %3, i32* %4)
%10 = load i32, i32* %3
%11 = and i32 %10, 67108864
%12 = icmp eq i32 %11, 0
br i1 %12, label %19, label %13
13: ; preds = %0
%14 = call i32 @cpuid_count(i32 13, i32 0, i32* %1, i32* %2, i32* %3, i32* %4)
%15 = load i32, i32* %1
%16 = lshr i32 %15, 2
%17 = and i32 %16, 1
%18 = add nsw i32 %17, -1
br label %19
19: ; preds = %13, %0
%20 = phi i32 [ -1, %0 ], [ %18, %13 ]
ret i32 %20
}