void init_mem_writer() {
  monitor_clear();
  monitor_write("###########################################\n");
  monitor_write("#                                         #\n");
  monitor_write("#       ");
  monitor_write_color("   Cold-Boot Kernel CBK    ", 4, 15);
  monitor_write("       #\n");
  monitor_write("#                                         #\n");
  monitor_write("# Version 0.1b                         ll #\n");
  monitor_write("# 2016                              CASED #\n");
  monitor_write("###########################################\n");
  monitor_write("\n- initialize descriptor_tables\n");
  init_descriptor_tables();
  monitor_write("- initialize paging and setup pagetable (takes a second)\n");
  initialise_paging();
  monitor_write("- initialize keyboard\n");
  asm volatile("sti");
  init_keyboard();
  monitor_write("- initialize console\n");
  init_console();
  monitor_write("- initialize pci\n");
  init_pci();
}


x86 assembly (clang, -O0):
<init_mem_writer>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <monitor_clear@plt>
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1060 <monitor_write@plt>
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1060 <monitor_write@plt>
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1060 <monitor_write@plt>
lea    0xea7(%rip),%rdi
mov    $0x4,%esi
mov    $0xf,%edx
mov    $0x0,%al
call   1080 <monitor_write_color@plt>
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1060 <monitor_write@plt>
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1060 <monitor_write@plt>
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1060 <monitor_write@plt>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1060 <monitor_write@plt>
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1060 <monitor_write@plt>
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1060 <monitor_write@plt>
mov    $0x0,%al
call   1090 <init_descriptor_tables@plt>
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1060 <monitor_write@plt>
mov    $0x0,%al
call   10a0 <initialise_paging@plt>
lea    0xef0(%rip),%rdi
mov    $0x0,%al
call   1060 <monitor_write@plt>
sti
mov    $0x0,%al
call   1050 <init_keyboard@plt>
lea    0xef1(%rip),%rdi
mov    $0x0,%al
call   1060 <monitor_write@plt>
mov    $0x0,%al
call   1070 <init_console@plt>
lea    0xef2(%rip),%rdi
mov    $0x0,%al
call   1060 <monitor_write@plt>
mov    $0x0,%al
call   1040 <init_pci@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_mem_writer>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <monitor_clear@plt>
lea    0xe6e(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <monitor_write@plt>
lea    0xe8a(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <monitor_write@plt>
lea    0xea6(%rip),%rdi
xor    %eax,%eax
call   1060 <monitor_write@plt>
lea    0xea1(%rip),%rdi
mov    $0x4,%esi
mov    $0xf,%edx
xor    %eax,%eax
call   1080 <monitor_write_color@plt>
lea    0xe76(%rip),%rdi
xor    %eax,%eax
call   1060 <monitor_write@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <monitor_write@plt>
lea    0xe8d(%rip),%rdi
xor    %eax,%eax
call   1060 <monitor_write@plt>
lea    0xeac(%rip),%rdi
xor    %eax,%eax
call   1060 <monitor_write@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <monitor_write@plt>
lea    0xec1(%rip),%rdi
xor    %eax,%eax
call   1060 <monitor_write@plt>
xor    %eax,%eax
call   1090 <init_descriptor_tables@plt>
lea    0xecd(%rip),%rdi
xor    %eax,%eax
call   1060 <monitor_write@plt>
xor    %eax,%eax
call   10a0 <initialise_paging@plt>
lea    0xef2(%rip),%rdi
xor    %eax,%eax
call   1060 <monitor_write@plt>
sti
xor    %eax,%eax
call   1050 <init_keyboard@plt>
lea    0xef3(%rip),%rdi
xor    %eax,%eax
call   1060 <monitor_write@plt>
xor    %eax,%eax
call   1070 <init_console@plt>
lea    0xef4(%rip),%rdi
xor    %eax,%eax
call   1060 <monitor_write@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <init_pci@plt>

LLVM IR (-O0):
@.str = [45 x i8] c"###########################################\0A\00"
@.str.1 = [45 x i8] c"# #\0A\00"
@.str.2 = [9 x i8] c"# \00"
@.str.3 = [28 x i8] c" Cold-Boot Kernel CBK \00"
@.str.4 = [10 x i8] c" #\0A\00"
@.str.5 = [45 x i8] c"# Version 0.1b ll #\0A\00"
@.str.6 = [45 x i8] c"# 2016 CASED #\0A\00"
@.str.7 = [33 x i8] c"\0A- initialize descriptor_tables\0A\00"
@.str.8 = [58 x i8] c"- initialize paging and setup pagetable (takes a second)\0A\00"
@.str.9 = [23 x i8] c"- initialize keyboard\0A\00"
@.str.10 = [22 x i8] c"- initialize console\0A\00"
@.str.11 = [18 x i8] c"- initialize pci\0A\00"
define void @init_mem_writer() {
%1 = call i32 (...) @monitor_clear()
%2 = call i32 (i8*, ...) bitcast (i32 (...)* @monitor_write to i32 (i8*, ...)*)(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (i8*, ...) bitcast (i32 (...)* @monitor_write to i32 (i8*, ...)*)(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 (i8*, ...) bitcast (i32 (...)* @monitor_write to i32 (i8*, ...)*)(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 (i8*, i32, i32, ...) bitcast (i32 (...)* @monitor_write_color to i32 (i8*, i32, i32, ...)*)(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 4, i32 15)
%6 = call i32 (i8*, ...) bitcast (i32 (...)* @monitor_write to i32 (i8*, ...)*)(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%7 = call i32 (i8*, ...) bitcast (i32 (...)* @monitor_write to i32 (i8*, ...)*)(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 (i8*, ...) bitcast (i32 (...)* @monitor_write to i32 (i8*, ...)*)(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0))
%9 = call i32 (i8*, ...) bitcast (i32 (...)* @monitor_write to i32 (i8*, ...)*)(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, i64 0, i64 0))
%10 = call i32 (i8*, ...) bitcast (i32 (...)* @monitor_write to i32 (i8*, ...)*)(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (i8*, ...) bitcast (i32 (...)* @monitor_write to i32 (i8*, ...)*)(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0))
%12 = call i32 (...) @init_descriptor_tables()
%13 = call i32 (i8*, ...) bitcast (i32 (...)* @monitor_write to i32 (i8*, ...)*)(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.8, i64 0, i64 0))
%14 = call i32 (...) @initialise_paging()
%15 = call i32 (i8*, ...) bitcast (i32 (...)* @monitor_write to i32 (i8*, ...)*)(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0))
%16 = call i32 (...) @init_keyboard()
%17 = call i32 (i8*, ...) bitcast (i32 (...)* @monitor_write to i32 (i8*, ...)*)(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0))
%18 = call i32 (...) @init_console()
%19 = call i32 (i8*, ...) bitcast (i32 (...)* @monitor_write to i32 (i8*, ...)*)(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.11, i64 0, i64 0))
%20 = call i32 (...) @init_pci()
ret void
}

LLVM IR (-O2):
@.str = [45 x i8] c"###########################################\0A\00"
@.str.1 = [45 x i8] c"# #\0A\00"
@.str.2 = [9 x i8] c"# \00"
@.str.3 = [28 x i8] c" Cold-Boot Kernel CBK \00"
@.str.4 = [10 x i8] c" #\0A\00"
@.str.5 = [45 x i8] c"# Version 0.1b ll #\0A\00"
@.str.6 = [45 x i8] c"# 2016 CASED #\0A\00"
@.str.7 = [33 x i8] c"\0A- initialize descriptor_tables\0A\00"
@.str.8 = [58 x i8] c"- initialize paging and setup pagetable (takes a second)\0A\00"
@.str.9 = [23 x i8] c"- initialize keyboard\0A\00"
@.str.10 = [22 x i8] c"- initialize console\0A\00"
@.str.11 = [18 x i8] c"- initialize pci\0A\00"
define void @init_mem_writer() {
%1 = tail call i32 (...) @monitor_clear()
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @monitor_write to i32 (i8*, ...)*)(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @monitor_write to i32 (i8*, ...)*)(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @monitor_write to i32 (i8*, ...)*)(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call i32 (i8*, i32, i32, ...) bitcast (i32 (...)* @monitor_write_color to i32 (i8*, i32, i32, ...)*)(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 4, i32 15)
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @monitor_write to i32 (i8*, ...)*)(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%7 = tail call i32 (i8*, ...) bitcast (i32 (...)* @monitor_write to i32 (i8*, ...)*)(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) bitcast (i32 (...)* @monitor_write to i32 (i8*, ...)*)(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0))
%9 = tail call i32 (i8*, ...) bitcast (i32 (...)* @monitor_write to i32 (i8*, ...)*)(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, i64 0, i64 0))
%10 = tail call i32 (i8*, ...) bitcast (i32 (...)* @monitor_write to i32 (i8*, ...)*)(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%11 = tail call i32 (i8*, ...) bitcast (i32 (...)* @monitor_write to i32 (i8*, ...)*)(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0))
%12 = tail call i32 (...) @init_descriptor_tables()
%13 = tail call i32 (i8*, ...) bitcast (i32 (...)* @monitor_write to i32 (i8*, ...)*)(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.8, i64 0, i64 0))
%14 = tail call i32 (...) @initialise_paging()
%15 = tail call i32 (i8*, ...) bitcast (i32 (...)* @monitor_write to i32 (i8*, ...)*)(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0))
tail call void asm sideeffect "sti", "~{dirflag},~{fpsr},~{flags}"()
%16 = tail call i32 (...) @init_keyboard()
%17 = tail call i32 (i8*, ...) bitcast (i32 (...)* @monitor_write to i32 (i8*, ...)*)(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0))
%18 = tail call i32 (...) @init_console()
%19 = tail call i32 (i8*, ...) bitcast (i32 (...)* @monitor_write to i32 (i8*, ...)*)(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.11, i64 0, i64 0))
%20 = tail call i32 (...) @init_pci()
ret void
}