void init_display() {
  volatile char *video = ((volatile char *)0x000B8000);
  int i;
  for (i = 0; i < 80 * 25; i++) {
    video[i * 2] = 0;
    video[i * 2 + 1] = 2;
  }
  video = (((volatile char *)0x000B8000) + ((25 / 2) * 80 + 80 / 2 - 6) * 2);
  video[2 * 2] = ':';
  video[5 * 2] = ':';
  video[8 * 2] = ':';
}


x86 assembly (clang, -O0):
<init_display>:
push   %rbp
mov    %rsp,%rbp
mov    $0xb8000,%eax
mov    %rax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x7d0,-0xc(%rbp)
jge    1154 <init_display+0x54>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x2,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1114 <init_display+0x14>
mov    $0xb8000,%eax
add    $0x7c4,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x3a,0x4(%rax)
mov    -0x8(%rbp),%rax
movb   $0x3a,0xa(%rax)
mov    -0x8(%rbp),%rax
movb   $0x3a,0x10(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_display>:
mov    $0xb8003,%eax
xor    %ecx,%ecx
nopw   0x0(%rax,%rax,1)
movb   $0x0,-0x3(%rax,%rcx,2)
movb   $0x2,-0x2(%rax,%rcx,2)
movb   $0x0,-0x1(%rax,%rcx,2)
movb   $0x2,(%rax,%rcx,2)
add    $0x2,%rcx
cmp    $0x7d0,%rcx
jne    1110 <init_display+0x10>
movb   $0x3a,0xb87c8
3a
movb   $0x3a,0xb87ce
3a
movb   $0x3a,0xb87d4
3a
ret

LLVM IR (-O0):
define void @init_display() {
%1 = alloca i8*
%2 = alloca i32
store i8* inttoptr (i64 753664 to i8*), i8** %1
store i32 0, i32* %2
br label %3
3: ; preds = %18, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 2000
br i1 %5, label %6, label %21
6: ; preds = %3
%7 = load i8*, i8** %1
%8 = load i32, i32* %2
%9 = mul nsw i32 %8, 2
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %7, i64 %10
store volatile i8 0, i8* %11
%12 = load i8*, i8** %1
%13 = load i32, i32* %2
%14 = mul nsw i32 %13, 2
%15 = add nsw i32 %14, 1
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %12, i64 %16
store volatile i8 2, i8* %17
br label %18
18: ; preds = %6
%19 = load i32, i32* %2
%20 = add nsw i32 %19, 1
store i32 %20, i32* %2
br label %3
21: ; preds = %3
store i8* getelementptr inbounds (i8, i8* inttoptr (i64 753664 to i8*), i64 1988), i8** %1
%22 = load i8*, i8** %1
%23 = getelementptr inbounds i8, i8* %22, i64 4
store volatile i8 58, i8* %23
%24 = load i8*, i8** %1
%25 = getelementptr inbounds i8, i8* %24, i64 10
store volatile i8 58, i8* %25
%26 = load i8*, i8** %1
%27 = getelementptr inbounds i8, i8* %26, i64 16
store volatile i8 58, i8* %27
ret void
}

LLVM IR (-O2):
define void @init_display() {
br label %1
1: ; preds = %1, %0
%2 = phi i64 [ 0, %0 ], [ %12, %1 ]
%3 = shl nuw nsw i64 %2, 1
%4 = getelementptr inbounds i8, i8* inttoptr (i64 753664 to i8*), i64 %3
store volatile i8 0, i8* %4
%5 = or i64 %3, 1
%6 = getelementptr inbounds i8, i8* inttoptr (i64 753664 to i8*), i64 %5
store volatile i8 2, i8* %6
%7 = shl nuw i64 %2, 1
%8 = or i64 %7, 2
%9 = getelementptr inbounds i8, i8* inttoptr (i64 753664 to i8*), i64 %8
store volatile i8 0, i8* %9
%10 = or i64 %7, 3
%11 = getelementptr inbounds i8, i8* inttoptr (i64 753664 to i8*), i64 %10
store volatile i8 2, 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 58, i8* inttoptr (i64 755656 to i8*)
store volatile i8 58, i8* inttoptr (i64 755662 to i8*)
store volatile i8 58, i8* inttoptr (i64 755668 to i8*)
ret void
}