#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*/ do_cpuid(unsigned int *, unsigned int *, unsigned int *,
                            unsigned int *);
int arch_init_intel(unsigned int level) {
  unsigned int eax, ebx, ecx = 0, edx;
  eax = 1;
  do_cpuid(&eax, &ebx, &ecx, &edx);
  if (!(edx & (1U << 4)))
    return 0;
  eax = 0x80000007;
  do_cpuid(&eax, &ebx, &ecx, &edx);
  return edx & (1U << 8);
}


x86 assembly (clang, -O0):
<arch_init_intel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0xc(%rbp)
lea    -0xc(%rbp),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
call   1030 <do_cpuid@plt>
mov    -0x18(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
jne    1159 <arch_init_intel+0x49>
movl   $0x0,-0x4(%rbp)
jmp    1180 <arch_init_intel+0x70>
movl   $0x80000007,-0xc(%rbp)
lea    -0xc(%rbp),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
call   1030 <do_cpuid@plt>
mov    -0x18(%rbp),%eax
and    $0x100,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arch_init_intel>:
sub    $0x18,%rsp
movl   $0x0,0x10(%rsp)
movl   $0x1,0xc(%rsp)
lea    0xc(%rsp),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   1030 <do_cpuid@plt>
xor    %eax,%eax
testb  $0x10,0x8(%rsp)
je     1170 <arch_init_intel+0x60>
movl   $0x80000007,0xc(%rsp)
80
lea    0xc(%rsp),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   1030 <do_cpuid@plt>
mov    $0x100,%eax
and    0x8(%rsp),%eax
add    $0x18,%rsp
ret

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

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