void print_hello() {
  int i;
  char hello[] = "Hello World!";
  volatile char *video = ((volatile char *)0x000B8000);
  for (i = 0; i < 80 * 25; i++)
    video[i * 2] = video[i * 2 + 1] = 0;
  for (i = 0; i < 13; i++) {
    video[i * 2] = hello[i];
    video[i * 2 + 1] = 7;
  }
  return;
}


x86 assembly (clang, -O0):
<print_hello>:
push   %rbp
mov    %rsp,%rbp
mov    0xef5(%rip),%rax
mov    %rax,-0x11(%rbp)
mov    0xef3(%rip),%eax
mov    %eax,-0x9(%rbp)
mov    0xeee(%rip),%al
mov    %al,-0x5(%rbp)
mov    $0xb8000,%eax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x4(%rbp)
cmpl   $0x7d0,-0x4(%rbp)
jge    1171 <print_hello+0x71>
mov    -0x20(%rbp),%rax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1131 <print_hello+0x31>
movl   $0x0,-0x4(%rbp)
cmpl   $0xd,-0x4(%rbp)
jge    11bc <print_hello+0xbc>
movslq -0x4(%rbp),%rax
mov    -0x11(%rbp,%rax,1),%dl
mov    -0x20(%rbp),%rax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x7,(%rax,%rcx,1)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1178 <print_hello+0x78>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_hello>:
mov    $0x3,%eax
mov    $0xb8000,%ecx
nopw   0x0(%rax,%rax,1)
movb   $0x0,-0x2(%rcx,%rax,1)
movb   $0x0,-0x3(%rcx,%rax,1)
movb   $0x0,(%rcx,%rax,1)
movb   $0x0,-0x1(%rcx,%rax,1)
add    $0x4,%rax
cmp    $0xfa3,%rax
jne    1110 <print_hello+0x10>
movb   $0x48,0xb8000
48
movb   $0x7,0xb8001
07
movb   $0x65,0xb8002
65
movb   $0x7,0xb8003
07
movb   $0x6c,0xb8004
6c
movb   $0x7,0xb8005
07
movb   $0x6c,0xb8006
6c
movb   $0x7,0xb8007
07
movb   $0x6f,0xb8008
6f
movb   $0x7,0xb8009
07
movb   $0x20,0xb800a
20
movb   $0x7,0xb800b
07
movb   $0x57,0xb800c
57
movb   $0x7,0xb800d
07
movb   $0x6f,0xb800e
6f
movb   $0x7,0xb800f
07
movb   $0x72,0xb8010
72
movb   $0x7,0xb8011
07
movb   $0x6c,0xb8012
6c
movb   $0x7,0xb8013
07
movb   $0x64,0xb8014
64
movb   $0x7,0xb8015
07
movb   $0x21,0xb8016
21
movb   $0x7,0xb8017
07
movb   $0x0,0xb8018
movb   $0x7,0xb8019
07
ret

LLVM IR (-O0):
@__const.print_hello.hello = [13 x i8] c"Hello World!\00"
define void @print_hello() {
%1 = alloca i32
%2 = alloca [13 x i8]
%3 = alloca i8*
%4 = bitcast [13 x i8]* %2 to i8*
store i8* inttoptr (i64 753664 to i8*), i8** %3
store i32 0, i32* %1
br label %5
5: ; preds = %20, %0
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 2000
br i1 %7, label %8, label %23
8: ; preds = %5
%9 = load i8*, i8** %3
%10 = load i32, i32* %1
%11 = mul nsw i32 %10, 2
%12 = add nsw i32 %11, 1
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %9, i64 %13
store volatile i8 0, i8* %14
%15 = load i8*, i8** %3
%16 = load i32, i32* %1
%17 = mul nsw i32 %16, 2
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %15, i64 %18
store volatile i8 0, i8* %19
br label %20
20: ; preds = %8
%21 = load i32, i32* %1
%22 = add nsw i32 %21, 1
store i32 %22, i32* %1
br label %5
23: ; preds = %5
store i32 0, i32* %1
br label %24
24: ; preds = %43, %23
%25 = load i32, i32* %1
%26 = icmp slt i32 %25, 13
br i1 %26, label %27, label %46
27: ; preds = %24
%28 = load i32, i32* %1
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [13 x i8], [13 x i8]* %2, i64 0, i64 %29
%31 = load i8, i8* %30
%32 = load i8*, i8** %3
%33 = load i32, i32* %1
%34 = mul nsw i32 %33, 2
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %32, i64 %35
store volatile i8 %31, i8* %36
%37 = load i8*, i8** %3
%38 = load i32, i32* %1
%39 = mul nsw i32 %38, 2
%40 = add nsw i32 %39, 1
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8, i8* %37, i64 %41
store volatile i8 7, i8* %42
br label %43
43: ; preds = %27
%44 = load i32, i32* %1
%45 = add nsw i32 %44, 1
store i32 %45, i32* %1
br label %24
46: ; preds = %24
ret void
}

