#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 /*<<< orphan*/, int *, int *, int *, int *);
int /*<<< orphan*/ strcmp(char *, char *);
int get_vendor(void) {
  int eax, ebx, ecx, edx;
  char vendor[13];
  cpuid(0, &eax, &ebx, &ecx, &edx);
  *(int *)(&vendor[0]) = ebx;
  *(int *)(&vendor[4]) = edx;
  *(int *)(&vendor[8]) = ecx;
  vendor[12] = (char)0;
  if (!strcmp(vendor, "GenuineIntel"))
    return 1;
  if (!strcmp(vendor, " UMC UMC UMC"))
    return 2;
  if (!strcmp(vendor, "AuthenticAMD"))
    return 3;
  if (!strcmp(vendor, "CyrixInstead"))
    return 4;
  if (!strcmp(vendor, "NexGenDriven"))
    return 5;
  if (!strcmp(vendor, "CentaurHauls"))
    return 6;
  if (!strcmp(vendor, "RiseRiseRise"))
    return 7;
  if (!strcmp(vendor, " SiS SiS SiS"))
    return 8;
  if (!strcmp(vendor, "GenuineTMx86"))
    return 9;
  if (!strcmp(vendor, "Geode by NSC"))
    return 10;
  if ((eax == 0) || ((eax & 0x500) != 0))
    return 1;
  return 99;
}


