#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 /*<<< orphan*/ printf(char *, ...);
void cpuid_print_name() {
  int name[13];
  cpuid(name + 0, 0x80000002);
  cpuid(name + 4, 0x80000003);
  cpuid(name + 8, 0x80000004);
  name[12] = '\0';
  printf("CPU Name = %s\n", (char *)name);
  printf("Threads  = -1/Unknown (not compiled for OpenMP)\n");
  printf("\n");
}


x86 assembly (clang, -O0):
<cpuid_print_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x40(%rbp),%rdi
mov    $0x80000002,%esi
call   1040 <cpuid@plt>
lea    -0x40(%rbp),%rdi
add    $0x10,%rdi
mov    $0x80000003,%esi
call   1040 <cpuid@plt>
lea    -0x40(%rbp),%rdi
add    $0x20,%rdi
mov    $0x80000004,%esi
call   1040 <cpuid@plt>
movl   $0x0,-0x10(%rbp)
lea    -0x40(%rbp),%rsi
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpuid_print_name>:
push   %rbx
sub    $0x40,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x80000002,%esi
call   1060 <cpuid@plt>
lea    0x10(%rsp),%rdi
mov    $0x80000003,%esi
call   1060 <cpuid@plt>
lea    0x20(%rsp),%rdi
mov    $0x80000004,%esi
call   1060 <cpuid@plt>
movl   $0x0,0x30(%rsp)
lea    0xe7e(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe7c(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"CPU Name = %s\0A\00"
@.str.1 = [49 x i8] c"Threads = -1/Unknown (not compiled for OpenMP)\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @cpuid_print_name() {
%1 = alloca [13 x i32]
%2 = getelementptr inbounds [13 x i32], [13 x i32]* %1, i64 0, i64 0
%3 = getelementptr inbounds i32, i32* %2, i64 0
%4 = call i32 @cpuid(i32* %3, i32 -2147483646)
%5 = getelementptr inbounds [13 x i32], [13 x i32]* %1, i64 0, i64 0
%6 = getelementptr inbounds i32, i32* %5, i64 4
%7 = call i32 @cpuid(i32* %6, i32 -2147483645)
%8 = getelementptr inbounds [13 x i32], [13 x i32]* %1, i64 0, i64 0
%9 = getelementptr inbounds i32, i32* %8, i64 8
%10 = call i32 @cpuid(i32* %9, i32 -2147483644)
%11 = getelementptr inbounds [13 x i32], [13 x i32]* %1, i64 0, i64 12
store i32 0, i32* %11
%12 = getelementptr inbounds [13 x i32], [13 x i32]* %1, i64 0, i64 0
%13 = bitcast i32* %12 to i8*
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"CPU Name = %s\0A\00"
@str = [48 x i8] c"Threads = -1/Unknown (not compiled for OpenMP)\00"
define void @cpuid_print_name() {
%1 = alloca [13 x i32]
%2 = bitcast [13 x i32]* %1 to i8*
%3 = getelementptr inbounds [13 x i32], [13 x i32]* %1, i64 0, i64 0
%4 = call i32 @cpuid(i32* %3, i32 -2147483646)
%5 = getelementptr inbounds [13 x i32], [13 x i32]* %1, i64 0, i64 4
%6 = call i32 @cpuid(i32* %5, i32 -2147483645)
%7 = getelementptr inbounds [13 x i32], [13 x i32]* %1, i64 0, i64 8
%8 = call i32 @cpuid(i32* %7, i32 -2147483644)
%9 = getelementptr inbounds [13 x i32], [13 x i32]* %1, i64 0, i64 12
store i32 0, i32* %9
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), [13 x i32]* %1)
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
%12 = call i32 @putchar(i32 10)
ret void
}