#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*/ gdt_setup();
int /*<<< orphan*/ idt_setup();
void kernel_main() {
  gdt_setup();
  idt_setup();
  char *vidmem = (char *)0xb8000;
  vidmem[0] = 'H';
  vidmem[2] = 'e';
  vidmem[4] = 'l';
  vidmem[6] = 'l';
  vidmem[8] = 'o';
  vidmem[10] = ' ';
  vidmem[12] = 'W';
  vidmem[14] = 'o';
  vidmem[16] = 'r';
  vidmem[18] = 'l';
  vidmem[20] = 'd';
  while (1) {
  }
}


x86 assembly (clang, -O0):
<kernel_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <gdt_setup@plt>
mov    $0x0,%al
call   1030 <idt_setup@plt>
mov    $0xb8000,%eax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x48,(%rax)
mov    -0x8(%rbp),%rax
movb   $0x65,0x2(%rax)
mov    -0x8(%rbp),%rax
movb   $0x6c,0x4(%rax)
mov    -0x8(%rbp),%rax
movb   $0x6c,0x6(%rax)
mov    -0x8(%rbp),%rax
movb   $0x6f,0x8(%rax)
mov    -0x8(%rbp),%rax
movb   $0x20,0xa(%rax)
mov    -0x8(%rbp),%rax
movb   $0x57,0xc(%rax)
mov    -0x8(%rbp),%rax
movb   $0x6f,0xe(%rax)
mov    -0x8(%rbp),%rax
movb   $0x72,0x10(%rax)
mov    -0x8(%rbp),%rax
movb   $0x6c,0x12(%rax)
mov    -0x8(%rbp),%rax
movb   $0x64,0x14(%rax)
jmp    1196 <kernel_main+0x76>

x86 assembly (clang, -O2):
<kernel_main>:
push   %rax
xor    %eax,%eax
call   1040 <gdt_setup@plt>
xor    %eax,%eax
call   1030 <idt_setup@plt>
movb   $0x48,0xb8000
48
movb   $0x65,0xb8002
65
movb   $0x6c,0xb8004
6c
movb   $0x6c,0xb8006
6c
movb   $0x6f,0xb8008
6f
movb   $0x20,0xb800a
20
movb   $0x57,0xb800c
57
movb   $0x6f,0xb800e
6f
movb   $0x72,0xb8010
72
movb   $0x6c,0xb8012
6c
movb   $0x64,0xb8014
64
nopw   0x0(%rax,%rax,1)
jmp    1190 <kernel_main+0x70>

LLVM IR (-O0):
define void @kernel_main() {
%1 = alloca i8*
%2 = call i32 (...) @gdt_setup()
%3 = call i32 (...) @idt_setup()
store i8* inttoptr (i64 753664 to i8*), i8** %1
%4 = load i8*, i8** %1
%5 = getelementptr inbounds i8, i8* %4, i64 0
store i8 72, i8* %5
%6 = load i8*, i8** %1
%7 = getelementptr inbounds i8, i8* %6, i64 2
store i8 101, i8* %7
%8 = load i8*, i8** %1
%9 = getelementptr inbounds i8, i8* %8, i64 4
store i8 108, i8* %9
%10 = load i8*, i8** %1
%11 = getelementptr inbounds i8, i8* %10, i64 6
store i8 108, i8* %11
%12 = load i8*, i8** %1
%13 = getelementptr inbounds i8, i8* %12, i64 8
store i8 111, i8* %13
%14 = load i8*, i8** %1
%15 = getelementptr inbounds i8, i8* %14, i64 10
store i8 32, i8* %15
%16 = load i8*, i8** %1
%17 = getelementptr inbounds i8, i8* %16, i64 12
store i8 87, i8* %17
%18 = load i8*, i8** %1
%19 = getelementptr inbounds i8, i8* %18, i64 14
store i8 111, i8* %19
%20 = load i8*, i8** %1
%21 = getelementptr inbounds i8, i8* %20, i64 16
store i8 114, i8* %21
%22 = load i8*, i8** %1
%23 = getelementptr inbounds i8, i8* %22, i64 18
store i8 108, i8* %23
%24 = load i8*, i8** %1
%25 = getelementptr inbounds i8, i8* %24, i64 20
store i8 100, i8* %25
br label %26
26: ; preds = %0, %26
br label %26
}

LLVM IR (-O2):
define void @kernel_main() {
%1 = tail call i32 (...) @gdt_setup()
%2 = tail call i32 (...) @idt_setup()
store i8 72, i8* inttoptr (i64 753664 to i8*)
store i8 101, i8* inttoptr (i64 753666 to i8*)
store i8 108, i8* inttoptr (i64 753668 to i8*)
store i8 108, i8* inttoptr (i64 753670 to i8*)
store i8 111, i8* inttoptr (i64 753672 to i8*)
store i8 32, i8* inttoptr (i64 753674 to i8*)
store i8 87, i8* inttoptr (i64 753676 to i8*)
store i8 111, i8* inttoptr (i64 753678 to i8*)
store i8 114, i8* inttoptr (i64 753680 to i8*)
store i8 108, i8* inttoptr (i64 753682 to i8*)
store i8 100, i8* inttoptr (i64 753684 to i8*)
br label %3
3: ; preds = %3, %0
br label %3
}