#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 **, int);
int InstructionSet() {
  static int _rv = -1;
  static int cpuinfo[4];
  static unsigned _feat_edx, _feat_ecx;
  if (_rv >= 0) {
    return _rv;
  }
  _rv = 0;
  __cpuid(&cpuinfo, 1);
  _feat_edx = (unsigned)cpuinfo[3];
  _feat_ecx = (unsigned)cpuinfo[2];
  if (sizeof(void *) == 4) {
    if (!((_feat_edx >> 23) & 1))
      goto done;
    ++_rv;
    if (!((_feat_edx >> 24) & 1))
      goto done;
    if (!((_feat_edx >> 25) & 1))
      goto done;
    _rv = 3;
    if (!((_feat_edx >> 26) & 1))
      goto done;
    ++_rv;
  } else {
    _rv = 4;
  }
  if (!((_feat_ecx >> 0) & 1))
    goto done;
  ++_rv;
  if (!((_feat_ecx >> 9) & 1))
    goto done;
  ++_rv;
  if (!((_feat_ecx >> 19) & 1))
    goto done;
  _rv = 8;
  if (!((_feat_ecx >> 20) & 1))
    goto done;
  _rv = 10;
done:
  return _rv;
}


x86 assembly (clang, -O0):
<InstructionSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
cmpl   $0x0,0x2f09(%rip)
jl     1133 <InstructionSet+0x23>
mov    0x2efd(%rip),%eax
mov    %eax,-0x4(%rbp)
jmp    1213 <InstructionSet+0x103>
movl   $0x0,0x2eeb(%rip)
lea    0x2efc(%rip),%rdi
mov    $0x1,%esi
call   1030 <__cpuid@plt>
mov    0x2ef8(%rip),%eax
mov    %eax,0x2ef6(%rip)
mov    0x2ee8(%rip),%eax
mov    %eax,0x2eee(%rip)
movl   $0x4,0x2eb8(%rip)
mov    0x2ede(%rip),%eax
shr    $0x0,%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    118a <InstructionSet+0x7a>
jmp    120a <InstructionSet+0xfa>
mov    0x2e98(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2e8f(%rip)
mov    0x2eb5(%rip),%eax
shr    $0x9,%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    11b3 <InstructionSet+0xa3>
jmp    120a <InstructionSet+0xfa>
mov    0x2e6f(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2e66(%rip)
mov    0x2e8c(%rip),%eax
shr    $0x13,%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    11dc <InstructionSet+0xcc>
jmp    120a <InstructionSet+0xfa>
movl   $0x8,0x2e42(%rip)
mov    0x2e68(%rip),%eax
shr    $0x14,%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    1200 <InstructionSet+0xf0>
jmp    120a <InstructionSet+0xfa>
movl   $0xa,0x2e1e(%rip)
mov    0x2e18(%rip),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<InstructionSet>:
push   %rax
mov    0x2f11(%rip),%eax
test   %eax,%eax
js     111d <InstructionSet+0xd>
pop    %rcx
ret
movl   $0x0,0x2f01(%rip)
lea    0x2f12(%rip),%rdi
mov    $0x1,%esi
call   1030 <__cpuid@plt>
mov    0x2f0a(%rip),%ecx
movl   $0x4,0x2ee0(%rip)
mov    $0x4,%eax
test   $0x1,%cl
je     111b <InstructionSet+0xb>
movl   $0x5,0x2ecc(%rip)
mov    $0x5,%eax
test   $0x200,%ecx
je     111b <InstructionSet+0xb>
movl   $0x6,0x2eb5(%rip)
mov    $0x6,%eax
test   $0x80000,%ecx
je     111b <InstructionSet+0xb>
shr    $0x13,%ecx
and    $0x2,%ecx
or     $0x8,%ecx
mov    %ecx,0x2e99(%rip)
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@InstructionSet._rv = internal global i32 -1
@InstructionSet.cpuinfo = internal global [4 x i32] zeroinitializer
@InstructionSet._feat_edx = internal global i32 0
@InstructionSet._feat_ecx = internal global i32 0
define i32 @InstructionSet() {
%1 = alloca i32
%2 = load i32, i32* @InstructionSet._rv
%3 = icmp sge i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = load i32, i32* @InstructionSet._rv
store i32 %5, i32* %1
br label %40
6: ; preds = %0
store i32 0, i32* @InstructionSet._rv
%7 = call i32 @__cpuid(i32** bitcast ([4 x i32]* @InstructionSet.cpuinfo to i32**), i32 1)
%8 = load i32, i32* getelementptr inbounds ([4 x i32], [4 x i32]* @InstructionSet.cpuinfo, i64 0, i64 3)
store i32 %8, i32* @InstructionSet._feat_edx
%9 = load i32, i32* getelementptr inbounds ([4 x i32], [4 x i32]* @InstructionSet.cpuinfo, i64 0, i64 2)
store i32 %9, i32* @InstructionSet._feat_ecx
store i32 4, i32* @InstructionSet._rv
%10 = load i32, i32* @InstructionSet._feat_ecx
%11 = lshr i32 %10, 0
%12 = and i32 %11, 1
%13 = icmp ne i32 %12, 0
br i1 %13, label %15, label %14
14: ; preds = %6
br label %38
15: ; preds = %6
%16 = load i32, i32* @InstructionSet._rv
%17 = add nsw i32 %16, 1
store i32 %17, i32* @InstructionSet._rv
%18 = load i32, i32* @InstructionSet._feat_ecx
%19 = lshr i32 %18, 9
%20 = and i32 %19, 1
%21 = icmp ne i32 %20, 0
br i1 %21, label %23, label %22
22: ; preds = %15
br label %38
23: ; preds = %15
%24 = load i32, i32* @InstructionSet._rv
%25 = add nsw i32 %24, 1
store i32 %25, i32* @InstructionSet._rv
%26 = load i32, i32* @InstructionSet._feat_ecx
%27 = lshr i32 %26, 19
%28 = and i32 %27, 1
%29 = icmp ne i32 %28, 0
br i1 %29, label %31, label %30
30: ; preds = %23
br label %38
31: ; preds = %23
store i32 8, i32* @InstructionSet._rv
%32 = load i32, i32* @InstructionSet._feat_ecx
%33 = lshr i32 %32, 20
%34 = and i32 %33, 1
%35 = icmp ne i32 %34, 0
br i1 %35, label %37, label %36
36: ; preds = %31
br label %38
37: ; preds = %31
store i32 10, i32* @InstructionSet._rv
br label %38
38: ; preds = %37, %36, %30, %22, %14
%39 = load i32, i32* @InstructionSet._rv
store i32 %39, i32* %1
br label %40
40: ; preds = %38, %4
%41 = load i32, i32* %1
ret i32 %41
}

LLVM IR (-O2):
@InstructionSet._rv = internal unnamed_addr global i32 -1
@InstructionSet.cpuinfo = internal global [4 x i32] zeroinitializer
define i32 @InstructionSet() {
%1 = load i32, i32* @InstructionSet._rv
%2 = icmp sgt i32 %1, -1
br i1 %2, label %18, label %3
3: ; preds = %0
store i32 0, i32* @InstructionSet._rv
%4 = tail call i32 @__cpuid(i32** bitcast ([4 x i32]* @InstructionSet.cpuinfo to i32**), i32 1)
%5 = load i32, i32* getelementptr inbounds ([4 x i32], [4 x i32]* @InstructionSet.cpuinfo, i64 0, i64 2)
store i32 4, i32* @InstructionSet._rv
%6 = and i32 %5, 1
%7 = icmp eq i32 %6, 0
br i1 %7, label %18, label %8
8: ; preds = %3
store i32 5, i32* @InstructionSet._rv
%9 = and i32 %5, 512
%10 = icmp eq i32 %9, 0
br i1 %10, label %18, label %11
11: ; preds = %8
store i32 6, i32* @InstructionSet._rv
%12 = and i32 %5, 524288
%13 = icmp eq i32 %12, 0
br i1 %13, label %18, label %14
14: ; preds = %11
%15 = and i32 %5, 1048576
%16 = icmp eq i32 %15, 0
%17 = select i1 %16, i32 8, i32 10
store i32 %17, i32* @InstructionSet._rv
br label %18
18: ; preds = %3, %8, %11, %14, %0
%19 = phi i32 [ %1, %0 ], [ %17, %14 ], [ 6, %11 ], [ 5, %8 ], [ 4, %3 ]
ret i32 %19
}