#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);
void draw_rect(int x1, int y1, int x2, int y2, char c) {
  draw_line(x1, y1, x2, y1, c);
  draw_line(x1, y2, x2, y2, c);
  draw_line(x1, y1 + 1, x1, y2 - 1, c);
  draw_line(x2, y1 + 1, x2, y2 - 1, c);
}


x86 assembly (clang, -O0):
<draw_rect>:
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
movsbl -0x11(%rbp),%r8d
call   1030 <draw_line@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
movsbl -0x11(%rbp),%r8d
call   1030 <draw_line@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    -0x4(%rbp),%edx
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
movsbl -0x11(%rbp),%r8d
call   1030 <draw_line@plt>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
movsbl -0x11(%rbp),%r8d
call   1030 <draw_line@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_rect>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8d,%r14d
mov    %ecx,%ebp
mov    %edx,%r15d
mov    %esi,%ebx
mov    %edi,%r12d
mov    %esi,%ecx
call   1030 <draw_line@plt>
mov    %r12d,%edi
mov    %ebp,%esi
mov    %r15d,%edx
mov    %ebp,%ecx
mov    %r14d,%r8d
call   1030 <draw_line@plt>
add    $0x1,%ebx
add    $0xffffffff,%ebp
mov    %r12d,%edi
mov    %ebx,%esi
mov    %r12d,%edx
mov    %ebp,%ecx
mov    %r14d,%r8d
call   1030 <draw_line@plt>
mov    %r15d,%edi
mov    %ebx,%esi
mov    %r15d,%edx
mov    %ebp,%ecx
mov    %r14d,%r8d
pop    %rbx
pop    %r12
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) {
%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 @draw_line(i32 %11, i32 %12, i32 %13, i32 %14, i8 signext %15)
%17 = load i32, i32* %6
%18 = load i32, i32* %9
%19 = load i32, i32* %8
%20 = load i32, i32* %9
%21 = load i8, i8* %10
%22 = call i32 @draw_line(i32 %17, i32 %18, i32 %19, i32 %20, i8 signext %21)
%23 = load i32, i32* %6
%24 = load i32, i32* %7
%25 = add nsw i32 %24, 1
%26 = load i32, i32* %6
%27 = load i32, i32* %9
%28 = sub nsw i32 %27, 1
%29 = load i8, i8* %10
%30 = call i32 @draw_line(i32 %23, i32 %25, i32 %26, i32 %28, i8 signext %29)
%31 = load i32, i32* %8
%32 = load i32, i32* %7
%33 = add nsw i32 %32, 1
%34 = load i32, i32* %8
%35 = load i32, i32* %9
%36 = sub nsw i32 %35, 1
%37 = load i8, i8* %10
%38 = call i32 @draw_line(i32 %31, i32 %33, i32 %34, i32 %36, i8 signext %37)
ret void
}

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