#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*/ console_clear();
int /*<<< orphan*/ console_init();
int /*<<< orphan*/ console_print(char *);
int /*<<< orphan*/ idt_init();
int /*<<< orphan*/ init_keyboard();
int /*<<< orphan*/ kb_init();
int /*<<< orphan*/ screentext_clear();
scalar_t__ systemcheck();
void kmain(void) {
  screentext_clear();
  idt_init();
  kb_init();
  console_init();
  console_clear();
  int i = 2;
  if (systemcheck()) {
    init_keyboard();
    console_print("Welcome to Kernel Sanders\n\n\n\n");
    console_print("> ");
    while (1)
      ;
  }
}


x86 assembly (clang, -O0):
<kmain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1070 <screentext_clear@plt>
mov    $0x0,%al
call   1090 <idt_init@plt>
mov    $0x0,%al
call   10a0 <kb_init@plt>
mov    $0x0,%al
call   1030 <console_init@plt>
mov    $0x0,%al
call   1040 <console_clear@plt>
movl   $0x2,-0x4(%rbp)
mov    $0x0,%al
call   1060 <systemcheck@plt>
cmp    $0x0,%rax
je     11e7 <kmain+0x67>
mov    $0x0,%al
call   1080 <init_keyboard@plt>
lea    0xe2f(%rip),%rdi
call   1050 <console_print@plt>
lea    0xe41(%rip),%rdi
call   1050 <console_print@plt>
jmp    11e2 <kmain+0x62>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kmain>:
push   %rax
xor    %eax,%eax
call   1070 <screentext_clear@plt>
xor    %eax,%eax
call   1090 <idt_init@plt>
xor    %eax,%eax
call   10a0 <kb_init@plt>
xor    %eax,%eax
call   1030 <console_init@plt>
xor    %eax,%eax
call   1040 <console_clear@plt>
xor    %eax,%eax
call   1060 <systemcheck@plt>
test   %rax,%rax
je     11d2 <kmain+0x52>
xor    %eax,%eax
call   1080 <init_keyboard@plt>
lea    0xe42(%rip),%rdi
call   1050 <console_print@plt>
lea    0xe54(%rip),%rdi
call   1050 <console_print@plt>
nop
jmp    11d0 <kmain+0x50>
pop    %rax
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Welcome to Kernel Sanders\0A\0A\0A\0A\00"
@.str.1 = [3 x i8] c"> \00"
define void @kmain() {
%1 = alloca i32
%2 = call i32 (...) @screentext_clear()
%3 = call i32 (...) @idt_init()
%4 = call i32 (...) @kb_init()
%5 = call i32 (...) @console_init()
%6 = call i32 (...) @console_clear()
store i32 2, i32* %1
%7 = call i64 (...) @systemcheck()
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %0
%10 = call i32 (...) @init_keyboard()
%11 = call i32 @console_print(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @console_print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %9, %13
br label %13
14: ; preds = %0
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"Welcome to Kernel Sanders\0A\0A\0A\0A\00"
@.str.1 = [3 x i8] c"> \00"
define void @kmain() {
%1 = tail call i32 (...) @screentext_clear()
%2 = tail call i32 (...) @idt_init()
%3 = tail call i32 (...) @kb_init()
%4 = tail call i32 (...) @console_init()
%5 = tail call i32 (...) @console_clear()
%6 = tail call i64 (...) @systemcheck()
%7 = icmp eq i64 %6, 0
br i1 %7, label %13, label %8
8: ; preds = %0
%9 = tail call i32 (...) @init_keyboard()
%10 = tail call i32 @console_print(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%11 = tail call i32 @console_print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %12, %8
br label %12
13: ; preds = %0
ret void
}