#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*/ writeFastVLine(short, short, short, short);
void fillRect(short x, short y, short w, short h, short color) {
  short i = 0;
  for (i = x; i < x + w; i++) {
    writeFastVLine(i, y, h, color);
  }
}


x86 assembly (clang, -O0):
<fillRect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %r8w,%ax
mov    %di,-0x2(%rbp)
mov    %si,-0x4(%rbp)
mov    %dx,-0x6(%rbp)
mov    %cx,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
movw   $0x0,-0xc(%rbp)
mov    -0x2(%rbp),%ax
mov    %ax,-0xc(%rbp)
movswl -0xc(%rbp),%eax
movswl -0x2(%rbp),%ecx
movswl -0x6(%rbp),%edx
add    %edx,%ecx
cmp    %ecx,%eax
jge    1183 <fillRect+0x73>
mov    -0xc(%rbp),%dx
mov    -0x4(%rbp),%cx
mov    -0x8(%rbp),%ax
movswl %dx,%edi
movswl %cx,%esi
movswl %ax,%edx
movswl -0xa(%rbp),%ecx
call   1030 <writeFastVLine@plt>
mov    -0xc(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0xc(%rbp)
jmp    113e <fillRect+0x2e>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fillRect>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%r14d
test   %r14w,%r14w
jle    115d <fillRect+0x4d>
mov    %edi,%ebp
add    %edi,%r14d
movswl %si,%r15d
movswl %cx,%r12d
movswl %r8w,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movswl %bp,%ebp
mov    %ebp,%edi
mov    %r15d,%esi
mov    %r12d,%edx
mov    %ebx,%ecx
call   1030 <writeFastVLine@plt>
add    $0x1,%ebp
movswl %bp,%eax
cmp    %eax,%r14d
jg     1140 <fillRect+0x30>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @fillRect(i16 signext %0, i16 signext %1, i16 signext %2, i16 signext %3, i16 signext %4) {
%6 = sext i16 %0 to i32
%7 = sext i16 %2 to i32
%8 = add nsw i32 %7, %6
%9 = icmp sgt i16 %2, 0
br i1 %9, label %10, label %16
10: ; preds = %5, %10
%11 = phi i16 [ %13, %10 ], [ %0, %5 ]
%12 = tail call i32 @writeFastVLine(i16 signext %11, i16 signext %1, i16 signext %3, i16 signext %4)
%13 = add i16 %11, 1
%14 = sext i16 %13 to i32
%15 = icmp sgt i32 %8, %14
br i1 %15, label %10, label %16
16: ; preds = %10, %5
ret void
}