#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*/ dump_page(int);
int /*<<< orphan*/ printf(char *, char *, char *, char *, char *, char *,
                          char *);
int /*<<< orphan*/ puts(char *);
void dump_x86_cpuid(void) {
  puts("");
  puts("CPUID dump:");
  printf("  %8s  %8s  %8s  %8s  %8s  %8s\n", "leaf", "subleaf", "eax", "ebx",
         "ecx", "edx");
  dump_page(0);
  dump_page(0x40000000);
  dump_page(0x80000000);
  dump_page(0xc0000000);
}


x86 assembly (clang, -O0):
<dump_x86_cpuid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeec(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb5(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb5(%rip),%rdi
lea    0xed1(%rip),%rsi
lea    0xec7(%rip),%rdx
lea    0xec8(%rip),%rcx
lea    0xec5(%rip),%r8
lea    0xec2(%rip),%r9
lea    0xebf(%rip),%rax
mov    %rax,(%rsp)
call   1040 <printf@plt>
xor    %edi,%edi
call   1050 <dump_page@plt>
mov    $0x40000000,%edi
call   1050 <dump_page@plt>
mov    $0x80000000,%edi
call   1050 <dump_page@plt>
mov    $0xc0000000,%edi
call   1050 <dump_page@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_x86_cpuid>:
push   %rax
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xeae(%rip),%rdi
call   1040 <puts@plt>
lea    0xee2(%rip),%rax
mov    %rax,(%rsp)
lea    0xea3(%rip),%rdi
lea    0xebf(%rip),%rsi
lea    0xeb5(%rip),%rdx
lea    0xeb6(%rip),%rcx
lea    0xeb3(%rip),%r8
lea    0xeb0(%rip),%r9
call   1050 <printf@plt>
xor    %edi,%edi
call   1060 <dump_page@plt>
mov    $0x40000000,%edi
call   1060 <dump_page@plt>
mov    $0x80000000,%edi
call   1060 <dump_page@plt>
mov    $0xc0000000,%edi
pop    %rax
jmp    1060 <dump_page@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [12 x i8] c"CPUID dump:\00"
@.str.2 = [32 x i8] c" %8s %8s %8s %8s %8s %8s\0A\00"
@.str.3 = [5 x i8] c"leaf\00"
@.str.4 = [8 x i8] c"subleaf\00"
@.str.5 = [4 x i8] c"eax\00"
@.str.6 = [4 x i8] c"ebx\00"
@.str.7 = [4 x i8] c"ecx\00"
@.str.8 = [4 x i8] c"edx\00"
define void @dump_x86_cpuid() {
%1 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @puts(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%4 = call i32 @dump_page(i32 0)
%5 = call i32 @dump_page(i32 1073741824)
%6 = call i32 @dump_page(i32 -2147483648)
%7 = call i32 @dump_page(i32 -1073741824)
ret void
}

LLVM IR (-O2):
@.str.1 = [12 x i8] c"CPUID dump:\00"
@.str.2 = [32 x i8] c" %8s %8s %8s %8s %8s %8s\0A\00"
@.str.3 = [5 x i8] c"leaf\00"
@.str.4 = [8 x i8] c"subleaf\00"
@.str.5 = [4 x i8] c"eax\00"
@.str.6 = [4 x i8] c"ebx\00"
@.str.7 = [4 x i8] c"ecx\00"
@.str.8 = [4 x i8] c"edx\00"
define void @dump_x86_cpuid() {
%1 = tail call i32 @putchar(i32 10)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%4 = tail call i32 @dump_page(i32 0)
%5 = tail call i32 @dump_page(i32 1073741824)
%6 = tail call i32 @dump_page(i32 -2147483648)
%7 = tail call i32 @dump_page(i32 -1073741824)
ret void
}