#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_CYAN;
int /*<<< orphan*/ COLOR_GREEN;
int /*<<< orphan*/ COLOR_MAGENTA;
int /*<<< orphan*/ COLOR_RED;
int /*<<< orphan*/ COLOR_WHITE;
int /*<<< orphan*/ COLOR_YELLOW;
int /*<<< orphan*/ TRUE;
int /*<<< orphan*/ has_colors();
int /*<<< orphan*/ idlok(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ init_pair(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ leaveok(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ nodelay(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ noecho();
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ scrollok(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ start_color();
int /*<<< orphan*/ stdscr;
int /*<<< orphan*/ wattrset(int /*<<< orphan*/, int /*<<< orphan*/);
int initcolor(void) {
  if (!has_colors())
    return 0;
  initscr();
  start_color();
  refresh();
  noecho();
  wattrset(stdscr, 0);
  scrollok(stdscr, TRUE);
  leaveok(stdscr, TRUE);
  idlok(stdscr, TRUE);
  nodelay(stdscr, TRUE);
  init_pair(2, COLOR_GREEN, COLOR_BLACK);
  init_pair(5, COLOR_WHITE, COLOR_BLACK);
  init_pair(1, COLOR_RED, COLOR_BLACK);
  init_pair(6, COLOR_CYAN, COLOR_BLACK);
  init_pair(7, COLOR_WHITE, COLOR_BLACK);
  init_pair(9, COLOR_WHITE, COLOR_BLACK);
  init_pair(8, COLOR_GREEN, COLOR_BLACK);
  init_pair(11, COLOR_WHITE, COLOR_BLACK);
  init_pair(12, COLOR_YELLOW, COLOR_BLACK);
  init_pair(3, COLOR_MAGENTA, COLOR_BLACK);
  init_pair(4, COLOR_MAGENTA, COLOR_BLACK);
  init_pair(10, COLOR_BLUE, COLOR_BLACK);
  init_pair(13, COLOR_BLUE, COLOR_BLACK);
  init_pair(14, COLOR_YELLOW, COLOR_BLACK);
  return 1;
}


x86 assembly (clang, -O0):
<initcolor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <has_colors@plt>
cmp    $0x0,%eax
jne    11d4 <initcolor+0x24>
movl   $0x0,-0x4(%rbp)
jmp    13eb <initcolor+0x23b>
mov    $0x0,%al
call   1060 <initscr@plt>
mov    $0x0,%al
call   1070 <start_color@plt>
mov    $0x0,%al
call   1090 <refresh@plt>
mov    $0x0,%al
call   10c0 <noecho@plt>
mov    0x2df1(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1040 <wattrset@plt>
mov    0x2de1(%rip),%rax
mov    (%rax),%edi
mov    0x2dd0(%rip),%rax
mov    (%rax),%esi
call   10b0 <scrollok@plt>
mov    0x2dca(%rip),%rax
mov    (%rax),%edi
mov    0x2db9(%rip),%rax
mov    (%rax),%esi
call   10d0 <leaveok@plt>
mov    0x2db3(%rip),%rax
mov    (%rax),%edi
mov    0x2da2(%rip),%rax
mov    (%rax),%esi
call   10a0 <idlok@plt>
mov    0x2d9c(%rip),%rax
mov    (%rax),%edi
mov    0x2d8b(%rip),%rax
mov    (%rax),%esi
call   1080 <nodelay@plt>
mov    0x2d65(%rip),%rax
mov    (%rax),%esi
mov    0x2d6c(%rip),%rax
mov    (%rax),%edx
mov    $0x2,%edi
call   1050 <init_pair@plt>
mov    0x2d31(%rip),%rax
mov    (%rax),%esi
mov    0x2d50(%rip),%rax
mov    (%rax),%edx
mov    $0x5,%edi
call   1050 <init_pair@plt>
mov    0x2cfd(%rip),%rax
mov    (%rax),%esi
mov    0x2d34(%rip),%rax
mov    (%rax),%edx
mov    $0x1,%edi
call   1050 <init_pair@plt>
mov    0x2d19(%rip),%rax
mov    (%rax),%esi
mov    0x2d18(%rip),%rax
mov    (%rax),%edx
mov    $0x6,%edi
call   1050 <init_pair@plt>
mov    0x2cdd(%rip),%rax
mov    (%rax),%esi
mov    0x2cfc(%rip),%rax
mov    (%rax),%edx
mov    $0x7,%edi
call   1050 <init_pair@plt>
mov    0x2cc1(%rip),%rax
mov    (%rax),%esi
mov    0x2ce0(%rip),%rax
mov    (%rax),%edx
mov    $0x9,%edi
call   1050 <init_pair@plt>
mov    0x2cbd(%rip),%rax
mov    (%rax),%esi
mov    0x2cc4(%rip),%rax
mov    (%rax),%edx
mov    $0x8,%edi
call   1050 <init_pair@plt>
mov    0x2c89(%rip),%rax
mov    (%rax),%esi
mov    0x2ca8(%rip),%rax
mov    (%rax),%edx
mov    $0xb,%edi
call   1050 <init_pair@plt>
mov    0x2c65(%rip),%rax
mov    (%rax),%esi
mov    0x2c8c(%rip),%rax
mov    (%rax),%edx
mov    $0xc,%edi
call   1050 <init_pair@plt>
mov    0x2c59(%rip),%rax
mov    (%rax),%esi
mov    0x2c70(%rip),%rax
mov    (%rax),%edx
mov    $0x3,%edi
call   1050 <init_pair@plt>
mov    0x2c3d(%rip),%rax
mov    (%rax),%esi
mov    0x2c54(%rip),%rax
mov    (%rax),%edx
mov    $0x4,%edi
call   1050 <init_pair@plt>
mov    0x2c09(%rip),%rax
mov    (%rax),%esi
mov    0x2c38(%rip),%rax
mov    (%rax),%edx
mov    $0xa,%edi
call   1050 <init_pair@plt>
mov    0x2bed(%rip),%rax
mov    (%rax),%esi
mov    0x2c1c(%rip),%rax
mov    (%rax),%edx
mov    $0xd,%edi
call   1050 <init_pair@plt>
mov    0x2bd9(%rip),%rax
mov    (%rax),%esi
mov    0x2c00(%rip),%rax
mov    (%rax),%edx
mov    $0xe,%edi
call   1050 <init_pair@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initcolor>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %r15d,%r15d
xor    %eax,%eax
call   1030 <has_colors@plt>
test   %eax,%eax
je     1332 <initcolor+0x182>
xor    %eax,%eax
call   1060 <initscr@plt>
xor    %eax,%eax
call   1070 <start_color@plt>
xor    %eax,%eax
call   1090 <refresh@plt>
xor    %eax,%eax
call   10c0 <noecho@plt>
mov    0x2dfc(%rip),%rbx
mov    (%rbx),%edi
xor    %esi,%esi
call   1040 <wattrset@plt>
mov    (%rbx),%edi
mov    0x2de2(%rip),%rbp
mov    0x0(%rbp),%esi
call   10b0 <scrollok@plt>
mov    (%rbx),%edi
mov    0x0(%rbp),%esi
call   10d0 <leaveok@plt>
mov    (%rbx),%edi
mov    0x0(%rbp),%esi
call   10a0 <idlok@plt>
mov    (%rbx),%edi
mov    0x0(%rbp),%esi
call   1080 <nodelay@plt>
mov    0x2d9d(%rip),%r14
mov    (%r14),%esi
mov    0x2da3(%rip),%rbx
mov    (%rbx),%edx
mov    $0x2,%edi
call   1050 <init_pair@plt>
mov    0x2d68(%rip),%rbp
mov    0x0(%rbp),%esi
mov    (%rbx),%edx
mov    $0x5,%edi
call   1050 <init_pair@plt>
mov    0x2d3a(%rip),%rax
mov    (%rax),%esi
mov    (%rbx),%edx
mov    $0x1,%r15d
mov    $0x1,%edi
call   1050 <init_pair@plt>
mov    0x2d57(%rip),%rax
mov    (%rax),%esi
mov    (%rbx),%edx
mov    $0x6,%edi
call   1050 <init_pair@plt>
mov    0x0(%rbp),%esi
mov    (%rbx),%edx
mov    $0x7,%edi
call   1050 <init_pair@plt>
mov    0x0(%rbp),%esi
mov    (%rbx),%edx
mov    $0x9,%edi
call   1050 <init_pair@plt>
mov    (%r14),%esi
mov    (%rbx),%edx
mov    $0x8,%edi
call   1050 <init_pair@plt>
mov    0x0(%rbp),%esi
mov    (%rbx),%edx
mov    $0xb,%edi
call   1050 <init_pair@plt>
mov    0x2cde(%rip),%r14
mov    (%r14),%esi
mov    (%rbx),%edx
mov    $0xc,%edi
call   1050 <init_pair@plt>
mov    0x2cd8(%rip),%rbp
mov    0x0(%rbp),%esi
mov    (%rbx),%edx
mov    $0x3,%edi
call   1050 <init_pair@plt>
mov    0x0(%rbp),%esi
mov    (%rbx),%edx
mov    $0x4,%edi
call   1050 <init_pair@plt>
mov    0x2c9b(%rip),%rbp
mov    0x0(%rbp),%esi
mov    (%rbx),%edx
mov    $0xa,%edi
call   1050 <init_pair@plt>
mov    0x0(%rbp),%esi
mov    (%rbx),%edx
mov    $0xd,%edi
call   1050 <init_pair@plt>
mov    (%r14),%esi
mov    (%rbx),%edx
mov    $0xe,%edi
call   1050 <init_pair@plt>
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdscr = global i32 0
@TRUE = global i32 0
@COLOR_GREEN = global i32 0
@COLOR_BLACK = global i32 0
@COLOR_WHITE = global i32 0
@COLOR_RED = global i32 0
@COLOR_CYAN = global i32 0
@COLOR_YELLOW = global i32 0
@COLOR_MAGENTA = global i32 0
@COLOR_BLUE = global i32 0
define i32 @initcolor() {
%1 = alloca i32
%2 = call i32 (...) @has_colors()
%3 = icmp ne i32 %2, 0
br i1 %3, label %5, label %4
4: ; preds = %0
store i32 0, i32* %1
br label %66
5: ; preds = %0
%6 = call i32 (...) @initscr()
%7 = call i32 (...) @start_color()
%8 = call i32 (...) @refresh()
%9 = call i32 (...) @noecho()
%10 = load i32, i32* @stdscr
%11 = call i32 @wattrset(i32 %10, i32 0)
%12 = load i32, i32* @stdscr
%13 = load i32, i32* @TRUE
%14 = call i32 @scrollok(i32 %12, i32 %13)
%15 = load i32, i32* @stdscr
%16 = load i32, i32* @TRUE
%17 = call i32 @leaveok(i32 %15, i32 %16)
%18 = load i32, i32* @stdscr
%19 = load i32, i32* @TRUE
%20 = call i32 @idlok(i32 %18, i32 %19)
%21 = load i32, i32* @stdscr
%22 = load i32, i32* @TRUE
%23 = call i32 @nodelay(i32 %21, i32 %22)
%24 = load i32, i32* @COLOR_GREEN
%25 = load i32, i32* @COLOR_BLACK
%26 = call i32 @init_pair(i32 2, i32 %24, i32 %25)
%27 = load i32, i32* @COLOR_WHITE
%28 = load i32, i32* @COLOR_BLACK
%29 = call i32 @init_pair(i32 5, i32 %27, i32 %28)
%30 = load i32, i32* @COLOR_RED
%31 = load i32, i32* @COLOR_BLACK
%32 = call i32 @init_pair(i32 1, i32 %30, i32 %31)
%33 = load i32, i32* @COLOR_CYAN
%34 = load i32, i32* @COLOR_BLACK
%35 = call i32 @init_pair(i32 6, i32 %33, i32 %34)
%36 = load i32, i32* @COLOR_WHITE
%37 = load i32, i32* @COLOR_BLACK
%38 = call i32 @init_pair(i32 7, i32 %36, i32 %37)
%39 = load i32, i32* @COLOR_WHITE
%40 = load i32, i32* @COLOR_BLACK
%41 = call i32 @init_pair(i32 9, i32 %39, i32 %40)
%42 = load i32, i32* @COLOR_GREEN
%43 = load i32, i32* @COLOR_BLACK
%44 = call i32 @init_pair(i32 8, i32 %42, i32 %43)
%45 = load i32, i32* @COLOR_WHITE
%46 = load i32, i32* @COLOR_BLACK
%47 = call i32 @init_pair(i32 11, i32 %45, i32 %46)
%48 = load i32, i32* @COLOR_YELLOW
%49 = load i32, i32* @COLOR_BLACK
%50 = call i32 @init_pair(i32 12, i32 %48, i32 %49)
%51 = load i32, i32* @COLOR_MAGENTA
%52 = load i32, i32* @COLOR_BLACK
%53 = call i32 @init_pair(i32 3, i32 %51, i32 %52)
%54 = load i32, i32* @COLOR_MAGENTA
%55 = load i32, i32* @COLOR_BLACK
%56 = call i32 @init_pair(i32 4, i32 %54, i32 %55)
%57 = load i32, i32* @COLOR_BLUE
%58 = load i32, i32* @COLOR_BLACK
%59 = call i32 @init_pair(i32 10, i32 %57, i32 %58)
%60 = load i32, i32* @COLOR_BLUE
%61 = load i32, i32* @COLOR_BLACK
%62 = call i32 @init_pair(i32 13, i32 %60, i32 %61)
%63 = load i32, i32* @COLOR_YELLOW
%64 = load i32, i32* @COLOR_BLACK
%65 = call i32 @init_pair(i32 14, i32 %63, i32 %64)
store i32 1, i32* %1
br label %66
66: ; preds = %5, %4
%67 = load i32, i32* %1
ret i32 %67
}

LLVM IR (-O2):
@stdscr = global i32 0
@TRUE = global i32 0
@COLOR_GREEN = global i32 0
@COLOR_BLACK = global i32 0
@COLOR_WHITE = global i32 0
@COLOR_RED = global i32 0
@COLOR_CYAN = global i32 0
@COLOR_YELLOW = global i32 0
@COLOR_MAGENTA = global i32 0
@COLOR_BLUE = global i32 0
define i32 @initcolor() {
%1 = tail call i32 (...) @has_colors()
%2 = icmp eq i32 %1, 0
br i1 %2, label %64, label %3
3: ; preds = %0
%4 = tail call i32 (...) @initscr()
%5 = tail call i32 (...) @start_color()
%6 = tail call i32 (...) @refresh()
%7 = tail call i32 (...) @noecho()
%8 = load i32, i32* @stdscr
%9 = tail call i32 @wattrset(i32 %8, i32 0)
%10 = load i32, i32* @stdscr
%11 = load i32, i32* @TRUE
%12 = tail call i32 @scrollok(i32 %10, i32 %11)
%13 = load i32, i32* @stdscr
%14 = load i32, i32* @TRUE
%15 = tail call i32 @leaveok(i32 %13, i32 %14)
%16 = load i32, i32* @stdscr
%17 = load i32, i32* @TRUE
%18 = tail call i32 @idlok(i32 %16, i32 %17)
%19 = load i32, i32* @stdscr
%20 = load i32, i32* @TRUE
%21 = tail call i32 @nodelay(i32 %19, i32 %20)
%22 = load i32, i32* @COLOR_GREEN
%23 = load i32, i32* @COLOR_BLACK
%24 = tail call i32 @init_pair(i32 2, i32 %22, i32 %23)
%25 = load i32, i32* @COLOR_WHITE
%26 = load i32, i32* @COLOR_BLACK
%27 = tail call i32 @init_pair(i32 5, i32 %25, i32 %26)
%28 = load i32, i32* @COLOR_RED
%29 = load i32, i32* @COLOR_BLACK
%30 = tail call i32 @init_pair(i32 1, i32 %28, i32 %29)
%31 = load i32, i32* @COLOR_CYAN
%32 = load i32, i32* @COLOR_BLACK
%33 = tail call i32 @init_pair(i32 6, i32 %31, i32 %32)
%34 = load i32, i32* @COLOR_WHITE
%35 = load i32, i32* @COLOR_BLACK
%36 = tail call i32 @init_pair(i32 7, i32 %34, i32 %35)
%37 = load i32, i32* @COLOR_WHITE
%38 = load i32, i32* @COLOR_BLACK
%39 = tail call i32 @init_pair(i32 9, i32 %37, i32 %38)
%40 = load i32, i32* @COLOR_GREEN
%41 = load i32, i32* @COLOR_BLACK
%42 = tail call i32 @init_pair(i32 8, i32 %40, i32 %41)
%43 = load i32, i32* @COLOR_WHITE
%44 = load i32, i32* @COLOR_BLACK
%45 = tail call i32 @init_pair(i32 11, i32 %43, i32 %44)
%46 = load i32, i32* @COLOR_YELLOW
%47 = load i32, i32* @COLOR_BLACK
%48 = tail call i32 @init_pair(i32 12, i32 %46, i32 %47)
%49 = load i32, i32* @COLOR_MAGENTA
%50 = load i32, i32* @COLOR_BLACK
%51 = tail call i32 @init_pair(i32 3, i32 %49, i32 %50)
%52 = load i32, i32* @COLOR_MAGENTA
%53 = load i32, i32* @COLOR_BLACK
%54 = tail call i32 @init_pair(i32 4, i32 %52, i32 %53)
%55 = load i32, i32* @COLOR_BLUE
%56 = load i32, i32* @COLOR_BLACK
%57 = tail call i32 @init_pair(i32 10, i32 %55, i32 %56)
%58 = load i32, i32* @COLOR_BLUE
%59 = load i32, i32* @COLOR_BLACK
%60 = tail call i32 @init_pair(i32 13, i32 %58, i32 %59)
%61 = load i32, i32* @COLOR_YELLOW
%62 = load i32, i32* @COLOR_BLACK
%63 = tail call i32 @init_pair(i32 14, i32 %61, i32 %62)
br label %64
64: ; preds = %0, %3
%65 = phi i32 [ 1, %3 ], [ 0, %0 ]
ret i32 %65
}