void _start(void *kernel_location) {
  char *textvram = (char *)0xB8000;
  unsigned long long addr = (unsigned long long)kernel_location;
  for (int i = 0; i < 16; i++) {
    textvram[i * 2] = "0123456789ABCDEF"[(addr >> 60) & 0xf];
    addr <<= 4;
  }
  for (;;)
    ;
}


x86 assembly (clang, -O0):
<_start>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    $0xb8000,%eax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x10,-0x1c(%rbp)
jge    116a <_start+0x6a>
mov    -0x18(%rbp),%rcx
shr    $0x3c,%rcx
and    $0xf,%rcx
lea    0xec3(%rip),%rax
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
shl    $0x4,%rax
mov    %rax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1120 <_start+0x20>
jmp    116f <_start+0x6f>
jmp    116f <_start+0x6f>

x86 assembly (clang, -O2):
<_start>:
mov    %rdi,%rcx
shr    $0x3c,%rcx
lea    0xef2(%rip),%rax
mov    (%rcx,%rax,1),%cl
mov    %cl,0xb8000
mov    %rdi,%rcx
shr    $0x38,%rcx
and    $0xf,%ecx
mov    (%rcx,%rax,1),%cl
mov    %cl,0xb8002
mov    %rdi,%rcx
shr    $0x34,%rcx
and    $0xf,%ecx
mov    (%rcx,%rax,1),%cl
mov    %cl,0xb8004
mov    %rdi,%rcx
shr    $0x30,%rcx
and    $0xf,%ecx
mov    (%rcx,%rax,1),%cl
mov    %cl,0xb8006
mov    %rdi,%rcx
shr    $0x2c,%rcx
and    $0xf,%ecx
mov    (%rcx,%rax,1),%cl
mov    %cl,0xb8008
mov    %rdi,%rcx
shr    $0x28,%rcx
and    $0xf,%ecx
mov    (%rcx,%rax,1),%cl
mov    %cl,0xb800a
mov    %rdi,%rcx
shr    $0x24,%rcx
and    $0xf,%ecx
mov    (%rcx,%rax,1),%cl
mov    %cl,0xb800c
mov    %rdi,%rcx
shr    $0x20,%rcx
and    $0xf,%ecx
mov    (%rcx,%rax,1),%cl
mov    %cl,0xb800e
mov    %edi,%ecx
shr    $0x1c,%ecx
mov    (%rcx,%rax,1),%cl
mov    %cl,0xb8010
mov    %edi,%ecx
shr    $0x18,%ecx
and    $0xf,%ecx
mov    (%rcx,%rax,1),%cl
mov    %cl,0xb8012
mov    %edi,%ecx
shr    $0x14,%ecx
and    $0xf,%ecx
mov    (%rcx,%rax,1),%cl
mov    %cl,0xb8014
mov    %edi,%ecx
shr    $0x10,%ecx
and    $0xf,%ecx
mov    (%rcx,%rax,1),%cl
mov    %cl,0xb8016
mov    %edi,%ecx
shr    $0xc,%ecx
and    $0xf,%ecx
mov    (%rcx,%rax,1),%cl
mov    %cl,0xb8018
mov    %edi,%ecx
shr    $0x8,%ecx
and    $0xf,%ecx
mov    (%rcx,%rax,1),%cl
mov    %cl,0xb801a
mov    %edi,%ecx
shr    $0x4,%ecx
and    $0xf,%ecx
mov    (%rcx,%rax,1),%cl
mov    %cl,0xb801c
and    $0xf,%edi
mov    (%rdi,%rax,1),%al
mov    %al,0xb801e
nopl   0x0(%rax)
jmp    1230 <_start+0x130>

