void kclrscr() {
  unsigned long *vidmem = (unsigned long *)0xb8000;
  unsigned long i = 0;
  while (i < (40 * 25)) {
    vidmem[i] = 0x0A200A20;
    ++i;
  };
}


x86 assembly (clang, -O0):
<kclrscr>:
push   %rbp
mov    %rsp,%rbp
mov    $0xb8000,%eax
mov    %rax,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x3e8,-0x10(%rbp)
jae    1144 <kclrscr+0x44>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movq   $0xa200a20,(%rax,%rcx,8)
0a
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1115 <kclrscr+0x15>
pop    %rbp
ret

x86 assembly (clang, -O2):
<kclrscr>:
mov    $0x12,%eax
mov    $0xb8000,%ecx
movaps 0xeef(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movaps %xmm0,-0x90(%rcx,%rax,8)
ff
movaps %xmm0,-0x80(%rcx,%rax,8)
movaps %xmm0,-0x70(%rcx,%rax,8)
movaps %xmm0,-0x60(%rcx,%rax,8)
movaps %xmm0,-0x50(%rcx,%rax,8)
movaps %xmm0,-0x40(%rcx,%rax,8)
movaps %xmm0,-0x30(%rcx,%rax,8)
movaps %xmm0,-0x20(%rcx,%rax,8)
movaps %xmm0,-0x10(%rcx,%rax,8)
movaps %xmm0,(%rcx,%rax,8)
add    $0x14,%rax
cmp    $0x3fa,%rax
jne    1120 <kclrscr+0x20>
ret

LLVM IR (-O0):
define void @kclrscr() {
%1 = alloca i64*
%2 = alloca i64
store i64* inttoptr (i64 753664 to i64*), i64** %1
store i64 0, i64* %2
br label %3
3: ; preds = %6, %0
%4 = load i64, i64* %2
%5 = icmp ult i64 %4, 1000
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = load i64*, i64** %1
%8 = load i64, i64* %2
%9 = getelementptr inbounds i64, i64* %7, i64 %8
store i64 169871904, i64* %9
%10 = load i64, i64* %2
%11 = add i64 %10, 1
store i64 %11, i64* %2
br label %3
12: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @kclrscr() {
br label %1
1: ; preds = %1, %0
%2 = phi i64 [ 0, %0 ], [ %27, %1 ]
%3 = getelementptr inbounds i64, i64* inttoptr (i64 753664 to i64*), i64 %2
%4 = bitcast i64* %3 to <2 x i64>*
store <2 x i64> <i64 169871904, i64 169871904>, <2 x i64>* %4
%5 = getelementptr inbounds i64, i64* %3, i64 2
%6 = bitcast i64* %5 to <2 x i64>*
store <2 x i64> <i64 169871904, i64 169871904>, <2 x i64>* %6
%7 = add nuw nsw i64 %2, 4
%8 = getelementptr inbounds i64, i64* inttoptr (i64 753664 to i64*), i64 %7
%9 = bitcast i64* %8 to <2 x i64>*
store <2 x i64> <i64 169871904, i64 169871904>, <2 x i64>* %9
%10 = getelementptr inbounds i64, i64* %8, i64 2
%11 = bitcast i64* %10 to <2 x i64>*
store <2 x i64> <i64 169871904, i64 169871904>, <2 x i64>* %11
%12 = add nuw nsw i64 %2, 8
%13 = getelementptr inbounds i64, i64* inttoptr (i64 753664 to i64*), i64 %12
%14 = bitcast i64* %13 to <2 x i64>*
store <2 x i64> <i64 169871904, i64 169871904>, <2 x i64>* %14
%15 = getelementptr inbounds i64, i64* %13, i64 2
%16 = bitcast i64* %15 to <2 x i64>*
store <2 x i64> <i64 169871904, i64 169871904>, <2 x i64>* %16
%17 = add nuw nsw i64 %2, 12
%18 = getelementptr inbounds i64, i64* inttoptr (i64 753664 to i64*), i64 %17
%19 = bitcast i64* %18 to <2 x i64>*
store <2 x i64> <i64 169871904, i64 169871904>, <2 x i64>* %19
%20 = getelementptr inbounds i64, i64* %18, i64 2
%21 = bitcast i64* %20 to <2 x i64>*
store <2 x i64> <i64 169871904, i64 169871904>, <2 x i64>* %21
%22 = add nuw nsw i64 %2, 16
%23 = getelementptr inbounds i64, i64* inttoptr (i64 753664 to i64*), i64 %22
%24 = bitcast i64* %23 to <2 x i64>*
store <2 x i64> <i64 169871904, i64 169871904>, <2 x i64>* %24
%25 = getelementptr inbounds i64, i64* %23, i64 2
%26 = bitcast i64* %25 to <2 x i64>*
store <2 x i64> <i64 169871904, i64 169871904>, <2 x i64>* %26
%27 = add nuw nsw i64 %2, 20
%28 = icmp eq i64 %27, 1000
br i1 %28, label %29, label %1
29: ; preds = %1
ret void
}