#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*/ *initscr();
int /*<<< orphan*/ keypad(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ nodelay(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ noecho();
int /*<<< orphan*/ raw();
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ stdscr;
int /*<<< orphan*/ wrefresh(int /*<<< orphan*/ *);
WINDOW *screen_init(bool israw) {
  WINDOW *screen = initscr();
  if (israw)
    raw();
  noecho();
  cbreak();
  nodelay(screen, TRUE);
  keypad(stdscr, TRUE);
  refresh();
  wrefresh(screen);
  return screen;
}


x86 assembly (clang, -O0):
<screen_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1060 <initscr@plt>
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     11a7 <screen_init+0x27>
mov    $0x0,%al
call   1070 <raw@plt>
mov    $0x0,%al
call   10a0 <noecho@plt>
mov    $0x0,%al
call   1030 <cbreak@plt>
mov    -0x10(%rbp),%rdi
mov    0x2e20(%rip),%rax
mov    (%rax),%esi
call   1080 <nodelay@plt>
mov    0x2e1a(%rip),%rax
mov    (%rax),%edi
mov    0x2e09(%rip),%rax
mov    (%rax),%esi
call   1050 <keypad@plt>
mov    $0x0,%al
call   1090 <refresh@plt>
mov    -0x10(%rbp),%rdi
call   1040 <wrefresh@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<screen_init>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
xor    %eax,%eax
call   1060 <initscr@plt>
mov    %rax,%rbx
test   %ebp,%ebp
je     119a <screen_init+0x1a>
xor    %eax,%eax
call   1070 <raw@plt>
xor    %eax,%eax
call   10a0 <noecho@plt>
xor    %eax,%eax
call   1030 <cbreak@plt>
mov    0x2e31(%rip),%rbp
mov    0x0(%rbp),%esi
mov    %rbx,%rdi
call   1080 <nodelay@plt>
mov    0x2e27(%rip),%rax
mov    (%rax),%edi
mov    0x0(%rbp),%esi
call   1050 <keypad@plt>
xor    %eax,%eax
call   1090 <refresh@plt>
mov    %rbx,%rdi
call   1040 <wrefresh@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@TRUE = global i32 0
@stdscr = global i32 0
define i32* @screen_init(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
store i32 %0, i32* %2
%4 = call i32* (...) @initscr()
store i32* %4, i32** %3
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 (...) @raw()
br label %9
9: ; preds = %7, %1
%10 = call i32 (...) @noecho()
%11 = call i32 (...) @cbreak()
%12 = load i32*, i32** %3
%13 = load i32, i32* @TRUE
%14 = call i32 @nodelay(i32* %12, i32 %13)
%15 = load i32, i32* @stdscr
%16 = load i32, i32* @TRUE
%17 = call i32 @keypad(i32 %15, i32 %16)
%18 = call i32 (...) @refresh()
%19 = load i32*, i32** %3
%20 = call i32 @wrefresh(i32* %19)
%21 = load i32*, i32** %3
ret i32* %21
}

LLVM IR (-O2):
@TRUE = global i32 0
@stdscr = global i32 0
define i32* @screen_init(i32 %0) {
%2 = tail call i32* (...) @initscr()
%3 = icmp eq i32 %0, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 (...) @raw()
br label %6
6: ; preds = %4, %1
%7 = tail call i32 (...) @noecho()
%8 = tail call i32 (...) @cbreak()
%9 = load i32, i32* @TRUE
%10 = tail call i32 @nodelay(i32* %2, i32 %9)
%11 = load i32, i32* @stdscr
%12 = load i32, i32* @TRUE
%13 = tail call i32 @keypad(i32 %11, i32 %12)
%14 = tail call i32 (...) @refresh()
%15 = tail call i32 @wrefresh(i32* %2)
ret i32* %2
}