#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;
scalar_t__ TRUE;
int /*<<< orphan*/ cbreak();
scalar_t__ has_colors();
int /*<<< orphan*/ init_pair(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ keypad(int /*<<< orphan*/, scalar_t__);
int /*<<< orphan*/ noecho();
int /*<<< orphan*/ start_color();
int /*<<< orphan*/ stdscr;
void curses_init(void) {
  initscr();
  cbreak();
  noecho();
  keypad(stdscr, TRUE);
  if (has_colors() == TRUE) {
    start_color();
    init_pair(1, COLOR_BLUE, COLOR_BLACK);
    init_pair(2, COLOR_GREEN, COLOR_BLACK);
    init_pair(3, COLOR_RED, COLOR_BLACK);
  }
}


x86 assembly (clang, -O0):
<curses_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1070 <initscr@plt>
mov    $0x0,%al
call   1040 <cbreak@plt>
mov    $0x0,%al
call   1090 <noecho@plt>
mov    0x2e58(%rip),%rax
mov    (%rax),%edi
mov    0x2e47(%rip),%rax
mov    (%rax),%rsi
call   1060 <keypad@plt>
mov    $0x0,%al
call   1030 <has_colors@plt>
mov    0x2e31(%rip),%rcx
cmp    (%rcx),%rax
jne    1213 <curses_init+0xa3>
mov    $0x0,%al
call   1080 <start_color@plt>
mov    0x2dfa(%rip),%rax
mov    (%rax),%esi
mov    0x2e09(%rip),%rax
mov    (%rax),%edx
mov    $0x1,%edi
call   1050 <init_pair@plt>
mov    0x2dee(%rip),%rax
mov    (%rax),%esi
mov    0x2ded(%rip),%rax
mov    (%rax),%edx
mov    $0x2,%edi
call   1050 <init_pair@plt>
mov    0x2dba(%rip),%rax
mov    (%rax),%esi
mov    0x2dd1(%rip),%rax
mov    (%rax),%edx
mov    $0x3,%edi
call   1050 <init_pair@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<curses_init>:
push   %rbx
xor    %eax,%eax
call   1070 <initscr@plt>
xor    %eax,%eax
call   1040 <cbreak@plt>
xor    %eax,%eax
call   1090 <noecho@plt>
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
mov    0x2e4a(%rip),%rbx
mov    (%rbx),%rsi
call   1060 <keypad@plt>
xor    %eax,%eax
call   1030 <has_colors@plt>
cmp    (%rbx),%rax
jne    11f8 <curses_init+0x88>
xor    %eax,%eax
call   1080 <start_color@plt>
mov    0x2e08(%rip),%rax
mov    (%rax),%esi
mov    0x2e17(%rip),%rbx
mov    (%rbx),%edx
mov    $0x1,%edi
call   1050 <init_pair@plt>
mov    0x2dfc(%rip),%rax
mov    (%rax),%esi
mov    (%rbx),%edx
mov    $0x2,%edi
call   1050 <init_pair@plt>
mov    0x2dcf(%rip),%rax
mov    (%rax),%esi
mov    (%rbx),%edx
mov    $0x3,%edi
pop    %rbx
jmp    1050 <init_pair@plt>
pop    %rbx
ret

LLVM IR (-O0):
@stdscr = global i32 0
@TRUE = global i64 0
@COLOR_BLUE = global i32 0
@COLOR_BLACK = global i32 0
@COLOR_GREEN = global i32 0
@COLOR_RED = global i32 0
define void @curses_init() {
%1 = call i32 (...) @initscr()
%2 = call i32 (...) @cbreak()
%3 = call i32 (...) @noecho()
%4 = load i32, i32* @stdscr
%5 = load i64, i64* @TRUE
%6 = call i32 @keypad(i32 %4, i64 %5)
%7 = call i64 (...) @has_colors()
%8 = load i64, i64* @TRUE
%9 = icmp eq i64 %7, %8
br i1 %9, label %10, label %21
10: ; preds = %0
%11 = call i32 (...) @start_color()
%12 = load i32, i32* @COLOR_BLUE
%13 = load i32, i32* @COLOR_BLACK
%14 = call i32 @init_pair(i32 1, i32 %12, i32 %13)
%15 = load i32, i32* @COLOR_GREEN
%16 = load i32, i32* @COLOR_BLACK
%17 = call i32 @init_pair(i32 2, i32 %15, i32 %16)
%18 = load i32, i32* @COLOR_RED
%19 = load i32, i32* @COLOR_BLACK
%20 = call i32 @init_pair(i32 3, i32 %18, i32 %19)
br label %21
21: ; preds = %10, %0
ret void
}

LLVM IR (-O2):
@stdscr = global i32 0
@TRUE = global i64 0
@COLOR_BLUE = global i32 0
@COLOR_BLACK = global i32 0
@COLOR_GREEN = global i32 0
@COLOR_RED = global i32 0
define void @curses_init() {
%1 = tail call i32 (...) @initscr()
%2 = tail call i32 (...) @cbreak()
%3 = tail call i32 (...) @noecho()
%4 = load i32, i32* @stdscr
%5 = load i64, i64* @TRUE
%6 = tail call i32 @keypad(i32 %4, i64 %5)
%7 = tail call i64 (...) @has_colors()
%8 = load i64, i64* @TRUE
%9 = icmp eq i64 %7, %8
br i1 %9, label %10, label %21
10: ; preds = %0
%11 = tail call i32 (...) @start_color()
%12 = load i32, i32* @COLOR_BLUE
%13 = load i32, i32* @COLOR_BLACK
%14 = tail call i32 @init_pair(i32 1, i32 %12, i32 %13)
%15 = load i32, i32* @COLOR_GREEN
%16 = load i32, i32* @COLOR_BLACK
%17 = tail call i32 @init_pair(i32 2, i32 %15, i32 %16)
%18 = load i32, i32* @COLOR_RED
%19 = load i32, i32* @COLOR_BLACK
%20 = tail call i32 @init_pair(i32 3, i32 %18, i32 %19)
br label %21
21: ; preds = %10, %0
ret void
}