#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*/ *, int /*<<< orphan*/,
                       int /*<<< orphan*/);
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ getmaxyx(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ mvwaddch(int /*<<< orphan*/ *, int, int, char);
int /*<<< orphan*/ *newwin(int, int, int, int);
int /*<<< orphan*/ wgetch(int /*<<< orphan*/ *);
int /*<<< orphan*/ wrefresh(int /*<<< orphan*/ *);
int main() {
  WINDOW *win;
  int i, j, maxy, maxx;
  initscr();
  win = newwin(10, 100, 5, 25);
  box(win, 0, 0);
  getmaxyx(win, maxy, maxx);
  for (i = 1; i < maxy - 1; i++)
    for (j = 1; j < maxx - 1; j++) {
      mvwaddch(win, i, j, '+');
    }
  wrefresh(win);
  wgetch(win);
  endwin();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <initscr@plt>
mov    $0xa,%edi
mov    $0x64,%esi
mov    $0x5,%edx
mov    $0x19,%ecx
call   1050 <newwin@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1070 <box@plt>
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
call   1060 <getmaxyx@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1234 <main+0xb4>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x20(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1221 <main+0xa1>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    $0x2b,%ecx
call   10a0 <mvwaddch@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11ee <main+0x6e>
jmp    1226 <main+0xa6>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11d6 <main+0x56>
mov    -0x10(%rbp),%rdi
call   1030 <wrefresh@plt>
mov    -0x10(%rbp),%rdi
call   1090 <wgetch@plt>
mov    $0x0,%al
call   1080 <endwin@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <initscr@plt>
mov    $0xa,%edi
mov    $0x64,%esi
mov    $0x5,%edx
mov    $0x19,%ecx
call   1050 <newwin@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1070 <box@plt>
mov    %rbx,%rdi
call   1060 <getmaxyx@plt>
mov    %rbx,%rdi
call   1030 <wrefresh@plt>
mov    %rbx,%rdi
call   1090 <wgetch@plt>
xor    %eax,%eax
call   1080 <endwin@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 (...) @initscr()
%8 = call i32* @newwin(i32 10, i32 100, i32 5, i32 25)
store i32* %8, i32** %2
%9 = load i32*, i32** %2
%10 = call i32 @box(i32* %9, i32 0, i32 0)
%11 = load i32*, i32** %2
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = call i32 @getmaxyx(i32* %11, i32 %12, i32 %13)
store i32 1, i32* %3
br label %15
15: ; preds = %35, %0
%16 = load i32, i32* %3
%17 = load i32, i32* %5
%18 = sub nsw i32 %17, 1
%19 = icmp slt i32 %16, %18
br i1 %19, label %20, label %38
20: ; preds = %15
store i32 1, i32* %4
br label %21
21: ; preds = %31, %20
%22 = load i32, i32* %4
%23 = load i32, i32* %6
%24 = sub nsw i32 %23, 1
%25 = icmp slt i32 %22, %24
br i1 %25, label %26, label %34
26: ; preds = %21
%27 = load i32*, i32** %2
%28 = load i32, i32* %3
%29 = load i32, i32* %4
%30 = call i32 @mvwaddch(i32* %27, i32 %28, i32 %29, i8 signext 43)
br label %31
31: ; preds = %26
%32 = load i32, i32* %4
%33 = add nsw i32 %32, 1
store i32 %33, i32* %4
br label %21
34: ; preds = %21
br label %35
35: ; preds = %34
%36 = load i32, i32* %3
%37 = add nsw i32 %36, 1
store i32 %37, i32* %3
br label %15
38: ; preds = %15
%39 = load i32*, i32** %2
%40 = call i32 @wrefresh(i32* %39)
%41 = load i32*, i32** %2
%42 = call i32 @wgetch(i32* %41)
%43 = call i32 (...) @endwin()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @initscr()
%2 = tail call i32* @newwin(i32 10, i32 100, i32 5, i32 25)
%3 = tail call i32 @box(i32* %2, i32 0, i32 0)
%4 = tail call i32 @getmaxyx(i32* %2, i32 undef, i32 undef)
%5 = tail call i32 @wrefresh(i32* %2)
%6 = tail call i32 @wgetch(i32* %2)
%7 = tail call i32 (...) @endwin()
ret i32 0
}