#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 */
scalar_t__ COLS;
scalar_t__ LINES;
int /*<<< orphan*/ TRUE;
int /*<<< orphan*/ cbreak();
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ keypad(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ *newwin(scalar_t__, scalar_t__, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ noecho();
int /*<<< orphan*/ *stdscr;
WINDOW *init_ncurses() {
  initscr();
  cbreak();
  noecho();
  keypad(stdscr, TRUE);
  WINDOW *win = newwin(LINES - 3, COLS - 1, 0, 0);
  keypad(win, TRUE);
  return win;
}


x86 assembly (clang, -O0):
<init_ncurses>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <initscr@plt>
mov    $0x0,%al
call   1030 <cbreak@plt>
mov    $0x0,%al
call   1070 <noecho@plt>
mov    0x2e6c(%rip),%rax
mov    (%rax),%rdi
mov    0x2e5a(%rip),%rax
mov    (%rax),%esi
call   1040 <keypad@plt>
mov    0x2e5c(%rip),%rax
mov    (%rax),%rdi
sub    $0x3,%rdi
mov    0x2e36(%rip),%rax
mov    (%rax),%rsi
sub    $0x1,%rsi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1060 <newwin@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e1f(%rip),%rax
mov    (%rax),%esi
call   1040 <keypad@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_ncurses>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <initscr@plt>
xor    %eax,%eax
call   1030 <cbreak@plt>
xor    %eax,%eax
call   1070 <noecho@plt>
mov    0x2e70(%rip),%rax
mov    (%rax),%rdi
mov    0x2e5e(%rip),%r14
mov    (%r14),%esi
call   1040 <keypad@plt>
mov    0x2e5f(%rip),%rax
mov    (%rax),%rdi
add    $0xfffffffffffffffd,%rdi
mov    0x2e39(%rip),%rax
mov    (%rax),%rsi
add    $0xffffffffffffffff,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
call   1060 <newwin@plt>
mov    %rax,%rbx
mov    (%r14),%esi
mov    %rax,%rdi
call   1040 <keypad@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stdscr = global i32* null
@TRUE = global i32 0
@LINES = global i64 0
@COLS = global i64 0
define i32* @init_ncurses() {
%1 = alloca i32*
%2 = call i32 (...) @initscr()
%3 = call i32 (...) @cbreak()
%4 = call i32 (...) @noecho()
%5 = load i32*, i32** @stdscr
%6 = load i32, i32* @TRUE
%7 = call i32 @keypad(i32* %5, i32 %6)
%8 = load i64, i64* @LINES
%9 = sub nsw i64 %8, 3
%10 = load i64, i64* @COLS
%11 = sub nsw i64 %10, 1
%12 = call i32* @newwin(i64 %9, i64 %11, i32 0, i32 0)
store i32* %12, i32** %1
%13 = load i32*, i32** %1
%14 = load i32, i32* @TRUE
%15 = call i32 @keypad(i32* %13, i32 %14)
%16 = load i32*, i32** %1
ret i32* %16
}

LLVM IR (-O2):
@stdscr = global i32* null
@TRUE = global i32 0
@LINES = global i64 0
@COLS = global i64 0
define i32* @init_ncurses() {
%1 = tail call i32 (...) @initscr()
%2 = tail call i32 (...) @cbreak()
%3 = tail call i32 (...) @noecho()
%4 = load i32*, i32** @stdscr
%5 = load i32, i32* @TRUE
%6 = tail call i32 @keypad(i32* %4, i32 %5)
%7 = load i64, i64* @LINES
%8 = add nsw i64 %7, -3
%9 = load i64, i64* @COLS
%10 = add nsw i64 %9, -1
%11 = tail call i32* @newwin(i64 %8, i64 %10, i32 0, i32 0)
%12 = load i32, i32* @TRUE
%13 = tail call i32 @keypad(i32* %11, i32 %12)
ret i32* %11
}