#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*/ Display();
int /*<<< orphan*/ fillRect(short, short, int, int, unsigned char);
int /*<<< orphan*/ usleep(int);
void testfillrect() {
  unsigned char color = 1;
  short i = 0;
  for (i = 0; i < 32 / 2; i += 3) {
    fillRect(i, i, 128 - i * 2, 32 - i * 2, color % 2);
    Display();
    usleep(1000);
    color++;
  }
}


x86 assembly (clang, -O0):
<testfillrect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x1,-0x1(%rbp)
movw   $0x0,-0x4(%rbp)
movw   $0x0,-0x4(%rbp)
movswl -0x4(%rbp),%eax
cmp    $0x10,%eax
jge    11c7 <testfillrect+0x97>
mov    -0x4(%rbp),%di
mov    -0x4(%rbp),%si
movswl -0x4(%rbp),%ecx
shl    $0x1,%ecx
mov    $0x80,%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
movswl -0x4(%rbp),%eax
shl    $0x1,%eax
mov    $0x20,%ecx
sub    %eax,%ecx
movzbl -0x1(%rbp),%eax
mov    $0x2,%r8d
cltd
idiv   %r8d
mov    %edx,%eax
mov    -0x8(%rbp),%edx
movswl %di,%edi
movswl %si,%esi
movzbl %al,%r8d
call   1030 <fillRect@plt>
mov    $0x0,%al
call   1040 <Display@plt>
mov    $0x3e8,%edi
call   1050 <usleep@plt>
mov    -0x1(%rbp),%al
add    $0x1,%al
mov    %al,-0x1(%rbp)
movswl -0x4(%rbp),%eax
add    $0x3,%eax
mov    %ax,-0x4(%rbp)
jmp    1148 <testfillrect+0x18>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testfillrect>:
push   %rax
xor    %edi,%edi
xor    %esi,%esi
mov    $0x80,%edx
mov    $0x20,%ecx
mov    $0x1,%r8d
call   1030 <fillRect@plt>
xor    %eax,%eax
call   1040 <Display@plt>
mov    $0x3e8,%edi
call   1050 <usleep@plt>
mov    $0x3,%edi
mov    $0x3,%esi
mov    $0x7a,%edx
mov    $0x1a,%ecx
xor    %r8d,%r8d
call   1030 <fillRect@plt>
xor    %eax,%eax
call   1040 <Display@plt>
mov    $0x3e8,%edi
call   1050 <usleep@plt>
mov    $0x6,%edi
mov    $0x6,%esi
mov    $0x74,%edx
mov    $0x14,%ecx
mov    $0x1,%r8d
call   1030 <fillRect@plt>
xor    %eax,%eax
call   1040 <Display@plt>
mov    $0x3e8,%edi
call   1050 <usleep@plt>
mov    $0x9,%edi
mov    $0x9,%esi
mov    $0x6e,%edx
mov    $0xe,%ecx
xor    %r8d,%r8d
call   1030 <fillRect@plt>
xor    %eax,%eax
call   1040 <Display@plt>
mov    $0x3e8,%edi
call   1050 <usleep@plt>
mov    $0xc,%edi
mov    $0xc,%esi
mov    $0x68,%edx
mov    $0x8,%ecx
mov    $0x1,%r8d
call   1030 <fillRect@plt>
xor    %eax,%eax
call   1040 <Display@plt>
mov    $0x3e8,%edi
call   1050 <usleep@plt>
mov    $0xf,%edi
mov    $0xf,%esi
mov    $0x62,%edx
mov    $0x2,%ecx
xor    %r8d,%r8d
call   1030 <fillRect@plt>
xor    %eax,%eax
call   1040 <Display@plt>
mov    $0x3e8,%edi
pop    %rax
jmp    1050 <usleep@plt>

LLVM IR (-O0):
define void @testfillrect() {
%1 = alloca i8
%2 = alloca i16
store i8 1, i8* %1
store i16 0, i16* %2
store i16 0, i16* %2
br label %3
3: ; preds = %27, %0
%4 = load i16, i16* %2
%5 = sext i16 %4 to i32
%6 = icmp slt i32 %5, 16
br i1 %6, label %7, label %32
7: ; preds = %3
%8 = load i16, i16* %2
%9 = load i16, i16* %2
%10 = load i16, i16* %2
%11 = sext i16 %10 to i32
%12 = mul nsw i32 %11, 2
%13 = sub nsw i32 128, %12
%14 = load i16, i16* %2
%15 = sext i16 %14 to i32
%16 = mul nsw i32 %15, 2
%17 = sub nsw i32 32, %16
%18 = load i8, i8* %1
%19 = zext i8 %18 to i32
%20 = srem i32 %19, 2
%21 = trunc i32 %20 to i8
%22 = call i32 @fillRect(i16 signext %8, i16 signext %9, i32 %13, i32 %17, i8 zeroext %21)
%23 = call i32 (...) @Display()
%24 = call i32 @usleep(i32 1000)
%25 = load i8, i8* %1
%26 = add i8 %25, 1
store i8 %26, i8* %1
br label %27
27: ; preds = %7
%28 = load i16, i16* %2
%29 = sext i16 %28 to i32
%30 = add nsw i32 %29, 3
%31 = trunc i32 %30 to i16
store i16 %31, i16* %2
br label %3
32: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @testfillrect() {
%1 = tail call i32 @fillRect(i16 signext 0, i16 signext 0, i32 128, i32 32, i8 zeroext 1)
%2 = tail call i32 (...) @Display()
%3 = tail call i32 @usleep(i32 1000)
%4 = tail call i32 @fillRect(i16 signext 3, i16 signext 3, i32 122, i32 26, i8 zeroext 0)
%5 = tail call i32 (...) @Display()
%6 = tail call i32 @usleep(i32 1000)
%7 = tail call i32 @fillRect(i16 signext 6, i16 signext 6, i32 116, i32 20, i8 zeroext 1)
%8 = tail call i32 (...) @Display()
%9 = tail call i32 @usleep(i32 1000)
%10 = tail call i32 @fillRect(i16 signext 9, i16 signext 9, i32 110, i32 14, i8 zeroext 0)
%11 = tail call i32 (...) @Display()
%12 = tail call i32 @usleep(i32 1000)
%13 = tail call i32 @fillRect(i16 signext 12, i16 signext 12, i32 104, i32 8, i8 zeroext 1)
%14 = tail call i32 (...) @Display()
%15 = tail call i32 @usleep(i32 1000)
%16 = tail call i32 @fillRect(i16 signext 15, i16 signext 15, i32 98, i32 2, i8 zeroext 0)
%17 = tail call i32 (...) @Display()
%18 = tail call i32 @usleep(i32 1000)
ret void
}