#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*/ ACS_LLCORNER;
int /*<<< orphan*/ ACS_LRCORNER;
int /*<<< orphan*/ ACS_ULCORNER;
int /*<<< orphan*/ ACS_URCORNER;
int /*<<< orphan*/ mvaddch(int, int, int /*<<< orphan*/);
int /*<<< orphan*/ mvhline(int, int, int /*<<< orphan*/, int);
int /*<<< orphan*/ mvvline(int, int, int /*<<< orphan*/, int);
void rectangle(int y1, int x1, int y2, int x2) {
  mvhline(y1, x1, 0, x2 - x1);
  mvhline(y2, x1, 0, x2 - x1);
  mvvline(y1, x1, 0, y2 - y1);
  mvvline(y1, x2, 0, y2 - y1);
  mvaddch(y1, x1, ACS_ULCORNER);
  mvaddch(y2, x1, ACS_LLCORNER);
  mvaddch(y1, x2, ACS_URCORNER);
  mvaddch(y2, x2, ACS_LRCORNER);
}


x86 assembly (clang, -O0):
<rectangle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%ecx
sub    -0x8(%rbp),%ecx
xor    %edx,%edx
call   1030 <mvhline@plt>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%ecx
sub    -0x8(%rbp),%ecx
xor    %edx,%edx
call   1030 <mvhline@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%ecx
sub    -0x4(%rbp),%ecx
xor    %edx,%edx
call   1040 <mvvline@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%ecx
sub    -0x4(%rbp),%ecx
xor    %edx,%edx
call   1040 <mvvline@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    0x2e4b(%rip),%rax
mov    (%rax),%edx
call   1050 <mvaddch@plt>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    0x2e0f(%rip),%rax
mov    (%rax),%edx
call   1050 <mvaddch@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    0x2e0b(%rip),%rax
mov    (%rax),%edx
call   1050 <mvaddch@plt>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    0x2e07(%rip),%rax
mov    (%rax),%edx
call   1050 <mvaddch@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rectangle>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %esi,%ebp
mov    %edi,%r12d
mov    %ecx,%ebx
sub    %esi,%ebx
xor    %edx,%edx
mov    %ebx,%ecx
call   1030 <mvhline@plt>
mov    %r15d,%edi
mov    %ebp,%esi
xor    %edx,%edx
mov    %ebx,%ecx
call   1030 <mvhline@plt>
mov    %r15d,%ebx
sub    %r12d,%ebx
mov    %r12d,%edi
mov    %ebp,%esi
xor    %edx,%edx
mov    %ebx,%ecx
call   1040 <mvvline@plt>
mov    %r12d,%edi
mov    %r14d,%esi
xor    %edx,%edx
mov    %ebx,%ecx
call   1040 <mvvline@plt>
mov    0x2e60(%rip),%rax
mov    (%rax),%edx
mov    %r12d,%edi
mov    %ebp,%esi
call   1050 <mvaddch@plt>
mov    0x2e25(%rip),%rax
mov    (%rax),%edx
mov    %r15d,%edi
mov    %ebp,%esi
call   1050 <mvaddch@plt>
mov    0x2e22(%rip),%rax
mov    (%rax),%edx
mov    %r12d,%edi
mov    %r14d,%esi
call   1050 <mvaddch@plt>
mov    0x2e1e(%rip),%rax
mov    (%rax),%edx
mov    %r15d,%edi
mov    %r14d,%esi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <mvaddch@plt>

LLVM IR (-O0):
@ACS_ULCORNER = global i32 0
@ACS_LLCORNER = global i32 0
@ACS_URCORNER = global i32 0
@ACS_LRCORNER = global i32 0
define void @rectangle(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = load i32, i32* %8
%12 = load i32, i32* %6
%13 = sub nsw i32 %11, %12
%14 = call i32 @mvhline(i32 %9, i32 %10, i32 0, i32 %13)
%15 = load i32, i32* %7
%16 = load i32, i32* %6
%17 = load i32, i32* %8
%18 = load i32, i32* %6
%19 = sub nsw i32 %17, %18
%20 = call i32 @mvhline(i32 %15, i32 %16, i32 0, i32 %19)
%21 = load i32, i32* %5
%22 = load i32, i32* %6
%23 = load i32, i32* %7
%24 = load i32, i32* %5
%25 = sub nsw i32 %23, %24
%26 = call i32 @mvvline(i32 %21, i32 %22, i32 0, i32 %25)
%27 = load i32, i32* %5
%28 = load i32, i32* %8
%29 = load i32, i32* %7
%30 = load i32, i32* %5
%31 = sub nsw i32 %29, %30
%32 = call i32 @mvvline(i32 %27, i32 %28, i32 0, i32 %31)
%33 = load i32, i32* %5
%34 = load i32, i32* %6
%35 = load i32, i32* @ACS_ULCORNER
%36 = call i32 @mvaddch(i32 %33, i32 %34, i32 %35)
%37 = load i32, i32* %7
%38 = load i32, i32* %6
%39 = load i32, i32* @ACS_LLCORNER
%40 = call i32 @mvaddch(i32 %37, i32 %38, i32 %39)
%41 = load i32, i32* %5
%42 = load i32, i32* %8
%43 = load i32, i32* @ACS_URCORNER
%44 = call i32 @mvaddch(i32 %41, i32 %42, i32 %43)
%45 = load i32, i32* %7
%46 = load i32, i32* %8
%47 = load i32, i32* @ACS_LRCORNER
%48 = call i32 @mvaddch(i32 %45, i32 %46, i32 %47)
ret void
}

LLVM IR (-O2):
@ACS_ULCORNER = global i32 0
@ACS_LLCORNER = global i32 0
@ACS_URCORNER = global i32 0
@ACS_LRCORNER = global i32 0
define void @rectangle(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = sub nsw i32 %3, %1
%6 = tail call i32 @mvhline(i32 %0, i32 %1, i32 0, i32 %5)
%7 = tail call i32 @mvhline(i32 %2, i32 %1, i32 0, i32 %5)
%8 = sub nsw i32 %2, %0
%9 = tail call i32 @mvvline(i32 %0, i32 %1, i32 0, i32 %8)
%10 = tail call i32 @mvvline(i32 %0, i32 %3, i32 0, i32 %8)
%11 = load i32, i32* @ACS_ULCORNER
%12 = tail call i32 @mvaddch(i32 %0, i32 %1, i32 %11)
%13 = load i32, i32* @ACS_LLCORNER
%14 = tail call i32 @mvaddch(i32 %2, i32 %1, i32 %13)
%15 = load i32, i32* @ACS_URCORNER
%16 = tail call i32 @mvaddch(i32 %0, i32 %3, i32 %15)
%17 = load i32, i32* @ACS_LRCORNER
%18 = tail call i32 @mvaddch(i32 %2, i32 %3, i32 %17)
ret void
}