void main() {
  unsigned char BackgroundColour = 0x06;
  unsigned char ForegroundColour = 0x00;
  unsigned char Colour =
      ((BackgroundColour << 4) & 0xF0) | (ForegroundColour & 0x0F);
  unsigned short *DisplayMemoryPtr = (unsigned short *)0xB8000;
  unsigned int DisplaySize = 2000;
  unsigned int i = 0;
  while (i < DisplaySize) {
    DisplayMemoryPtr[i++] = (((unsigned short)Colour) << 8) | 0x00;
  }
  i = 0x0F000000;
  while (i--) {
    ;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movb   $0x6,-0x1(%rbp)
movb   $0x0,-0x2(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x4,%eax
and    $0xf0,%eax
movzbl -0x2(%rbp),%ecx
and    $0xf,%ecx
or     %ecx,%eax
mov    %al,-0x3(%rbp)
mov    $0xb8000,%eax
mov    %rax,-0x10(%rbp)
movl   $0x7d0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    1171 <main+0x71>
movzbl -0x3(%rbp),%eax
movzwl %ax,%eax
shl    $0x8,%eax
or     $0x0,%eax
mov    %ax,%dx
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x18(%rbp)
mov    %ecx,%ecx
mov    %dx,(%rax,%rcx,2)
jmp    113b <main+0x3b>
movl   $0xf000000,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x18(%rbp)
cmp    $0x0,%eax
je     1191 <main+0x91>
jmp    1178 <main+0x78>
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0xb8090,%eax
xor    %ecx,%ecx
movaps 0xef2(%rip),%xmm0
xchg   %ax,%ax
movaps %xmm0,-0x90(%rax,%rcx,2)
ff
movaps %xmm0,-0x80(%rax,%rcx,2)
movaps %xmm0,-0x70(%rax,%rcx,2)
movaps %xmm0,-0x60(%rax,%rcx,2)
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    $0x50,%rcx
cmp    $0x7d0,%rcx
jne    1110 <main+0x10>
ret

LLVM IR (-O0):
define void @main() {
%1 = alloca i8
%2 = alloca i8
%3 = alloca i8
%4 = alloca i16*
%5 = alloca i32
%6 = alloca i32
store i8 6, i8* %1
store i8 0, i8* %2
%7 = load i8, i8* %1
%8 = zext i8 %7 to i32
%9 = shl i32 %8, 4
%10 = and i32 %9, 240
%11 = load i8, i8* %2
%12 = zext i8 %11 to i32
%13 = and i32 %12, 15
%14 = or i32 %10, %13
%15 = trunc i32 %14 to i8
store i8 %15, i8* %3
store i16* inttoptr (i64 753664 to i16*), i16** %4
store i32 2000, i32* %5
store i32 0, i32* %6
br label %16
16: ; preds = %20, %0
%17 = load i32, i32* %6
%18 = load i32, i32* %5
%19 = icmp ult i32 %17, %18
br i1 %19, label %20, label %32
20: ; preds = %16
%21 = load i8, i8* %3
%22 = zext i8 %21 to i16
%23 = zext i16 %22 to i32
%24 = shl i32 %23, 8
%25 = or i32 %24, 0
%26 = trunc i32 %25 to i16
%27 = load i16*, i16** %4
%28 = load i32, i32* %6
%29 = add i32 %28, 1
store i32 %29, i32* %6
%30 = zext i32 %28 to i64
%31 = getelementptr inbounds i16, i16* %27, i64 %30
store i16 %26, i16* %31
br label %16
32: ; preds = %16
store i32 251658240, i32* %6
br label %33
33: ; preds = %37, %32
%34 = load i32, i32* %6
%35 = add i32 %34, -1
store i32 %35, i32* %6
%36 = icmp ne i32 %34, 0
br i1 %36, label %37, label %38
37: ; preds = %33
br label %33
38: ; preds = %33
ret void
}

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