#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*/ drawline(int, int, int, int, unsigned char);
void drawrect(int left, int top, int right, int bottom, unsigned char color) {
  drawline(left, top, right, top, color);
  drawline(left, top, left, bottom, color);
  drawline(right, top, right, bottom, color);
  drawline(left, bottom, right, bottom, color);
}


x86 assembly (clang, -O0):
<drawrect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %r8b,%al
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
movzbl -0x11(%rbp),%r8d
call   1030 <drawline@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
mov    -0x10(%rbp),%ecx
movzbl -0x11(%rbp),%r8d
call   1030 <drawline@plt>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
movzbl -0x11(%rbp),%r8d
call   1030 <drawline@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
movzbl -0x11(%rbp),%r8d
call   1030 <drawline@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawrect>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8d,%r14d
mov    %ecx,%r15d
mov    %edx,%r12d
mov    %esi,%ebp
mov    %edi,%ebx
mov    %esi,%ecx
call   1030 <drawline@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
call   1030 <drawline@plt>
mov    %r12d,%edi
mov    %ebp,%esi
mov    %r12d,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
call   1030 <drawline@plt>
mov    %ebx,%edi
mov    %r15d,%esi
mov    %r12d,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <drawline@plt>

LLVM IR (-O0):
define void @drawrect(i32 %0, i32 %1, i32 %2, i32 %3, i8 zeroext %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i8 %4, i8* %10
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = load i32, i32* %7
%15 = load i8, i8* %10
%16 = call i32 @drawline(i32 %11, i32 %12, i32 %13, i32 %14, i8 zeroext %15)
%17 = load i32, i32* %6
%18 = load i32, i32* %7
%19 = load i32, i32* %6
%20 = load i32, i32* %9
%21 = load i8, i8* %10
%22 = call i32 @drawline(i32 %17, i32 %18, i32 %19, i32 %20, i8 zeroext %21)
%23 = load i32, i32* %8
%24 = load i32, i32* %7
%25 = load i32, i32* %8
%26 = load i32, i32* %9
%27 = load i8, i8* %10
%28 = call i32 @drawline(i32 %23, i32 %24, i32 %25, i32 %26, i8 zeroext %27)
%29 = load i32, i32* %6
%30 = load i32, i32* %9
%31 = load i32, i32* %8
%32 = load i32, i32* %9
%33 = load i8, i8* %10
%34 = call i32 @drawline(i32 %29, i32 %30, i32 %31, i32 %32, i8 zeroext %33)
ret void
}

LLVM IR (-O2):
define void @drawrect(i32 %0, i32 %1, i32 %2, i32 %3, i8 zeroext %4) {
%6 = tail call i32 @drawline(i32 %0, i32 %1, i32 %2, i32 %1, i8 zeroext %4)
%7 = tail call i32 @drawline(i32 %0, i32 %1, i32 %0, i32 %3, i8 zeroext %4)
%8 = tail call i32 @drawline(i32 %2, i32 %1, i32 %2, i32 %3, i8 zeroext %4)
%9 = tail call i32 @drawline(i32 %0, i32 %3, i32 %2, i32 %3, i8 zeroext %4)
ret void
}