void kmain() {
  term_init();
  printf("Initialising interrupts...\n");
  idt_init();
  irq_init();
  asm volatile("sti");
  printf("Initialising timer...\n");
  timer_init(100);
  printf("Initialising keyboard...\n");
  kbd_init();
  printf("...\n");
  while (1)
    ;
}


x86 assembly (clang, -O0):
<kmain>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1080 <term_init@plt>
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1070 <idt_init@plt>
mov    $0x0,%al
call   1060 <irq_init@plt>
sti
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x64,%edi
mov    $0x0,%al
call   1050 <timer_init@plt>
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <kbd_init@plt>
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c5 <kmain+0x65>

x86 assembly (clang, -O2):
<kmain>:
push   %rax
xor    %eax,%eax
call   1080 <term_init@plt>
lea    0xe91(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1070 <idt_init@plt>
xor    %eax,%eax
call   1060 <irq_init@plt>
sti
lea    0xe91(%rip),%rdi
call   1030 <puts@plt>
mov    $0x64,%edi
xor    %eax,%eax
call   1050 <timer_init@plt>
lea    0xe8f(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <kbd_init@plt>
lea    0xe91(%rip),%rdi
call   1030 <puts@plt>
nopw   0x0(%rax,%rax,1)
jmp    11c0 <kmain+0x60>

LLVM IR (-O0):
@.str = [28 x i8] c"Initialising interrupts...\0A\00"
@.str.1 = [23 x i8] c"Initialising timer...\0A\00"
@.str.2 = [26 x i8] c"Initialising keyboard...\0A\00"
@.str.3 = [5 x i8] c"...\0A\00"
define void @kmain() {
%1 = call i32 (...) @term_init()
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @idt_init()
%4 = call i32 (...) @irq_init()
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (i32, ...) bitcast (i32 (...)* @timer_init to i32 (i32, ...)*)(i32 100)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 (...) @kbd_init()
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %10
10: ; preds = %0, %10
br label %10
}

LLVM IR (-O2):
@str = [27 x i8] c"Initialising interrupts...\00"
@str.4 = [22 x i8] c"Initialising timer...\00"
@str.5 = [25 x i8] c"Initialising keyboard...\00"
@str.6 = [4 x i8] c"...\00"
define void @kmain() {
%1 = tail call i32 (...) @term_init()
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (...) @idt_init()
%4 = tail call i32 (...) @irq_init()
tail call void asm sideeffect "sti", "~{dirflag},~{fpsr},~{flags}"()
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.4, i64 0, i64 0))
%6 = tail call i32 (i32, ...) bitcast (i32 (...)* @timer_init to i32 (i32, ...)*)(i32 100)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.5, i64 0, i64 0))
%8 = tail call i32 (...) @kbd_init()
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.6, i64 0, i64 0))
br label %10
10: ; preds = %0, %10
br label %10
}