#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_COM(int);
int /*<<< orphan*/ LCD_DATA(int);
void ili9163_set_window(int x, int y, int xlen, int ylen) {
  xlen--;
  ylen--;
  LCD_COM(0x2A);
  LCD_DATA(x >> 8);
  LCD_DATA(x);
  LCD_DATA((x + xlen) >> 8);
  LCD_DATA((x + xlen));
  LCD_COM(0x2B);
  LCD_DATA(y >> 8);
  LCD_DATA(y);
  LCD_DATA((y + ylen) >> 8);
  LCD_DATA((y + ylen));
}


x86 assembly (clang, -O0):
<ili9163_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    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
mov    $0x2a,%edi
call   1040 <LCD_COM@plt>
mov    -0x4(%rbp),%edi
sar    $0x8,%edi
call   1030 <LCD_DATA@plt>
mov    -0x4(%rbp),%edi
call   1030 <LCD_DATA@plt>
mov    -0x4(%rbp),%edi
add    -0xc(%rbp),%edi
sar    $0x8,%edi
call   1030 <LCD_DATA@plt>
mov    -0x4(%rbp),%edi
add    -0xc(%rbp),%edi
call   1030 <LCD_DATA@plt>
mov    $0x2b,%edi
call   1040 <LCD_COM@plt>
mov    -0x8(%rbp),%edi
sar    $0x8,%edi
call   1030 <LCD_DATA@plt>
mov    -0x8(%rbp),%edi
call   1030 <LCD_DATA@plt>
mov    -0x8(%rbp),%edi
add    -0x10(%rbp),%edi
sar    $0x8,%edi
call   1030 <LCD_DATA@plt>
mov    -0x8(%rbp),%edi
add    -0x10(%rbp),%edi
call   1030 <LCD_DATA@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ili9163_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    $0x2a,%edi
call   1040 <LCD_COM@plt>
mov    %ebx,%edi
sar    $0x8,%edi
call   1030 <LCD_DATA@plt>
mov    %ebx,%edi
call   1030 <LCD_DATA@plt>
add    %r15d,%ebx
add    $0xffffffff,%ebx
mov    %ebx,%edi
sar    $0x8,%edi
call   1030 <LCD_DATA@plt>
mov    %ebx,%edi
call   1030 <LCD_DATA@plt>
mov    $0x2b,%edi
call   1040 <LCD_COM@plt>
mov    %r12d,%edi
sar    $0x8,%edi
call   1030 <LCD_DATA@plt>
mov    %r12d,%edi
call   1030 <LCD_DATA@plt>
lea    (%r12,%r14,1),%ebx
add    $0xffffffff,%ebx
mov    %ebx,%edi
sar    $0x8,%edi
call   1030 <LCD_DATA@plt>
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <LCD_DATA@plt>

LLVM IR (-O0):
define void @ili9163_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* %7
%10 = add nsw i32 %9, -1
store i32 %10, i32* %7
%11 = load i32, i32* %8
%12 = add nsw i32 %11, -1
store i32 %12, i32* %8
%13 = call i32 @LCD_COM(i32 42)
%14 = load i32, i32* %5
%15 = ashr i32 %14, 8
%16 = call i32 @LCD_DATA(i32 %15)
%17 = load i32, i32* %5
%18 = call i32 @LCD_DATA(i32 %17)
%19 = load i32, i32* %5
%20 = load i32, i32* %7
%21 = add nsw i32 %19, %20
%22 = ashr i32 %21, 8
%23 = call i32 @LCD_DATA(i32 %22)
%24 = load i32, i32* %5
%25 = load i32, i32* %7
%26 = add nsw i32 %24, %25
%27 = call i32 @LCD_DATA(i32 %26)
%28 = call i32 @LCD_COM(i32 43)
%29 = load i32, i32* %6
%30 = ashr i32 %29, 8
%31 = call i32 @LCD_DATA(i32 %30)
%32 = load i32, i32* %6
%33 = call i32 @LCD_DATA(i32 %32)
%34 = load i32, i32* %6
%35 = load i32, i32* %8
%36 = add nsw i32 %34, %35
%37 = ashr i32 %36, 8
%38 = call i32 @LCD_DATA(i32 %37)
%39 = load i32, i32* %6
%40 = load i32, i32* %8
%41 = add nsw i32 %39, %40
%42 = call i32 @LCD_DATA(i32 %41)
ret void
}

LLVM IR (-O2):
define void @ili9163_set_window(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @LCD_COM(i32 42)
%6 = ashr i32 %0, 8
%7 = tail call i32 @LCD_DATA(i32 %6)
%8 = tail call i32 @LCD_DATA(i32 %0)
%9 = add i32 %0, -1
%10 = add i32 %9, %2
%11 = ashr i32 %10, 8
%12 = tail call i32 @LCD_DATA(i32 %11)
%13 = tail call i32 @LCD_DATA(i32 %10)
%14 = tail call i32 @LCD_COM(i32 43)
%15 = ashr i32 %1, 8
%16 = tail call i32 @LCD_DATA(i32 %15)
%17 = tail call i32 @LCD_DATA(i32 %1)
%18 = add i32 %1, -1
%19 = add i32 %18, %3
%20 = ashr i32 %19, 8
%21 = tail call i32 @LCD_DATA(i32 %20)
%22 = tail call i32 @LCD_DATA(i32 %19)
ret void
}