#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*/ osuWritePixel(int, int, int, int, int);
void draw_rectangle(int x0, int y0, int x1, int y1, int r, int g, int b) {
  int i, j;
  for (j = y0; j <= y1; j++)
    for (i = x0; i <= x1; i++)
      osuWritePixel(i, j, r, g, b);
}


x86 assembly (clang, -O0):
<draw_rectangle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     1189 <draw_rectangle+0x79>
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1176 <draw_rectangle+0x66>
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    0x10(%rbp),%r8d
call   1030 <osuWritePixel@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1147 <draw_rectangle+0x37>
jmp    117b <draw_rectangle+0x6b>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1135 <draw_rectangle+0x25>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_rectangle>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,0x10(%rsp)
mov    %edi,0x8(%rsp)
mov    %ecx,0xc(%rsp)
cmp    %ecx,%esi
jle    113e <draw_rectangle+0x2e>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r9d,%r13d
mov    %r8d,%ebp
mov    %esi,%ebx
mov    0x50(%rsp),%r15d
mov    0x10(%rsp),%rax
lea    0x1(%rax),%r14d
jmp    116b <draw_rectangle+0x5b>
cs nopw 0x0(%rax,%rax,1)
lea    0x1(%rbx),%eax
cmp    0xc(%rsp),%ebx
mov    %eax,%ebx
je     112f <draw_rectangle+0x1f>
mov    0x8(%rsp),%eax
cmp    0x10(%rsp),%eax
jg     1160 <draw_rectangle+0x50>
mov    0x8(%rsp),%r12d
nopw   0x0(%rax,%rax,1)
mov    %r12d,%edi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r13d,%ecx
mov    %r15d,%r8d
call   1030 <osuWritePixel@plt>
add    $0x1,%r12d
cmp    %r12d,%r14d
jne    1180 <draw_rectangle+0x70>
jmp    1160 <draw_rectangle+0x50>

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

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