void kmain(void) {
  char *str = "Hi. This is my first Kernel. It doesn't do much :'(. But it's "
              "strange to think that its an entire OS :D";
  char *vidptr = (char *)0xb8000;
  unsigned int i = 0;
  unsigned int j = 0;
  while (j < 80 * 25 * 2) {
    vidptr[j] = ' ';
    vidptr[j + 1] = 0x07;
    j = j + 2;
  }
  j = 0;
  while (str[j] != '\0') {
    vidptr[i] = str[j];
    vidptr[i + 1] = 0x07;
    ++j;
    i = i + 2;
  }
  return;
}


x86 assembly (clang, -O0):
<kmain>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    $0xb8000,%eax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0xfa0,-0x18(%rbp)
jae    115c <kmain+0x5c>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
movb   $0x20,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,%ecx
movb   $0x7,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x18(%rbp)
jmp    1126 <kmain+0x26>
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     11b2 <kmain+0xb2>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,%ecx
movb   $0x7,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x14(%rbp)
jmp    1163 <kmain+0x63>
pop    %rbp
ret

x86 assembly (clang, -O2):
<kmain>:
mov    $0xb8070,%eax
xor    %ecx,%ecx
movaps 0xef2(%rip),%xmm0
xchg   %ax,%ax
movaps %xmm0,-0x70(%rax,%rcx,2)
movaps %xmm0,-0x60(%rax,%rcx,2)
cmp    $0x7c0,%rcx
je     1146 <kmain+0x46>
movaps %xmm0,-0x50(%rax,%rcx,2)
movaps %xmm0,-0x40(%rax,%rcx,2)
movaps %xmm0,-0x30(%rax,%rcx,2)
movaps %xmm0,-0x20(%rax,%rcx,2)
movaps %xmm0,-0x10(%rax,%rcx,2)
movaps %xmm0,(%rax,%rcx,2)
add    $0x40,%rcx
jmp    1110 <kmain+0x10>
lea    0xf83(%rip),%r8
cmp    $0xb80ce,%r8
setb   %dl
lea    0xfd9(%rip),%rsi
cmp    $0xb8001,%rsi
setae  %cl
test   %dl,%cl
je     1175 <kmain+0x75>
xor    %edx,%edx
xor    %esi,%esi
jmp    1233 <kmain+0x133>
movaps 0xe94(%rip),%xmm0
movaps %xmm0,0xb8000
movaps 0xe95(%rip),%xmm0
movaps %xmm0,0xb8010
movaps 0xe96(%rip),%xmm0
movaps %xmm0,0xb8020
movaps 0xe97(%rip),%xmm0
movaps %xmm0,0xb8030
movaps 0xe98(%rip),%xmm0
movaps %xmm0,0xb8040
movaps 0xe99(%rip),%xmm0
movaps %xmm0,0xb8050
movaps 0xe9a(%rip),%xmm0
movaps %xmm0,0xb8060
movaps 0xe9b(%rip),%xmm0
movaps %xmm0,0xb8070
movaps 0xe9c(%rip),%xmm0
movaps %xmm0,0xb8080
movaps 0xe9d(%rip),%xmm0
movaps %xmm0,0xb8090
movaps 0xe9e(%rip),%xmm0
movaps %xmm0,0xb80a0
movaps 0xe9f(%rip),%xmm0
movaps %xmm0,0xb80b0
mov    $0x60,%esi
mov    $0xc0,%edx
mov    (%rsi,%r8,1),%cl
mov    %cl,-0x70(%rax,%rdx,1)
mov    %rdx,%rcx
or     $0x1,%rcx
movb   $0x7,-0x70(%rax,%rcx,1)
add    %rdx,%rax
add    $0xffffffffffffff95,%rax
mov    $0x66,%r9d
sub    %rsi,%r9
lea    (%rsi,%r8,1),%rdi
add    $0x2,%rdi
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl -0x1(%rdi,%rsi,1),%edx
movzbl (%rdi,%rsi,1),%ecx
mov    %dl,-0x3(%rax,%rsi,2)
movb   $0x7,-0x2(%rax,%rsi,2)
mov    %cl,-0x1(%rax,%rsi,2)
movb   $0x7,(%rax,%rsi,2)
add    $0x2,%rsi
cmp    %rsi,%r9
jne    1270 <kmain+0x170>
ret

