#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 lcd_read_rdr();
int /*<<< orphan*/ lcd_write_index_register(int);
int /*<<< orphan*/ lcd_write_wdr(int);
int lcd_read_pixel(int x, int y) {
  int pixel;
  lcd_write_index_register(0x20);
  lcd_write_wdr(x);
  lcd_write_index_register(0x21);
  lcd_write_wdr(y);
  lcd_write_index_register(0x50);
  lcd_write_wdr(x);
  lcd_write_index_register(0x51);
  lcd_write_wdr(x);
  lcd_write_index_register(0x52);
  lcd_write_wdr(y);
  lcd_write_index_register(0x53);
  lcd_write_wdr(y);
  lcd_write_index_register(0x22);
  pixel = lcd_read_rdr();
  return pixel;
}


x86 assembly (clang, -O0):
<lcd_read_pixel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x20,%edi
call   1030 <lcd_write_index_register@plt>
mov    -0x4(%rbp),%edi
call   1040 <lcd_write_wdr@plt>
mov    $0x21,%edi
call   1030 <lcd_write_index_register@plt>
mov    -0x8(%rbp),%edi
call   1040 <lcd_write_wdr@plt>
mov    $0x50,%edi
call   1030 <lcd_write_index_register@plt>
mov    -0x4(%rbp),%edi
call   1040 <lcd_write_wdr@plt>
mov    $0x51,%edi
call   1030 <lcd_write_index_register@plt>
mov    -0x4(%rbp),%edi
call   1040 <lcd_write_wdr@plt>
mov    $0x52,%edi
call   1030 <lcd_write_index_register@plt>
mov    -0x8(%rbp),%edi
call   1040 <lcd_write_wdr@plt>
mov    $0x53,%edi
call   1030 <lcd_write_index_register@plt>
mov    -0x8(%rbp),%edi
call   1040 <lcd_write_wdr@plt>
mov    $0x22,%edi
call   1030 <lcd_write_index_register@plt>
mov    $0x0,%al
call   1050 <lcd_read_rdr@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcd_read_pixel>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x20,%edi
call   1030 <lcd_write_index_register@plt>
mov    %ebp,%edi
call   1040 <lcd_write_wdr@plt>
mov    $0x21,%edi
call   1030 <lcd_write_index_register@plt>
mov    %ebx,%edi
call   1040 <lcd_write_wdr@plt>
mov    $0x50,%edi
call   1030 <lcd_write_index_register@plt>
mov    %ebp,%edi
call   1040 <lcd_write_wdr@plt>
mov    $0x51,%edi
call   1030 <lcd_write_index_register@plt>
mov    %ebp,%edi
call   1040 <lcd_write_wdr@plt>
mov    $0x52,%edi
call   1030 <lcd_write_index_register@plt>
mov    %ebx,%edi
call   1040 <lcd_write_wdr@plt>
mov    $0x53,%edi
call   1030 <lcd_write_index_register@plt>
mov    %ebx,%edi
call   1040 <lcd_write_wdr@plt>
mov    $0x22,%edi
call   1030 <lcd_write_index_register@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <lcd_read_rdr@plt>

LLVM IR (-O0):
define i32 @lcd_read_pixel(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = call i32 @lcd_write_index_register(i32 32)
%7 = load i32, i32* %3
%8 = call i32 @lcd_write_wdr(i32 %7)
%9 = call i32 @lcd_write_index_register(i32 33)
%10 = load i32, i32* %4
%11 = call i32 @lcd_write_wdr(i32 %10)
%12 = call i32 @lcd_write_index_register(i32 80)
%13 = load i32, i32* %3
%14 = call i32 @lcd_write_wdr(i32 %13)
%15 = call i32 @lcd_write_index_register(i32 81)
%16 = load i32, i32* %3
%17 = call i32 @lcd_write_wdr(i32 %16)
%18 = call i32 @lcd_write_index_register(i32 82)
%19 = load i32, i32* %4
%20 = call i32 @lcd_write_wdr(i32 %19)
%21 = call i32 @lcd_write_index_register(i32 83)
%22 = load i32, i32* %4
%23 = call i32 @lcd_write_wdr(i32 %22)
%24 = call i32 @lcd_write_index_register(i32 34)
%25 = call i32 (...) @lcd_read_rdr()
store i32 %25, i32* %5
%26 = load i32, i32* %5
ret i32 %26
}

LLVM IR (-O2):
define i32 @lcd_read_pixel(i32 %0, i32 %1) {
%3 = tail call i32 @lcd_write_index_register(i32 32)
%4 = tail call i32 @lcd_write_wdr(i32 %0)
%5 = tail call i32 @lcd_write_index_register(i32 33)
%6 = tail call i32 @lcd_write_wdr(i32 %1)
%7 = tail call i32 @lcd_write_index_register(i32 80)
%8 = tail call i32 @lcd_write_wdr(i32 %0)
%9 = tail call i32 @lcd_write_index_register(i32 81)
%10 = tail call i32 @lcd_write_wdr(i32 %0)
%11 = tail call i32 @lcd_write_index_register(i32 82)
%12 = tail call i32 @lcd_write_wdr(i32 %1)
%13 = tail call i32 @lcd_write_index_register(i32 83)
%14 = tail call i32 @lcd_write_wdr(i32 %1)
%15 = tail call i32 @lcd_write_index_register(i32 34)
%16 = tail call i32 (...) @lcd_read_rdr()
ret i32 %16
}