#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 *, int *, int *);
int have_cpuid();
int have_excpuid();
int get_cputype(int gettype) {
  int eax, ebx, ecx, edx;
  int extend_family, family;
  int extend_model, model;
  int type, stepping;
  int feature = 0;
  cpuid(1, &eax, &ebx, &ecx, &edx);
  switch (gettype) {
  case 1:
    return ((((eax) >> (20)) & (0xff)));
  case 2:
    return ((((eax) >> (16)) & (0x0f)));
  case 3:
    return ((((eax) >> (12)) & (0x03)));
  case 4:
    return ((((eax) >> (8)) & (0x0f)));
  case 5:
    return ((((eax) >> (4)) & (0x0f)));
  case 6:
    return ((((ebx) >> (24)) & (0x0f)));
  case 7:
    return ((((ebx) >> (16)) & (0x0f)));
  case 8:
    return ((((ebx) >> (8)) & (0x0f)));
  case 9:
    return ((((eax) >> (0)) & (0x0f)));
  case 10:
    return ((((ebx) >> (0)) & (0xff)));
  case 12:
    if (have_cpuid() < 4)
      return 0;
    cpuid(4, &eax, &ebx, &ecx, &edx);
    return ((((eax) >> (14)) & (0xfff)));
  case 13:
    if (have_cpuid() < 4)
      return 0;
    cpuid(4, &eax, &ebx, &ecx, &edx);
    return ((((eax) >> (26)) & (0x3f)));
  case 11:
    if ((edx & (1 << 3)) != 0)
      feature |= (1 << 12);
    if ((edx & (1 << 15)) != 0)
      feature |= (1 << 11);
    if ((edx & (1 << 19)) != 0)
      feature |= (1 << 13);
    if ((edx & (1 << 23)) != 0)
      feature |= (1 << 8);
    if ((edx & (1 << 25)) != 0)
      feature |= (1 << 0);
    if ((edx & (1 << 26)) != 0)
      feature |= (1 << 1);
    if ((edx & (1 << 27)) != 0) {
      if (((((ebx) >> (16)) & (0x0f))) > 0)
        feature |= (1 << 14);
    }
    if ((ecx & (1 << 0)) != 0)
      feature |= (1 << 2);
    if ((ecx & (1 << 9)) != 0)
      feature |= (1 << 3);
    if ((ecx & (1 << 19)) != 0)
      feature |= (1 << 4);
    if ((ecx & (1 << 20)) != 0)
      feature |= (1 << 5);
    if (have_excpuid() >= 0x01) {
      cpuid(0x80000001, &eax, &ebx, &ecx, &edx);
      if ((ecx & (1 << 6)) != 0)
        feature |= (1 << 6);
      if ((ecx & (1 << 7)) != 0)
        feature |= (1 << 15);
      if ((edx & (1 << 30)) != 0)
        feature |= (1 << 10);
      if ((edx & (1 << 31)) != 0)
        feature |= (1 << 9);
    }
    if (have_excpuid() >= 0x1a) {
      cpuid(0x8000001a, &eax, &ebx, &ecx, &edx);
      if ((eax & (1 << 0)) != 0)
        feature |= (1 << 16);
      if ((eax & (1 << 1)) != 0)
        feature |= (1 << 17);
    }
  }
  return feature;
}


