#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, char, char, char, int);
void draw_rect(int x1, int y1, int x2, int y2, char r, char g, char b,
               int screen) {
  draw_line(x1, y1, x2, y1, r, g, b, screen);
  draw_line(x2, y1, x2, y2, r, g, b, screen);
  draw_line(x1, y2, x2, y2, r, g, b, screen);
  draw_line(x1, y1, x1, y2, r, g, b, screen);
}


x86 assembly (clang, -O0):
<draw_rect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %r8d,-0x24(%rbp)
mov    %ecx,%eax
mov    -0x24(%rbp),%ecx
mov    %eax,-0x20(%rbp)
mov    %edx,%eax
mov    -0x20(%rbp),%edx
mov    %eax,-0x1c(%rbp)
mov    %esi,%eax
mov    -0x1c(%rbp),%esi
mov    %eax,-0x18(%rbp)
mov    %edi,%r8d
mov    -0x18(%rbp),%edi
mov    %r9b,%al
mov    0x18(%rbp),%r9d
mov    0x10(%rbp),%r9b
mov    %r8d,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %cl,-0x11(%rbp)
mov    %al,-0x12(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
mov    -0x11(%rbp),%r8b
mov    -0x12(%rbp),%r9b
mov    0x10(%rbp),%r10b
mov    0x18(%rbp),%eax
movsbl %r8b,%r8d
movsbl %r9b,%r9d
movsbl %r10b,%r10d
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1030 <draw_line@plt>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x11(%rbp),%r8b
mov    -0x12(%rbp),%r9b
mov    0x10(%rbp),%r10b
mov    0x18(%rbp),%eax
movsbl %r8b,%r8d
movsbl %r9b,%r9d
movsbl %r10b,%r10d
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1030 <draw_line@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x11(%rbp),%r8b
mov    -0x12(%rbp),%r9b
mov    0x10(%rbp),%r10b
mov    0x18(%rbp),%eax
movsbl %r8b,%r8d
movsbl %r9b,%r9d
movsbl %r10b,%r10d
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1030 <draw_line@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x11(%rbp),%r8b
mov    -0x12(%rbp),%r9b
mov    0x10(%rbp),%r10b
mov    0x18(%rbp),%eax
movsbl %r8b,%r8d
movsbl %r9b,%r9d
movsbl %r10b,%r10d
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1030 <draw_line@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_rect>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %ecx,0x4(%rsp)
mov    %edx,%ebx
mov    %edi,0xc(%rsp)
movsbl 0x50(%rsp),%r15d
mov    0x58(%rsp),%ebp
mov    %esi,%ecx
mov    %esi,%r12d
mov    %esi,0x8(%rsp)
mov    %r8d,%r13d
mov    %r9d,%r14d
mov    %r9d,(%rsp)
push   %rbp
push   %r15
mov    %r15,0x20(%rsp)
call   1030 <draw_line@plt>
add    $0x10,%rsp
mov    %ebx,%edi
mov    %r12d,%esi
mov    %ebx,%edx
mov    0x4(%rsp),%r12d
mov    %r12d,%ecx
mov    %r13d,%r8d
mov    %r14d,%r9d
push   %rbp
push   %r15
call   1030 <draw_line@plt>
add    $0x10,%rsp
mov    0xc(%rsp),%r15d
mov    %r15d,%edi
mov    %r12d,%esi
mov    %ebx,%edx
mov    %r12d,%ecx
mov    %r13d,%r8d
mov    (%rsp),%ebx
mov    %ebx,%r9d
push   %rbp
push   0x18(%rsp)
call   1030 <draw_line@plt>
add    $0x10,%rsp
mov    %r15d,%edi
mov    0x8(%rsp),%esi
mov    %r15d,%edx
mov    %r12d,%ecx
mov    %r13d,%r8d
mov    %ebx,%r9d
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <draw_line@plt>

LLVM IR (-O0):
define void @draw_rect(i32 %0, i32 %1, i32 %2, i32 %3, i8 signext %4, i8 signext %5, i8 signext %6, i32 %7) {
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8
%14 = alloca i8
%15 = alloca i8
%16 = alloca i32
store i32 %0, i32* %9
store i32 %1, i32* %10
store i32 %2, i32* %11
store i32 %3, i32* %12
store i8 %4, i8* %13
store i8 %5, i8* %14
store i8 %6, i8* %15
store i32 %7, i32* %16
%17 = load i32, i32* %9
%18 = load i32, i32* %10
%19 = load i32, i32* %11
%20 = load i32, i32* %10
%21 = load i8, i8* %13
%22 = load i8, i8* %14
%23 = load i8, i8* %15
%24 = load i32, i32* %16
%25 = call i32 @draw_line(i32 %17, i32 %18, i32 %19, i32 %20, i8 signext %21, i8 signext %22, i8 signext %23, i32 %24)
%26 = load i32, i32* %11
%27 = load i32, i32* %10
%28 = load i32, i32* %11
%29 = load i32, i32* %12
%30 = load i8, i8* %13
%31 = load i8, i8* %14
%32 = load i8, i8* %15
%33 = load i32, i32* %16
%34 = call i32 @draw_line(i32 %26, i32 %27, i32 %28, i32 %29, i8 signext %30, i8 signext %31, i8 signext %32, i32 %33)
%35 = load i32, i32* %9
%36 = load i32, i32* %12
%37 = load i32, i32* %11
%38 = load i32, i32* %12
%39 = load i8, i8* %13
%40 = load i8, i8* %14
%41 = load i8, i8* %15
%42 = load i32, i32* %16
%43 = call i32 @draw_line(i32 %35, i32 %36, i32 %37, i32 %38, i8 signext %39, i8 signext %40, i8 signext %41, i32 %42)
%44 = load i32, i32* %9
%45 = load i32, i32* %10
%46 = load i32, i32* %9
%47 = load i32, i32* %12
%48 = load i8, i8* %13
%49 = load i8, i8* %14
%50 = load i8, i8* %15
%51 = load i32, i32* %16
%52 = call i32 @draw_line(i32 %44, i32 %45, i32 %46, i32 %47, i8 signext %48, i8 signext %49, i8 signext %50, i32 %51)
ret void
}

LLVM IR (-O2):
define void @draw_rect(i32 %0, i32 %1, i32 %2, i32 %3, i8 signext %4, i8 signext %5, i8 signext %6, i32 %7) {
%9 = tail call i32 @draw_line(i32 %0, i32 %1, i32 %2, i32 %1, i8 signext %4, i8 signext %5, i8 signext %6, i32 %7)
%10 = tail call i32 @draw_line(i32 %2, i32 %1, i32 %2, i32 %3, i8 signext %4, i8 signext %5, i8 signext %6, i32 %7)
%11 = tail call i32 @draw_line(i32 %0, i32 %3, i32 %2, i32 %3, i8 signext %4, i8 signext %5, i8 signext %6, i32 %7)
%12 = tail call i32 @draw_line(i32 %0, i32 %1, i32 %0, i32 %3, i8 signext %4, i8 signext %5, i8 signext %6, i32 %7)
ret void
}