#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, unsigned int *, unsigned int *,
                               unsigned int *, unsigned int *);
void sb_cpuid(int *pn, int n) {
  unsigned int na = 0, nb = 0, nc = 0, nd = 0;
  __get_cpuid(n, &na, &nb, &nc, &nd);
  pn[0] = (int)na;
  pn[1] = (int)nb;
  pn[2] = (int)nc;
  pn[3] = (int)nd;
}


x86 assembly (clang, -O0):
<sb_cpuid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0xc(%rbp),%edi
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
lea    -0x1c(%rbp),%r8
call   1030 <__get_cpuid@plt>
mov    -0x10(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x18(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x1c(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0xc(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sb_cpuid>:
push   %rbx
sub    $0x10,%rsp
mov    %esi,%eax
mov    %rdi,%rbx
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x0,0x4(%rsp)
movl   $0x0,(%rsp)
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
lea    0x4(%rsp),%rcx
mov    %rsp,%r8
mov    %eax,%edi
call   1030 <__get_cpuid@plt>
mov    0xc(%rsp),%eax
mov    %eax,(%rbx)
mov    0x8(%rsp),%eax
mov    %eax,0x4(%rbx)
mov    0x4(%rsp),%eax
mov    %eax,0x8(%rbx)
mov    (%rsp),%eax
mov    %eax,0xc(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @sb_cpuid(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
%9 = load i32, i32* %4
%10 = call i32 @__get_cpuid(i32 %9, i32* %5, i32* %6, i32* %7, i32* %8)
%11 = load i32, i32* %5
%12 = load i32*, i32** %3
%13 = getelementptr inbounds i32, i32* %12, i64 0
store i32 %11, i32* %13
%14 = load i32, i32* %6
%15 = load i32*, i32** %3
%16 = getelementptr inbounds i32, i32* %15, i64 1
store i32 %14, i32* %16
%17 = load i32, i32* %7
%18 = load i32*, i32** %3
%19 = getelementptr inbounds i32, i32* %18, i64 2
store i32 %17, i32* %19
%20 = load i32, i32* %8
%21 = load i32*, i32** %3
%22 = getelementptr inbounds i32, i32* %21, i64 3
store i32 %20, i32* %22
ret void
}

LLVM IR (-O2):
define void @sb_cpuid(i32* nocapture writeonly %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%8 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%9 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%10 = bitcast i32* %6 to i8*
store i32 0, i32* %6
%11 = call i32 @__get_cpuid(i32 %1, i32* %3, i32* %4, i32* %5, i32* %6)
%12 = load i32, i32* %3
store i32 %12, i32* %0
%13 = load i32, i32* %4
%14 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %13, i32* %14
%15 = load i32, i32* %5
%16 = getelementptr inbounds i32, i32* %0, i64 2
store i32 %15, i32* %16
%17 = load i32, i32* %6
%18 = getelementptr inbounds i32, i32* %0, i64 3
store i32 %17, i32* %18
ret void
}