#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*/ setPixel(int, int, char);
void fillRectangle(short x, short y, short width, short height, char c) {
  int newX;
  int newY;
  for (newX = x; newX < width + x; newX++) {
    for (newY = y; newY < height + y; newY++) {
      setPixel(newX, newY, c);
    }
  }
}


x86 assembly (clang, -O0):
<fillRectangle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %r8b,%al
mov    %di,-0x2(%rbp)
mov    %si,-0x4(%rbp)
mov    %dx,-0x6(%rbp)
mov    %cx,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movswl -0x2(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
movswl -0x6(%rbp),%ecx
movswl -0x2(%rbp),%edx
add    %edx,%ecx
cmp    %ecx,%eax
jge    1196 <fillRectangle+0x86>
movswl -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
movswl -0x8(%rbp),%ecx
movswl -0x4(%rbp),%edx
add    %edx,%ecx
cmp    %ecx,%eax
jge    1183 <fillRectangle+0x73>
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
movsbl -0x9(%rbp),%edx
call   1030 <setPixel@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1151 <fillRectangle+0x41>
jmp    1188 <fillRectangle+0x78>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1135 <fillRectangle+0x25>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @fillRectangle(i16 signext %0, i16 signext %1, i16 signext %2, i16 signext %3, i8 signext %4) {
%6 = alloca i16
%7 = alloca i16
%8 = alloca i16
%9 = alloca i16
%10 = alloca i8
%11 = alloca i32
%12 = alloca i32
store i16 %0, i16* %6
store i16 %1, i16* %7
store i16 %2, i16* %8
store i16 %3, i16* %9
store i8 %4, i8* %10
%13 = load i16, i16* %6
%14 = sext i16 %13 to i32
store i32 %14, i32* %11
br label %15
15: ; preds = %43, %5
%16 = load i32, i32* %11
%17 = load i16, i16* %8
%18 = sext i16 %17 to i32
%19 = load i16, i16* %6
%20 = sext i16 %19 to i32
%21 = add nsw i32 %18, %20
%22 = icmp slt i32 %16, %21
br i1 %22, label %23, label %46
23: ; preds = %15
%24 = load i16, i16* %7
%25 = sext i16 %24 to i32
store i32 %25, i32* %12
br label %26
26: ; preds = %39, %23
%27 = load i32, i32* %12
%28 = load i16, i16* %9
%29 = sext i16 %28 to i32
%30 = load i16, i16* %7
%31 = sext i16 %30 to i32
%32 = add nsw i32 %29, %31
%33 = icmp slt i32 %27, %32
br i1 %33, label %34, label %42
34: ; preds = %26
%35 = load i32, i32* %11
%36 = load i32, i32* %12
%37 = load i8, i8* %10
%38 = call i32 @setPixel(i32 %35, i32 %36, i8 signext %37)
br label %39
39: ; preds = %34
%40 = load i32, i32* %12
%41 = add nsw i32 %40, 1
store i32 %41, i32* %12
br label %26
42: ; preds = %26
br label %43
43: ; preds = %42
%44 = load i32, i32* %11
%45 = add nsw i32 %44, 1
store i32 %45, i32* %11
br label %15
46: ; preds = %15
ret void
}

LLVM IR (-O2):
define void @fillRectangle(i16 signext %0, i16 signext %1, i16 signext %2, i16 signext %3, i8 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 %25
10: ; preds = %5
%11 = sext i16 %1 to i32
%12 = sext i16 %3 to i32
%13 = add nsw i32 %12, %11
%14 = icmp sgt i16 %3, 0
br label %15
15: ; preds = %10, %22
%16 = phi i32 [ %6, %10 ], [ %23, %22 ]
br i1 %14, label %17, label %22
17: ; preds = %15, %17
%18 = phi i32 [ %20, %17 ], [ %11, %15 ]
%19 = tail call i32 @setPixel(i32 %16, i32 %18, i8 signext %4)
%20 = add nsw i32 %18, 1
%21 = icmp slt i32 %20, %13
br i1 %21, label %17, label %22
22: ; preds = %17, %15
%23 = add nsw i32 %16, 1
%24 = icmp slt i32 %23, %8
br i1 %24, label %15, label %25
25: ; preds = %22, %5
ret void
}