#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 */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int /*<<< orphan*/ box(int /*<<< orphan*/ *, char, char);
int /*<<< orphan*/ *derwin(int /*<<< orphan*/ *, int, int, int, int);
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ getch();
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ *stdscr;
int /*<<< orphan*/ wrefresh(int /*<<< orphan*/ *);
int main() {
  WINDOW *w;
  initscr();
  box(stdscr, '|', '-');
  w = derwin(stdscr, 4, 20, 5, 3);
  box(w, '|', '-');
  refresh();
  wrefresh(w);
  getch();
  endwin();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <initscr@plt>
mov    0x2e5b(%rip),%rax
mov    (%rax),%rdi
mov    $0x7c,%esi
mov    $0x2d,%edx
call   1050 <box@plt>
mov    0x2e42(%rip),%rax
mov    (%rax),%rdi
mov    $0x4,%esi
mov    $0x14,%edx
mov    $0x5,%ecx
mov    $0x3,%r8d
call   1090 <derwin@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x7c,%esi
mov    $0x2d,%edx
call   1050 <box@plt>
mov    $0x0,%al
call   1060 <refresh@plt>
mov    -0x10(%rbp),%rdi
call   1030 <wrefresh@plt>
mov    $0x0,%al
call   1070 <getch@plt>
mov    $0x0,%al
call   1080 <endwin@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <initscr@plt>
mov    0x2e69(%rip),%rbx
mov    (%rbx),%rdi
mov    $0x7c,%esi
mov    $0x2d,%edx
call   1050 <box@plt>
mov    (%rbx),%rdi
mov    $0x4,%esi
mov    $0x14,%edx
mov    $0x5,%ecx
mov    $0x3,%r8d
call   1090 <derwin@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x7c,%esi
mov    $0x2d,%edx
call   1050 <box@plt>
xor    %eax,%eax
call   1060 <refresh@plt>
mov    %rbx,%rdi
call   1030 <wrefresh@plt>
xor    %eax,%eax
call   1070 <getch@plt>
xor    %eax,%eax
call   1080 <endwin@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stdscr = global i32* null
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
%3 = call i32 (...) @initscr()
%4 = load i32*, i32** @stdscr
%5 = call i32 @box(i32* %4, i8 signext 124, i8 signext 45)
%6 = load i32*, i32** @stdscr
%7 = call i32* @derwin(i32* %6, i32 4, i32 20, i32 5, i32 3)
store i32* %7, i32** %2
%8 = load i32*, i32** %2
%9 = call i32 @box(i32* %8, i8 signext 124, i8 signext 45)
%10 = call i32 (...) @refresh()
%11 = load i32*, i32** %2
%12 = call i32 @wrefresh(i32* %11)
%13 = call i32 (...) @getch()
%14 = call i32 (...) @endwin()
ret i32 0
}

LLVM IR (-O2):
@stdscr = global i32* null
define i32 @main() {
%1 = tail call i32 (...) @initscr()
%2 = load i32*, i32** @stdscr
%3 = tail call i32 @box(i32* %2, i8 signext 124, i8 signext 45)
%4 = load i32*, i32** @stdscr
%5 = tail call i32* @derwin(i32* %4, i32 4, i32 20, i32 5, i32 3)
%6 = tail call i32 @box(i32* %5, i8 signext 124, i8 signext 45)
%7 = tail call i32 (...) @refresh()
%8 = tail call i32 @wrefresh(i32* %5)
%9 = tail call i32 (...) @getch()
%10 = tail call i32 (...) @endwin()
ret i32 0
}