#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_background_color(int color) {
  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(color);
}


x86 assembly (clang, -O0):
<lcd_background_color>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
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,-0x10(%rbp)
cmpq   $0x12c00,-0x10(%rbp)
jae    11d0 <lcd_background_color+0xb0>
mov    -0x4(%rbp),%edi
call   1040 <lcd_write_wdr@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    11a9 <lcd_background_color+0x89>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcd_background_color>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
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
mov    %ebp,%edi
call   1040 <lcd_write_wdr@plt>
add    $0xffffffffffffffff,%rbx
jne    11a0 <lcd_background_color+0x80>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

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