#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*/ TRUE;
int /*<<< orphan*/ cbreak();
int /*<<< orphan*/ delwin(int /*<<< orphan*/ *);
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ getmaxyx(int /*<<< orphan*/, int, int);
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ keypad(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mvwprintw(int /*<<< orphan*/ *, int, int /*<<< orphan*/,
                             char *);
int /*<<< orphan*/ *newwin(int, int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ noecho();
int /*<<< orphan*/ stdscr;
int /*<<< orphan*/ waitatick();
int /*<<< orphan*/ wrefresh(int /*<<< orphan*/ *);
int main(void) {
  WINDOW *win1;
  int y, x;
  initscr();
  cbreak();
  keypad(stdscr, TRUE);
  noecho();
  getmaxyx(stdscr, y, x);
  win1 = newwin(y, x, 0, 0);
  mvwprintw(win1, y / 2 - 2, 0, "This is printed in window 1.");
  wrefresh(win1);
  waitatick();
  mvwprintw(win1, y / 2 + 2, 0, "Fuck yeahhhh.");
  wrefresh(win1);
  waitatick();
  waitatick();
  delwin(win1);
  endwin();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <initscr@plt>
mov    $0x0,%al
call   1030 <cbreak@plt>
mov    0x2e14(%rip),%rax
mov    (%rax),%edi
mov    0x2e03(%rip),%rax
mov    (%rax),%esi
call   1050 <keypad@plt>
mov    $0x0,%al
call   10d0 <noecho@plt>
mov    0x2df6(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1080 <getmaxyx@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1070 <newwin@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
sub    $0x2,%esi
xor    %edx,%edx
lea    0xdd1(%rip),%rcx
call   10c0 <mvwprintw@plt>
mov    -0x10(%rbp),%rdi
call   1040 <wrefresh@plt>
mov    $0x0,%al
call   10a0 <waitatick@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
add    $0x2,%esi
xor    %edx,%edx
lea    0xdbc(%rip),%rcx
call   10c0 <mvwprintw@plt>
mov    -0x10(%rbp),%rdi
call   1040 <wrefresh@plt>
mov    $0x0,%al
call   10a0 <waitatick@plt>
mov    $0x0,%al
call   10a0 <waitatick@plt>
mov    -0x10(%rbp),%rdi
call   1090 <delwin@plt>
mov    $0x0,%al
call   10b0 <endwin@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1060 <initscr@plt>
xor    %eax,%eax
call   1030 <cbreak@plt>
mov    0x2e22(%rip),%rbx
mov    (%rbx),%edi
mov    0x2e11(%rip),%rax
mov    (%rax),%esi
call   1050 <keypad@plt>
xor    %eax,%eax
call   10d0 <noecho@plt>
mov    (%rbx),%edi
call   1080 <getmaxyx@plt>
xor    %edx,%edx
xor    %ecx,%ecx
call   1070 <newwin@plt>
mov    %rax,%rbx
lea    0xe09(%rip),%rcx
mov    %rax,%rdi
mov    $0xfffffffe,%esi
xor    %edx,%edx
call   10c0 <mvwprintw@plt>
mov    %rbx,%rdi
call   1040 <wrefresh@plt>
xor    %eax,%eax
call   10a0 <waitatick@plt>
lea    0xe01(%rip),%rcx
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %edx,%edx
call   10c0 <mvwprintw@plt>
mov    %rbx,%rdi
call   1040 <wrefresh@plt>
xor    %eax,%eax
call   10a0 <waitatick@plt>
xor    %eax,%eax
call   10a0 <waitatick@plt>
mov    %rbx,%rdi
call   1090 <delwin@plt>
xor    %eax,%eax
call   10b0 <endwin@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stdscr = global i32 0
@TRUE = global i32 0
@.str = [29 x i8] c"This is printed in window 1.\00"
@.str.1 = [14 x i8] c"Fuck yeahhhh.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (...) @initscr()
%6 = call i32 (...) @cbreak()
%7 = load i32, i32* @stdscr
%8 = load i32, i32* @TRUE
%9 = call i32 @keypad(i32 %7, i32 %8)
%10 = call i32 (...) @noecho()
%11 = load i32, i32* @stdscr
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = call i32 @getmaxyx(i32 %11, i32 %12, i32 %13)
%15 = load i32, i32* %3
%16 = load i32, i32* %4
%17 = call i32* @newwin(i32 %15, i32 %16, i32 0, i32 0)
store i32* %17, i32** %2
%18 = load i32*, i32** %2
%19 = load i32, i32* %3
%20 = sdiv i32 %19, 2
%21 = sub nsw i32 %20, 2
%22 = call i32 @mvwprintw(i32* %18, i32 %21, i32 0, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%23 = load i32*, i32** %2
%24 = call i32 @wrefresh(i32* %23)
%25 = call i32 (...) @waitatick()
%26 = load i32*, i32** %2
%27 = load i32, i32* %3
%28 = sdiv i32 %27, 2
%29 = add nsw i32 %28, 2
%30 = call i32 @mvwprintw(i32* %26, i32 %29, i32 0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%31 = load i32*, i32** %2
%32 = call i32 @wrefresh(i32* %31)
%33 = call i32 (...) @waitatick()
%34 = call i32 (...) @waitatick()
%35 = load i32*, i32** %2
%36 = call i32 @delwin(i32* %35)
%37 = call i32 (...) @endwin()
ret i32 0
}

LLVM IR (-O2):
@stdscr = global i32 0
@TRUE = global i32 0
@.str = [29 x i8] c"This is printed in window 1.\00"
@.str.1 = [14 x i8] c"Fuck yeahhhh.\00"
define i32 @main() {
%1 = tail call i32 (...) @initscr()
%2 = tail call i32 (...) @cbreak()
%3 = load i32, i32* @stdscr
%4 = load i32, i32* @TRUE
%5 = tail call i32 @keypad(i32 %3, i32 %4)
%6 = tail call i32 (...) @noecho()
%7 = load i32, i32* @stdscr
%8 = tail call i32 @getmaxyx(i32 %7, i32 undef, i32 undef)
%9 = tail call i32* @newwin(i32 undef, i32 undef, i32 0, i32 0)
%10 = tail call i32 @mvwprintw(i32* %9, i32 -2, i32 0, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%11 = tail call i32 @wrefresh(i32* %9)
%12 = tail call i32 (...) @waitatick()
%13 = tail call i32 @mvwprintw(i32* %9, i32 2, i32 0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%14 = tail call i32 @wrefresh(i32* %9)
%15 = tail call i32 (...) @waitatick()
%16 = tail call i32 (...) @waitatick()
%17 = tail call i32 @delwin(i32* %9)
%18 = tail call i32 (...) @endwin()
ret i32 0
}