#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_CYAN;
int /*<<< orphan*/ COLOR_GREEN;
int /*<<< orphan*/ COLOR_RED;
int /*<<< orphan*/ COLOR_WHITE;
int /*<<< orphan*/ COLOR_YELLOW;
scalar_t__ TRUE;
scalar_t__ has_colors();
int /*<<< orphan*/ init_pair(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ start_color();
void ensure_colors() {
  if (has_colors() == TRUE) {
    start_color();
    (init_pair('@', COLOR_GREEN, COLOR_BLACK));
    (init_pair('#', COLOR_BLACK, COLOR_YELLOW));
    (init_pair('~', COLOR_WHITE, COLOR_CYAN));
    (init_pair('|', COLOR_YELLOW, COLOR_BLACK));
    (init_pair('0', COLOR_GREEN, COLOR_GREEN));
    (init_pair(300, COLOR_RED, COLOR_BLACK));
  }
}


x86 assembly (clang, -O0):
<ensure_colors>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <has_colors@plt>
mov    0x2ea6(%rip),%rcx
cmp    (%rcx),%rax
jne    11fa <ensure_colors+0xca>
mov    $0x0,%al
call   1050 <start_color@plt>
mov    0x2e77(%rip),%rax
mov    (%rax),%esi
mov    0x2e7e(%rip),%rax
mov    (%rax),%edx
mov    $0x40,%edi
call   1040 <init_pair@plt>
mov    0x2e6b(%rip),%rax
mov    (%rax),%esi
mov    0x2e3a(%rip),%rax
mov    (%rax),%edx
mov    $0x23,%edi
call   1040 <init_pair@plt>
mov    0x2e2f(%rip),%rax
mov    (%rax),%esi
mov    0x2e3e(%rip),%rax
mov    (%rax),%edx
mov    $0x7e,%edi
call   1040 <init_pair@plt>
mov    0x2e0b(%rip),%rax
mov    (%rax),%esi
mov    0x2e2a(%rip),%rax
mov    (%rax),%edx
mov    $0x7c,%edi
call   1040 <init_pair@plt>
mov    0x2e07(%rip),%rax
mov    (%rax),%esi
mov    0x2dfe(%rip),%rax
mov    (%rax),%edx
mov    $0x30,%edi
call   1040 <init_pair@plt>
mov    0x2dcb(%rip),%rax
mov    (%rax),%esi
mov    0x2df2(%rip),%rax
mov    (%rax),%edx
mov    $0x12c,%edi
call   1040 <init_pair@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ensure_colors>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1030 <has_colors@plt>
mov    0x2ea5(%rip),%rcx
cmp    (%rcx),%rax
jne    11da <ensure_colors+0xaa>
xor    %eax,%eax
call   1050 <start_color@plt>
mov    0x2e76(%rip),%r14
mov    (%r14),%esi
mov    0x2e7c(%rip),%rbx
mov    (%rbx),%edx
mov    $0x40,%edi
call   1040 <init_pair@plt>
mov    (%rbx),%esi
mov    0x2e3f(%rip),%r15
mov    (%r15),%edx
mov    $0x23,%edi
call   1040 <init_pair@plt>
mov    0x2e33(%rip),%rax
mov    (%rax),%esi
mov    0x2e42(%rip),%rax
mov    (%rax),%edx
mov    $0x7e,%edi
call   1040 <init_pair@plt>
mov    (%r15),%esi
mov    (%rbx),%edx
mov    $0x7c,%edi
call   1040 <init_pair@plt>
mov    (%r14),%edx
mov    $0x30,%edi
mov    %edx,%esi
call   1040 <init_pair@plt>
mov    0x2de9(%rip),%rax
mov    (%rax),%esi
mov    (%rbx),%edx
mov    $0x12c,%edi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <init_pair@plt>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@TRUE = global i64 0
@COLOR_GREEN = global i32 0
@COLOR_BLACK = global i32 0
@COLOR_YELLOW = global i32 0
@COLOR_WHITE = global i32 0
@COLOR_CYAN = global i32 0
@COLOR_RED = global i32 0
define void @ensure_colors() {
%1 = call i64 (...) @has_colors()
%2 = load i64, i64* @TRUE
%3 = icmp eq i64 %1, %2
br i1 %3, label %4, label %24
4: ; preds = %0
%5 = call i32 (...) @start_color()
%6 = load i32, i32* @COLOR_GREEN
%7 = load i32, i32* @COLOR_BLACK
%8 = call i32 @init_pair(i32 64, i32 %6, i32 %7)
%9 = load i32, i32* @COLOR_BLACK
%10 = load i32, i32* @COLOR_YELLOW
%11 = call i32 @init_pair(i32 35, i32 %9, i32 %10)
%12 = load i32, i32* @COLOR_WHITE
%13 = load i32, i32* @COLOR_CYAN
%14 = call i32 @init_pair(i32 126, i32 %12, i32 %13)
%15 = load i32, i32* @COLOR_YELLOW
%16 = load i32, i32* @COLOR_BLACK
%17 = call i32 @init_pair(i32 124, i32 %15, i32 %16)
%18 = load i32, i32* @COLOR_GREEN
%19 = load i32, i32* @COLOR_GREEN
%20 = call i32 @init_pair(i32 48, i32 %18, i32 %19)
%21 = load i32, i32* @COLOR_RED
%22 = load i32, i32* @COLOR_BLACK
%23 = call i32 @init_pair(i32 300, i32 %21, i32 %22)
br label %24
24: ; preds = %4, %0
ret void
}

LLVM IR (-O2):
@TRUE = global i64 0
@COLOR_GREEN = global i32 0
@COLOR_BLACK = global i32 0
@COLOR_YELLOW = global i32 0
@COLOR_WHITE = global i32 0
@COLOR_CYAN = global i32 0
@COLOR_RED = global i32 0
define void @ensure_colors() {
%1 = tail call i64 (...) @has_colors()
%2 = load i64, i64* @TRUE
%3 = icmp eq i64 %1, %2
br i1 %3, label %4, label %23
4: ; preds = %0
%5 = tail call i32 (...) @start_color()
%6 = load i32, i32* @COLOR_GREEN
%7 = load i32, i32* @COLOR_BLACK
%8 = tail call i32 @init_pair(i32 64, i32 %6, i32 %7)
%9 = load i32, i32* @COLOR_BLACK
%10 = load i32, i32* @COLOR_YELLOW
%11 = tail call i32 @init_pair(i32 35, i32 %9, i32 %10)
%12 = load i32, i32* @COLOR_WHITE
%13 = load i32, i32* @COLOR_CYAN
%14 = tail call i32 @init_pair(i32 126, i32 %12, i32 %13)
%15 = load i32, i32* @COLOR_YELLOW
%16 = load i32, i32* @COLOR_BLACK
%17 = tail call i32 @init_pair(i32 124, i32 %15, i32 %16)
%18 = load i32, i32* @COLOR_GREEN
%19 = tail call i32 @init_pair(i32 48, i32 %18, i32 %18)
%20 = load i32, i32* @COLOR_RED
%21 = load i32, i32* @COLOR_BLACK
%22 = tail call i32 @init_pair(i32 300, i32 %20, i32 %21)
br label %23
23: ; preds = %4, %0
ret void
}