LLVM IR (-O0):
@.str = [104 x i8] c"Hi. This is my first Kernel. It doesn't do much :'(. But it's strange to think that its an entire OS :D\00"
define void @kmain() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* getelementptr inbounds ([104 x i8], [104 x i8]* @.str, i64 0, i64 0), i8** %1
store i8* inttoptr (i64 753664 to i8*), i8** %2
store i32 0, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %8, %0
%6 = load i32, i32* %4
%7 = icmp ult i32 %6, 4000
br i1 %7, label %8, label %20
8: ; preds = %5
%9 = load i8*, i8** %2
%10 = load i32, i32* %4
%11 = zext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %9, i64 %11
store i8 32, i8* %12
%13 = load i8*, i8** %2
%14 = load i32, i32* %4
%15 = add i32 %14, 1
%16 = zext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %13, i64 %16
store i8 7, i8* %17
%18 = load i32, i32* %4
%19 = add i32 %18, 2
store i32 %19, i32* %4
br label %5
20: ; preds = %5
store i32 0, i32* %4
br label %21
21: ; preds = %29, %20
%22 = load i8*, i8** %1
%23 = load i32, i32* %4
%24 = zext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %48
29: ; preds = %21
%30 = load i8*, i8** %1
%31 = load i32, i32* %4
%32 = zext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %30, i64 %32
%34 = load i8, i8* %33
%35 = load i8*, i8** %2
%36 = load i32, i32* %3
%37 = zext i32 %36 to i64
%38 = getelementptr inbounds i8, i8* %35, i64 %37
store i8 %34, i8* %38
%39 = load i8*, i8** %2
%40 = load i32, i32* %3
%41 = add i32 %40, 1
%42 = zext i32 %41 to i64
%43 = getelementptr inbounds i8, i8* %39, i64 %42
store i8 7, i8* %43
%44 = load i32, i32* %4
%45 = add i32 %44, 1
store i32 %45, i32* %4
%46 = load i32, i32* %3
%47 = add i32 %46, 2
store i32 %47, i32* %3
br label %21
48: ; preds = %21
ret void
}

