#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 */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ cpuid_exec(int, int *, int *, int *, int *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, int, int, int, int);
int /*<<< orphan*/ stderr;
void cpuid(uint32_t val, uint32_t *eax, uint32_t *ebx, uint32_t *ecx,
           uint32_t *edx) {
  (void)fprintf(stderr, "cpuid_pre:        %.8x %.8x %.8x %.8x %.8x\n", val,
                *eax, *ebx, *ecx, *edx);
  cpuid_exec(val, eax, ebx, ecx, edx);
  (void)fprintf(stderr, "cpuid_post:       %.8x %.8x %.8x %.8x %.8x\n", val,
                *eax, *ebx, *ecx, *edx);
}


x86 assembly (clang, -O0):
<cpuid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    0x2e9e(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    (%rax),%r8d
mov    -0x20(%rbp),%rax
mov    (%rax),%r9d
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
lea    0xe98(%rip),%rsi
mov    %eax,(%rsp)
call   1040 <fprintf@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
call   1030 <cpuid_exec@plt>
mov    0x2e51(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    (%rax),%r8d
mov    -0x20(%rbp),%rax
mov    (%rax),%r9d
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
lea    0xe77(%rip),%rsi
mov    %eax,(%rsp)
call   1040 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpuid>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,%r15
mov    %rcx,%r12
mov    %rdx,%rbx
mov    %rsi,%rbp
mov    %edi,%r14d
mov    0x2e9f(%rip),%r13
mov    0x0(%r13),%edi
mov    (%rsi),%ecx
mov    (%rdx),%r8d
mov    (%r12),%r9d
mov    (%r15),%eax
mov    %eax,(%rsp)
lea    0xea5(%rip),%rsi
mov    %r14d,%edx
call   1040 <fprintf@plt>
mov    %r14d,%edi
mov    %rbp,%rsi
mov    %rbx,%rdx
mov    %r12,%rcx
mov    %r15,%r8
call   1030 <cpuid_exec@plt>
mov    0x0(%r13),%edi
mov    0x0(%rbp),%ecx
mov    (%rbx),%r8d
mov    (%r12),%r9d
mov    (%r15),%eax
mov    %eax,(%rsp)
lea    0xe9a(%rip),%rsi
mov    %r14d,%edx
call   1040 <fprintf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [44 x i8] c"cpuid_pre: %.8x %.8x %.8x %.8x %.8x\0A\00"
@.str.1 = [44 x i8] c"cpuid_post: %.8x %.8x %.8x %.8x %.8x\0A\00"
define void @cpuid(i32 %0, i32* %1, i32* %2, i32* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
store i32 %0, i32* %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
store i32* %4, i32** %10
%11 = load i32, i32* @stderr
%12 = load i32, i32* %6
%13 = load i32*, i32** %7
%14 = load i32, i32* %13
%15 = load i32*, i32** %8
%16 = load i32, i32* %15
%17 = load i32*, i32** %9
%18 = load i32, i32* %17
%19 = load i32*, i32** %10
%20 = load i32, i32* %19
%21 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %14, i32 %16, i32 %18, i32 %20)
%22 = load i32, i32* %6
%23 = load i32*, i32** %7
%24 = load i32*, i32** %8
%25 = load i32*, i32** %9
%26 = load i32*, i32** %10
%27 = call i32 @cpuid_exec(i32 %22, i32* %23, i32* %24, i32* %25, i32* %26)
%28 = load i32, i32* @stderr
%29 = load i32, i32* %6
%30 = load i32*, i32** %7
%31 = load i32, i32* %30
%32 = load i32*, i32** %8
%33 = load i32, i32* %32
%34 = load i32*, i32** %9
%35 = load i32, i32* %34
%36 = load i32*, i32** %10
%37 = load i32, i32* %36
%38 = call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), i32 %29, i32 %31, i32 %33, i32 %35, i32 %37)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [44 x i8] c"cpuid_pre: %.8x %.8x %.8x %.8x %.8x\0A\00"
@.str.1 = [44 x i8] c"cpuid_post: %.8x %.8x %.8x %.8x %.8x\0A\00"
define void @cpuid(i32 %0, i32* %1, i32* %2, i32* %3, i32* %4) {
%6 = load i32, i32* @stderr
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %7, i32 %8, i32 %9, i32 %10)
%12 = tail call i32 @cpuid_exec(i32 %0, i32* %1, i32* %2, i32* %3, i32* %4)
%13 = load i32, i32* @stderr
%14 = load i32, i32* %1
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = load i32, i32* %4
%18 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), i32 %0, i32 %14, i32 %15, i32 %16, i32 %17)
ret void
}