#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*/ putpixel(unsigned long, unsigned long, unsigned int);
void rectangle(unsigned long x, unsigned long y, unsigned long height,
               unsigned long width, unsigned int color) {
  unsigned long m, n;
  for (n = 0; n != width; n++) {
    for (m = 0; m != height; m++) {
      putpixel(x + m, y + n, color);
    }
  }
}


x86 assembly (clang, -O0):
<rectangle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x20(%rbp),%rax
je     1197 <rectangle+0x87>
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x18(%rbp),%rax
je     1181 <rectangle+0x71>
mov    -0x8(%rbp),%rdi
add    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    -0x38(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <putpixel@plt>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    114a <rectangle+0x3a>
jmp    1186 <rectangle+0x76>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1134 <rectangle+0x24>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rectangle>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,0x8(%rsp)
mov    %rdi,(%rsp)
mov    %rcx,0x10(%rsp)
test   %rcx,%rcx
je     1179 <rectangle+0x69>
mov    %r8d,%ebx
mov    %rdx,%r14
xor    %r12d,%r12d
jmp    114b <rectangle+0x3b>
nopl   0x0(%rax)
add    $0x1,%r12
cmp    0x10(%rsp),%r12
je     1179 <rectangle+0x69>
test   %r14,%r14
je     1140 <rectangle+0x30>
mov    0x8(%rsp),%rax
lea    (%r12,%rax,1),%rbp
mov    (%rsp),%r13
mov    %r14,%r15
mov    %r13,%rdi
mov    %rbp,%rsi
mov    %ebx,%edx
call   1030 <putpixel@plt>
add    $0x1,%r13
add    $0xffffffffffffffff,%r15
jne    1160 <rectangle+0x50>
jmp    1140 <rectangle+0x30>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @rectangle(i64 %0, i64 %1, i64 %2, i64 %3, i32 %4) {
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i32
%11 = alloca i64
%12 = alloca i64
store i64 %0, i64* %6
store i64 %1, i64* %7
store i64 %2, i64* %8
store i64 %3, i64* %9
store i32 %4, i32* %10
store i64 0, i64* %12
br label %13
13: ; preds = %35, %5
%14 = load i64, i64* %12
%15 = load i64, i64* %9
%16 = icmp ne i64 %14, %15
br i1 %16, label %17, label %38
17: ; preds = %13
store i64 0, i64* %11
br label %18
18: ; preds = %31, %17
%19 = load i64, i64* %11
%20 = load i64, i64* %8
%21 = icmp ne i64 %19, %20
br i1 %21, label %22, label %34
22: ; preds = %18
%23 = load i64, i64* %6
%24 = load i64, i64* %11
%25 = add i64 %23, %24
%26 = load i64, i64* %7
%27 = load i64, i64* %12
%28 = add i64 %26, %27
%29 = load i32, i32* %10
%30 = call i32 @putpixel(i64 %25, i64 %28, i32 %29)
br label %31
31: ; preds = %22
%32 = load i64, i64* %11
%33 = add i64 %32, 1
store i64 %33, i64* %11
br label %18
34: ; preds = %18
br label %35
35: ; preds = %34
%36 = load i64, i64* %12
%37 = add i64 %36, 1
store i64 %37, i64* %12
br label %13
38: ; preds = %13
ret void
}

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