LLVM IR (-O2):
@.str = [104 x i8] c"Hi. This is my first Kernel. It doesn't do much :'(. But it's strange to think that its an entire OS :D\00"
define void @kmain() {
br label %1
1: ; preds = %12, %0
%2 = phi i64 [ 0, %0 ], [ %34, %12 ]
%3 = shl nuw i64 %2, 1
%4 = or i64 %3, 1
%5 = or i64 %3, 17
%6 = getelementptr inbounds i8, i8* inttoptr (i64 753663 to i8*), i64 %4
%7 = bitcast i8* %6 to <16 x i8>*
%8 = getelementptr inbounds i8, i8* inttoptr (i64 753663 to i8*), i64 %5
%9 = bitcast i8* %8 to <16 x i8>*
store <16 x i8> <i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7>, <16 x i8>* %7
store <16 x i8> <i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7>, <16 x i8>* %9
%10 = or i64 %2, 16
%11 = icmp eq i64 %10, 2000
br i1 %11, label %35, label %12
12: ; preds = %1
%13 = shl nuw i64 %10, 1
%14 = or i64 %13, 1
%15 = or i64 %13, 17
%16 = getelementptr inbounds i8, i8* inttoptr (i64 753663 to i8*), i64 %14
%17 = bitcast i8* %16 to <16 x i8>*
%18 = getelementptr inbounds i8, i8* inttoptr (i64 753663 to i8*), i64 %15
%19 = bitcast i8* %18 to <16 x i8>*
store <16 x i8> <i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7>, <16 x i8>* %17
store <16 x i8> <i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7>, <16 x i8>* %19
%20 = shl nuw i64 %2, 1
%21 = or i64 %20, 65
%22 = or i64 %20, 81
%23 = getelementptr inbounds i8, i8* inttoptr (i64 753663 to i8*), i64 %21
%24 = bitcast i8* %23 to <16 x i8>*
%25 = getelementptr inbounds i8, i8* inttoptr (i64 753663 to i8*), i64 %22
%26 = bitcast i8* %25 to <16 x i8>*
store <16 x i8> <i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7>, <16 x i8>* %24
store <16 x i8> <i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7>, <16 x i8>* %26
%27 = shl nuw i64 %2, 1
%28 = or i64 %27, 97
%29 = or i64 %27, 113
%30 = getelementptr inbounds i8, i8* inttoptr (i64 753663 to i8*), i64 %28
%31 = bitcast i8* %30 to <16 x i8>*
%32 = getelementptr inbounds i8, i8* inttoptr (i64 753663 to i8*), i64 %29
%33 = bitcast i8* %32 to <16 x i8>*
store <16 x i8> <i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7>, <16 x i8>* %31
store <16 x i8> <i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7, i8 32, i8 7>, <16 x i8>* %33
%34 = add nuw nsw i64 %2, 64
br label %1
35: ; preds = %1
br i1 and (i1 icmp ult (i8* inttoptr (i64 753664 to i8*), i8* getelementptr inbounds ([104 x i8], [104 x i8]* @.str, i64 0, i64 103)), i1 icmp ult (i8* getelementptr inbounds ([104 x i8], [104 x i8]* @.str, i64 0, i64 0), i8* inttoptr (i64 753870 to i8*))), label %37, label %36
36: ; preds = %35
store <16 x i8> <i8 72, i8 7, i8 105, i8 7, i8 46, i8 7, i8 32, i8 7, i8 84, i8 7, i8 104, i8 7, i8 105, i8 7, i8 115, i8 7>, <16 x i8>* inttoptr (i64 753664 to <16 x i8>*)
store <16 x i8> <i8 32, i8 7, i8 105, i8 7, i8 115, i8 7, i8 32, i8 7, i8 109, i8 7, i8 121, i8 7, i8 32, i8 7, i8 102, i8 7>, <16 x i8>* inttoptr (i64 753680 to <16 x i8>*)
store <16 x i8> <i8 105, i8 7, i8 114, i8 7, i8 115, i8 7, i8 116, i8 7, i8 32, i8 7, i8 75, i8 7, i8 101, i8 7, i8 114, i8 7>, <16 x i8>* inttoptr (i64 753696 to <16 x i8>*)
store <16 x i8> <i8 110, i8 7, i8 101, i8 7, i8 108, i8 7, i8 46, i8 7, i8 32, i8 7, i8 73, i8 7, i8 116, i8 7, i8 32, i8 7>, <16 x i8>* inttoptr (i64 753712 to <16 x i8>*)
store <16 x i8> <i8 100, i8 7, i8 111, i8 7, i8 101, i8 7, i8 115, i8 7, i8 110, i8 7, i8 39, i8 7, i8 116, i8 7, i8 32, i8 7>, <16 x i8>* inttoptr (i64 753728 to <16 x i8>*)
store <16 x i8> <i8 100, i8 7, i8 111, i8 7, i8 32, i8 7, i8 109, i8 7, i8 117, i8 7, i8 99, i8 7, i8 104, i8 7, i8 32, i8 7>, <16 x i8>* inttoptr (i64 753744 to <16 x i8>*)
store <16 x i8> <i8 58, i8 7, i8 39, i8 7, i8 40, i8 7, i8 46, i8 7, i8 32, i8 7, i8 66, i8 7, i8 117, i8 7, i8 116, i8 7>, <16 x i8>* inttoptr (i64 753760 to <16 x i8>*)
store <16 x i8> <i8 32, i8 7, i8 105, i8 7, i8 116, i8 7, i8 39, i8 7, i8 115, i8 7, i8 32, i8 7, i8 115, i8 7, i8 116, i8 7>, <16 x i8>* inttoptr (i64 753776 to <16 x i8>*)
store <16 x i8> <i8 114, i8 7, i8 97, i8 7, i8 110, i8 7, i8 103, i8 7, i8 101, i8 7, i8 32, i8 7, i8 116, i8 7, i8 111, i8 7>, <16 x i8>* inttoptr (i64 753792 to <16 x i8>*)
store <16 x i8> <i8 32, i8 7, i8 116, i8 7, i8 104, i8 7, i8 105, i8 7, i8 110, i8 7, i8 107, i8 7, i8 32, i8 7, i8 116, i8 7>, <16 x i8>* inttoptr (i64 753808 to <16 x i8>*)
store <16 x i8> <i8 104, i8 7, i8 97, i8 7, i8 116, i8 7, i8 32, i8 7, i8 105, i8 7, i8 116, i8 7, i8 115, i8 7, i8 32, i8 7>, <16 x i8>* inttoptr (i64 753824 to <16 x i8>*)
store <16 x i8> <i8 97, i8 7, i8 110, i8 7, i8 32, i8 7, i8 101, i8 7, i8 110, i8 7, i8 116, i8 7, i8 105, i8 7, i8 114, i8 7>, <16 x i8>* inttoptr (i64 753840 to <16 x i8>*)
br label %37
37: ; preds = %36, %35
%38 = phi i64 [ 0, %35 ], [ 192, %36 ]
%39 = phi i64 [ 0, %35 ], [ 96, %36 ]
%40 = getelementptr inbounds [104 x i8], [104 x i8]* @.str, i64 0, i64 %39
%41 = load i8, i8* %40
%42 = getelementptr inbounds i8, i8* inttoptr (i64 753664 to i8*), i64 %38
store i8 %41, i8* %42
%43 = or i64 %38, 1
%44 = getelementptr inbounds i8, i8* inttoptr (i64 753664 to i8*), i64 %43
store i8 7, i8* %44
%45 = or i64 %39, 1
%46 = or i64 %38, 2
br label %47
47: ; preds = %47, %37
%48 = phi i64 [ %46, %37 ], [ %63, %47 ]
%49 = phi i64 [ %45, %37 ], [ %62, %47 ]
%50 = getelementptr inbounds [104 x i8], [104 x i8]* @.str, i64 0, i64 %49
%51 = load i8, i8* %50
%52 = getelementptr inbounds i8, i8* inttoptr (i64 753664 to i8*), i64 %48
store i8 %51, i8* %52
%53 = or i64 %48, 1
%54 = getelementptr inbounds i8, i8* inttoptr (i64 753664 to i8*), i64 %53
store i8 7, i8* %54
%55 = add nuw nsw i64 %49, 1
%56 = add nuw nsw i64 %48, 2
%57 = getelementptr inbounds [104 x i8], [104 x i8]* @.str, i64 0, i64 %55
%58 = load i8, i8* %57
%59 = getelementptr inbounds i8, i8* inttoptr (i64 753664 to i8*), i64 %56
store i8 %58, i8* %59
%60 = or i64 %56, 1
%61 = getelementptr inbounds i8, i8* inttoptr (i64 753664 to i8*), i64 %60
store i8 7, i8* %61
%62 = add nuw nsw i64 %49, 2
%63 = add nuw nsw i64 %48, 4
%64 = icmp eq i64 %62, 103
br i1 %64, label %65, label %47
65: ; preds = %47
ret void
}