#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_BLUE;
int /*<<< orphan*/ COLOR_CYAN;
int /*<<< orphan*/ COLOR_GREEN;
int /*<<< orphan*/ COLOR_MAGENTA;
int /*<<< orphan*/ COLOR_RED;
int /*<<< orphan*/ COLOR_YELLOW;
scalar_t__ OK;
int /*<<< orphan*/ TRUE;
int /*<<< orphan*/ cbreak();
int /*<<< orphan*/ clear();
int /*<<< orphan*/ curs_set(int /*<<< orphan*/);
int /*<<< orphan*/ init_pair(int, int /*<<< orphan*/, int);
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ keypad(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ noecho();
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ start_color();
int /*<<< orphan*/ stdscr;
scalar_t__ use_default_colors();
void init_curses() {
  int bg = 0;
  initscr();
  start_color();
  cbreak();
  noecho();
  keypad(stdscr, TRUE);
  clear();
  refresh();
  curs_set(0);
  bg = use_default_colors() == OK ? -1 : 0;
  init_pair(1, COLOR_RED, bg);
  init_pair(2, COLOR_GREEN, bg);
  init_pair(3, COLOR_YELLOW, bg);
  init_pair(4, COLOR_BLUE, bg);
  init_pair(5, COLOR_MAGENTA, bg);
  init_pair(6, COLOR_CYAN, bg);
}


x86 assembly (clang, -O0):
<init_curses>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1070 <initscr@plt>
mov    $0x0,%al
call   1080 <start_color@plt>
mov    $0x0,%al
call   1040 <cbreak@plt>
mov    $0x0,%al
call   10a0 <noecho@plt>
mov    0x2e16(%rip),%rax
mov    (%rax),%edi
mov    0x2e05(%rip),%rax
mov    (%rax),%esi
call   1060 <keypad@plt>
mov    $0x0,%al
call   10b0 <clear@plt>
mov    $0x0,%al
call   1090 <refresh@plt>
xor    %edi,%edi
call   10c0 <curs_set@plt>
mov    $0x0,%al
call   1030 <use_default_colors@plt>
mov    %rax,%rdx
mov    0x2da8(%rip),%rax
mov    (%rax),%rsi
xor    %eax,%eax
mov    $0xffffffff,%ecx
cmp    %rsi,%rdx
cmove  %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    0x2d7e(%rip),%rax
mov    (%rax),%esi
mov    -0x4(%rbp),%edx
mov    $0x1,%edi
call   1050 <init_pair@plt>
mov    0x2d98(%rip),%rax
mov    (%rax),%esi
mov    -0x4(%rbp),%edx
mov    $0x2,%edi
call   1050 <init_pair@plt>
mov    0x2d6a(%rip),%rax
mov    (%rax),%esi
mov    -0x4(%rbp),%edx
mov    $0x3,%edi
call   1050 <init_pair@plt>
mov    0x2d44(%rip),%rax
mov    (%rax),%esi
mov    -0x4(%rbp),%edx
mov    $0x4,%edi
call   1050 <init_pair@plt>
mov    0x2d46(%rip),%rax
mov    (%rax),%esi
mov    -0x4(%rbp),%edx
mov    $0x5,%edi
call   1050 <init_pair@plt>
mov    0x2d48(%rip),%rax
mov    (%rax),%esi
mov    -0x4(%rbp),%edx
mov    $0x6,%edi
call   1050 <init_pair@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_curses>:
push   %rbx
xor    %eax,%eax
call   1070 <initscr@plt>
xor    %eax,%eax
call   1080 <start_color@plt>
xor    %eax,%eax
call   1040 <cbreak@plt>
xor    %eax,%eax
call   10a0 <noecho@plt>
mov    0x2e24(%rip),%rax
mov    (%rax),%edi
mov    0x2e13(%rip),%rax
mov    (%rax),%esi
call   1060 <keypad@plt>
xor    %eax,%eax
call   10b0 <clear@plt>
xor    %eax,%eax
call   1090 <refresh@plt>
xor    %edi,%edi
call   10c0 <curs_set@plt>
xor    %eax,%eax
call   1030 <use_default_colors@plt>
mov    0x2db9(%rip),%rcx
xor    %ebx,%ebx
cmp    (%rcx),%rax
sete   %bl
neg    %ebx
mov    0x2d98(%rip),%rax
mov    (%rax),%esi
mov    $0x1,%edi
mov    %ebx,%edx
call   1050 <init_pair@plt>
mov    0x2db3(%rip),%rax
mov    (%rax),%esi
mov    $0x2,%edi
mov    %ebx,%edx
call   1050 <init_pair@plt>
mov    0x2d86(%rip),%rax
mov    (%rax),%esi
mov    $0x3,%edi
mov    %ebx,%edx
call   1050 <init_pair@plt>
mov    0x2d61(%rip),%rax
mov    (%rax),%esi
mov    $0x4,%edi
mov    %ebx,%edx
call   1050 <init_pair@plt>
mov    0x2d64(%rip),%rax
mov    (%rax),%esi
mov    $0x5,%edi
mov    %ebx,%edx
call   1050 <init_pair@plt>
mov    0x2d67(%rip),%rax
mov    (%rax),%esi
mov    $0x6,%edi
mov    %ebx,%edx
pop    %rbx
jmp    1050 <init_pair@plt>

LLVM IR (-O0):
@stdscr = global i32 0
@TRUE = global i32 0
@OK = global i64 0
@COLOR_RED = global i32 0
@COLOR_GREEN = global i32 0
@COLOR_YELLOW = global i32 0
@COLOR_BLUE = global i32 0
@COLOR_MAGENTA = global i32 0
@COLOR_CYAN = global i32 0
define void @init_curses() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @initscr()
%3 = call i32 (...) @start_color()
%4 = call i32 (...) @cbreak()
%5 = call i32 (...) @noecho()
%6 = load i32, i32* @stdscr
%7 = load i32, i32* @TRUE
%8 = call i32 @keypad(i32 %6, i32 %7)
%9 = call i32 (...) @clear()
%10 = call i32 (...) @refresh()
%11 = call i32 @curs_set(i32 0)
%12 = call i64 (...) @use_default_colors()
%13 = load i64, i64* @OK
%14 = icmp eq i64 %12, %13
%15 = zext i1 %14 to i64
%16 = select i1 %14, i32 -1, i32 0
store i32 %16, i32* %1
%17 = load i32, i32* @COLOR_RED
%18 = load i32, i32* %1
%19 = call i32 @init_pair(i32 1, i32 %17, i32 %18)
%20 = load i32, i32* @COLOR_GREEN
%21 = load i32, i32* %1
%22 = call i32 @init_pair(i32 2, i32 %20, i32 %21)
%23 = load i32, i32* @COLOR_YELLOW
%24 = load i32, i32* %1
%25 = call i32 @init_pair(i32 3, i32 %23, i32 %24)
%26 = load i32, i32* @COLOR_BLUE
%27 = load i32, i32* %1
%28 = call i32 @init_pair(i32 4, i32 %26, i32 %27)
%29 = load i32, i32* @COLOR_MAGENTA
%30 = load i32, i32* %1
%31 = call i32 @init_pair(i32 5, i32 %29, i32 %30)
%32 = load i32, i32* @COLOR_CYAN
%33 = load i32, i32* %1
%34 = call i32 @init_pair(i32 6, i32 %32, i32 %33)
ret void
}

