#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*/ lcd_write_index_register(int);
int /*<<< orphan*/ lcd_write_wdr(int);
void lcd_clear_screen(void) {
  unsigned long int counter;
  lcd_write_index_register(0x20);
  lcd_write_wdr(0);
  lcd_write_index_register(0x21);
  lcd_write_wdr(0);
  lcd_write_index_register(0x50);
  lcd_write_wdr(0);
  lcd_write_index_register(0x51);
  lcd_write_wdr(319);
  lcd_write_index_register(0x52);
  lcd_write_wdr(0);
  lcd_write_index_register(0x53);
  lcd_write_wdr(239);
  lcd_write_index_register(0x22);
  for (counter = 0; counter < 76800; counter++)
    lcd_write_wdr(0xFFFF);
}


x86 assembly (clang, -O0):
<lcd_clear_screen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x20,%edi
call   1030 <lcd_write_index_register@plt>
xor    %edi,%edi
call   1040 <lcd_write_wdr@plt>
mov    $0x21,%edi
call   1030 <lcd_write_index_register@plt>
xor    %edi,%edi
call   1040 <lcd_write_wdr@plt>
mov    $0x50,%edi
call   1030 <lcd_write_index_register@plt>
xor    %edi,%edi
call   1040 <lcd_write_wdr@plt>
mov    $0x51,%edi
call   1030 <lcd_write_index_register@plt>
mov    $0x13f,%edi
call   1040 <lcd_write_wdr@plt>
mov    $0x52,%edi
call   1030 <lcd_write_index_register@plt>
xor    %edi,%edi
call   1040 <lcd_write_wdr@plt>
mov    $0x53,%edi
call   1030 <lcd_write_index_register@plt>
mov    $0xef,%edi
call   1040 <lcd_write_wdr@plt>
mov    $0x22,%edi
call   1030 <lcd_write_index_register@plt>
movq   $0x0,-0x8(%rbp)
cmpq   $0x12c00,-0x8(%rbp)
jae    11cf <lcd_clear_screen+0xaf>
mov    $0xffff,%edi
call   1040 <lcd_write_wdr@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    11a6 <lcd_clear_screen+0x86>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcd_clear_screen>:
push   %rbx
mov    $0x20,%edi
call   1030 <lcd_write_index_register@plt>
xor    %edi,%edi
call   1040 <lcd_write_wdr@plt>
mov    $0x21,%edi
call   1030 <lcd_write_index_register@plt>
xor    %edi,%edi
call   1040 <lcd_write_wdr@plt>
mov    $0x50,%edi
call   1030 <lcd_write_index_register@plt>
xor    %edi,%edi
call   1040 <lcd_write_wdr@plt>
mov    $0x51,%edi
call   1030 <lcd_write_index_register@plt>
mov    $0x13f,%edi
call   1040 <lcd_write_wdr@plt>
mov    $0x52,%edi
call   1030 <lcd_write_index_register@plt>
xor    %edi,%edi
call   1040 <lcd_write_wdr@plt>
mov    $0x53,%edi
call   1030 <lcd_write_index_register@plt>
mov    $0xef,%edi
call   1040 <lcd_write_wdr@plt>
mov    $0x22,%edi
call   1030 <lcd_write_index_register@plt>
mov    $0x12c00,%ebx
nopl   0x0(%rax)
mov    $0xffff,%edi
call   1040 <lcd_write_wdr@plt>
add    $0xffffffffffffffff,%rbx
jne    11a0 <lcd_clear_screen+0x80>
pop    %rbx
ret

LLVM IR (-O0):
define void @lcd_clear_screen() {
%1 = alloca i64
%2 = call i32 @lcd_write_index_register(i32 32)
%3 = call i32 @lcd_write_wdr(i32 0)
%4 = call i32 @lcd_write_index_register(i32 33)
%5 = call i32 @lcd_write_wdr(i32 0)
%6 = call i32 @lcd_write_index_register(i32 80)
%7 = call i32 @lcd_write_wdr(i32 0)
%8 = call i32 @lcd_write_index_register(i32 81)
%9 = call i32 @lcd_write_wdr(i32 319)
%10 = call i32 @lcd_write_index_register(i32 82)
%11 = call i32 @lcd_write_wdr(i32 0)
%12 = call i32 @lcd_write_index_register(i32 83)
%13 = call i32 @lcd_write_wdr(i32 239)
%14 = call i32 @lcd_write_index_register(i32 34)
store i64 0, i64* %1
br label %15
15: ; preds = %20, %0
%16 = load i64, i64* %1
%17 = icmp ult i64 %16, 76800
br i1 %17, label %18, label %23
18: ; preds = %15
%19 = call i32 @lcd_write_wdr(i32 65535)
br label %20
20: ; preds = %18
%21 = load i64, i64* %1
%22 = add i64 %21, 1
store i64 %22, i64* %1
br label %15
23: ; preds = %15
ret void
}

LLVM IR (-O2):
define void @lcd_clear_screen() {
%1 = tail call i32 @lcd_write_index_register(i32 32)
%2 = tail call i32 @lcd_write_wdr(i32 0)
%3 = tail call i32 @lcd_write_index_register(i32 33)
%4 = tail call i32 @lcd_write_wdr(i32 0)
%5 = tail call i32 @lcd_write_index_register(i32 80)
%6 = tail call i32 @lcd_write_wdr(i32 0)
%7 = tail call i32 @lcd_write_index_register(i32 81)
%8 = tail call i32 @lcd_write_wdr(i32 319)
%9 = tail call i32 @lcd_write_index_register(i32 82)
%10 = tail call i32 @lcd_write_wdr(i32 0)
%11 = tail call i32 @lcd_write_index_register(i32 83)
%12 = tail call i32 @lcd_write_wdr(i32 239)
%13 = tail call i32 @lcd_write_index_register(i32 34)
br label %14
14: ; preds = %0, %14
%15 = phi i64 [ 0, %0 ], [ %17, %14 ]
%16 = tail call i32 @lcd_write_wdr(i32 65535)
%17 = add nuw nsw i64 %15, 1
%18 = icmp eq i64 %17, 76800
br i1 %18, label %19, label %14
19: ; preds = %14
ret void
}