#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 COLOR_BLACK;
int COLOR_BLUE;
int COLOR_CYAN;
int COLOR_GREEN;
int COLOR_MAGENTA;
int COLOR_RED;
int COLOR_WHITE;
int COLOR_YELLOW;
scalar_t__ FALSE;
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ has_colors();
int /*<<< orphan*/ init_pair(int, int, int);
int /*<<< orphan*/ start_color();
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ use_default_colors();
void colors(void) {
  if (has_colors() == FALSE) {
    endwin();
    fprintf(stderr, "Your terminal doesn\'t even have 50 shades of gray ...\n");
    exit(1);
  }
  use_default_colors();
  start_color();
  init_pair(1, -1, -1);
  init_pair(2, COLOR_BLACK, -1);
  init_pair(3, COLOR_RED, -1);
  init_pair(4, COLOR_GREEN, -1);
  init_pair(5, COLOR_YELLOW, -1);
  init_pair(6, COLOR_BLUE, -1);
  init_pair(7, COLOR_MAGENTA, -1);
  init_pair(8, COLOR_CYAN, -1);
  init_pair(9, COLOR_WHITE, -1);
}


x86 assembly (clang, -O0):
<colors>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <has_colors@plt>
mov    0x2e1e(%rip),%rcx
cmp    (%rcx),%rax
jne    11b1 <colors+0x41>
mov    $0x0,%al
call   1080 <endwin@plt>
mov    0x2e1f(%rip),%rax
mov    (%rax),%edi
lea    0xe5e(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    $0x0,%al
call   1030 <use_default_colors@plt>
mov    $0x0,%al
call   1060 <start_color@plt>
mov    $0x1,%edi
mov    $0xffffffff,%edx
mov    %edx,%esi
call   1050 <init_pair@plt>
mov    0x2e11(%rip),%rax
mov    (%rax),%esi
mov    $0x2,%edi
mov    $0xffffffff,%edx
call   1050 <init_pair@plt>
mov    0x2da9(%rip),%rax
mov    (%rax),%esi
mov    $0x3,%edi
mov    $0xffffffff,%edx
call   1050 <init_pair@plt>
mov    0x2dd1(%rip),%rax
mov    (%rax),%esi
mov    $0x4,%edi
mov    $0xffffffff,%edx
call   1050 <init_pair@plt>
mov    0x2d91(%rip),%rax
mov    (%rax),%esi
mov    $0x5,%edi
mov    $0xffffffff,%edx
call   1050 <init_pair@plt>
mov    0x2d71(%rip),%rax
mov    (%rax),%esi
mov    $0x6,%edi
mov    $0xffffffff,%edx
call   1050 <init_pair@plt>
mov    0x2d79(%rip),%rax
mov    (%rax),%esi
mov    $0x7,%edi
mov    $0xffffffff,%edx
call   1050 <init_pair@plt>
mov    0x2d79(%rip),%rax
mov    (%rax),%esi
mov    $0x8,%edi
mov    $0xffffffff,%edx
call   1050 <init_pair@plt>
mov    0x2d41(%rip),%rax
mov    (%rax),%esi
mov    $0x9,%edi
mov    $0xffffffff,%edx
call   1050 <init_pair@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<colors>:
push   %rax
xor    %eax,%eax
call   1040 <has_colors@plt>
mov    0x2e21(%rip),%rcx
cmp    (%rcx),%rax
je     126b <colors+0xfb>
xor    %eax,%eax
call   1030 <use_default_colors@plt>
xor    %eax,%eax
call   1060 <start_color@plt>
mov    $0x1,%edi
mov    $0xffffffff,%esi
mov    $0xffffffff,%edx
call   1050 <init_pair@plt>
mov    0x2e37(%rip),%rax
mov    (%rax),%esi
mov    $0x2,%edi
mov    $0xffffffff,%edx
call   1050 <init_pair@plt>
mov    0x2dcf(%rip),%rax
mov    (%rax),%esi
mov    $0x3,%edi
mov    $0xffffffff,%edx
call   1050 <init_pair@plt>
mov    0x2df7(%rip),%rax
mov    (%rax),%esi
mov    $0x4,%edi
mov    $0xffffffff,%edx
call   1050 <init_pair@plt>
mov    0x2db7(%rip),%rax
mov    (%rax),%esi
mov    $0x5,%edi
mov    $0xffffffff,%edx
call   1050 <init_pair@plt>
mov    0x2d97(%rip),%rax
mov    (%rax),%esi
mov    $0x6,%edi
mov    $0xffffffff,%edx
call   1050 <init_pair@plt>
mov    0x2d9f(%rip),%rax
mov    (%rax),%esi
mov    $0x7,%edi
mov    $0xffffffff,%edx
call   1050 <init_pair@plt>
mov    0x2d9f(%rip),%rax
mov    (%rax),%esi
mov    $0x8,%edi
mov    $0xffffffff,%edx
call   1050 <init_pair@plt>
mov    0x2d67(%rip),%rax
mov    (%rax),%esi
mov    $0x9,%edi
mov    $0xffffffff,%edx
pop    %rax
jmp    1050 <init_pair@plt>
xor    %eax,%eax
call   1080 <endwin@plt>
mov    0x2d3f(%rip),%rax
mov    (%rax),%edi
lea    0xd7e(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@FALSE = global i64 0
@stderr = global i32 0
@.str = [55 x i8] c"Your terminal doesn't even have 50 shades of gray ...\0A\00"
@COLOR_BLACK = global i32 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
@COLOR_WHITE = global i32 0
define void @colors() {
%1 = call i64 (...) @has_colors()
%2 = load i64, i64* @FALSE
%3 = icmp eq i64 %1, %2
br i1 %3, label %4, label %9
4: ; preds = %0
%5 = call i32 (...) @endwin()
%6 = load i32, i32* @stderr
%7 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @exit(i32 1)
unreachable
9: ; preds = %0
%10 = call i32 (...) @use_default_colors()
%11 = call i32 (...) @start_color()
%12 = call i32 @init_pair(i32 1, i32 -1, i32 -1)
%13 = load i32, i32* @COLOR_BLACK
%14 = call i32 @init_pair(i32 2, i32 %13, i32 -1)
%15 = load i32, i32* @COLOR_RED
%16 = call i32 @init_pair(i32 3, i32 %15, i32 -1)
%17 = load i32, i32* @COLOR_GREEN
%18 = call i32 @init_pair(i32 4, i32 %17, i32 -1)
%19 = load i32, i32* @COLOR_YELLOW
%20 = call i32 @init_pair(i32 5, i32 %19, i32 -1)
%21 = load i32, i32* @COLOR_BLUE
%22 = call i32 @init_pair(i32 6, i32 %21, i32 -1)
%23 = load i32, i32* @COLOR_MAGENTA
%24 = call i32 @init_pair(i32 7, i32 %23, i32 -1)
%25 = load i32, i32* @COLOR_CYAN
%26 = call i32 @init_pair(i32 8, i32 %25, i32 -1)
%27 = load i32, i32* @COLOR_WHITE
%28 = call i32 @init_pair(i32 9, i32 %27, i32 -1)
ret void
}

LLVM IR (-O2):
@FALSE = global i64 0
@stderr = global i32 0
@.str = [55 x i8] c"Your terminal doesn't even have 50 shades of gray ...\0A\00"
@COLOR_BLACK = global i32 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
@COLOR_WHITE = global i32 0
define void @colors() {
%1 = tail call i64 (...) @has_colors()
%2 = load i64, i64* @FALSE
%3 = icmp eq i64 %1, %2
br i1 %3, label %4, label %9
4: ; preds = %0
%5 = tail call i32 (...) @endwin()
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %0
%10 = tail call i32 (...) @use_default_colors()
%11 = tail call i32 (...) @start_color()
%12 = tail call i32 @init_pair(i32 1, i32 -1, i32 -1)
%13 = load i32, i32* @COLOR_BLACK
%14 = tail call i32 @init_pair(i32 2, i32 %13, i32 -1)
%15 = load i32, i32* @COLOR_RED
%16 = tail call i32 @init_pair(i32 3, i32 %15, i32 -1)
%17 = load i32, i32* @COLOR_GREEN
%18 = tail call i32 @init_pair(i32 4, i32 %17, i32 -1)
%19 = load i32, i32* @COLOR_YELLOW
%20 = tail call i32 @init_pair(i32 5, i32 %19, i32 -1)
%21 = load i32, i32* @COLOR_BLUE
%22 = tail call i32 @init_pair(i32 6, i32 %21, i32 -1)
%23 = load i32, i32* @COLOR_MAGENTA
%24 = tail call i32 @init_pair(i32 7, i32 %23, i32 -1)
%25 = load i32, i32* @COLOR_CYAN
%26 = tail call i32 @init_pair(i32 8, i32 %25, i32 -1)
%27 = load i32, i32* @COLOR_WHITE
%28 = tail call i32 @init_pair(i32 9, i32 %27, i32 -1)
ret void
}