LLVM IR (-O2):
@stdscr = global i32 0
@TRUE = global i32 0
@OK = global i64 0
@COLOR_RED = global i32 0
@COLOR_GREEN = global i32 0
@COLOR_YELLOW = global i32 0
@COLOR_BLUE = global i32 0
@COLOR_MAGENTA = global i32 0
@COLOR_CYAN = global i32 0
define void @init_curses() {
%1 = tail call i32 (...) @initscr()
%2 = tail call i32 (...) @start_color()
%3 = tail call i32 (...) @cbreak()
%4 = tail call i32 (...) @noecho()
%5 = load i32, i32* @stdscr
%6 = load i32, i32* @TRUE
%7 = tail call i32 @keypad(i32 %5, i32 %6)
%8 = tail call i32 (...) @clear()
%9 = tail call i32 (...) @refresh()
%10 = tail call i32 @curs_set(i32 0)
%11 = tail call i64 (...) @use_default_colors()
%12 = load i64, i64* @OK
%13 = icmp eq i64 %11, %12
%14 = sext i1 %13 to i32
%15 = load i32, i32* @COLOR_RED
%16 = tail call i32 @init_pair(i32 1, i32 %15, i32 %14)
%17 = load i32, i32* @COLOR_GREEN
%18 = tail call i32 @init_pair(i32 2, i32 %17, i32 %14)
%19 = load i32, i32* @COLOR_YELLOW
%20 = tail call i32 @init_pair(i32 3, i32 %19, i32 %14)
%21 = load i32, i32* @COLOR_BLUE
%22 = tail call i32 @init_pair(i32 4, i32 %21, i32 %14)
%23 = load i32, i32* @COLOR_MAGENTA
%24 = tail call i32 @init_pair(i32 5, i32 %23, i32 %14)
%25 = load i32, i32* @COLOR_CYAN
%26 = tail call i32 @init_pair(i32 6, i32 %25, i32 %14)
ret void
}