#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*/ copy_boot_params();
int /*<<< orphan*/ detect_memory();
int /*<<< orphan*/ die();
int /*<<< orphan*/ go_to_protected_mode();
int /*<<< orphan*/ init_heap();
int /*<<< orphan*/ keyboard_set_repeat();
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ query_ist();
int /*<<< orphan*/ query_mca();
int /*<<< orphan*/ set_bios_mode();
int /*<<< orphan*/ set_video();
scalar_t__ validate_cpu();
void main(void) {
  copy_boot_params();
  init_heap();
  if (validate_cpu()) {
    puts("Unable to boot - please use a kernel appropriate "
         "for your CPU.\n");
    die();
  }
  set_bios_mode();
  detect_memory();
  keyboard_set_repeat();
  query_mca();
  query_ist();
  set_video();
  go_to_protected_mode();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <copy_boot_params@plt>
mov    $0x0,%al
call   10a0 <init_heap@plt>
mov    $0x0,%al
call   10b0 <validate_cpu@plt>
cmp    $0x0,%rax
je     11f6 <main+0x36>
lea    0xe16(%rip),%rdi
call   1030 <puts@plt>
mov    $0x0,%al
call   10d0 <die@plt>
mov    $0x0,%al
call   1070 <set_bios_mode@plt>
mov    $0x0,%al
call   1060 <detect_memory@plt>
mov    $0x0,%al
call   1090 <keyboard_set_repeat@plt>
mov    $0x0,%al
call   10c0 <query_mca@plt>
mov    $0x0,%al
call   1040 <query_ist@plt>
mov    $0x0,%al
call   10e0 <set_video@plt>
mov    $0x0,%al
call   1080 <go_to_protected_mode@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <copy_boot_params@plt>
xor    %eax,%eax
call   10a0 <init_heap@plt>
xor    %eax,%eax
call   10b0 <validate_cpu@plt>
test   %rax,%rax
je     11ee <main+0x2e>
lea    0xe1e(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   10d0 <die@plt>
xor    %eax,%eax
call   1070 <set_bios_mode@plt>
xor    %eax,%eax
call   1060 <detect_memory@plt>
xor    %eax,%eax
call   1090 <keyboard_set_repeat@plt>
xor    %eax,%eax
call   10c0 <query_mca@plt>
xor    %eax,%eax
call   1040 <query_ist@plt>
xor    %eax,%eax
call   10e0 <set_video@plt>
xor    %eax,%eax
pop    %rcx
jmp    1080 <go_to_protected_mode@plt>

LLVM IR (-O0):
@.str = [64 x i8] c"Unable to boot - please use a kernel appropriate for your CPU.\0A\00"
define void @main() {
%1 = call i32 (...) @copy_boot_params()
%2 = call i32 (...) @init_heap()
%3 = call i64 (...) @validate_cpu()
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = call i32 @puts(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (...) @die()
br label %8
8: ; preds = %5, %0
%9 = call i32 (...) @set_bios_mode()
%10 = call i32 (...) @detect_memory()
%11 = call i32 (...) @keyboard_set_repeat()
%12 = call i32 (...) @query_mca()
%13 = call i32 (...) @query_ist()
%14 = call i32 (...) @set_video()
%15 = call i32 (...) @go_to_protected_mode()
ret void
}

LLVM IR (-O2):
@.str = [64 x i8] c"Unable to boot - please use a kernel appropriate for your CPU.\0A\00"
define void @main() {
%1 = tail call i32 (...) @copy_boot_params()
%2 = tail call i32 (...) @init_heap()
%3 = tail call i64 (...) @validate_cpu()
%4 = icmp eq i64 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %0
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 (...) @die()
br label %8
8: ; preds = %5, %0
%9 = tail call i32 (...) @set_bios_mode()
%10 = tail call i32 (...) @detect_memory()
%11 = tail call i32 (...) @keyboard_set_repeat()
%12 = tail call i32 (...) @query_mca()
%13 = tail call i32 (...) @query_ist()
%14 = tail call i32 (...) @set_video()
%15 = tail call i32 (...) @go_to_protected_mode()
ret void
}