#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*/ draw_line(int, int, int, int, int);
void draw_filled_rectangle(int x1, int y1, int x2, int y2, int color) {
  int y;
  if (y1 > y2) {
    y = y2;
    y2 = y1;
    y1 = y;
  }
  for (y = y1; y < y2; y++)
    draw_line(x1, y, x2, y, color);
}


x86 assembly (clang, -O0):
<draw_filled_rectangle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    1146 <draw_filled_rectangle+0x36>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    117b <draw_filled_rectangle+0x6b>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x14(%rbp),%r8d
call   1030 <draw_line@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114c <draw_filled_rectangle+0x3c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_filled_rectangle>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%ebx
cmp    %ecx,%esi
mov    %ecx,%ebp
cmovg  %esi,%ebp
cmovg  %ecx,%ebx
cmp    %ebp,%ebx
jge    1159 <draw_filled_rectangle+0x49>
mov    %r8d,%r14d
mov    %edx,%r15d
mov    %edi,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r12d,%edi
mov    %ebx,%esi
mov    %r15d,%edx
mov    %ebx,%ecx
mov    %r14d,%r8d
call   1030 <draw_line@plt>
add    $0x1,%ebx
cmp    %ebx,%ebp
jne    1140 <draw_filled_rectangle+0x30>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @draw_filled_rectangle(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = icmp sgt i32 %1, %3
%7 = select i1 %6, i32 %1, i32 %3
%8 = select i1 %6, i32 %3, i32 %1
%9 = icmp slt i32 %8, %7
br i1 %9, label %10, label %15
10: ; preds = %5, %10
%11 = phi i32 [ %13, %10 ], [ %8, %5 ]
%12 = tail call i32 @draw_line(i32 %0, i32 %11, i32 %2, i32 %11, i32 %4)
%13 = add i32 %11, 1
%14 = icmp eq i32 %13, %7
br i1 %14, label %15, label %10
15: ; preds = %10, %5
ret void
}