#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*/ plotPixel(int, int, unsigned int);
void VfillRect(int x, int y, int width, int height, unsigned int color) {
  int j, i;
  int endx, endy;
  endx = width + x;
  endy = height + y;
  for (i = y; i < endy; i++) {
    for (j = x; j < endx; j++) {
      plotPixel(j, i, color);
    }
  }
}


x86 assembly (clang, -O0):
<VfillRect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    -0xc(%rbp),%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    118d <VfillRect+0x7d>
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    117a <VfillRect+0x6a>
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1030 <plotPixel@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1152 <VfillRect+0x42>
jmp    117f <VfillRect+0x6f>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1140 <VfillRect+0x30>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<VfillRect>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,(%rsp)
test   %ecx,%ecx
jle    1176 <VfillRect+0x66>
mov    %r8d,%r13d
mov    %ecx,%r15d
mov    %edx,%r14d
mov    %esi,%ebp
mov    (%rsp),%rax
lea    (%r14,%rax,1),%r12d
add    %esi,%r15d
jmp    1148 <VfillRect+0x38>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    %r15d,%ebp
jge    1176 <VfillRect+0x66>
test   %r14d,%r14d
jle    1140 <VfillRect+0x30>
mov    (%rsp),%rax
mov    %eax,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r13d,%edx
call   1030 <plotPixel@plt>
add    $0x1,%ebx
cmp    %r12d,%ebx
jl     1160 <VfillRect+0x50>
jmp    1140 <VfillRect+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @VfillRect(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
%12 = alloca i32
%13 = alloca i32
%14 = 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
%15 = load i32, i32* %8
%16 = load i32, i32* %6
%17 = add nsw i32 %15, %16
store i32 %17, i32* %13
%18 = load i32, i32* %9
%19 = load i32, i32* %7
%20 = add nsw i32 %18, %19
store i32 %20, i32* %14
%21 = load i32, i32* %7
store i32 %21, i32* %12
br label %22
22: ; preds = %41, %5
%23 = load i32, i32* %12
%24 = load i32, i32* %14
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %44
26: ; preds = %22
%27 = load i32, i32* %6
store i32 %27, i32* %11
br label %28
28: ; preds = %37, %26
%29 = load i32, i32* %11
%30 = load i32, i32* %13
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %40
32: ; preds = %28
%33 = load i32, i32* %11
%34 = load i32, i32* %12
%35 = load i32, i32* %10
%36 = call i32 @plotPixel(i32 %33, i32 %34, i32 %35)
br label %37
37: ; preds = %32
%38 = load i32, i32* %11
%39 = add nsw i32 %38, 1
store i32 %39, i32* %11
br label %28
40: ; preds = %28
br label %41
41: ; preds = %40
%42 = load i32, i32* %12
%43 = add nsw i32 %42, 1
store i32 %43, i32* %12
br label %22
44: ; preds = %22
ret void
}

LLVM IR (-O2):
define void @VfillRect(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = add nsw i32 %2, %0
%7 = add nsw i32 %3, %1
%8 = icmp sgt i32 %3, 0
br i1 %8, label %9, label %21
9: ; preds = %5
%10 = icmp sgt i32 %2, 0
br label %11
11: ; preds = %9, %18
%12 = phi i32 [ %1, %9 ], [ %19, %18 ]
br i1 %10, label %13, label %18
13: ; preds = %11, %13
%14 = phi i32 [ %16, %13 ], [ %0, %11 ]
%15 = tail call i32 @plotPixel(i32 %14, i32 %12, i32 %4)
%16 = add nsw i32 %14, 1
%17 = icmp slt i32 %16, %6
br i1 %17, label %13, label %18
18: ; preds = %13, %11
%19 = add nsw i32 %12, 1
%20 = icmp slt i32 %19, %7
br i1 %20, label %11, label %21
21: ; preds = %18, %5
ret void
}