#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_GREEN;
int /*<<< orphan*/ COLOR_RED;
int /*<<< orphan*/ COLOR_YELLOW;
int /*<<< orphan*/ has_colors();
int /*<<< orphan*/ init_pair(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ start_color();
bool init_colors() {
  if (!has_colors()) {
    return false;
  }
  start_color();
  init_pair(1, COLOR_RED, COLOR_BLACK);
  init_pair(2, COLOR_GREEN, COLOR_BLACK);
  init_pair(3, COLOR_YELLOW, COLOR_BLACK);
  return true;
}


x86 assembly (clang, -O0):
<init_colors>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <has_colors@plt>
cmp    $0x0,%eax
jne    1154 <init_colors+0x24>
movl   $0x0,-0x4(%rbp)
jmp    11b6 <init_colors+0x86>
mov    $0x0,%al
call   1050 <start_color@plt>
mov    0x2e66(%rip),%rax
mov    (%rax),%esi
mov    0x2e7d(%rip),%rax
mov    (%rax),%edx
mov    $0x1,%edi
call   1040 <init_pair@plt>
mov    0x2e62(%rip),%rax
mov    (%rax),%esi
mov    0x2e61(%rip),%rax
mov    (%rax),%edx
mov    $0x2,%edi
call   1040 <init_pair@plt>
mov    0x2e36(%rip),%rax
mov    (%rax),%esi
mov    0x2e45(%rip),%rax
mov    (%rax),%edx
mov    $0x3,%edi
call   1040 <init_pair@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_colors>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <has_colors@plt>
test   %eax,%eax
je     1196 <init_colors+0x66>
xor    %eax,%eax
call   1050 <start_color@plt>
mov    0x2e79(%rip),%rax
mov    (%rax),%esi
mov    0x2e90(%rip),%r14
mov    (%r14),%edx
mov    $0x1,%ebx
mov    $0x1,%edi
call   1040 <init_pair@plt>
mov    0x2e6f(%rip),%rax
mov    (%rax),%esi
mov    (%r14),%edx
mov    $0x2,%edi
call   1040 <init_pair@plt>
mov    0x2e49(%rip),%rax
mov    (%rax),%esi
mov    (%r14),%edx
mov    $0x3,%edi
call   1040 <init_pair@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@COLOR_RED = global i32 0
@COLOR_BLACK = global i32 0
@COLOR_GREEN = global i32 0
@COLOR_YELLOW = global i32 0
define i32 @init_colors() {
%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 %16
5: ; preds = %0
%6 = call i32 (...) @start_color()
%7 = load i32, i32* @COLOR_RED
%8 = load i32, i32* @COLOR_BLACK
%9 = call i32 @init_pair(i32 1, i32 %7, i32 %8)
%10 = load i32, i32* @COLOR_GREEN
%11 = load i32, i32* @COLOR_BLACK
%12 = call i32 @init_pair(i32 2, i32 %10, i32 %11)
%13 = load i32, i32* @COLOR_YELLOW
%14 = load i32, i32* @COLOR_BLACK
%15 = call i32 @init_pair(i32 3, i32 %13, i32 %14)
store i32 1, i32* %1
br label %16
16: ; preds = %5, %4
%17 = load i32, i32* %1
ret i32 %17
}

LLVM IR (-O2):
@COLOR_RED = global i32 0
@COLOR_BLACK = global i32 0
@COLOR_GREEN = global i32 0
@COLOR_YELLOW = global i32 0
define i32 @init_colors() {
%1 = tail call i32 (...) @has_colors()
%2 = icmp eq i32 %1, 0
br i1 %2, label %14, label %3
3: ; preds = %0
%4 = tail call i32 (...) @start_color()
%5 = load i32, i32* @COLOR_RED
%6 = load i32, i32* @COLOR_BLACK
%7 = tail call i32 @init_pair(i32 1, i32 %5, i32 %6)
%8 = load i32, i32* @COLOR_GREEN
%9 = load i32, i32* @COLOR_BLACK
%10 = tail call i32 @init_pair(i32 2, i32 %8, i32 %9)
%11 = load i32, i32* @COLOR_YELLOW
%12 = load i32, i32* @COLOR_BLACK
%13 = tail call i32 @init_pair(i32 3, i32 %11, i32 %12)
br label %14
14: ; preds = %0, %3
%15 = phi i32 [ 1, %3 ], [ 0, %0 ]
ret i32 %15
}