#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*/ PrintChar(int);
void ClearScreen() {
  char *char_device = (char *)65536;
  unsigned int i, j;
  *char_device = 0;
  *(char_device + 1) = 0;
  for (i = 0; i < 24; i++) {
    for (j = 0; j < 40; j++) {
      PrintChar(20);
    }
  }
  *char_device = 0;
  *(char_device + 1) = 0;
}


x86 assembly (clang, -O0):
<ClearScreen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x10000,%eax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
movb   $0x0,0x1(%rax)
movl   $0x0,-0xc(%rbp)
cmpl   $0x18,-0xc(%rbp)
jae    117d <ClearScreen+0x6d>
movl   $0x0,-0x10(%rbp)
cmpl   $0x28,-0x10(%rbp)
jae    116a <ClearScreen+0x5a>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1148 <ClearScreen+0x38>
jmp    116f <ClearScreen+0x5f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1137 <ClearScreen+0x27>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
movb   $0x0,0x1(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ClearScreen>:
push   %rbx
movb   $0x0,0x10000
movb   $0x0,0x10001
mov    $0x18,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
mov    $0x14,%edi
call   1030 <PrintChar@plt>
add    $0xffffffff,%ebx
jne    1130 <ClearScreen+0x20>
movb   $0x0,0x10000
movb   $0x0,0x10001
pop    %rbx
ret

LLVM IR (-O0):
define void @ClearScreen() {
%1 = alloca i8*
%2 = alloca i32
%3 = alloca i32
store i8* inttoptr (i64 65536 to i8*), i8** %1
%4 = load i8*, i8** %1
store i8 0, i8* %4
%5 = load i8*, i8** %1
%6 = getelementptr inbounds i8, i8* %5, i64 1
store i8 0, i8* %6
store i32 0, i32* %2
br label %7
7: ; preds = %20, %0
%8 = load i32, i32* %2
%9 = icmp ult i32 %8, 24
br i1 %9, label %10, label %23
10: ; preds = %7
store i32 0, i32* %3
br label %11
11: ; preds = %16, %10
%12 = load i32, i32* %3
%13 = icmp ult i32 %12, 40
br i1 %13, label %14, label %19
14: ; preds = %11
%15 = call i32 @PrintChar(i32 20)
br label %16
16: ; preds = %14
%17 = load i32, i32* %3
%18 = add i32 %17, 1
store i32 %18, i32* %3
br label %11
19: ; preds = %11
br label %20
20: ; preds = %19
%21 = load i32, i32* %2
%22 = add i32 %21, 1
store i32 %22, i32* %2
br label %7
23: ; preds = %7
%24 = load i8*, i8** %1
store i8 0, i8* %24
%25 = load i8*, i8** %1
%26 = getelementptr inbounds i8, i8* %25, i64 1
store i8 0, i8* %26
ret void
}

LLVM IR (-O2):
define void @ClearScreen() {
store i8 0, i8* inttoptr (i64 65536 to i8*)
store i8 0, i8* inttoptr (i64 65537 to i8*)
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %43, %1 ]
%3 = tail call i32 @PrintChar(i32 20)
%4 = tail call i32 @PrintChar(i32 20)
%5 = tail call i32 @PrintChar(i32 20)
%6 = tail call i32 @PrintChar(i32 20)
%7 = tail call i32 @PrintChar(i32 20)
%8 = tail call i32 @PrintChar(i32 20)
%9 = tail call i32 @PrintChar(i32 20)
%10 = tail call i32 @PrintChar(i32 20)
%11 = tail call i32 @PrintChar(i32 20)
%12 = tail call i32 @PrintChar(i32 20)
%13 = tail call i32 @PrintChar(i32 20)
%14 = tail call i32 @PrintChar(i32 20)
%15 = tail call i32 @PrintChar(i32 20)
%16 = tail call i32 @PrintChar(i32 20)
%17 = tail call i32 @PrintChar(i32 20)
%18 = tail call i32 @PrintChar(i32 20)
%19 = tail call i32 @PrintChar(i32 20)
%20 = tail call i32 @PrintChar(i32 20)
%21 = tail call i32 @PrintChar(i32 20)
%22 = tail call i32 @PrintChar(i32 20)
%23 = tail call i32 @PrintChar(i32 20)
%24 = tail call i32 @PrintChar(i32 20)
%25 = tail call i32 @PrintChar(i32 20)
%26 = tail call i32 @PrintChar(i32 20)
%27 = tail call i32 @PrintChar(i32 20)
%28 = tail call i32 @PrintChar(i32 20)
%29 = tail call i32 @PrintChar(i32 20)
%30 = tail call i32 @PrintChar(i32 20)
%31 = tail call i32 @PrintChar(i32 20)
%32 = tail call i32 @PrintChar(i32 20)
%33 = tail call i32 @PrintChar(i32 20)
%34 = tail call i32 @PrintChar(i32 20)
%35 = tail call i32 @PrintChar(i32 20)
%36 = tail call i32 @PrintChar(i32 20)
%37 = tail call i32 @PrintChar(i32 20)
%38 = tail call i32 @PrintChar(i32 20)
%39 = tail call i32 @PrintChar(i32 20)
%40 = tail call i32 @PrintChar(i32 20)
%41 = tail call i32 @PrintChar(i32 20)
%42 = tail call i32 @PrintChar(i32 20)
%43 = add nuw nsw i32 %2, 1
%44 = icmp eq i32 %43, 24
br i1 %44, label %45, label %1
45: ; preds = %1
store i8 0, i8* inttoptr (i64 65536 to i8*)
store i8 0, i8* inttoptr (i64 65537 to i8*)
ret void
}