x86 assembly (clang, -O0):
<get_cputype>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0x34(%rbp)
mov    $0x1,%edi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x14(%rbp),%rcx
lea    -0x18(%rbp),%r8
call   1040 <cpuid@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x40(%rbp)
sub    $0xc,%eax
ja     1501 <get_cputype+0x3d1>
mov    -0x40(%rbp),%rax
lea    0xe84(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0xc(%rbp),%eax
sar    $0x14,%eax
and    $0xff,%eax
mov    %eax,-0x4(%rbp)
jmp    1507 <get_cputype+0x3d7>
mov    -0xc(%rbp),%eax
sar    $0x10,%eax
and    $0xf,%eax
mov    %eax,-0x4(%rbp)
jmp    1507 <get_cputype+0x3d7>
mov    -0xc(%rbp),%eax
sar    $0xc,%eax
and    $0x3,%eax
mov    %eax,-0x4(%rbp)
jmp    1507 <get_cputype+0x3d7>
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
and    $0xf,%eax
mov    %eax,-0x4(%rbp)
jmp    1507 <get_cputype+0x3d7>
mov    -0xc(%rbp),%eax
sar    $0x4,%eax
and    $0xf,%eax
mov    %eax,-0x4(%rbp)
jmp    1507 <get_cputype+0x3d7>
mov    -0x10(%rbp),%eax
sar    $0x18,%eax
and    $0xf,%eax
mov    %eax,-0x4(%rbp)
jmp    1507 <get_cputype+0x3d7>
mov    -0x10(%rbp),%eax
sar    $0x10,%eax
and    $0xf,%eax
mov    %eax,-0x4(%rbp)
jmp    1507 <get_cputype+0x3d7>
mov    -0x10(%rbp),%eax
sar    $0x8,%eax
and    $0xf,%eax
mov    %eax,-0x4(%rbp)
jmp    1507 <get_cputype+0x3d7>
mov    -0xc(%rbp),%eax
sar    $0x0,%eax
and    $0xf,%eax
mov    %eax,-0x4(%rbp)
jmp    1507 <get_cputype+0x3d7>
mov    -0x10(%rbp),%eax
sar    $0x0,%eax
and    $0xff,%eax
mov    %eax,-0x4(%rbp)
jmp    1507 <get_cputype+0x3d7>
mov    $0x0,%al
call   1050 <have_cpuid@plt>
cmp    $0x4,%eax
jge    124f <get_cputype+0x11f>
movl   $0x0,-0x4(%rbp)
jmp    1507 <get_cputype+0x3d7>
mov    $0x4,%edi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x14(%rbp),%rcx
lea    -0x18(%rbp),%r8
call   1040 <cpuid@plt>
mov    -0xc(%rbp),%eax
sar    $0xe,%eax
and    $0xfff,%eax
mov    %eax,-0x4(%rbp)
jmp    1507 <get_cputype+0x3d7>
mov    $0x0,%al
call   1050 <have_cpuid@plt>
cmp    $0x4,%eax
jge    1298 <get_cputype+0x168>
movl   $0x0,-0x4(%rbp)
jmp    1507 <get_cputype+0x3d7>
mov    $0x4,%edi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x14(%rbp),%rcx
lea    -0x18(%rbp),%r8
call   1040 <cpuid@plt>
mov    -0xc(%rbp),%eax
sar    $0x1a,%eax
and    $0x3f,%eax
mov    %eax,-0x4(%rbp)
jmp    1507 <get_cputype+0x3d7>
mov    -0x18(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     12dd <get_cputype+0x1ad>
mov    -0x34(%rbp),%eax
or     $0x1000,%eax
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%eax
and    $0x8000,%eax
cmp    $0x0,%eax
je     12f9 <get_cputype+0x1c9>
mov    -0x34(%rbp),%eax
or     $0x800,%eax
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%eax
and    $0x80000,%eax
cmp    $0x0,%eax
je     1315 <get_cputype+0x1e5>
mov    -0x34(%rbp),%eax
or     $0x2000,%eax
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%eax
and    $0x800000,%eax
cmp    $0x0,%eax
je     1331 <get_cputype+0x201>
mov    -0x34(%rbp),%eax
or     $0x100,%eax
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%eax
and    $0x2000000,%eax
cmp    $0x0,%eax
je     134b <get_cputype+0x21b>
mov    -0x34(%rbp),%eax
or     $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%eax
and    $0x4000000,%eax
cmp    $0x0,%eax
je     1365 <get_cputype+0x235>
mov    -0x34(%rbp),%eax
or     $0x2,%eax
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%eax
and    $0x8000000,%eax
cmp    $0x0,%eax
je     1398 <get_cputype+0x268>
mov    -0x10(%rbp),%eax
sar    $0x10,%eax
and    $0xf,%eax
cmp    $0x0,%eax
jle    1393 <get_cputype+0x263>
mov    -0x34(%rbp),%eax
or     $0x4000,%eax
mov    %eax,-0x34(%rbp)
jmp    1398 <get_cputype+0x268>
mov    -0x14(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     13b0 <get_cputype+0x280>
mov    -0x34(%rbp),%eax
or     $0x4,%eax
mov    %eax,-0x34(%rbp)
mov    -0x14(%rbp),%eax
and    $0x200,%eax
cmp    $0x0,%eax
je     13ca <get_cputype+0x29a>
mov    -0x34(%rbp),%eax
or     $0x8,%eax
mov    %eax,-0x34(%rbp)
mov    -0x14(%rbp),%eax
and    $0x80000,%eax
cmp    $0x0,%eax
je     13e4 <get_cputype+0x2b4>
mov    -0x34(%rbp),%eax
or     $0x10,%eax
mov    %eax,-0x34(%rbp)
mov    -0x14(%rbp),%eax
and    $0x100000,%eax
cmp    $0x0,%eax
je     13fe <get_cputype+0x2ce>
mov    -0x34(%rbp),%eax
or     $0x20,%eax
mov    %eax,-0x34(%rbp)
mov    $0x0,%al
call   1030 <have_excpuid@plt>
cmp    $0x1,%eax
jl     1499 <get_cputype+0x369>
mov    $0x80000001,%edi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x14(%rbp),%rcx
lea    -0x18(%rbp),%r8
call   1040 <cpuid@plt>
mov    -0x14(%rbp),%eax
and    $0x40,%eax
cmp    $0x0,%eax
je     1440 <get_cputype+0x310>
mov    -0x34(%rbp),%eax
or     $0x40,%eax
mov    %eax,-0x34(%rbp)
mov    -0x14(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     145c <get_cputype+0x32c>
mov    -0x34(%rbp),%eax
or     $0x8000,%eax
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%eax
and    $0x40000000,%eax
cmp    $0x0,%eax
je     1478 <get_cputype+0x348>
mov    -0x34(%rbp),%eax
or     $0x400,%eax
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%eax
and    $0x80000000,%eax
cmp    $0x0,%eax
je     1494 <get_cputype+0x364>
mov    -0x34(%rbp),%eax
or     $0x200,%eax
mov    %eax,-0x34(%rbp)
jmp    1499 <get_cputype+0x369>
mov    $0x0,%al
call   1030 <have_excpuid@plt>
cmp    $0x1a,%eax
jl     14fc <get_cputype+0x3cc>
mov    $0x8000001a,%edi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x14(%rbp),%rcx
lea    -0x18(%rbp),%r8
call   1040 <cpuid@plt>
mov    -0xc(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     14dd <get_cputype+0x3ad>
mov    -0x34(%rbp),%eax
or     $0x10000,%eax
mov    %eax,-0x34(%rbp)
mov    -0xc(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     14f7 <get_cputype+0x3c7>
mov    -0x34(%rbp),%eax
or     $0x20000,%eax
mov    %eax,-0x34(%rbp)
jmp    14fc <get_cputype+0x3cc>
jmp    1501 <get_cputype+0x3d1>
mov    -0x34(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_cputype>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
mov    %rsp,%rsi
lea    0x4(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
mov    $0x1,%edi
call   1040 <cpuid@plt>
add    $0xffffffff,%ebx
cmp    $0xc,%ebx
ja     1179 <get_cputype+0x49>
lea    0xe9e(%rip),%rax
movslq (%rax,%rbx,4),%rcx
add    %rax,%rcx
jmp    *%rcx
mov    (%rsp),%eax
shr    $0x14,%eax
movzbl %al,%ebx
jmp    1367 <get_cputype+0x237>
xor    %ebx,%ebx
jmp    1367 <get_cputype+0x237>
movzwl 0x2(%rsp),%ebx
jmp    1364 <get_cputype+0x234>
mov    (%rsp),%ebx
shr    $0xc,%ebx
and    $0x3,%ebx
jmp    1367 <get_cputype+0x237>
mov    (%rsp),%ebx
jmp    11c0 <get_cputype+0x90>
mov    (%rsp),%ebx
shr    $0x4,%ebx
jmp    1364 <get_cputype+0x234>
movzbl 0x7(%rsp),%ebx
jmp    1364 <get_cputype+0x234>
movzwl 0x6(%rsp),%ebx
jmp    1364 <get_cputype+0x234>
mov    0x4(%rsp),%ebx
shr    $0x8,%ebx
jmp    1364 <get_cputype+0x234>
movzbl 0x4(%rsp),%ebx
jmp    1367 <get_cputype+0x237>
mov    0x8(%rsp),%eax
mov    %eax,%ecx
and    $0x8,%ecx
shl    $0x9,%ecx
mov    %eax,%edx
shr    $0x4,%edx
and    $0x800,%edx
or     %ecx,%edx
mov    %eax,%ecx
shr    $0x6,%ecx
and    $0x2000,%ecx
or     %edx,%ecx
mov    %eax,%edx
shr    $0xf,%edx
and    $0x100,%edx
or     %ecx,%edx
mov    %eax,%ecx
shr    $0x19,%ecx
mov    %ecx,%esi
and    $0x1,%esi
or     %edx,%esi
and    $0x2,%ecx
or     %esi,%ecx
test   $0x8000000,%eax
je     122d <get_cputype+0xfd>
lea    0x4000(%rcx),%eax
testb  $0xf,0x6(%rsp)
cmove  %ecx,%eax
mov    %eax,%ecx
mov    0xc(%rsp),%ebx
lea    0x0(,%rbx,4),%eax
and    $0x4,%eax
mov    %ebx,%edx
shr    $0x6,%edx
and    $0x8,%edx
or     %ecx,%edx
shr    $0xf,%ebx
mov    %ebx,%ecx
and    $0x10,%ecx
or     %eax,%ecx
and    $0x20,%ebx
or     %ecx,%ebx
or     %edx,%ebx
xor    %eax,%eax
call   1030 <have_excpuid@plt>
test   %eax,%eax
jle    12b0 <get_cputype+0x180>
mov    %rsp,%rsi
lea    0x4(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
mov    $0x80000001,%edi
call   1040 <cpuid@plt>
mov    0xc(%rsp),%eax
mov    %eax,%ecx
and    $0x40,%ecx
or     %ebx,%ecx
shl    $0x8,%eax
and    $0x8000,%eax
or     %ecx,%eax
mov    0x8(%rsp),%ecx
mov    %ecx,%edx
shr    $0x14,%edx
and    $0x400,%edx
or     %eax,%edx
mov    %edx,%ebx
or     $0x200,%ebx
test   %ecx,%ecx
cmovns %edx,%ebx
xor    %eax,%eax
call   1030 <have_excpuid@plt>
cmp    $0x1a,%eax
jl     1367 <get_cputype+0x237>
mov    %rsp,%rsi
lea    0x4(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
mov    $0x8000001a,%edi
call   1040 <cpuid@plt>
mov    (%rsp),%eax
shl    $0x10,%eax
mov    %eax,%ecx
and    $0x10000,%ecx
or     %ebx,%ecx
and    $0x20000,%eax
or     %ecx,%eax
mov    %eax,%ebx
jmp    1367 <get_cputype+0x237>
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <have_cpuid@plt>
cmp    $0x4,%eax
jl     1367 <get_cputype+0x237>
mov    %rsp,%rsi
lea    0x4(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
mov    $0x4,%edi
call   1040 <cpuid@plt>
mov    (%rsp),%ebx
shr    $0xe,%ebx
and    $0xfff,%ebx
jmp    1367 <get_cputype+0x237>
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <have_cpuid@plt>
cmp    $0x4,%eax
jl     1367 <get_cputype+0x237>
mov    %rsp,%rsi
lea    0x4(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
mov    $0x4,%edi
call   1040 <cpuid@plt>
mov    (%rsp),%ebx
shr    $0x1a,%ebx
jmp    1367 <get_cputype+0x237>
mov    (%rsp),%ebx
and    $0xf,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @get_cputype(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 %0, i32* %3
store i32 0, i32* %14
%15 = call i32 @cpuid(i32 1, i32* %4, i32* %5, i32* %6, i32* %7)
%16 = load i32, i32* %3
switch i32 %16, label %211 [
i32 1, label %17
i32 2, label %21
i32 3, label %25
i32 4, label %29
i32 5, label %33
i32 6, label %37
i32 7, label %41
i32 8, label %45
i32 9, label %49
i32 10, label %53
i32 12, label %57
i32 13, label %66
i32 11, label %75
]
17: ; preds = %1
%18 = load i32, i32* %4
%19 = ashr i32 %18, 20
%20 = and i32 %19, 255
store i32 %20, i32* %2
br label %213
21: ; preds = %1
%22 = load i32, i32* %4
%23 = ashr i32 %22, 16
%24 = and i32 %23, 15
store i32 %24, i32* %2
br label %213
25: ; preds = %1
%26 = load i32, i32* %4
%27 = ashr i32 %26, 12
%28 = and i32 %27, 3
store i32 %28, i32* %2
br label %213
29: ; preds = %1
%30 = load i32, i32* %4
%31 = ashr i32 %30, 8
%32 = and i32 %31, 15
store i32 %32, i32* %2
br label %213
33: ; preds = %1
%34 = load i32, i32* %4
%35 = ashr i32 %34, 4
%36 = and i32 %35, 15
store i32 %36, i32* %2
br label %213
37: ; preds = %1
%38 = load i32, i32* %5
%39 = ashr i32 %38, 24
%40 = and i32 %39, 15
store i32 %40, i32* %2
br label %213
41: ; preds = %1
%42 = load i32, i32* %5
%43 = ashr i32 %42, 16
%44 = and i32 %43, 15
store i32 %44, i32* %2
br label %213
45: ; preds = %1
%46 = load i32, i32* %5
%47 = ashr i32 %46, 8
%48 = and i32 %47, 15
store i32 %48, i32* %2
br label %213
49: ; preds = %1
%50 = load i32, i32* %4
%51 = ashr i32 %50, 0
%52 = and i32 %51, 15
store i32 %52, i32* %2
br label %213
53: ; preds = %1
%54 = load i32, i32* %5
%55 = ashr i32 %54, 0
%56 = and i32 %55, 255
store i32 %56, i32* %2
br label %213
57: ; preds = %1
%58 = call i32 (...) @have_cpuid()
%59 = icmp slt i32 %58, 4
br i1 %59, label %60, label %61
60: ; preds = %57
store i32 0, i32* %2
br label %213
61: ; preds = %57
%62 = call i32 @cpuid(i32 4, i32* %4, i32* %5, i32* %6, i32* %7)
%63 = load i32, i32* %4
%64 = ashr i32 %63, 14
%65 = and i32 %64, 4095
store i32 %65, i32* %2
br label %213
66: ; preds = %1
%67 = call i32 (...) @have_cpuid()
%68 = icmp slt i32 %67, 4
br i1 %68, label %69, label %70
69: ; preds = %66
store i32 0, i32* %2
br label %213
70: ; preds = %66
%71 = call i32 @cpuid(i32 4, i32* %4, i32* %5, i32* %6, i32* %7)
%72 = load i32, i32* %4
%73 = ashr i32 %72, 26
%74 = and i32 %73, 63
store i32 %74, i32* %2
br label %213
75: ; preds = %1
%76 = load i32, i32* %7
%77 = and i32 %76, 8
%78 = icmp ne i32 %77, 0
br i1 %78, label %79, label %82
79: ; preds = %75
%80 = load i32, i32* %14
%81 = or i32 %80, 4096
store i32 %81, i32* %14
br label %82
82: ; preds = %79, %75
%83 = load i32, i32* %7
%84 = and i32 %83, 32768
%85 = icmp ne i32 %84, 0
br i1 %85, label %86, label %89
86: ; preds = %82
%87 = load i32, i32* %14
%88 = or i32 %87, 2048
store i32 %88, i32* %14
br label %89
89: ; preds = %86, %82
%90 = load i32, i32* %7
%91 = and i32 %90, 524288
%92 = icmp ne i32 %91, 0
br i1 %92, label %93, label %96
93: ; preds = %89
%94 = load i32, i32* %14
%95 = or i32 %94, 8192
store i32 %95, i32* %14
br label %96
96: ; preds = %93, %89
%97 = load i32, i32* %7
%98 = and i32 %97, 8388608
%99 = icmp ne i32 %98, 0
br i1 %99, label %100, label %103
100: ; preds = %96
%101 = load i32, i32* %14
%102 = or i32 %101, 256
store i32 %102, i32* %14
br label %103
103: ; preds = %100, %96
%104 = load i32, i32* %7
%105 = and i32 %104, 33554432
%106 = icmp ne i32 %105, 0
br i1 %106, label %107, label %110
107: ; preds = %103
%108 = load i32, i32* %14
%109 = or i32 %108, 1
store i32 %109, i32* %14
br label %110
110: ; preds = %107, %103
%111 = load i32, i32* %7
%112 = and i32 %111, 67108864
%113 = icmp ne i32 %112, 0
br i1 %113, label %114, label %117
114: ; preds = %110
%115 = load i32, i32* %14
%116 = or i32 %115, 2
store i32 %116, i32* %14
br label %117
117: ; preds = %114, %110
%118 = load i32, i32* %7
%119 = and i32 %118, 134217728
%120 = icmp ne i32 %119, 0
br i1 %120, label %121, label %130
121: ; preds = %117
%122 = load i32, i32* %5
%123 = ashr i32 %122, 16
%124 = and i32 %123, 15
%125 = icmp sgt i32 %124, 0
br i1 %125, label %126, label %129
126: ; preds = %121
%127 = load i32, i32* %14
%128 = or i32 %127, 16384
store i32 %128, i32* %14
br label %129
129: ; preds = %126, %121
br label %130
130: ; preds = %129, %117
%131 = load i32, i32* %6
%132 = and i32 %131, 1
%133 = icmp ne i32 %132, 0
br i1 %133, label %134, label %137
134: ; preds = %130
%135 = load i32, i32* %14
%136 = or i32 %135, 4
store i32 %136, i32* %14
br label %137
137: ; preds = %134, %130
%138 = load i32, i32* %6
%139 = and i32 %138, 512
%140 = icmp ne i32 %139, 0
br i1 %140, label %141, label %144
141: ; preds = %137
%142 = load i32, i32* %14
%143 = or i32 %142, 8
store i32 %143, i32* %14
br label %144
144: ; preds = %141, %137
%145 = load i32, i32* %6
%146 = and i32 %145, 524288
%147 = icmp ne i32 %146, 0
br i1 %147, label %148, label %151
148: ; preds = %144
%149 = load i32, i32* %14
%150 = or i32 %149, 16
store i32 %150, i32* %14
br label %151
151: ; preds = %148, %144
%152 = load i32, i32* %6
%153 = and i32 %152, 1048576
%154 = icmp ne i32 %153, 0
br i1 %154, label %155, label %158
155: ; preds = %151
%156 = load i32, i32* %14
%157 = or i32 %156, 32
store i32 %157, i32* %14
br label %158
158: ; preds = %155, %151
%159 = call i32 (...) @have_excpuid()
%160 = icmp sge i32 %159, 1
br i1 %160, label %161, label %191
161: ; preds = %158
%162 = call i32 @cpuid(i32 -2147483647, i32* %4, i32* %5, i32* %6, i32* %7)
%163 = load i32, i32* %6
%164 = and i32 %163, 64
%165 = icmp ne i32 %164, 0
br i1 %165, label %166, label %169
166: ; preds = %161
%167 = load i32, i32* %14
%168 = or i32 %167, 64
store i32 %168, i32* %14
br label %169
169: ; preds = %166, %161
%170 = load i32, i32* %6
%171 = and i32 %170, 128
%172 = icmp ne i32 %171, 0
br i1 %172, label %173, label %176
173: ; preds = %169
%174 = load i32, i32* %14
%175 = or i32 %174, 32768
store i32 %175, i32* %14
br label %176
176: ; preds = %173, %169
%177 = load i32, i32* %7
%178 = and i32 %177, 1073741824
%179 = icmp ne i32 %178, 0
br i1 %179, label %180, label %183
180: ; preds = %176
%181 = load i32, i32* %14
%182 = or i32 %181, 1024
store i32 %182, i32* %14
br label %183
183: ; preds = %180, %176
%184 = load i32, i32* %7
%185 = and i32 %184, -2147483648
%186 = icmp ne i32 %185, 0
br i1 %186, label %187, label %190
187: ; preds = %183
%188 = load i32, i32* %14
%189 = or i32 %188, 512
store i32 %189, i32* %14
br label %190
190: ; preds = %187, %183
br label %191
191: ; preds = %190, %158
%192 = call i32 (...) @have_excpuid()
%193 = icmp sge i32 %192, 26
br i1 %193, label %194, label %210
194: ; preds = %191
%195 = call i32 @cpuid(i32 -2147483622, i32* %4, i32* %5, i32* %6, i32* %7)
%196 = load i32, i32* %4
%197 = and i32 %196, 1
%198 = icmp ne i32 %197, 0
br i1 %198, label %199, label %202
199: ; preds = %194
%200 = load i32, i32* %14
%201 = or i32 %200, 65536
store i32 %201, i32* %14
br label %202
202: ; preds = %199, %194
%203 = load i32, i32* %4
%204 = and i32 %203, 2
%205 = icmp ne i32 %204, 0
br i1 %205, label %206, label %209
206: ; preds = %202
%207 = load i32, i32* %14
%208 = or i32 %207, 131072
store i32 %208, i32* %14
br label %209
209: ; preds = %206, %202
br label %210
210: ; preds = %209, %191
br label %211
211: ; preds = %210, %1
%212 = load i32, i32* %14
store i32 %212, i32* %2
br label %213
213: ; preds = %211, %70, %69, %61, %60, %53, %49, %45, %41, %37, %33, %29, %25, %21, %17
%214 = load i32, i32* %2
ret i32 %214
}

LLVM IR (-O2):
define i32 @get_cputype(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*
%9 = bitcast i32* %5 to i8*
%10 = call i32 @cpuid(i32 1, i32* %2, i32* %3, i32* %4, i32* %5)
switch i32 %0, label %133 [
i32 1, label %11
i32 2, label %15
i32 3, label %19
i32 4, label %23
i32 5, label %27
i32 6, label %31
i32 7, label %35
i32 8, label %39
i32 9, label %43
i32 10, label %46
i32 12, label %49
i32 13, label %57
i32 11, label %64
]
11: ; preds = %1
%12 = load i32, i32* %2
%13 = lshr i32 %12, 20
%14 = and i32 %13, 255
br label %133
15: ; preds = %1
%16 = load i32, i32* %2
%17 = lshr i32 %16, 16
%18 = and i32 %17, 15
br label %133
19: ; preds = %1
%20 = load i32, i32* %2
%21 = lshr i32 %20, 12
%22 = and i32 %21, 3
br label %133
23: ; preds = %1
%24 = load i32, i32* %2
%25 = lshr i32 %24, 8
%26 = and i32 %25, 15
br label %133
27: ; preds = %1
%28 = load i32, i32* %2
%29 = lshr i32 %28, 4
%30 = and i32 %29, 15
br label %133
31: ; preds = %1
%32 = load i32, i32* %3
%33 = lshr i32 %32, 24
%34 = and i32 %33, 15
br label %133
35: ; preds = %1
%36 = load i32, i32* %3
%37 = lshr i32 %36, 16
%38 = and i32 %37, 15
br label %133
39: ; preds = %1
%40 = load i32, i32* %3
%41 = lshr i32 %40, 8
%42 = and i32 %41, 15
br label %133
43: ; preds = %1
%44 = load i32, i32* %2
%45 = and i32 %44, 15
br label %133
46: ; preds = %1
%47 = load i32, i32* %3
%48 = and i32 %47, 255
br label %133
49: ; preds = %1
%50 = call i32 (...) @have_cpuid()
%51 = icmp slt i32 %50, 4
br i1 %51, label %133, label %52
52: ; preds = %49
%53 = call i32 @cpuid(i32 4, i32* %2, i32* %3, i32* %4, i32* %5)
%54 = load i32, i32* %2
%55 = lshr i32 %54, 14
%56 = and i32 %55, 4095
br label %133
57: ; preds = %1
%58 = call i32 (...) @have_cpuid()
%59 = icmp slt i32 %58, 4
br i1 %59, label %133, label %60
60: ; preds = %57
%61 = call i32 @cpuid(i32 4, i32* %2, i32* %3, i32* %4, i32* %5)
%62 = load i32, i32* %2
%63 = lshr i32 %62, 26
br label %133
64: ; preds = %1
%65 = load i32, i32* %5
%66 = shl i32 %65, 9
%67 = and i32 %66, 4096
%68 = lshr i32 %65, 4
%69 = and i32 %68, 2048
%70 = or i32 %69, %67
%71 = lshr i32 %65, 6
%72 = and i32 %71, 8192
%73 = or i32 %70, %72
%74 = lshr i32 %65, 15
%75 = and i32 %74, 256
%76 = or i32 %73, %75
%77 = lshr i32 %65, 25
%78 = and i32 %77, 1
%79 = or i32 %76, %78
%80 = and i32 %77, 2
%81 = or i32 %79, %80
%82 = and i32 %65, 134217728
%83 = icmp eq i32 %82, 0
br i1 %83, label %90, label %84
84: ; preds = %64
%85 = load i32, i32* %3
%86 = and i32 %85, 983040
%87 = icmp eq i32 %86, 0
%88 = or i32 %81, 16384
%89 = select i1 %87, i32 %81, i32 %88
br label %90
90: ; preds = %84, %64
%91 = phi i32 [ %81, %64 ], [ %89, %84 ]
%92 = load i32, i32* %4
%93 = shl i32 %92, 2
%94 = and i32 %93, 4
%95 = or i32 %94, %91
%96 = lshr i32 %92, 6
%97 = and i32 %96, 8
%98 = or i32 %95, %97
%99 = lshr i32 %92, 15
%100 = and i32 %99, 16
%101 = or i32 %98, %100
%102 = and i32 %99, 32
%103 = or i32 %101, %102
%104 = call i32 (...) @have_excpuid()
%105 = icmp sgt i32 %104, 0
br i1 %105, label %106, label %121
106: ; preds = %90
%107 = call i32 @cpuid(i32 -2147483647, i32* %2, i32* %3, i32* %4, i32* %5)
%108 = load i32, i32* %4
%109 = and i32 %108, 64
%110 = or i32 %109, %103
%111 = shl i32 %108, 8
%112 = and i32 %111, 32768
%113 = or i32 %110, %112
%114 = load i32, i32* %5
%115 = lshr i32 %114, 20
%116 = and i32 %115, 1024
%117 = or i32 %113, %116
%118 = icmp sgt i32 %114, -1
%119 = or i32 %117, 512
%120 = select i1 %118, i32 %117, i32 %119
br label %121
121: ; preds = %106, %90
%122 = phi i32 [ %103, %90 ], [ %120, %106 ]
%123 = call i32 (...) @have_excpuid()
%124 = icmp sgt i32 %123, 25
br i1 %124, label %125, label %133
125: ; preds = %121
%126 = call i32 @cpuid(i32 -2147483622, i32* %2, i32* %3, i32* %4, i32* %5)
%127 = load i32, i32* %2
%128 = shl i32 %127, 16
%129 = and i32 %128, 65536
%130 = or i32 %129, %122
%131 = and i32 %128, 131072
%132 = or i32 %130, %131
br label %133
133: ; preds = %125, %1, %121, %57, %49, %60, %52, %46, %43, %39, %35, %31, %27, %23, %19, %15, %11
%134 = phi i32 [ %63, %60 ], [ %56, %52 ], [ %48, %46 ], [ %45, %43 ], [ %42, %39 ], [ %38, %35 ], [ %34, %31 ], [ %30, %27 ], [ %26, %23 ], [ %22, %19 ], [ %18, %15 ], [ %14, %11 ], [ 0, %49 ], [ 0, %57 ], [ 0, %1 ], [ %122, %121 ], [ %132, %125 ]
ret i32 %134
}