LLVM IR (-O0):
@.str = [17 x i8] c"0123456789ABCDEF\00"
define void @_start(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
store i8* %0, i8** %2
store i8* inttoptr (i64 753664 to i8*), i8** %3
%6 = load i8*, i8** %2
%7 = ptrtoint i8* %6 to i64
store i64 %7, i64* %4
store i32 0, i32* %5
br label %8
8: ; preds = %24, %1
%9 = load i32, i32* %5
%10 = icmp slt i32 %9, 16
br i1 %10, label %11, label %27
11: ; preds = %8
%12 = load i64, i64* %4
%13 = lshr i64 %12, 60
%14 = and i64 %13, 15
%15 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %14
%16 = load i8, i8* %15
%17 = load i8*, i8** %3
%18 = load i32, i32* %5
%19 = mul nsw i32 %18, 2
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %17, i64 %20
store i8 %16, i8* %21
%22 = load i64, i64* %4
%23 = shl i64 %22, 4
store i64 %23, i64* %4
br label %24
24: ; preds = %11
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
store i32 %26, i32* %5
br label %8
27: ; preds = %8
br label %28
28: ; preds = %28, %27
br label %28
}

LLVM IR (-O2):
@.str = [17 x i8] c"0123456789ABCDEF\00"
define void @_start(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = lshr i64 %2, 60
%4 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %3
%5 = load i8, i8* %4
store i8 %5, i8* inttoptr (i64 753664 to i8*)
%6 = lshr i64 %2, 56
%7 = and i64 %6, 15
%8 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %7
%9 = load i8, i8* %8
store i8 %9, i8* inttoptr (i64 753666 to i8*)
%10 = lshr i64 %2, 52
%11 = and i64 %10, 15
%12 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %11
%13 = load i8, i8* %12
store i8 %13, i8* inttoptr (i64 753668 to i8*)
%14 = lshr i64 %2, 48
%15 = and i64 %14, 15
%16 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %15
%17 = load i8, i8* %16
store i8 %17, i8* inttoptr (i64 753670 to i8*)
%18 = lshr i64 %2, 44
%19 = and i64 %18, 15
%20 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %19
%21 = load i8, i8* %20
store i8 %21, i8* inttoptr (i64 753672 to i8*)
%22 = lshr i64 %2, 40
%23 = and i64 %22, 15
%24 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %23
%25 = load i8, i8* %24
store i8 %25, i8* inttoptr (i64 753674 to i8*)
%26 = lshr i64 %2, 36
%27 = and i64 %26, 15
%28 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %27
%29 = load i8, i8* %28
store i8 %29, i8* inttoptr (i64 753676 to i8*)
%30 = lshr i64 %2, 32
%31 = and i64 %30, 15
%32 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %31
%33 = load i8, i8* %32
store i8 %33, i8* inttoptr (i64 753678 to i8*)
%34 = lshr i64 %2, 28
%35 = and i64 %34, 15
%36 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %35
%37 = load i8, i8* %36
store i8 %37, i8* inttoptr (i64 753680 to i8*)
%38 = lshr i64 %2, 24
%39 = and i64 %38, 15
%40 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %39
%41 = load i8, i8* %40
store i8 %41, i8* inttoptr (i64 753682 to i8*)
%42 = lshr i64 %2, 20
%43 = and i64 %42, 15
%44 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %43
%45 = load i8, i8* %44
store i8 %45, i8* inttoptr (i64 753684 to i8*)
%46 = lshr i64 %2, 16
%47 = and i64 %46, 15
%48 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %47
%49 = load i8, i8* %48
store i8 %49, i8* inttoptr (i64 753686 to i8*)
%50 = lshr i64 %2, 12
%51 = and i64 %50, 15
%52 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %51
%53 = load i8, i8* %52
store i8 %53, i8* inttoptr (i64 753688 to i8*)
%54 = lshr i64 %2, 8
%55 = and i64 %54, 15
%56 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %55
%57 = load i8, i8* %56
store i8 %57, i8* inttoptr (i64 753690 to i8*)
%58 = lshr i64 %2, 4
%59 = and i64 %58, 15
%60 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %59
%61 = load i8, i8* %60
store i8 %61, i8* inttoptr (i64 753692 to i8*)
%62 = and i64 %2, 15
%63 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %62
%64 = load i8, i8* %63
store i8 %64, i8* inttoptr (i64 753694 to i8*)
br label %65
65: ; preds = %1, %65
br label %65
}