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


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    0x2e5d(%rip),%rax
mov    (%rax),%edi
call   1040 <attron@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%ecx
sub    -0x8(%rbp),%ecx
xor    %edx,%edx
call   1050 <mvhline@plt>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%ecx
sub    -0x8(%rbp),%ecx
xor    %edx,%edx
call   1050 <mvhline@plt>
mov    -0x4(%rbp),%edi
add    $0x1,%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%ecx
sub    -0x4(%rbp),%ecx
xor    %edx,%edx
call   1060 <mvvline@plt>
mov    -0x4(%rbp),%edi
add    $0x1,%edi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%ecx
sub    -0x4(%rbp),%ecx
xor    %edx,%edx
call   1060 <mvvline@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    0x2e11(%rip),%rax
mov    (%rax),%edx
call   1070 <mvaddch@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    0x2de5(%rip),%rax
mov    (%rax),%edx
call   1070 <mvaddch@plt>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    0x2db9(%rip),%rax
mov    (%rax),%edx
call   1070 <mvaddch@plt>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    0x2dcd(%rip),%rax
mov    (%rax),%edx
call   1070 <mvaddch@plt>
mov    0x2da7(%rip),%rax
mov    (%rax),%edi
call   1030 <attroff@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rectangle>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %esi,%r12d
mov    %edi,%r13d
mov    0x2e5a(%rip),%rax
mov    (%rax),%edi
call   1040 <attron@plt>
lea    0x1(%r12),%ebx
mov    %r14d,%ebp
sub    %r12d,%ebp
mov    %r13d,%edi
mov    %ebx,%esi
xor    %edx,%edx
mov    %ebp,%ecx
call   1050 <mvhline@plt>
mov    %r15d,%edi
mov    %ebx,%esi
xor    %edx,%edx
mov    %ebp,%ecx
call   1050 <mvhline@plt>
lea    0x1(%r13),%ebx
mov    %r15d,%ebp
sub    %r13d,%ebp
mov    %ebx,%edi
mov    %r12d,%esi
xor    %edx,%edx
mov    %ebp,%ecx
call   1060 <mvvline@plt>
mov    %ebx,%edi
mov    %r14d,%esi
xor    %edx,%edx
mov    %ebp,%ecx
call   1060 <mvvline@plt>
mov    0x2e1f(%rip),%rax
mov    (%rax),%edx
mov    %r13d,%edi
mov    %r12d,%esi
call   1070 <mvaddch@plt>
mov    0x2df3(%rip),%rax
mov    (%rax),%edx
mov    %r13d,%edi
mov    %r14d,%esi
call   1070 <mvaddch@plt>
mov    0x2dc7(%rip),%rax
mov    (%rax),%edx
mov    %r15d,%edi
mov    %r12d,%esi
call   1070 <mvaddch@plt>
mov    0x2ddb(%rip),%rax
mov    (%rax),%edx
mov    %r15d,%edi
mov    %r14d,%esi
call   1070 <mvaddch@plt>
mov    0x2daf(%rip),%rax
mov    (%rax),%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <attroff@plt>

LLVM IR (-O0):
@A_BOLD = global i32 0
@ACS_ULCORNER = global i32 0
@ACS_URCORNER = global i32 0
@ACS_LLCORNER = 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* @A_BOLD
%10 = call i32 @attron(i32 %9)
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = add nsw i32 %12, 1
%14 = load i32, i32* %8
%15 = load i32, i32* %6
%16 = sub nsw i32 %14, %15
%17 = call i32 @mvhline(i32 %11, i32 %13, i32 0, i32 %16)
%18 = load i32, i32* %7
%19 = load i32, i32* %6
%20 = add nsw i32 %19, 1
%21 = load i32, i32* %8
%22 = load i32, i32* %6
%23 = sub nsw i32 %21, %22
%24 = call i32 @mvhline(i32 %18, i32 %20, i32 0, i32 %23)
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
%27 = load i32, i32* %6
%28 = load i32, i32* %7
%29 = load i32, i32* %5
%30 = sub nsw i32 %28, %29
%31 = call i32 @mvvline(i32 %26, i32 %27, i32 0, i32 %30)
%32 = load i32, i32* %5
%33 = add nsw i32 %32, 1
%34 = load i32, i32* %8
%35 = load i32, i32* %7
%36 = load i32, i32* %5
%37 = sub nsw i32 %35, %36
%38 = call i32 @mvvline(i32 %33, i32 %34, i32 0, i32 %37)
%39 = load i32, i32* %5
%40 = load i32, i32* %6
%41 = load i32, i32* @ACS_ULCORNER
%42 = call i32 @mvaddch(i32 %39, i32 %40, i32 %41)
%43 = load i32, i32* %5
%44 = load i32, i32* %8
%45 = load i32, i32* @ACS_URCORNER
%46 = call i32 @mvaddch(i32 %43, i32 %44, i32 %45)
%47 = load i32, i32* %7
%48 = load i32, i32* %6
%49 = load i32, i32* @ACS_LLCORNER
%50 = call i32 @mvaddch(i32 %47, i32 %48, i32 %49)
%51 = load i32, i32* %7
%52 = load i32, i32* %8
%53 = load i32, i32* @ACS_LRCORNER
%54 = call i32 @mvaddch(i32 %51, i32 %52, i32 %53)
%55 = load i32, i32* @A_BOLD
%56 = call i32 @attroff(i32 %55)
ret void
}

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