#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*/ write_reg(int, int);
void ili9325_set_window(int x, int y, int xlen, int ylen) {
  write_reg(0x0020, x);
  write_reg(0x0021, y);
  write_reg(0x0050, x);
  write_reg(0x0052, y);
  write_reg(0x0051, x + xlen - 1);
  write_reg(0x0053, y + ylen - 1);
}


x86 assembly (clang, -O0):
<ili9325_set_window>:
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    -0x4(%rbp),%esi
mov    $0x20,%edi
call   1030 <write_reg@plt>
mov    -0x8(%rbp),%esi
mov    $0x21,%edi
call   1030 <write_reg@plt>
mov    -0x4(%rbp),%esi
mov    $0x50,%edi
call   1030 <write_reg@plt>
mov    -0x8(%rbp),%esi
mov    $0x52,%edi
call   1030 <write_reg@plt>
mov    -0x4(%rbp),%esi
add    -0xc(%rbp),%esi
sub    $0x1,%esi
mov    $0x51,%edi
call   1030 <write_reg@plt>
mov    -0x8(%rbp),%esi
add    -0x10(%rbp),%esi
sub    $0x1,%esi
mov    $0x53,%edi
call   1030 <write_reg@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @ili9325_set_window(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* %5
%10 = call i32 @write_reg(i32 32, i32 %9)
%11 = load i32, i32* %6
%12 = call i32 @write_reg(i32 33, i32 %11)
%13 = load i32, i32* %5
%14 = call i32 @write_reg(i32 80, i32 %13)
%15 = load i32, i32* %6
%16 = call i32 @write_reg(i32 82, i32 %15)
%17 = load i32, i32* %5
%18 = load i32, i32* %7
%19 = add nsw i32 %17, %18
%20 = sub nsw i32 %19, 1
%21 = call i32 @write_reg(i32 81, i32 %20)
%22 = load i32, i32* %6
%23 = load i32, i32* %8
%24 = add nsw i32 %22, %23
%25 = sub nsw i32 %24, 1
%26 = call i32 @write_reg(i32 83, i32 %25)
ret void
}

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