#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*/ terminal_initialize();
int /*<<< orphan*/ terminal_writestring(char *);
void kernel_main(void) {
  terminal_initialize();
  terminal_writestring("Hello, kernel World!\n");
  terminal_writestring("Hello, kernel World!\n");
  terminal_writestring("Hello, kernel World!\n");
  terminal_writestring("Hello, kernel World!\n");
  terminal_writestring("Hello, kernel World!\n");
  terminal_writestring("Hello, kernel World!\n");
}


x86 assembly (clang, -O0):
<kernel_main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <terminal_initialize@plt>
lea    0xece(%rip),%rdi
call   1030 <terminal_writestring@plt>
lea    0xec2(%rip),%rdi
call   1030 <terminal_writestring@plt>
lea    0xeb6(%rip),%rdi
call   1030 <terminal_writestring@plt>
lea    0xeaa(%rip),%rdi
call   1030 <terminal_writestring@plt>
lea    0xe9e(%rip),%rdi
call   1030 <terminal_writestring@plt>
lea    0xe92(%rip),%rdi
call   1030 <terminal_writestring@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<kernel_main>:
push   %rbx
xor    %eax,%eax
call   1040 <terminal_initialize@plt>
lea    0xed1(%rip),%rbx
mov    %rbx,%rdi
call   1030 <terminal_writestring@plt>
mov    %rbx,%rdi
call   1030 <terminal_writestring@plt>
mov    %rbx,%rdi
call   1030 <terminal_writestring@plt>
mov    %rbx,%rdi
call   1030 <terminal_writestring@plt>
mov    %rbx,%rdi
call   1030 <terminal_writestring@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <terminal_writestring@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"Hello, kernel World!\0A\00"
define void @kernel_main() {
%1 = call i32 (...) @terminal_initialize()
%2 = call i32 @terminal_writestring(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @terminal_writestring(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @terminal_writestring(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @terminal_writestring(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @terminal_writestring(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @terminal_writestring(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"Hello, kernel World!\0A\00"
define void @kernel_main() {
%1 = tail call i32 (...) @terminal_initialize()
%2 = tail call i32 @terminal_writestring(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @terminal_writestring(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @terminal_writestring(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @terminal_writestring(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @terminal_writestring(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @terminal_writestring(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
ret void
}