#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*/ LCDdriver_WriteCom(int);
int /*<<< orphan*/ LCDdriver_WriteData(int);
void LCD_FilledRect(int xmin, int xmax, int ymin, int ymax, int color) {
  int i;
  LCDdriver_WriteCom(0x2a);
  LCDdriver_WriteData(xmin);
  LCDdriver_WriteData(xmax);
  LCDdriver_WriteCom(0x2b);
  LCDdriver_WriteData(ymin + 1);
  LCDdriver_WriteData(ymax + 1);
  LCDdriver_WriteCom(0x2c);
  for (i = ((xmax - xmin + 1) * (ymax - ymin + 1)); i > 0; i--) {
    LCDdriver_WriteData(color >> 8);
    LCDdriver_WriteData(color);
  }
}


x86 assembly (clang, -O0):
<LCD_FilledRect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    $0x2a,%edi
call   1040 <LCDdriver_WriteCom@plt>
mov    -0x4(%rbp),%edi
call   1030 <LCDdriver_WriteData@plt>
mov    -0x8(%rbp),%edi
call   1030 <LCDdriver_WriteData@plt>
mov    $0x2b,%edi
call   1040 <LCDdriver_WriteCom@plt>
mov    -0xc(%rbp),%edi
add    $0x1,%edi
call   1030 <LCDdriver_WriteData@plt>
mov    -0x10(%rbp),%edi
add    $0x1,%edi
call   1030 <LCDdriver_WriteData@plt>
mov    $0x2c,%edi
call   1040 <LCDdriver_WriteCom@plt>
mov    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
add    $0x1,%eax
mov    -0x10(%rbp),%ecx
sub    -0xc(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jle    11bf <LCD_FilledRect+0x9f>
mov    -0x14(%rbp),%edi
sar    $0x8,%edi
call   1030 <LCDdriver_WriteData@plt>
mov    -0x14(%rbp),%edi
call   1030 <LCDdriver_WriteData@plt>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    1194 <LCD_FilledRect+0x74>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LCD_FilledRect>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8d,%r13d
mov    %ecx,%ebx
mov    %edx,%r15d
mov    %esi,%r14d
mov    %edi,%r12d
mov    $0x2a,%edi
call   1040 <LCDdriver_WriteCom@plt>
mov    %r12d,%edi
call   1030 <LCDdriver_WriteData@plt>
mov    %r14d,%edi
call   1030 <LCDdriver_WriteData@plt>
mov    $0x2b,%edi
call   1040 <LCDdriver_WriteCom@plt>
lea    0x1(%r15),%edi
call   1030 <LCDdriver_WriteData@plt>
lea    0x1(%rbx),%edi
call   1030 <LCDdriver_WriteData@plt>
mov    $0x2c,%edi
call   1040 <LCDdriver_WriteCom@plt>
sub    %r12d,%r14d
add    $0x1,%r14d
sub    %r15d,%ebx
add    $0x1,%ebx
imul   %r14d,%ebx
test   %ebx,%ebx
jle    11b7 <LCD_FilledRect+0x97>
mov    %r13d,%ebp
sar    $0x8,%ebp
add    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1030 <LCDdriver_WriteData@plt>
mov    %r13d,%edi
call   1030 <LCDdriver_WriteData@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     11a0 <LCD_FilledRect+0x80>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @LCD_FilledRect(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%12 = call i32 @LCDdriver_WriteCom(i32 42)
%13 = load i32, i32* %6
%14 = call i32 @LCDdriver_WriteData(i32 %13)
%15 = load i32, i32* %7
%16 = call i32 @LCDdriver_WriteData(i32 %15)
%17 = call i32 @LCDdriver_WriteCom(i32 43)
%18 = load i32, i32* %8
%19 = add nsw i32 %18, 1
%20 = call i32 @LCDdriver_WriteData(i32 %19)
%21 = load i32, i32* %9
%22 = add nsw i32 %21, 1
%23 = call i32 @LCDdriver_WriteData(i32 %22)
%24 = call i32 @LCDdriver_WriteCom(i32 44)
%25 = load i32, i32* %7
%26 = load i32, i32* %6
%27 = sub nsw i32 %25, %26
%28 = add nsw i32 %27, 1
%29 = load i32, i32* %9
%30 = load i32, i32* %8
%31 = sub nsw i32 %29, %30
%32 = add nsw i32 %31, 1
%33 = mul nsw i32 %28, %32
store i32 %33, i32* %11
br label %34
34: ; preds = %43, %5
%35 = load i32, i32* %11
%36 = icmp sgt i32 %35, 0
br i1 %36, label %37, label %46
37: ; preds = %34
%38 = load i32, i32* %10
%39 = ashr i32 %38, 8
%40 = call i32 @LCDdriver_WriteData(i32 %39)
%41 = load i32, i32* %10
%42 = call i32 @LCDdriver_WriteData(i32 %41)
br label %43
43: ; preds = %37
%44 = load i32, i32* %11
%45 = add nsw i32 %44, -1
store i32 %45, i32* %11
br label %34
46: ; preds = %34
ret void
}

LLVM IR (-O2):
define void @LCD_FilledRect(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i32 @LCDdriver_WriteCom(i32 42)
%7 = tail call i32 @LCDdriver_WriteData(i32 %0)
%8 = tail call i32 @LCDdriver_WriteData(i32 %1)
%9 = tail call i32 @LCDdriver_WriteCom(i32 43)
%10 = add nsw i32 %2, 1
%11 = tail call i32 @LCDdriver_WriteData(i32 %10)
%12 = add nsw i32 %3, 1
%13 = tail call i32 @LCDdriver_WriteData(i32 %12)
%14 = tail call i32 @LCDdriver_WriteCom(i32 44)
%15 = sub i32 1, %0
%16 = add i32 %15, %1
%17 = sub i32 1, %2
%18 = add i32 %17, %3
%19 = mul nsw i32 %18, %16
%20 = icmp sgt i32 %19, 0
br i1 %20, label %21, label %29
21: ; preds = %5
%22 = ashr i32 %4, 8
br label %23
23: ; preds = %21, %23
%24 = phi i32 [ %19, %21 ], [ %27, %23 ]
%25 = tail call i32 @LCDdriver_WriteData(i32 %22)
%26 = tail call i32 @LCDdriver_WriteData(i32 %4)
%27 = add nsw i32 %24, -1
%28 = icmp ugt i32 %24, 1
br i1 %28, label %23, label %29
29: ; preds = %23, %5
ret void
}