#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*/ fillTriangle(int, int, int, int, int, int, int);
int /*<<< orphan*/ usleep(int);
void testfilltriangle() {
  unsigned char color = 1;
  short i = 0;
  for (i = (((128) < (32)) ? (128) : (32)) / 2; i > 0; i -= 5) {
    fillTriangle(128 / 2, 32 / 2 - i, 128 / 2 - i, 32 / 2 + i, 128 / 2 + i,
                 32 / 2 + i, 1);
    if (color == 1)
      color = 0;
    else
      color = 1;
    Display();
    usleep(1000);
  }
}


x86 assembly (clang, -O0):
<testfilltriangle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x1,-0x1(%rbp)
movw   $0x0,-0x4(%rbp)
movw   $0x10,-0x4(%rbp)
movswl -0x4(%rbp),%eax
cmp    $0x0,%eax
jle    11d0 <testfilltriangle+0xa0>
movswl -0x4(%rbp),%eax
mov    $0x10,%esi
sub    %eax,%esi
movswl -0x4(%rbp),%eax
mov    $0x40,%edx
sub    %eax,%edx
movswl -0x4(%rbp),%ecx
add    $0x10,%ecx
movswl -0x4(%rbp),%r8d
add    $0x40,%r8d
movswl -0x4(%rbp),%r9d
add    $0x10,%r9d
mov    $0x40,%edi
movl   $0x1,(%rsp)
call   1040 <fillTriangle@plt>
movzbl -0x1(%rbp),%eax
cmp    $0x1,%eax
jne    11ab <testfilltriangle+0x7b>
movb   $0x0,-0x1(%rbp)
jmp    11af <testfilltriangle+0x7f>
movb   $0x1,-0x1(%rbp)
mov    $0x0,%al
call   1030 <Display@plt>
mov    $0x3e8,%edi
call   1050 <usleep@plt>
movswl -0x4(%rbp),%eax
sub    $0x5,%eax
mov    %ax,-0x4(%rbp)
jmp    1148 <testfilltriangle+0x18>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testfilltriangle>:
push   %rax
movl   $0x1,(%rsp)
mov    $0x40,%edi
xor    %esi,%esi
mov    $0x30,%edx
mov    $0x20,%ecx
mov    $0x50,%r8d
mov    $0x20,%r9d
call   1040 <fillTriangle@plt>
xor    %eax,%eax
call   1030 <Display@plt>
mov    $0x3e8,%edi
call   1050 <usleep@plt>
movl   $0x1,(%rsp)
mov    $0x40,%edi
mov    $0x5,%esi
mov    $0x35,%edx
mov    $0x1b,%ecx
mov    $0x4b,%r8d
mov    $0x1b,%r9d
call   1040 <fillTriangle@plt>
xor    %eax,%eax
call   1030 <Display@plt>
mov    $0x3e8,%edi
call   1050 <usleep@plt>
movl   $0x1,(%rsp)
mov    $0x40,%edi
mov    $0xa,%esi
mov    $0x3a,%edx
mov    $0x16,%ecx
mov    $0x46,%r8d
mov    $0x16,%r9d
call   1040 <fillTriangle@plt>
xor    %eax,%eax
call   1030 <Display@plt>
mov    $0x3e8,%edi
call   1050 <usleep@plt>
movl   $0x1,(%rsp)
mov    $0x40,%edi
mov    $0xf,%esi
mov    $0x3f,%edx
mov    $0x11,%ecx
mov    $0x41,%r8d
mov    $0x11,%r9d
call   1040 <fillTriangle@plt>
xor    %eax,%eax
call   1030 <Display@plt>
mov    $0x3e8,%edi
pop    %rax
jmp    1050 <usleep@plt>

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

LLVM IR (-O2):
define void @testfilltriangle() {
%1 = tail call i32 @fillTriangle(i32 64, i32 0, i32 48, i32 32, i32 80, i32 32, i32 1)
%2 = tail call i32 (...) @Display()
%3 = tail call i32 @usleep(i32 1000)
%4 = tail call i32 @fillTriangle(i32 64, i32 5, i32 53, i32 27, i32 75, i32 27, i32 1)
%5 = tail call i32 (...) @Display()
%6 = tail call i32 @usleep(i32 1000)
%7 = tail call i32 @fillTriangle(i32 64, i32 10, i32 58, i32 22, i32 70, i32 22, i32 1)
%8 = tail call i32 (...) @Display()
%9 = tail call i32 @usleep(i32 1000)
%10 = tail call i32 @fillTriangle(i32 64, i32 15, i32 63, i32 17, i32 65, i32 17, i32 1)
%11 = tail call i32 (...) @Display()
%12 = tail call i32 @usleep(i32 1000)
ret void
}