#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*/ clear_screen();
int /*<<< orphan*/ idt_init();
int /*<<< orphan*/ init_shell();
int /*<<< orphan*/ kb_init();
int /*<<< orphan*/ kprint(char *);
int /*<<< orphan*/ kprint_newline();
int /*<<< orphan*/ shell();
void kmain(void) {
  clear_screen();
  kprint("Congrats on booting the BUSTANUT kernel. ");
  kprint_newline();
  kprint(
      "(BUSTANUT is Undergoing Sustained Testing And is Not a Unix Terminal)");
  kprint_newline();
  kprint("Now get the flag out of it!\n\n\n");
  idt_init();
  kb_init();
  init_shell();
  shell();
  return;
}


x86 assembly (clang, -O0):
<kmain>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1070 <clear_screen@plt>
lea    0xe7e(%rip),%rdi
call   1050 <kprint@plt>
mov    $0x0,%al
call   1030 <kprint_newline@plt>
lea    0xe95(%rip),%rdi
call   1050 <kprint@plt>
mov    $0x0,%al
call   1030 <kprint_newline@plt>
lea    0xec8(%rip),%rdi
call   1050 <kprint@plt>
mov    $0x0,%al
call   1060 <idt_init@plt>
mov    $0x0,%al
call   1080 <kb_init@plt>
mov    $0x0,%al
call   1040 <init_shell@plt>
mov    $0x0,%al
call   1090 <shell@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<kmain>:
push   %rax
xor    %eax,%eax
call   1070 <clear_screen@plt>
lea    0xe81(%rip),%rdi
call   1050 <kprint@plt>
xor    %eax,%eax
call   1030 <kprint_newline@plt>
lea    0xe98(%rip),%rdi
call   1050 <kprint@plt>
xor    %eax,%eax
call   1030 <kprint_newline@plt>
lea    0xecb(%rip),%rdi
call   1050 <kprint@plt>
xor    %eax,%eax
call   1060 <idt_init@plt>
xor    %eax,%eax
call   1080 <kb_init@plt>
xor    %eax,%eax
call   1040 <init_shell@plt>
xor    %eax,%eax
pop    %rcx
jmp    1090 <shell@plt>

LLVM IR (-O0):
@.str = [42 x i8] c"Congrats on booting the BUSTANUT kernel. \00"
@.str.1 = [70 x i8] c"(BUSTANUT is Undergoing Sustained Testing And is Not a Unix Terminal)\00"
@.str.2 = [31 x i8] c"Now get the flag out of it!\0A\0A\0A\00"
define void @kmain() {
%1 = call i32 (...) @clear_screen()
%2 = call i32 @kprint(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @kprint_newline()
%4 = call i32 @kprint(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 (...) @kprint_newline()
%6 = call i32 @kprint(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 (...) @idt_init()
%8 = call i32 (...) @kb_init()
%9 = call i32 (...) @init_shell()
%10 = call i32 (...) @shell()
ret void
}

LLVM IR (-O2):
@.str = [42 x i8] c"Congrats on booting the BUSTANUT kernel. \00"
@.str.1 = [70 x i8] c"(BUSTANUT is Undergoing Sustained Testing And is Not a Unix Terminal)\00"
@.str.2 = [31 x i8] c"Now get the flag out of it!\0A\0A\0A\00"
define void @kmain() {
%1 = tail call i32 (...) @clear_screen()
%2 = tail call i32 @kprint(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @kprint_newline()
%4 = tail call i32 @kprint(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 (...) @kprint_newline()
%6 = tail call i32 @kprint(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 (...) @idt_init()
%8 = tail call i32 (...) @kb_init()
%9 = tail call i32 (...) @init_shell()
%10 = tail call i32 (...) @shell()
ret void
}