#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ set_cursor(int /*<<< orphan*/, int);
void clear_screen(char *video_memory) {
  int i, j;
  for (i = 0; i < 25; i++) {
    for (j = 0; j < 80; j++) {
      *video_memory++ = ' ';
      *video_memory++ = 0x02;
    }
  }
  set_cursor(0, 1);
}


x86 assembly (clang, -O0):
<clear_screen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x19,-0xc(%rbp)
jge    1183 <clear_screen+0x73>
movl   $0x0,-0x10(%rbp)
cmpl   $0x50,-0x10(%rbp)
jge    1170 <clear_screen+0x60>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movb   $0x20,(%rax)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movb   $0x2,(%rax)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1134 <clear_screen+0x24>
jmp    1175 <clear_screen+0x65>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <clear_screen+0x13>
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <set_cursor@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_screen>:
xor    %eax,%eax
movaps 0xee7(%rip),%xmm0
nopl   0x0(%rax)
movups %xmm0,(%rdi,%rax,1)
movups %xmm0,0x10(%rdi,%rax,1)
movups %xmm0,0x20(%rdi,%rax,1)
movups %xmm0,0x30(%rdi,%rax,1)
movups %xmm0,0x40(%rdi,%rax,1)
movups %xmm0,0x50(%rdi,%rax,1)
movups %xmm0,0x60(%rdi,%rax,1)
movups %xmm0,0x70(%rdi,%rax,1)
movups %xmm0,0x80(%rdi,%rax,1)
movups %xmm0,0x90(%rdi,%rax,1)
cmp    $0xf00,%eax
je     11b9 <clear_screen+0xa9>
movups %xmm0,0xa0(%rdi,%rax,1)
movups %xmm0,0xb0(%rdi,%rax,1)
movups %xmm0,0xc0(%rdi,%rax,1)
movups %xmm0,0xd0(%rdi,%rax,1)
movups %xmm0,0xe0(%rdi,%rax,1)
movups %xmm0,0xf0(%rdi,%rax,1)
movups %xmm0,0x100(%rdi,%rax,1)
movups %xmm0,0x110(%rdi,%rax,1)
movups %xmm0,0x120(%rdi,%rax,1)
movups %xmm0,0x130(%rdi,%rax,1)
add    $0x140,%rax
jmp    1120 <clear_screen+0x10>
xor    %edi,%edi
mov    $0x1,%esi
jmp    1030 <set_cursor@plt>

LLVM IR (-O0):
define void @clear_screen(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %5
5: ; preds = %21, %1
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 25
br i1 %7, label %8, label %24
8: ; preds = %5
store i32 0, i32* %4
br label %9
9: ; preds = %17, %8
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 80
br i1 %11, label %12, label %20
12: ; preds = %9
%13 = load i8*, i8** %2
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %2
store i8 32, i8* %13
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %2
store i8 2, i8* %15
br label %17
17: ; preds = %12
%18 = load i32, i32* %4
%19 = add nsw i32 %18, 1
store i32 %19, i32* %4
br label %9
20: ; preds = %9
br label %21
21: ; preds = %20
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %5
24: ; preds = %5
%25 = call i32 @set_cursor(i32 0, i32 1)
ret void
}

LLVM IR (-O2):
define void @clear_screen(i8* nocapture writeonly %0) {
br label %2
2: ; preds = %26, %1
%3 = phi i32 [ 0, %1 ], [ %47, %26 ]
%4 = phi i8* [ %0, %1 ], [ %27, %26 ]
%5 = getelementptr i8, i8* %4, i64 160
%6 = bitcast i8* %4 to <16 x i8>*
store <16 x i8> <i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2>, <16 x i8>* %6
%7 = getelementptr inbounds i8, i8* %4, i64 16
%8 = bitcast i8* %7 to <16 x i8>*
store <16 x i8> <i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2>, <16 x i8>* %8
%9 = getelementptr inbounds i8, i8* %4, i64 32
%10 = bitcast i8* %9 to <16 x i8>*
store <16 x i8> <i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2>, <16 x i8>* %10
%11 = getelementptr inbounds i8, i8* %4, i64 48
%12 = bitcast i8* %11 to <16 x i8>*
store <16 x i8> <i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2>, <16 x i8>* %12
%13 = getelementptr inbounds i8, i8* %4, i64 64
%14 = bitcast i8* %13 to <16 x i8>*
store <16 x i8> <i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2>, <16 x i8>* %14
%15 = getelementptr inbounds i8, i8* %4, i64 80
%16 = bitcast i8* %15 to <16 x i8>*
store <16 x i8> <i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2>, <16 x i8>* %16
%17 = getelementptr inbounds i8, i8* %4, i64 96
%18 = bitcast i8* %17 to <16 x i8>*
store <16 x i8> <i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2>, <16 x i8>* %18
%19 = getelementptr inbounds i8, i8* %4, i64 112
%20 = bitcast i8* %19 to <16 x i8>*
store <16 x i8> <i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2>, <16 x i8>* %20
%21 = getelementptr inbounds i8, i8* %4, i64 128
%22 = bitcast i8* %21 to <16 x i8>*
store <16 x i8> <i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2>, <16 x i8>* %22
%23 = getelementptr inbounds i8, i8* %4, i64 144
%24 = bitcast i8* %23 to <16 x i8>*
store <16 x i8> <i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2>, <16 x i8>* %24
%25 = icmp eq i32 %3, 24
br i1 %25, label %48, label %26
26: ; preds = %2
%27 = getelementptr i8, i8* %4, i64 320
%28 = bitcast i8* %5 to <16 x i8>*
store <16 x i8> <i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2>, <16 x i8>* %28
%29 = getelementptr i8, i8* %4, i64 176
%30 = bitcast i8* %29 to <16 x i8>*
store <16 x i8> <i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2>, <16 x i8>* %30
%31 = getelementptr i8, i8* %4, i64 192
%32 = bitcast i8* %31 to <16 x i8>*
store <16 x i8> <i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2>, <16 x i8>* %32
%33 = getelementptr i8, i8* %4, i64 208
%34 = bitcast i8* %33 to <16 x i8>*
store <16 x i8> <i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2>, <16 x i8>* %34
%35 = getelementptr i8, i8* %4, i64 224
%36 = bitcast i8* %35 to <16 x i8>*
store <16 x i8> <i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2>, <16 x i8>* %36
%37 = getelementptr i8, i8* %4, i64 240
%38 = bitcast i8* %37 to <16 x i8>*
store <16 x i8> <i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2>, <16 x i8>* %38
%39 = getelementptr i8, i8* %4, i64 256
%40 = bitcast i8* %39 to <16 x i8>*
store <16 x i8> <i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2>, <16 x i8>* %40
%41 = getelementptr i8, i8* %4, i64 272
%42 = bitcast i8* %41 to <16 x i8>*
store <16 x i8> <i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2>, <16 x i8>* %42
%43 = getelementptr i8, i8* %4, i64 288
%44 = bitcast i8* %43 to <16 x i8>*
store <16 x i8> <i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2>, <16 x i8>* %44
%45 = getelementptr i8, i8* %4, i64 304
%46 = bitcast i8* %45 to <16 x i8>*
store <16 x i8> <i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2, i8 32, i8 2>, <16 x i8>* %46
%47 = add nuw nsw i32 %3, 2
br label %2
48: ; preds = %2
%49 = tail call i32 @set_cursor(i32 0, i32 1)
ret void
}