#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*/ wr_reg(int, unsigned int);
void GLCD_SetWindow(unsigned int x, unsigned int y, unsigned int w,
                    unsigned int h) {
  wr_reg(0x50, y);
  wr_reg(0x51, y + h - 1);
  wr_reg(0x52, x);
  wr_reg(0x53, x + w - 1);
  wr_reg(0x20, y);
  wr_reg(0x21, x);
}


x86 assembly (clang, -O0):
<GLCD_SetWindow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x8(%rbp),%esi
mov    $0x50,%edi
call   1030 <wr_reg@plt>
mov    -0x8(%rbp),%esi
add    -0x10(%rbp),%esi
sub    $0x1,%esi
mov    $0x51,%edi
call   1030 <wr_reg@plt>
mov    -0x4(%rbp),%esi
mov    $0x52,%edi
call   1030 <wr_reg@plt>
mov    -0x4(%rbp),%esi
add    -0xc(%rbp),%esi
sub    $0x1,%esi
mov    $0x53,%edi
call   1030 <wr_reg@plt>
mov    -0x8(%rbp),%esi
mov    $0x20,%edi
call   1030 <wr_reg@plt>
mov    -0x4(%rbp),%esi
mov    $0x21,%edi
call   1030 <wr_reg@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GLCD_SetWindow>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %ecx,%r15d
mov    %edx,%r12d
mov    %esi,%ebx
mov    %edi,%r14d
mov    $0x50,%edi
call   1030 <wr_reg@plt>
lea    (%rbx,%r15,1),%esi
add    $0xffffffff,%esi
mov    $0x51,%edi
call   1030 <wr_reg@plt>
mov    $0x52,%edi
mov    %r14d,%esi
call   1030 <wr_reg@plt>
lea    (%r14,%r12,1),%esi
add    $0xffffffff,%esi
mov    $0x53,%edi
call   1030 <wr_reg@plt>
mov    $0x20,%edi
mov    %ebx,%esi
call   1030 <wr_reg@plt>
mov    $0x21,%edi
mov    %r14d,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <wr_reg@plt>

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

LLVM IR (-O2):
define void @GLCD_SetWindow(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @wr_reg(i32 80, i32 %1)
%6 = add i32 %1, -1
%7 = add i32 %6, %3
%8 = tail call i32 @wr_reg(i32 81, i32 %7)
%9 = tail call i32 @wr_reg(i32 82, i32 %0)
%10 = add i32 %0, -1
%11 = add i32 %10, %2
%12 = tail call i32 @wr_reg(i32 83, i32 %11)
%13 = tail call i32 @wr_reg(i32 32, i32 %1)
%14 = tail call i32 @wr_reg(i32 33, i32 %0)
ret void
}