#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 */
scalar_t__ cmdline_find_option_bool(char *);
int /*<<< orphan*/ console_init();
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();
  console_init();
  if (cmdline_find_option_bool("debug"))
    puts("early console in setup code\n");
  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   1060 <copy_boot_params@plt>
mov    $0x0,%al
call   1030 <console_init@plt>
lea    0xe07(%rip),%rdi
call   10f0 <cmdline_find_option_bool@plt>
cmp    $0x0,%rax
je     1214 <main+0x34>
lea    0xdf7(%rip),%rdi
call   1040 <puts@plt>
mov    $0x0,%al
call   10b0 <init_heap@plt>
mov    $0x0,%al
call   10c0 <validate_cpu@plt>
cmp    $0x0,%rax
je     123f <main+0x5f>
lea    0xdf0(%rip),%rdi
call   1040 <puts@plt>
mov    $0x0,%al
call   10e0 <die@plt>
mov    $0x0,%al
call   1080 <set_bios_mode@plt>
mov    $0x0,%al
call   1070 <detect_memory@plt>
mov    $0x0,%al
call   10a0 <keyboard_set_repeat@plt>
mov    $0x0,%al
call   10d0 <query_mca@plt>
mov    $0x0,%al
call   1050 <query_ist@plt>
mov    $0x0,%al
call   1100 <set_video@plt>
mov    $0x0,%al
call   1090 <go_to_protected_mode@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1060 <copy_boot_params@plt>
xor    %eax,%eax
call   1030 <console_init@plt>
lea    0xe0a(%rip),%rdi
call   10f0 <cmdline_find_option_bool@plt>
test   %rax,%rax
je     120c <main+0x2c>
lea    0xdff(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   10b0 <init_heap@plt>
xor    %eax,%eax
call   10c0 <validate_cpu@plt>
test   %rax,%rax
je     1232 <main+0x52>
lea    0xdfd(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   10e0 <die@plt>
xor    %eax,%eax
call   1080 <set_bios_mode@plt>
xor    %eax,%eax
call   1070 <detect_memory@plt>
xor    %eax,%eax
call   10a0 <keyboard_set_repeat@plt>
xor    %eax,%eax
call   10d0 <query_mca@plt>
xor    %eax,%eax
call   1050 <query_ist@plt>
xor    %eax,%eax
call   1100 <set_video@plt>
xor    %eax,%eax
pop    %rcx
jmp    1090 <go_to_protected_mode@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"debug\00"
@.str.1 = [29 x i8] c"early console in setup code\0A\00"
@.str.2 = [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 (...) @console_init()
%3 = call i64 @cmdline_find_option_bool(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 @puts(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
br label %7
7: ; preds = %5, %0
%8 = call i32 (...) @init_heap()
%9 = call i64 (...) @validate_cpu()
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = call i32 @puts(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 (...) @die()
br label %14
14: ; preds = %11, %7
%15 = call i32 (...) @set_bios_mode()
%16 = call i32 (...) @detect_memory()
%17 = call i32 (...) @keyboard_set_repeat()
%18 = call i32 (...) @query_mca()
%19 = call i32 (...) @query_ist()
%20 = call i32 (...) @set_video()
%21 = call i32 (...) @go_to_protected_mode()
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"debug\00"
@.str.1 = [29 x i8] c"early console in setup code\0A\00"
@.str.2 = [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 (...) @console_init()
%3 = tail call i64 @cmdline_find_option_bool(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
br label %7
7: ; preds = %5, %0
%8 = tail call i32 (...) @init_heap()
%9 = tail call i64 (...) @validate_cpu()
%10 = icmp eq i64 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %7
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @.str.2, i64 0, i64 0))
%13 = tail call i32 (...) @die()
br label %14
14: ; preds = %11, %7
%15 = tail call i32 (...) @set_bios_mode()
%16 = tail call i32 (...) @detect_memory()
%17 = tail call i32 (...) @keyboard_set_repeat()
%18 = tail call i32 (...) @query_mca()
%19 = tail call i32 (...) @query_ist()
%20 = tail call i32 (...) @set_video()
%21 = tail call i32 (...) @go_to_protected_mode()
ret void
}