#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*/ drawRect(short, short, int, int, int);
int /*<<< orphan*/ usleep(int);
void testdrawrect() {
  short i = 0;
  for (i = 0; i < 32 / 2; i += 2) {
    drawRect(i, i, 128 - 2 * i, 32 - 2 * i, 1);
    Display();
    usleep(1000);
  }
}


x86 assembly (clang, -O0):
<testdrawrect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movw   $0x0,-0x2(%rbp)
movw   $0x0,-0x2(%rbp)
movswl -0x2(%rbp),%eax
cmp    $0x10,%eax
jge    11a7 <testdrawrect+0x77>
mov    -0x2(%rbp),%si
mov    -0x2(%rbp),%ax
movswl -0x2(%rbp),%ecx
shl    $0x1,%ecx
mov    $0x80,%edx
sub    %ecx,%edx
movswl -0x2(%rbp),%edi
shl    $0x1,%edi
mov    $0x20,%ecx
sub    %edi,%ecx
mov    $0x1,%r8d
movswl %si,%edi
movswl %ax,%esi
call   1030 <drawRect@plt>
mov    $0x0,%al
call   1040 <Display@plt>
mov    $0x3e8,%edi
call   1050 <usleep@plt>
movswl -0x2(%rbp),%eax
add    $0x2,%eax
mov    %ax,-0x2(%rbp)
jmp    1144 <testdrawrect+0x14>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testdrawrect>:
push   %rax
xor    %edi,%edi
xor    %esi,%esi
mov    $0x80,%edx
mov    $0x20,%ecx
mov    $0x1,%r8d
call   1030 <drawRect@plt>
xor    %eax,%eax
call   1040 <Display@plt>
mov    $0x3e8,%edi
call   1050 <usleep@plt>
mov    $0x2,%edi
mov    $0x2,%esi
mov    $0x7c,%edx
mov    $0x1c,%ecx
mov    $0x1,%r8d
call   1030 <drawRect@plt>
xor    %eax,%eax
call   1040 <Display@plt>
mov    $0x3e8,%edi
call   1050 <usleep@plt>
mov    $0x4,%edi
mov    $0x4,%esi
mov    $0x78,%edx
mov    $0x18,%ecx
mov    $0x1,%r8d
call   1030 <drawRect@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 <drawRect@plt>
xor    %eax,%eax
call   1040 <Display@plt>
mov    $0x3e8,%edi
call   1050 <usleep@plt>
mov    $0x8,%edi
mov    $0x8,%esi
mov    $0x70,%edx
mov    $0x10,%ecx
mov    $0x1,%r8d
call   1030 <drawRect@plt>
xor    %eax,%eax
call   1040 <Display@plt>
mov    $0x3e8,%edi
call   1050 <usleep@plt>
mov    $0xa,%edi
mov    $0xa,%esi
mov    $0x6c,%edx
mov    $0xc,%ecx
mov    $0x1,%r8d
call   1030 <drawRect@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 <drawRect@plt>
xor    %eax,%eax
call   1040 <Display@plt>
mov    $0x3e8,%edi
call   1050 <usleep@plt>
mov    $0xe,%edi
mov    $0xe,%esi
mov    $0x64,%edx
mov    $0x4,%ecx
mov    $0x1,%r8d
call   1030 <drawRect@plt>
xor    %eax,%eax
call   1040 <Display@plt>
mov    $0x3e8,%edi
pop    %rax
jmp    1050 <usleep@plt>

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

LLVM IR (-O2):
define void @testdrawrect() {
%1 = tail call i32 @drawRect(i16 signext 0, i16 signext 0, i32 128, i32 32, i32 1)
%2 = tail call i32 (...) @Display()
%3 = tail call i32 @usleep(i32 1000)
%4 = tail call i32 @drawRect(i16 signext 2, i16 signext 2, i32 124, i32 28, i32 1)
%5 = tail call i32 (...) @Display()
%6 = tail call i32 @usleep(i32 1000)
%7 = tail call i32 @drawRect(i16 signext 4, i16 signext 4, i32 120, i32 24, i32 1)
%8 = tail call i32 (...) @Display()
%9 = tail call i32 @usleep(i32 1000)
%10 = tail call i32 @drawRect(i16 signext 6, i16 signext 6, i32 116, i32 20, i32 1)
%11 = tail call i32 (...) @Display()
%12 = tail call i32 @usleep(i32 1000)
%13 = tail call i32 @drawRect(i16 signext 8, i16 signext 8, i32 112, i32 16, i32 1)
%14 = tail call i32 (...) @Display()
%15 = tail call i32 @usleep(i32 1000)
%16 = tail call i32 @drawRect(i16 signext 10, i16 signext 10, i32 108, i32 12, i32 1)
%17 = tail call i32 (...) @Display()
%18 = tail call i32 @usleep(i32 1000)
%19 = tail call i32 @drawRect(i16 signext 12, i16 signext 12, i32 104, i32 8, i32 1)
%20 = tail call i32 (...) @Display()
%21 = tail call i32 @usleep(i32 1000)
%22 = tail call i32 @drawRect(i16 signext 14, i16 signext 14, i32 100, i32 4, i32 1)
%23 = tail call i32 (...) @Display()
%24 = tail call i32 @usleep(i32 1000)
ret void
}