#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*/ SetColumn(int /*<<< orphan*/);
int /*<<< orphan*/ SetPageStart(unsigned int);
int /*<<< orphan*/ send_data(int /*<<< orphan*/);
void ClearScreen(void) {
  unsigned int ra;
  unsigned int rb;
  for (ra = 0; ra < 8; ra++) {
    SetPageStart(ra);
    SetColumn(0);
    for (rb = 0; rb < 0x80; rb++)
      send_data(0);
  }
}


x86 assembly (clang, -O0):
<ClearScreen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x8,-0x4(%rbp)
jae    1194 <ClearScreen+0x64>
mov    -0x4(%rbp),%edi
call   1030 <SetPageStart@plt>
xor    %edi,%edi
call   1050 <SetColumn@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x80,-0x8(%rbp)
jae    1181 <ClearScreen+0x51>
xor    %edi,%edi
call   1040 <send_data@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    115f <ClearScreen+0x2f>
jmp    1186 <ClearScreen+0x56>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    113f <ClearScreen+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ClearScreen>:
push   %rbx
xor    %edi,%edi
call   1030 <SetPageStart@plt>
xor    %edi,%edi
call   1050 <SetColumn@plt>
mov    $0x80,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %edi,%edi
call   1040 <send_data@plt>
add    $0xffffffff,%ebx
jne    1150 <ClearScreen+0x20>
mov    $0x1,%edi
call   1030 <SetPageStart@plt>
xor    %edi,%edi
call   1050 <SetColumn@plt>
mov    $0x80,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %edi,%edi
call   1040 <send_data@plt>
add    $0xffffffff,%ebx
jne    1180 <ClearScreen+0x50>
mov    $0x2,%edi
call   1030 <SetPageStart@plt>
xor    %edi,%edi
call   1050 <SetColumn@plt>
mov    $0x80,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %edi,%edi
call   1040 <send_data@plt>
add    $0xffffffff,%ebx
jne    11b0 <ClearScreen+0x80>
mov    $0x3,%edi
call   1030 <SetPageStart@plt>
xor    %edi,%edi
call   1050 <SetColumn@plt>
mov    $0x80,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %edi,%edi
call   1040 <send_data@plt>
add    $0xffffffff,%ebx
jne    11e0 <ClearScreen+0xb0>
mov    $0x4,%edi
call   1030 <SetPageStart@plt>
xor    %edi,%edi
call   1050 <SetColumn@plt>
mov    $0x80,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %edi,%edi
call   1040 <send_data@plt>
add    $0xffffffff,%ebx
jne    1210 <ClearScreen+0xe0>
mov    $0x5,%edi
call   1030 <SetPageStart@plt>
xor    %edi,%edi
call   1050 <SetColumn@plt>
mov    $0x80,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %edi,%edi
call   1040 <send_data@plt>
add    $0xffffffff,%ebx
jne    1240 <ClearScreen+0x110>
mov    $0x6,%edi
call   1030 <SetPageStart@plt>
xor    %edi,%edi
call   1050 <SetColumn@plt>
mov    $0x80,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %edi,%edi
call   1040 <send_data@plt>
add    $0xffffffff,%ebx
jne    1270 <ClearScreen+0x140>
mov    $0x7,%edi
call   1030 <SetPageStart@plt>
xor    %edi,%edi
call   1050 <SetColumn@plt>
mov    $0x80,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %edi,%edi
call   1040 <send_data@plt>
add    $0xffffffff,%ebx
jne    12a0 <ClearScreen+0x170>
pop    %rbx
ret

