void clear_scroll(void) {
  int i;
  char *s;
  s = (char *)(0xb8000 + 12 * 160);
  for (i = 0; i < 80 * (24 - 12); i++) {
    *s++ = ' ';
    *s++ = 0x17;
  }
}


x86 assembly (clang, -O0):
<clear_scroll>:
push   %rbp
mov    %rsp,%rbp
mov    $0xb8780,%eax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x4(%rbp)
cmpl   $0x3c0,-0x4(%rbp)
jge    1153 <clear_scroll+0x53>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x20,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x17,(%rax)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1114 <clear_scroll+0x14>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_scroll>:
mov    $0x38,%eax
mov    $0xb8780,%ecx
movaps 0xeef(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movaps %xmm0,-0x70(%rcx,%rax,2)
movaps %xmm0,-0x60(%rcx,%rax,2)
movaps %xmm0,-0x50(%rcx,%rax,2)
movaps %xmm0,-0x40(%rcx,%rax,2)
movaps %xmm0,-0x30(%rcx,%rax,2)
movaps %xmm0,-0x20(%rcx,%rax,2)
movaps %xmm0,-0x10(%rcx,%rax,2)
movaps %xmm0,(%rcx,%rax,2)
add    $0x40,%rax
cmp    $0x3f8,%rax
jne    1120 <clear_scroll+0x20>
ret

LLVM IR (-O0):
define void @clear_scroll() {
%1 = alloca i32
%2 = alloca i8*
store i8* inttoptr (i64 755584 to i8*), i8** %2
store i32 0, i32* %1
br label %3
3: ; preds = %11, %0
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 960
br i1 %5, label %6, label %14
6: ; preds = %3
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i32 1
store i8* %8, i8** %2
store i8 32, i8* %7
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %2
store i8 23, i8* %9
br label %11
11: ; preds = %6
%12 = load i32, i32* %1
%13 = add nsw i32 %12, 1
store i32 %13, i32* %1
br label %3
14: ; preds = %3
ret void
}

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