#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_RED;
int /*<<< orphan*/ fail(char *);
scalar_t__ has_colors();
int /*<<< orphan*/ init_pair(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ start_color();
void init_colors(void) {
  if (has_colors()) {
    start_color();
    init_pair(1, COLOR_BLACK, COLOR_BLACK);
    init_pair(2, COLOR_RED, COLOR_BLACK);
  } else {
    fail("Couldn't start_color(). Check if your term has_colors().\n");
  }
}


x86 assembly (clang, -O0):
<init_colors>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <has_colors@plt>
cmp    $0x0,%rax
je     1199 <init_colors+0x59>
mov    $0x0,%al
call   1060 <start_color@plt>
mov    0x2e85(%rip),%rax
mov    (%rax),%esi
mov    0x2e7c(%rip),%rax
mov    (%rax),%edx
mov    $0x1,%edi
call   1050 <init_pair@plt>
mov    0x2e59(%rip),%rax
mov    (%rax),%esi
mov    0x2e60(%rip),%rax
mov    (%rax),%edx
mov    $0x2,%edi
call   1050 <init_pair@plt>
jmp    11a5 <init_colors+0x65>
lea    0xe60(%rip),%rdi
call   1040 <fail@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_colors>:
push   %rbx
xor    %eax,%eax
call   1030 <has_colors@plt>
test   %rax,%rax
je     117f <init_colors+0x3f>
xor    %eax,%eax
call   1060 <start_color@plt>
mov    0x2e8d(%rip),%rbx
mov    (%rbx),%edx
mov    $0x1,%edi
mov    %edx,%esi
call   1050 <init_pair@plt>
mov    0x2e68(%rip),%rax
mov    (%rax),%esi
mov    (%rbx),%edx
mov    $0x2,%edi
pop    %rbx
jmp    1050 <init_pair@plt>
lea    0xe7a(%rip),%rdi
pop    %rbx
jmp    1040 <fail@plt>

LLVM IR (-O0):
@COLOR_BLACK = global i32 0
@COLOR_RED = global i32 0
@.str = [58 x i8] c"Couldn't start_color(). Check if your term has_colors().\0A\00"
define void @init_colors() {
%1 = call i64 (...) @has_colors()
%2 = icmp ne i64 %1, 0
br i1 %2, label %3, label %11
3: ; preds = %0
%4 = call i32 (...) @start_color()
%5 = load i32, i32* @COLOR_BLACK
%6 = load i32, i32* @COLOR_BLACK
%7 = call i32 @init_pair(i32 1, i32 %5, i32 %6)
%8 = load i32, i32* @COLOR_RED
%9 = load i32, i32* @COLOR_BLACK
%10 = call i32 @init_pair(i32 2, i32 %8, i32 %9)
br label %13
11: ; preds = %0
%12 = call i32 @fail(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %3
ret void
}

LLVM IR (-O2):
@COLOR_BLACK = global i32 0
@COLOR_RED = global i32 0
@.str = [58 x i8] c"Couldn't start_color(). Check if your term has_colors().\0A\00"
define void @init_colors() {
%1 = tail call i64 (...) @has_colors()
%2 = icmp eq i64 %1, 0
br i1 %2, label %10, label %3
3: ; preds = %0
%4 = tail call i32 (...) @start_color()
%5 = load i32, i32* @COLOR_BLACK
%6 = tail call i32 @init_pair(i32 1, i32 %5, i32 %5)
%7 = load i32, i32* @COLOR_RED
%8 = load i32, i32* @COLOR_BLACK
%9 = tail call i32 @init_pair(i32 2, i32 %7, i32 %8)
br label %12
10: ; preds = %0
%11 = tail call i32 @fail(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %3
ret void
}