LLVM IR (-O0):
define void @ClearScreen() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %19, %0
%4 = load i32, i32* %1
%5 = icmp ult i32 %4, 8
br i1 %5, label %6, label %22
6: ; preds = %3
%7 = load i32, i32* %1
%8 = call i32 @SetPageStart(i32 %7)
%9 = call i32 @SetColumn(i32 0)
store i32 0, i32* %2
br label %10
10: ; preds = %15, %6
%11 = load i32, i32* %2
%12 = icmp ult i32 %11, 128
br i1 %12, label %13, label %18
13: ; preds = %10
%14 = call i32 @send_data(i32 0)
br label %15
15: ; preds = %13
%16 = load i32, i32* %2
%17 = add i32 %16, 1
store i32 %17, i32* %2
br label %10
18: ; preds = %10
br label %19
19: ; preds = %18
%20 = load i32, i32* %1
%21 = add i32 %20, 1
store i32 %21, i32* %1
br label %3
22: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @ClearScreen() {
%1 = tail call i32 @SetPageStart(i32 0)
%2 = tail call i32 @SetColumn(i32 0)
br label %3
3: ; preds = %0, %3
%4 = phi i32 [ 0, %0 ], [ %6, %3 ]
%5 = tail call i32 @send_data(i32 0)
%6 = add nuw nsw i32 %4, 1
%7 = icmp eq i32 %6, 128
br i1 %7, label %8, label %3
8: ; preds = %3
%9 = tail call i32 @SetPageStart(i32 1)
%10 = tail call i32 @SetColumn(i32 0)
br label %11
11: ; preds = %11, %8
%12 = phi i32 [ 0, %8 ], [ %14, %11 ]
%13 = tail call i32 @send_data(i32 0)
%14 = add nuw nsw i32 %12, 1
%15 = icmp eq i32 %14, 128
br i1 %15, label %16, label %11
16: ; preds = %11
%17 = tail call i32 @SetPageStart(i32 2)
%18 = tail call i32 @SetColumn(i32 0)
br label %19
19: ; preds = %19, %16
%20 = phi i32 [ 0, %16 ], [ %22, %19 ]
%21 = tail call i32 @send_data(i32 0)
%22 = add nuw nsw i32 %20, 1
%23 = icmp eq i32 %22, 128
br i1 %23, label %24, label %19
24: ; preds = %19
%25 = tail call i32 @SetPageStart(i32 3)
%26 = tail call i32 @SetColumn(i32 0)
br label %27
27: ; preds = %27, %24
%28 = phi i32 [ 0, %24 ], [ %30, %27 ]
%29 = tail call i32 @send_data(i32 0)
%30 = add nuw nsw i32 %28, 1
%31 = icmp eq i32 %30, 128
br i1 %31, label %32, label %27
32: ; preds = %27
%33 = tail call i32 @SetPageStart(i32 4)
%34 = tail call i32 @SetColumn(i32 0)
br label %35
35: ; preds = %35, %32
%36 = phi i32 [ 0, %32 ], [ %38, %35 ]
%37 = tail call i32 @send_data(i32 0)
%38 = add nuw nsw i32 %36, 1
%39 = icmp eq i32 %38, 128
br i1 %39, label %40, label %35
40: ; preds = %35
%41 = tail call i32 @SetPageStart(i32 5)
%42 = tail call i32 @SetColumn(i32 0)
br label %43
43: ; preds = %43, %40
%44 = phi i32 [ 0, %40 ], [ %46, %43 ]
%45 = tail call i32 @send_data(i32 0)
%46 = add nuw nsw i32 %44, 1
%47 = icmp eq i32 %46, 128
br i1 %47, label %48, label %43
48: ; preds = %43
%49 = tail call i32 @SetPageStart(i32 6)
%50 = tail call i32 @SetColumn(i32 0)
br label %51
51: ; preds = %51, %48
%52 = phi i32 [ 0, %48 ], [ %54, %51 ]
%53 = tail call i32 @send_data(i32 0)
%54 = add nuw nsw i32 %52, 1
%55 = icmp eq i32 %54, 128
br i1 %55, label %56, label %51
56: ; preds = %51
%57 = tail call i32 @SetPageStart(i32 7)
%58 = tail call i32 @SetColumn(i32 0)
br label %59
59: ; preds = %59, %56
%60 = phi i32 [ 0, %56 ], [ %62, %59 ]
%61 = tail call i32 @send_data(i32 0)
%62 = add nuw nsw i32 %60, 1
%63 = icmp eq i32 %62, 128
br i1 %63, label %64, label %59
64: ; preds = %59
ret void
}