#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 */
unsigned long cpuid(int);
int /*<<< orphan*/ strcmp(char *, char *);
int get_vendor(void) {
  unsigned long cpuid0, cpuid1;
  char vendor[18];
  cpuid0 = cpuid(0);
  cpuid1 = cpuid(1);
  *(unsigned long *)(&vendor[0]) = cpuid0;
  *(unsigned long *)(&vendor[8]) = cpuid1;
  vendor[17] = (char)0;
  if (!strcmp(vendor, "GenuineIntel"))
    return 1;
  return 99;
}


x86 assembly (clang, -O0):
<get_vendor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
xor    %edi,%edi
call   1040 <cpuid@plt>
mov    %rax,-0x10(%rbp)
mov    $0x1,%edi
call   1040 <cpuid@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
movb   $0x0,-0x1f(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xea0(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    117a <get_vendor+0x5a>
movl   $0x1,-0x4(%rbp)
jmp    1181 <get_vendor+0x61>
movl   $0x63,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_vendor>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
xor    %edi,%edi
call   1030 <cpuid@plt>
mov    %rax,%rbx
mov    $0x1,%ebp
mov    $0x1,%edi
call   1030 <cpuid@plt>
mov    %rbx,(%rsp)
mov    %rax,0x8(%rsp)
movabs $0x49656e69756e6547,%rax
6e 65 49
xor    %rbx,%rax
movabs $0x6c65746e49656e,%rcx
xor    0x5(%rsp),%rcx
or     %rax,%rcx
mov    $0x63,%eax
cmove  %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"GenuineIntel\00"
define i32 @get_vendor() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca [18 x i8]
%5 = call i64 @cpuid(i32 0)
store i64 %5, i64* %2
%6 = call i64 @cpuid(i32 1)
store i64 %6, i64* %3
%7 = load i64, i64* %2
%8 = getelementptr inbounds [18 x i8], [18 x i8]* %4, i64 0, i64 0
%9 = bitcast i8* %8 to i64*
store i64 %7, i64* %9
%10 = load i64, i64* %3
%11 = getelementptr inbounds [18 x i8], [18 x i8]* %4, i64 0, i64 8
%12 = bitcast i8* %11 to i64*
store i64 %10, i64* %12
%13 = getelementptr inbounds [18 x i8], [18 x i8]* %4, i64 0, i64 17
store i8 0, i8* %13
%14 = getelementptr inbounds [18 x i8], [18 x i8]* %4, i64 0, i64 0
%15 = call i32 @strcmp(i8* %14, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%16 = icmp ne i32 %15, 0
br i1 %16, label %18, label %17
17: ; preds = %0
store i32 1, i32* %1
br label %19
18: ; preds = %0
store i32 99, i32* %1
br label %19
19: ; preds = %18, %17
%20 = load i32, i32* %1
ret i32 %20
}

LLVM IR (-O2):
@.str = [13 x i8] c"GenuineIntel\00"
define i32 @get_vendor() {
%1 = alloca [18 x i8]
%2 = getelementptr inbounds [18 x i8], [18 x i8]* %1, i64 0, i64 0
%3 = tail call i64 @cpuid(i32 0)
%4 = tail call i64 @cpuid(i32 1)
%5 = bitcast [18 x i8]* %1 to i64*
store i64 %3, i64* %5
%6 = getelementptr inbounds [18 x i8], [18 x i8]* %1, i64 0, i64 8
%7 = bitcast i8* %6 to i64*
store i64 %4, i64* %7
%8 = call i32 @bcmp(i8* dereferenceable(13) %2, i8* dereferenceable(13) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i64 13)
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i32 1, i32 99
ret i32 %10
}