LLVM IR (-O2):
define void @print_hello() {
br label %1
1: ; preds = %1, %0
%2 = phi i64 [ 0, %0 ], [ %12, %1 ]
%3 = shl nuw nsw i64 %2, 1
%4 = or i64 %3, 1
%5 = getelementptr inbounds i8, i8* inttoptr (i64 753664 to i8*), i64 %4
store volatile i8 0, i8* %5
%6 = getelementptr inbounds i8, i8* inttoptr (i64 753664 to i8*), i64 %3
store volatile i8 0, i8* %6
%7 = shl nuw i64 %2, 1
%8 = or i64 %7, 2
%9 = or i64 %7, 3
%10 = getelementptr inbounds i8, i8* inttoptr (i64 753664 to i8*), i64 %9
store volatile i8 0, i8* %10
%11 = getelementptr inbounds i8, i8* inttoptr (i64 753664 to i8*), i64 %8
store volatile i8 0, i8* %11
%12 = add nuw nsw i64 %2, 2
%13 = icmp eq i64 %12, 2000
br i1 %13, label %14, label %1
14: ; preds = %1
store volatile i8 72, i8* inttoptr (i64 753664 to i8*)
store volatile i8 7, i8* inttoptr (i64 753665 to i8*)
store volatile i8 101, i8* inttoptr (i64 753666 to i8*)
store volatile i8 7, i8* inttoptr (i64 753667 to i8*)
store volatile i8 108, i8* inttoptr (i64 753668 to i8*)
store volatile i8 7, i8* inttoptr (i64 753669 to i8*)
store volatile i8 108, i8* inttoptr (i64 753670 to i8*)
store volatile i8 7, i8* inttoptr (i64 753671 to i8*)
store volatile i8 111, i8* inttoptr (i64 753672 to i8*)
store volatile i8 7, i8* inttoptr (i64 753673 to i8*)
store volatile i8 32, i8* inttoptr (i64 753674 to i8*)
store volatile i8 7, i8* inttoptr (i64 753675 to i8*)
store volatile i8 87, i8* inttoptr (i64 753676 to i8*)
store volatile i8 7, i8* inttoptr (i64 753677 to i8*)
store volatile i8 111, i8* inttoptr (i64 753678 to i8*)
store volatile i8 7, i8* inttoptr (i64 753679 to i8*)
store volatile i8 114, i8* inttoptr (i64 753680 to i8*)
store volatile i8 7, i8* inttoptr (i64 753681 to i8*)
store volatile i8 108, i8* inttoptr (i64 753682 to i8*)
store volatile i8 7, i8* inttoptr (i64 753683 to i8*)
store volatile i8 100, i8* inttoptr (i64 753684 to i8*)
store volatile i8 7, i8* inttoptr (i64 753685 to i8*)
store volatile i8 33, i8* inttoptr (i64 753686 to i8*)
store volatile i8 7, i8* inttoptr (i64 753687 to i8*)
store volatile i8 0, i8* inttoptr (i64 753688 to i8*)
store volatile i8 7, i8* inttoptr (i64 753689 to i8*)
ret void
}