#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 */
struct winsize {
  int ws_row;
  int ws_col;
};
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int /*<<< orphan*/ FALSE;
int /*<<< orphan*/ TIOCGWINSZ;
int /*<<< orphan*/ TRUE;
int /*<<< orphan*/ cbreak();
int /*<<< orphan*/ clear();
int /*<<< orphan*/ curs_set(int /*<<< orphan*/);
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ ioctl(int /*<<< orphan*/, int /*<<< orphan*/,
                         struct winsize *);
int /*<<< orphan*/ keypad(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ *newwin(int, int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ noecho();
WINDOW *startNCWindow() {
  initscr();
  noecho();
  curs_set(FALSE);
  cbreak();
  struct winsize terminalWindow;
  ioctl(0, TIOCGWINSZ, &terminalWindow);
  int rows = terminalWindow.ws_row;
  int columns = terminalWindow.ws_col;
  WINDOW *window;
  window = newwin(rows, columns, 0, 0);
  keypad(window, TRUE);
  clear();
  return window;
}


x86 assembly (clang, -O0):
<startNCWindow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1050 <initscr@plt>
mov    $0x0,%al
call   1080 <noecho@plt>
mov    0x2e3b(%rip),%rax
mov    (%rax),%edi
call   10a0 <curs_set@plt>
mov    $0x0,%al
call   1030 <cbreak@plt>
mov    0x2e16(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
lea    -0x8(%rbp),%rdx
call   1070 <ioctl@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1060 <newwin@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2dff(%rip),%rax
mov    (%rax),%esi
call   1040 <keypad@plt>
mov    $0x0,%al
call   1090 <clear@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<startNCWindow>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1050 <initscr@plt>
xor    %eax,%eax
call   1080 <noecho@plt>
mov    0x2e3e(%rip),%rax
mov    (%rax),%edi
call   10a0 <curs_set@plt>
xor    %eax,%eax
call   1030 <cbreak@plt>
mov    0x2e19(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rdx
xor    %edi,%edi
call   1070 <ioctl@plt>
mov    0x8(%rsp),%edi
mov    0xc(%rsp),%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1060 <newwin@plt>
mov    %rax,%rbx
mov    0x2e10(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1040 <keypad@plt>
xor    %eax,%eax
call   1090 <clear@plt>
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.winsize = type { i32, i32 }
@FALSE = global i32 0
@TIOCGWINSZ = global i32 0
@TRUE = global i32 0
define i32* @startNCWindow() {
%1 = alloca %struct.winsize
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
%5 = call i32 (...) @initscr()
%6 = call i32 (...) @noecho()
%7 = load i32, i32* @FALSE
%8 = call i32 @curs_set(i32 %7)
%9 = call i32 (...) @cbreak()
%10 = load i32, i32* @TIOCGWINSZ
%11 = call i32 @ioctl(i32 0, i32 %10, %struct.winsize* %1)
%12 = getelementptr inbounds %struct.winsize, %struct.winsize* %1, i32 0, i32 0
%13 = load i32, i32* %12
store i32 %13, i32* %2
%14 = getelementptr inbounds %struct.winsize, %struct.winsize* %1, i32 0, i32 1
%15 = load i32, i32* %14
store i32 %15, i32* %3
%16 = load i32, i32* %2
%17 = load i32, i32* %3
%18 = call i32* @newwin(i32 %16, i32 %17, i32 0, i32 0)
store i32* %18, i32** %4
%19 = load i32*, i32** %4
%20 = load i32, i32* @TRUE
%21 = call i32 @keypad(i32* %19, i32 %20)
%22 = call i32 (...) @clear()
%23 = load i32*, i32** %4
ret i32* %23
}

LLVM IR (-O2):
%struct.winsize = type { i32, i32 }
@FALSE = global i32 0
@TIOCGWINSZ = global i32 0
@TRUE = global i32 0
define i32* @startNCWindow() {
%1 = alloca %struct.winsize
%2 = tail call i32 (...) @initscr()
%3 = tail call i32 (...) @noecho()
%4 = load i32, i32* @FALSE
%5 = tail call i32 @curs_set(i32 %4)
%6 = tail call i32 (...) @cbreak()
%7 = bitcast %struct.winsize* %1 to i8*
%8 = load i32, i32* @TIOCGWINSZ
%9 = call i32 @ioctl(i32 0, i32 %8, %struct.winsize* %1)
%10 = getelementptr inbounds %struct.winsize, %struct.winsize* %1, i64 0, i32 0
%11 = load i32, i32* %10
%12 = getelementptr inbounds %struct.winsize, %struct.winsize* %1, i64 0, i32 1
%13 = load i32, i32* %12
%14 = call i32* @newwin(i32 %11, i32 %13, i32 0, i32 0)
%15 = load i32, i32* @TRUE
%16 = call i32 @keypad(i32* %14, i32 %15)
%17 = call i32 (...) @clear()
ret i32* %14
}