#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_PAIR(int);
int /*<<< orphan*/ COLOR_RED;
scalar_t__ FALSE;
int /*<<< orphan*/ attron(int /*<<< orphan*/);
int /*<<< orphan*/ endwin();
scalar_t__ has_colors();
int /*<<< orphan*/ init_color(int /*<<< orphan*/, int /*<<< orphan*/, int, int);
int /*<<< orphan*/ init_pair(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ start_color();
int init_colors() {
  if (has_colors() == FALSE) {
    endwin();
    printf("Your terminal does not support color\n");
    return (1);
  }
  start_color();
  init_color(COLOR_BLACK, 0, 0, 0);
  init_color(COLOR_GREEN, 0, 1000, 0);
  init_color(COLOR_BLUE, 0, 0, 1000);
  init_pair(1, COLOR_GREEN, COLOR_BLACK);
  init_pair(2, COLOR_RED, COLOR_BLACK);
  init_pair(3, COLOR_BLUE, COLOR_BLACK);
  attron(COLOR_PAIR(1));
  return 0;
}


x86 assembly (clang, -O0):
<init_colors>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <has_colors@plt>
mov    0x2e32(%rip),%rcx
cmp    (%rcx),%rax
jne    11be <init_colors+0x3e>
mov    $0x0,%al
call   10a0 <endwin@plt>
lea    0xe53(%rip),%rdi
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1273 <init_colors+0xf3>
mov    $0x0,%al
call   1070 <start_color@plt>
mov    0x2e1c(%rip),%rax
mov    (%rax),%edi
xor    %ecx,%ecx
mov    %ecx,%esi
mov    %ecx,%edx
call   1040 <init_color@plt>
mov    0x2e00(%rip),%rax
mov    (%rax),%edi
xor    %ecx,%ecx
mov    $0x3e8,%edx
mov    %ecx,%esi
call   1040 <init_color@plt>
mov    0x2dd9(%rip),%rax
mov    (%rax),%edi
xor    %edx,%edx
mov    $0x3e8,%ecx
mov    %edx,%esi
call   1040 <init_color@plt>
mov    0x2dd2(%rip),%rax
mov    (%rax),%esi
mov    0x2dd1(%rip),%rax
mov    (%rax),%edx
mov    $0x1,%edi
call   1050 <init_pair@plt>
mov    0x2d96(%rip),%rax
mov    (%rax),%esi
mov    0x2db5(%rip),%rax
mov    (%rax),%edx
mov    $0x2,%edi
call   1050 <init_pair@plt>
mov    0x2d8a(%rip),%rax
mov    (%rax),%esi
mov    0x2d99(%rip),%rax
mov    (%rax),%edx
mov    $0x3,%edi
call   1050 <init_pair@plt>
mov    $0x1,%edi
call   1090 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1080 <attron@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_colors>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <has_colors@plt>
mov    0x2e30(%rip),%rcx
cmp    (%rcx),%rax
jne    11ba <init_colors+0x3a>
xor    %eax,%eax
call   10a0 <endwin@plt>
lea    0xe55(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
jmp    124f <init_colors+0xcf>
xor    %eax,%eax
call   1070 <start_color@plt>
mov    0x2e20(%rip),%r14
mov    (%r14),%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1050 <init_color@plt>
mov    0x2e03(%rip),%r15
mov    (%r15),%edi
xor    %esi,%esi
mov    $0x3e8,%edx
xor    %ecx,%ecx
call   1050 <init_color@plt>
mov    0x2ddb(%rip),%r12
mov    (%r12),%edi
xor    %esi,%esi
xor    %edx,%edx
mov    $0x3e8,%ecx
call   1050 <init_color@plt>
mov    (%r15),%esi
mov    (%r14),%edx
mov    $0x1,%edi
call   1060 <init_pair@plt>
mov    0x2da2(%rip),%rax
mov    (%rax),%esi
mov    (%r14),%edx
mov    $0x2,%edi
call   1060 <init_pair@plt>
mov    (%r12),%esi
mov    (%r14),%edx
mov    $0x3,%edi
call   1060 <init_pair@plt>
mov    $0x1,%edi
call   1090 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1080 <attron@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@FALSE = global i64 0
@.str = [38 x i8] c"Your terminal does not support color\0A\00"
@COLOR_BLACK = global i32 0
@COLOR_GREEN = global i32 0
@COLOR_BLUE = global i32 0
@COLOR_RED = global i32 0
define i32 @init_colors() {
%1 = alloca i32
%2 = call i64 (...) @has_colors()
%3 = load i64, i64* @FALSE
%4 = icmp eq i64 %2, %3
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = call i32 (...) @endwin()
%7 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %1
br label %27
8: ; preds = %0
%9 = call i32 (...) @start_color()
%10 = load i32, i32* @COLOR_BLACK
%11 = call i32 @init_color(i32 %10, i32 0, i32 0, i32 0)
%12 = load i32, i32* @COLOR_GREEN
%13 = call i32 @init_color(i32 %12, i32 0, i32 1000, i32 0)
%14 = load i32, i32* @COLOR_BLUE
%15 = call i32 @init_color(i32 %14, i32 0, i32 0, i32 1000)
%16 = load i32, i32* @COLOR_GREEN
%17 = load i32, i32* @COLOR_BLACK
%18 = call i32 @init_pair(i32 1, i32 %16, i32 %17)
%19 = load i32, i32* @COLOR_RED
%20 = load i32, i32* @COLOR_BLACK
%21 = call i32 @init_pair(i32 2, i32 %19, i32 %20)
%22 = load i32, i32* @COLOR_BLUE
%23 = load i32, i32* @COLOR_BLACK
%24 = call i32 @init_pair(i32 3, i32 %22, i32 %23)
%25 = call i32 @COLOR_PAIR(i32 1)
%26 = call i32 @attron(i32 %25)
store i32 0, i32* %1
br label %27
27: ; preds = %8, %5
%28 = load i32, i32* %1
ret i32 %28
}

LLVM IR (-O2):
@FALSE = global i64 0
@COLOR_BLACK = global i32 0
@COLOR_GREEN = global i32 0
@COLOR_BLUE = global i32 0
@COLOR_RED = global i32 0
@str = [37 x i8] c"Your terminal does not support color\00"
define i32 @init_colors() {
%1 = tail call i64 (...) @has_colors()
%2 = load i64, i64* @FALSE
%3 = icmp eq i64 %1, %2
br i1 %3, label %4, label %7
4: ; preds = %0
%5 = tail call i32 (...) @endwin()
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
br label %26
7: ; preds = %0
%8 = tail call i32 (...) @start_color()
%9 = load i32, i32* @COLOR_BLACK
%10 = tail call i32 @init_color(i32 %9, i32 0, i32 0, i32 0)
%11 = load i32, i32* @COLOR_GREEN
%12 = tail call i32 @init_color(i32 %11, i32 0, i32 1000, i32 0)
%13 = load i32, i32* @COLOR_BLUE
%14 = tail call i32 @init_color(i32 %13, i32 0, i32 0, i32 1000)
%15 = load i32, i32* @COLOR_GREEN
%16 = load i32, i32* @COLOR_BLACK
%17 = tail call i32 @init_pair(i32 1, i32 %15, i32 %16)
%18 = load i32, i32* @COLOR_RED
%19 = load i32, i32* @COLOR_BLACK
%20 = tail call i32 @init_pair(i32 2, i32 %18, i32 %19)
%21 = load i32, i32* @COLOR_BLUE
%22 = load i32, i32* @COLOR_BLACK
%23 = tail call i32 @init_pair(i32 3, i32 %21, i32 %22)
%24 = tail call i32 @COLOR_PAIR(i32 1)
%25 = tail call i32 @attron(i32 %24)
br label %26
26: ; preds = %7, %4
%27 = phi i32 [ 1, %4 ], [ 0, %7 ]
ret i32 %27
}