#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*/ mcurses_hlinexl(int, int, int, char);
int /*<<< orphan*/ mcurses_vlineyl(int, int, int, char);
int mcurses_box(int x1, int y1, int x2, int y2, char c) {
  mcurses_hlinexl(x1, y1, x2 - x1 + 1, c);
  mcurses_hlinexl(x1, y2, x2 - x1 + 1, c);
  mcurses_vlineyl(x1, y1 + 1, y2 - y1 - 1, c);
  mcurses_vlineyl(x2, y1 + 1, y2 - y1 - 1, c);
}


x86 assembly (clang, -O0):
<mcurses_box>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %r8b,%al
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %al,-0x15(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
sub    -0x8(%rbp),%edx
add    $0x1,%edx
movsbl -0x15(%rbp),%ecx
call   1040 <mcurses_hlinexl@plt>
mov    -0x8(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
sub    -0x8(%rbp),%edx
add    $0x1,%edx
movsbl -0x15(%rbp),%ecx
call   1040 <mcurses_hlinexl@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
add    $0x1,%esi
mov    -0x14(%rbp),%edx
sub    -0xc(%rbp),%edx
sub    $0x1,%edx
movsbl -0x15(%rbp),%ecx
call   1030 <mcurses_vlineyl@plt>
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
add    $0x1,%esi
mov    -0x14(%rbp),%edx
sub    -0xc(%rbp),%edx
sub    $0x1,%edx
movsbl -0x15(%rbp),%ecx
call   1030 <mcurses_vlineyl@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mcurses_box>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8d,%r12d
mov    %ecx,%r15d
mov    %edx,%r14d
mov    %esi,%ebx
mov    %edi,%r13d
mov    %edx,%ebp
sub    %edi,%ebp
add    $0x1,%ebp
mov    %ebp,%edx
mov    %r8d,%ecx
call   1040 <mcurses_hlinexl@plt>
mov    %r13d,%edi
mov    %r15d,%esi
mov    %ebp,%edx
mov    %r12d,%ecx
call   1040 <mcurses_hlinexl@plt>
lea    0x1(%rbx),%ebp
not    %ebx
add    %r15d,%ebx
mov    %r13d,%edi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %r12d,%ecx
call   1030 <mcurses_vlineyl@plt>
mov    %r14d,%edi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %r12d,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <mcurses_vlineyl@plt>

LLVM IR (-O0):
define i32 @mcurses_box(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 i32
%11 = alloca i8
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i8 %4, i8* %11
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = load i32, i32* %9
%15 = load i32, i32* %7
%16 = sub nsw i32 %14, %15
%17 = add nsw i32 %16, 1
%18 = load i8, i8* %11
%19 = call i32 @mcurses_hlinexl(i32 %12, i32 %13, i32 %17, i8 signext %18)
%20 = load i32, i32* %7
%21 = load i32, i32* %10
%22 = load i32, i32* %9
%23 = load i32, i32* %7
%24 = sub nsw i32 %22, %23
%25 = add nsw i32 %24, 1
%26 = load i8, i8* %11
%27 = call i32 @mcurses_hlinexl(i32 %20, i32 %21, i32 %25, i8 signext %26)
%28 = load i32, i32* %7
%29 = load i32, i32* %8
%30 = add nsw i32 %29, 1
%31 = load i32, i32* %10
%32 = load i32, i32* %8
%33 = sub nsw i32 %31, %32
%34 = sub nsw i32 %33, 1
%35 = load i8, i8* %11
%36 = call i32 @mcurses_vlineyl(i32 %28, i32 %30, i32 %34, i8 signext %35)
%37 = load i32, i32* %9
%38 = load i32, i32* %8
%39 = add nsw i32 %38, 1
%40 = load i32, i32* %10
%41 = load i32, i32* %8
%42 = sub nsw i32 %40, %41
%43 = sub nsw i32 %42, 1
%44 = load i8, i8* %11
%45 = call i32 @mcurses_vlineyl(i32 %37, i32 %39, i32 %43, i8 signext %44)
%46 = load i32, i32* %6
ret i32 %46
}

LLVM IR (-O2):
define i32 @mcurses_box(i32 %0, i32 %1, i32 %2, i32 %3, i8 signext %4) {
%6 = sub nsw i32 %2, %0
%7 = add nsw i32 %6, 1
%8 = tail call i32 @mcurses_hlinexl(i32 %0, i32 %1, i32 %7, i8 signext %4)
%9 = tail call i32 @mcurses_hlinexl(i32 %0, i32 %3, i32 %7, i8 signext %4)
%10 = add nsw i32 %1, 1
%11 = xor i32 %1, -1
%12 = add i32 %11, %3
%13 = tail call i32 @mcurses_vlineyl(i32 %0, i32 %10, i32 %12, i8 signext %4)
%14 = tail call i32 @mcurses_vlineyl(i32 %2, i32 %10, i32 %12, i8 signext %4)
ret i32 undef
}