x86 assembly (clang, -O0):
<get_vendor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
xor    %edi,%edi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
call   1040 <cpuid@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x21(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1d(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x19(%rbp)
movb   $0x0,-0x15(%rbp)
lea    -0x21(%rbp),%rdi
lea    0xea0(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    117a <get_vendor+0x5a>
movl   $0x1,-0x4(%rbp)
jmp    12f5 <get_vendor+0x1d5>
lea    -0x21(%rbp),%rdi
lea    0xe88(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    119f <get_vendor+0x7f>
movl   $0x2,-0x4(%rbp)
jmp    12f5 <get_vendor+0x1d5>
lea    -0x21(%rbp),%rdi
lea    0xe70(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11c4 <get_vendor+0xa4>
movl   $0x3,-0x4(%rbp)
jmp    12f5 <get_vendor+0x1d5>
lea    -0x21(%rbp),%rdi
lea    0xe58(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11e9 <get_vendor+0xc9>
movl   $0x4,-0x4(%rbp)
jmp    12f5 <get_vendor+0x1d5>
lea    -0x21(%rbp),%rdi
lea    0xe40(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    120e <get_vendor+0xee>
movl   $0x5,-0x4(%rbp)
jmp    12f5 <get_vendor+0x1d5>
lea    -0x21(%rbp),%rdi
lea    0xe28(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1233 <get_vendor+0x113>
movl   $0x6,-0x4(%rbp)
jmp    12f5 <get_vendor+0x1d5>
lea    -0x21(%rbp),%rdi
lea    0xe10(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1258 <get_vendor+0x138>
movl   $0x7,-0x4(%rbp)
jmp    12f5 <get_vendor+0x1d5>
lea    -0x21(%rbp),%rdi
lea    0xdf8(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    127d <get_vendor+0x15d>
movl   $0x8,-0x4(%rbp)
jmp    12f5 <get_vendor+0x1d5>
lea    -0x21(%rbp),%rdi
lea    0xde0(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    12a2 <get_vendor+0x182>
movl   $0x9,-0x4(%rbp)
jmp    12f5 <get_vendor+0x1d5>
lea    -0x21(%rbp),%rdi
lea    0xdc8(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    12c7 <get_vendor+0x1a7>
movl   $0xa,-0x4(%rbp)
jmp    12f5 <get_vendor+0x1d5>
cmpl   $0x0,-0x8(%rbp)
je     12e2 <get_vendor+0x1c2>
mov    -0x8(%rbp),%eax
and    $0x500,%eax
cmp    $0x0,%eax
je     12ee <get_vendor+0x1ce>
movl   $0x1,-0x4(%rbp)
jmp    12f5 <get_vendor+0x1d5>
movl   $0x63,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_vendor>:
sub    $0x28,%rsp
lea    0x24(%rsp),%rsi
lea    0x20(%rsp),%rdx
lea    0x1c(%rsp),%rcx
lea    0x18(%rsp),%r8
xor    %edi,%edi
call   1030 <cpuid@plt>
mov    0x20(%rsp),%eax
mov    %eax,0x8(%rsp)
mov    0x18(%rsp),%eax
mov    %eax,0xc(%rsp)
mov    0x1c(%rsp),%eax
mov    %eax,0x10(%rsp)
movb   $0x0,0x14(%rsp)
movabs $0x49656e69756e6547,%rax
6e 65 49
xor    0x8(%rsp),%rax
movabs $0x6c65746e49656e,%rcx
xor    0xd(%rsp),%rcx
or     %rax,%rcx
je     12ef <get_vendor+0x1df>
movabs $0x434d5520434d5520,%rax
55 4d 43
xor    0x8(%rsp),%rax
movabs $0x434d5520434d55,%rcx
xor    0xd(%rsp),%rcx
or     %rax,%rcx
je     12f9 <get_vendor+0x1e9>
movabs $0x69746e6568747541,%rax
6e 74 69
xor    0x8(%rsp),%rax
movabs $0x444d416369746e,%rcx
xor    0xd(%rsp),%rcx
or     %rax,%rcx
je     1303 <get_vendor+0x1f3>
movabs $0x736e497869727943,%rax
49 6e 73
xor    0x8(%rsp),%rax
movabs $0x64616574736e49,%rcx
xor    0xd(%rsp),%rcx
or     %rax,%rcx
je     130d <get_vendor+0x1fd>
movabs $0x72446e654778654e,%rax
6e 44 72
xor    0x8(%rsp),%rax
movabs $0x6e65766972446e,%rcx
xor    0xd(%rsp),%rcx
or     %rax,%rcx
je     1317 <get_vendor+0x207>
movabs $0x48727561746e6543,%rax
75 72 48
xor    0x8(%rsp),%rax
movabs $0x736c7561487275,%rcx
xor    0xd(%rsp),%rcx
or     %rax,%rcx
je     1321 <get_vendor+0x211>
movabs $0x6573695265736952,%rax
69 73 65
xor    0x8(%rsp),%rax
movabs $0x65736952657369,%rcx
xor    0xd(%rsp),%rcx
or     %rax,%rcx
je     132b <get_vendor+0x21b>
movabs $0x5369532053695320,%rax
53 69 53
xor    0x8(%rsp),%rax
movabs $0x53695320536953,%rcx
xor    0xd(%rsp),%rcx
or     %rax,%rcx
je     1335 <get_vendor+0x225>
movabs $0x54656e69756e6547,%rax
6e 65 54
xor    0x8(%rsp),%rax
movabs $0x3638784d54656e,%rcx
xor    0xd(%rsp),%rcx
or     %rax,%rcx
je     133f <get_vendor+0x22f>
movabs $0x79622065646f6547,%rax
20 62 79
xor    0x8(%rsp),%rax
movabs $0x43534e20796220,%rcx
xor    0xd(%rsp),%rcx
or     %rax,%rcx
je     1349 <get_vendor+0x239>
mov    0x24(%rsp),%ecx
test   $0x500,%ecx
mov    $0x63,%eax
mov    $0x1,%edx
cmovne %edx,%eax
test   %ecx,%ecx
cmove  %edx,%eax
add    $0x28,%rsp
ret
mov    $0x1,%eax
add    $0x28,%rsp
ret
mov    $0x2,%eax
add    $0x28,%rsp
ret
mov    $0x3,%eax
add    $0x28,%rsp
ret
mov    $0x4,%eax
add    $0x28,%rsp
ret
mov    $0x5,%eax
add    $0x28,%rsp
ret
mov    $0x6,%eax
add    $0x28,%rsp
ret
mov    $0x7,%eax
add    $0x28,%rsp
ret
mov    $0x8,%eax
add    $0x28,%rsp
ret
mov    $0x9,%eax
add    $0x28,%rsp
ret
mov    $0xa,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"GenuineIntel\00"
@.str.1 = [13 x i8] c" UMC UMC UMC\00"
@.str.2 = [13 x i8] c"AuthenticAMD\00"
@.str.3 = [13 x i8] c"CyrixInstead\00"
@.str.4 = [13 x i8] c"NexGenDriven\00"
@.str.5 = [13 x i8] c"CentaurHauls\00"
@.str.6 = [13 x i8] c"RiseRiseRise\00"
@.str.7 = [13 x i8] c" SiS SiS SiS\00"
@.str.8 = [13 x i8] c"GenuineTMx86\00"
@.str.9 = [13 x i8] c"Geode by NSC\00"
define i32 @get_vendor() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [13 x i8]
%7 = call i32 @cpuid(i32 0, i32* %2, i32* %3, i32* %4, i32* %5)
%8 = load i32, i32* %3
%9 = getelementptr inbounds [13 x i8], [13 x i8]* %6, i64 0, i64 0
%10 = bitcast i8* %9 to i32*
store i32 %8, i32* %10
%11 = load i32, i32* %5
%12 = getelementptr inbounds [13 x i8], [13 x i8]* %6, i64 0, i64 4
%13 = bitcast i8* %12 to i32*
store i32 %11, i32* %13
%14 = load i32, i32* %4
%15 = getelementptr inbounds [13 x i8], [13 x i8]* %6, i64 0, i64 8
%16 = bitcast i8* %15 to i32*
store i32 %14, i32* %16
%17 = getelementptr inbounds [13 x i8], [13 x i8]* %6, i64 0, i64 12
store i8 0, i8* %17
%18 = getelementptr inbounds [13 x i8], [13 x i8]* %6, i64 0, i64 0
%19 = call i32 @strcmp(i8* %18, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%20 = icmp ne i32 %19, 0
br i1 %20, label %22, label %21
21: ; preds = %0
store i32 1, i32* %1
br label %76
22: ; preds = %0
%23 = getelementptr inbounds [13 x i8], [13 x i8]* %6, i64 0, i64 0
%24 = call i32 @strcmp(i8* %23, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%25 = icmp ne i32 %24, 0
br i1 %25, label %27, label %26
26: ; preds = %22
store i32 2, i32* %1
br label %76
27: ; preds = %22
%28 = getelementptr inbounds [13 x i8], [13 x i8]* %6, i64 0, i64 0
%29 = call i32 @strcmp(i8* %28, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%30 = icmp ne i32 %29, 0
br i1 %30, label %32, label %31
31: ; preds = %27
store i32 3, i32* %1
br label %76
32: ; preds = %27
%33 = getelementptr inbounds [13 x i8], [13 x i8]* %6, i64 0, i64 0
%34 = call i32 @strcmp(i8* %33, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%35 = icmp ne i32 %34, 0
br i1 %35, label %37, label %36
36: ; preds = %32
store i32 4, i32* %1
br label %76
37: ; preds = %32
%38 = getelementptr inbounds [13 x i8], [13 x i8]* %6, i64 0, i64 0
%39 = call i32 @strcmp(i8* %38, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%40 = icmp ne i32 %39, 0
br i1 %40, label %42, label %41
41: ; preds = %37
store i32 5, i32* %1
br label %76
42: ; preds = %37
%43 = getelementptr inbounds [13 x i8], [13 x i8]* %6, i64 0, i64 0
%44 = call i32 @strcmp(i8* %43, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%45 = icmp ne i32 %44, 0
br i1 %45, label %47, label %46
46: ; preds = %42
store i32 6, i32* %1
br label %76
47: ; preds = %42
%48 = getelementptr inbounds [13 x i8], [13 x i8]* %6, i64 0, i64 0
%49 = call i32 @strcmp(i8* %48, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
%50 = icmp ne i32 %49, 0
br i1 %50, label %52, label %51
51: ; preds = %47
store i32 7, i32* %1
br label %76
52: ; preds = %47
%53 = getelementptr inbounds [13 x i8], [13 x i8]* %6, i64 0, i64 0
%54 = call i32 @strcmp(i8* %53, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
%55 = icmp ne i32 %54, 0
br i1 %55, label %57, label %56
56: ; preds = %52
store i32 8, i32* %1
br label %76
57: ; preds = %52
%58 = getelementptr inbounds [13 x i8], [13 x i8]* %6, i64 0, i64 0
%59 = call i32 @strcmp(i8* %58, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
%60 = icmp ne i32 %59, 0
br i1 %60, label %62, label %61
61: ; preds = %57
store i32 9, i32* %1
br label %76
62: ; preds = %57
%63 = getelementptr inbounds [13 x i8], [13 x i8]* %6, i64 0, i64 0
%64 = call i32 @strcmp(i8* %63, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0))
%65 = icmp ne i32 %64, 0
br i1 %65, label %67, label %66
66: ; preds = %62
store i32 10, i32* %1
br label %76
67: ; preds = %62
%68 = load i32, i32* %2
%69 = icmp eq i32 %68, 0
br i1 %69, label %74, label %70
70: ; preds = %67
%71 = load i32, i32* %2
%72 = and i32 %71, 1280
%73 = icmp ne i32 %72, 0
br i1 %73, label %74, label %75
74: ; preds = %70, %67
store i32 1, i32* %1
br label %76
75: ; preds = %70
store i32 99, i32* %1
br label %76
76: ; preds = %75, %74, %66, %61, %56, %51, %46, %41, %36, %31, %26, %21
%77 = load i32, i32* %1
ret i32 %77
}

LLVM IR (-O2):
@.str = [13 x i8] c"GenuineIntel\00"
@.str.1 = [13 x i8] c" UMC UMC UMC\00"
@.str.2 = [13 x i8] c"AuthenticAMD\00"
@.str.3 = [13 x i8] c"CyrixInstead\00"
@.str.4 = [13 x i8] c"NexGenDriven\00"
@.str.5 = [13 x i8] c"CentaurHauls\00"
@.str.6 = [13 x i8] c"RiseRiseRise\00"
@.str.7 = [13 x i8] c" SiS SiS SiS\00"
@.str.8 = [13 x i8] c"GenuineTMx86\00"
@.str.9 = [13 x i8] c"Geode by NSC\00"
define i32 @get_vendor() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [13 x i8]
%6 = bitcast i32* %1 to i8*
%7 = bitcast i32* %2 to i8*
%8 = bitcast i32* %3 to i8*
%9 = bitcast i32* %4 to i8*
%10 = getelementptr inbounds [13 x i8], [13 x i8]* %5, i64 0, i64 0
%11 = call i32 @cpuid(i32 0, i32* %1, i32* %2, i32* %3, i32* %4)
%12 = load i32, i32* %2
%13 = bitcast [13 x i8]* %5 to i32*
store i32 %12, i32* %13
%14 = load i32, i32* %4
%15 = getelementptr inbounds [13 x i8], [13 x i8]* %5, i64 0, i64 4
%16 = bitcast i8* %15 to i32*
store i32 %14, i32* %16
%17 = load i32, i32* %3
%18 = getelementptr inbounds [13 x i8], [13 x i8]* %5, i64 0, i64 8
%19 = bitcast i8* %18 to i32*
store i32 %17, i32* %19
%20 = getelementptr inbounds [13 x i8], [13 x i8]* %5, i64 0, i64 12
store i8 0, i8* %20
%21 = call i32 @bcmp(i8* dereferenceable(13) %10, i8* dereferenceable(13) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i64 13)
%22 = icmp eq i32 %21, 0
br i1 %22, label %57, label %23
23: ; preds = %0
%24 = call i32 @bcmp(i8* dereferenceable(13) %10, i8* dereferenceable(13) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i64 13)
%25 = icmp eq i32 %24, 0
br i1 %25, label %57, label %26
26: ; preds = %23
%27 = call i32 @bcmp(i8* dereferenceable(13) %10, i8* dereferenceable(13) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i64 13)
%28 = icmp eq i32 %27, 0
br i1 %28, label %57, label %29
29: ; preds = %26
%30 = call i32 @bcmp(i8* dereferenceable(13) %10, i8* dereferenceable(13) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i64 13)
%31 = icmp eq i32 %30, 0
br i1 %31, label %57, label %32
32: ; preds = %29
%33 = call i32 @bcmp(i8* dereferenceable(13) %10, i8* dereferenceable(13) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i64 13)
%34 = icmp eq i32 %33, 0
br i1 %34, label %57, label %35
35: ; preds = %32
%36 = call i32 @bcmp(i8* dereferenceable(13) %10, i8* dereferenceable(13) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i64 13)
%37 = icmp eq i32 %36, 0
br i1 %37, label %57, label %38
38: ; preds = %35
%39 = call i32 @bcmp(i8* dereferenceable(13) %10, i8* dereferenceable(13) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i64 13)
%40 = icmp eq i32 %39, 0
br i1 %40, label %57, label %41
41: ; preds = %38
%42 = call i32 @bcmp(i8* dereferenceable(13) %10, i8* dereferenceable(13) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i64 13)
%43 = icmp eq i32 %42, 0
br i1 %43, label %57, label %44
44: ; preds = %41
%45 = call i32 @bcmp(i8* dereferenceable(13) %10, i8* dereferenceable(13) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i64 13)
%46 = icmp eq i32 %45, 0
br i1 %46, label %57, label %47
47: ; preds = %44
%48 = call i32 @bcmp(i8* dereferenceable(13) %10, i8* dereferenceable(13) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i64 13)
%49 = icmp eq i32 %48, 0
br i1 %49, label %57, label %50
50: ; preds = %47
%51 = load i32, i32* %1
%52 = icmp ne i32 %51, 0
%53 = and i32 %51, 1280
%54 = icmp eq i32 %53, 0
%55 = and i1 %52, %54
%56 = select i1 %55, i32 99, i32 1
br label %57
57: ; preds = %50, %47, %44, %41, %38, %35, %32, %29, %26, %23, %0
%58 = phi i32 [ 1, %0 ], [ 2, %23 ], [ 3, %26 ], [ 4, %29 ], [ 5, %32 ], [ 6, %35 ], [ 7, %38 ], [ 8, %41 ], [ 9, %44 ], [ 10, %47 ], [ %56, %50 ]
ret i32 %58
}