#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*/ __get_cpuid(int /*<<< orphan*/, unsigned int *,
                               unsigned int *, unsigned int *, unsigned int *);
int /*<<< orphan*/ memcpy(char *, unsigned int *, int);
int /*<<< orphan*/ puts(char *);
char *get_vendor(char *s) {
  unsigned int a = 0;
  unsigned int b, c, d = 0;
  if (!__get_cpuid(0, &a, &b, &c, &d))
    puts("=(");
  else {
    memcpy(s, &b, 4);
    memcpy(s + 4, &d, 4);
    memcpy(s + 8, &c, 4);
  }
  return s;
}


x86 assembly (clang, -O0):
<get_vendor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x18(%rbp)
xor    %edi,%edi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x14(%rbp),%rcx
lea    -0x18(%rbp),%r8
call   1040 <__get_cpuid@plt>
cmp    $0x0,%eax
jne    117b <get_vendor+0x4b>
lea    0xe8f(%rip),%rdi
call   1030 <puts@plt>
jmp    11b9 <get_vendor+0x89>
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x4,%edx
call   1050 <memcpy@plt>
mov    -0x8(%rbp),%rdi
add    $0x4,%rdi
lea    -0x18(%rbp),%rsi
mov    $0x4,%edx
call   1050 <memcpy@plt>
mov    -0x8(%rbp),%rdi
add    $0x8,%rdi
lea    -0x14(%rbp),%rsi
mov    $0x4,%edx
call   1050 <memcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_vendor>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movl   $0x0,0xc(%rsp)
movl   $0x0,(%rsp)
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
lea    0x4(%rsp),%rcx
mov    %rsp,%r8
xor    %edi,%edi
call   1040 <__get_cpuid@plt>
test   %eax,%eax
je     119c <get_vendor+0x6c>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1050 <memcpy@plt>
lea    0x4(%rbx),%rdi
mov    %rsp,%rsi
mov    $0x4,%edx
call   1050 <memcpy@plt>
lea    0x8(%rbx),%rdi
lea    0x4(%rsp),%rsi
mov    $0x4,%edx
call   1050 <memcpy@plt>
jmp    11a8 <get_vendor+0x78>
lea    0xe5d(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

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

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