#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 */

/* Variables and functions */
int /*<<< orphan*/ COLOR_BLACK;
int /*<<< orphan*/ COLOR_BLUE;
int /*<<< orphan*/ COLOR_GREEN;
int /*<<< orphan*/ COLOR_RED;
int /*<<< orphan*/ COLOR_WHITE;
int /*<<< orphan*/ COLOR_YELLOW;
int /*<<< orphan*/ TRUE;
int /*<<< orphan*/ clear();
int /*<<< orphan*/ curs_set(int /*<<< orphan*/);
scalar_t__ has_colors();
int /*<<< orphan*/ init_pair(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ nodelay(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ start_color();
int /*<<< orphan*/ stdscr;
void ncurses_setup() {
  initscr();
  nodelay(stdscr, TRUE);
  if (has_colors())
    start_color();
  curs_set(0);
  init_pair(1, COLOR_RED, COLOR_BLACK);
  init_pair(3, COLOR_GREEN, COLOR_BLACK);
  init_pair(2, COLOR_BLUE, COLOR_BLACK);
  init_pair(4, COLOR_YELLOW, COLOR_BLACK);
  init_pair(5, COLOR_WHITE, COLOR_BLACK);
  init_pair(6, COLOR_BLUE, COLOR_WHITE);
  clear();
  return;
}


x86 assembly (clang, -O0):
<ncurses_setup>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <initscr@plt>
mov    0x2e66(%rip),%rax
mov    (%rax),%edi
mov    0x2e55(%rip),%rax
mov    (%rax),%esi
call   1070 <nodelay@plt>
mov    $0x0,%al
call   1030 <has_colors@plt>
cmp    $0x0,%rax
je     11aa <ncurses_setup+0x3a>
mov    $0x0,%al
call   1060 <start_color@plt>
xor    %edi,%edi
call   1090 <curs_set@plt>
mov    0x2df0(%rip),%rax
mov    (%rax),%esi
mov    0x2e17(%rip),%rax
mov    (%rax),%edx
mov    $0x1,%edi
call   1040 <init_pair@plt>
mov    0x2dfc(%rip),%rax
mov    (%rax),%esi
mov    0x2dfb(%rip),%rax
mov    (%rax),%edx
mov    $0x3,%edi
call   1040 <init_pair@plt>
mov    0x2dc0(%rip),%rax
mov    (%rax),%esi
mov    0x2ddf(%rip),%rax
mov    (%rax),%edx
mov    $0x2,%edi
call   1040 <init_pair@plt>
mov    0x2dac(%rip),%rax
mov    (%rax),%esi
mov    0x2dc3(%rip),%rax
mov    (%rax),%edx
mov    $0x4,%edi
call   1040 <init_pair@plt>
mov    0x2d98(%rip),%rax
mov    (%rax),%esi
mov    0x2da7(%rip),%rax
mov    (%rax),%edx
mov    $0x5,%edi
call   1040 <init_pair@plt>
mov    0x2d6c(%rip),%rax
mov    (%rax),%esi
mov    0x2d73(%rip),%rax
mov    (%rax),%edx
mov    $0x6,%edi
call   1040 <init_pair@plt>
mov    $0x0,%al
call   1080 <clear@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ncurses_setup>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1050 <initscr@plt>
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
mov    0x2e54(%rip),%rax
mov    (%rax),%esi
call   1070 <nodelay@plt>
xor    %eax,%eax
call   1030 <has_colors@plt>
test   %rax,%rax
je     11a6 <ncurses_setup+0x36>
xor    %eax,%eax
call   1060 <start_color@plt>
xor    %edi,%edi
call   1090 <curs_set@plt>
mov    0x2df4(%rip),%rax
mov    (%rax),%esi
mov    0x2e1b(%rip),%rbx
mov    (%rbx),%edx
mov    $0x1,%edi
call   1040 <init_pair@plt>
mov    0x2e00(%rip),%rax
mov    (%rax),%esi
mov    (%rbx),%edx
mov    $0x3,%edi
call   1040 <init_pair@plt>
mov    0x2dcb(%rip),%r14
mov    (%r14),%esi
mov    (%rbx),%edx
mov    $0x2,%edi
call   1040 <init_pair@plt>
mov    0x2dbd(%rip),%rax
mov    (%rax),%esi
mov    (%rbx),%edx
mov    $0x4,%edi
call   1040 <init_pair@plt>
mov    0x2db0(%rip),%r15
mov    (%r15),%esi
mov    (%rbx),%edx
mov    $0x5,%edi
call   1040 <init_pair@plt>
mov    (%r14),%esi
mov    (%r15),%edx
mov    $0x6,%edi
call   1040 <init_pair@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1080 <clear@plt>

LLVM IR (-O0):
@stdscr = global i32 0
@TRUE = global i32 0
@COLOR_RED = global i32 0
@COLOR_BLACK = global i32 0
@COLOR_GREEN = global i32 0
@COLOR_BLUE = global i32 0
@COLOR_YELLOW = global i32 0
@COLOR_WHITE = global i32 0
define void @ncurses_setup() {
%1 = call i32 (...) @initscr()
%2 = load i32, i32* @stdscr
%3 = load i32, i32* @TRUE
%4 = call i32 @nodelay(i32 %2, i32 %3)
%5 = call i64 (...) @has_colors()
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 (...) @start_color()
br label %9
9: ; preds = %7, %0
%10 = call i32 @curs_set(i32 0)
%11 = load i32, i32* @COLOR_RED
%12 = load i32, i32* @COLOR_BLACK
%13 = call i32 @init_pair(i32 1, i32 %11, i32 %12)
%14 = load i32, i32* @COLOR_GREEN
%15 = load i32, i32* @COLOR_BLACK
%16 = call i32 @init_pair(i32 3, i32 %14, i32 %15)
%17 = load i32, i32* @COLOR_BLUE
%18 = load i32, i32* @COLOR_BLACK
%19 = call i32 @init_pair(i32 2, i32 %17, i32 %18)
%20 = load i32, i32* @COLOR_YELLOW
%21 = load i32, i32* @COLOR_BLACK
%22 = call i32 @init_pair(i32 4, i32 %20, i32 %21)
%23 = load i32, i32* @COLOR_WHITE
%24 = load i32, i32* @COLOR_BLACK
%25 = call i32 @init_pair(i32 5, i32 %23, i32 %24)
%26 = load i32, i32* @COLOR_BLUE
%27 = load i32, i32* @COLOR_WHITE
%28 = call i32 @init_pair(i32 6, i32 %26, i32 %27)
%29 = call i32 (...) @clear()
ret void
}

LLVM IR (-O2):
@stdscr = global i32 0
@TRUE = global i32 0
@COLOR_RED = global i32 0
@COLOR_BLACK = global i32 0
@COLOR_GREEN = global i32 0
@COLOR_BLUE = global i32 0
@COLOR_YELLOW = global i32 0
@COLOR_WHITE = global i32 0
define void @ncurses_setup() {
%1 = tail call i32 (...) @initscr()
%2 = load i32, i32* @stdscr
%3 = load i32, i32* @TRUE
%4 = tail call i32 @nodelay(i32 %2, i32 %3)
%5 = tail call i64 (...) @has_colors()
%6 = icmp eq i64 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %0
%8 = tail call i32 (...) @start_color()
br label %9
9: ; preds = %7, %0
%10 = tail call i32 @curs_set(i32 0)
%11 = load i32, i32* @COLOR_RED
%12 = load i32, i32* @COLOR_BLACK
%13 = tail call i32 @init_pair(i32 1, i32 %11, i32 %12)
%14 = load i32, i32* @COLOR_GREEN
%15 = load i32, i32* @COLOR_BLACK
%16 = tail call i32 @init_pair(i32 3, i32 %14, i32 %15)
%17 = load i32, i32* @COLOR_BLUE
%18 = load i32, i32* @COLOR_BLACK
%19 = tail call i32 @init_pair(i32 2, i32 %17, i32 %18)
%20 = load i32, i32* @COLOR_YELLOW
%21 = load i32, i32* @COLOR_BLACK
%22 = tail call i32 @init_pair(i32 4, i32 %20, i32 %21)
%23 = load i32, i32* @COLOR_WHITE
%24 = load i32, i32* @COLOR_BLACK
%25 = tail call i32 @init_pair(i32 5, i32 %23, i32 %24)
%26 = load i32, i32* @COLOR_BLUE
%27 = load i32, i32* @COLOR_WHITE
%28 = tail call i32 @init_pair(i32 6, i32 %26, i32 %27)
%29 = tail call i32 (...) @clear()
ret void
}