#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 */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int /*<<< orphan*/ A_BOLD;
int /*<<< orphan*/ COLOR_PAIR(int);
scalar_t__ TRUE;
scalar_t__ has_colors();
int /*<<< orphan*/ wattron(int /*<<< orphan*/ *, int /*<<< orphan*/);
void plaza_use_palette(WINDOW *win, int palette, bool bold) {
  if (has_colors() == TRUE) {
    wattron(win, COLOR_PAIR(palette));
    if (bold)
      wattron(win, A_BOLD);
  }
}


x86 assembly (clang, -O0):
<plaza_use_palette>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    $0x0,%al
call   1030 <has_colors@plt>
mov    0x2e98(%rip),%rcx
cmp    (%rcx),%rax
jne    1195 <plaza_use_palette+0x65>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <COLOR_PAIR@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
call   1050 <wattron@plt>
cmpl   $0x0,-0x10(%rbp)
je     1190 <plaza_use_palette+0x60>
mov    -0x8(%rbp),%rdi
mov    0x2e4f(%rip),%rax
mov    (%rax),%esi
call   1050 <wattron@plt>
jmp    1195 <plaza_use_palette+0x65>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<plaza_use_palette>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <has_colors@plt>
mov    0x2e9e(%rip),%rcx
cmp    (%rcx),%rax
jne    117a <plaza_use_palette+0x4a>
mov    %ebp,%edi
call   1040 <COLOR_PAIR@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <wattron@plt>
test   %r14d,%r14d
je     117a <plaza_use_palette+0x4a>
mov    0x2e6c(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <wattron@plt>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@TRUE = global i64 0
@A_BOLD = global i32 0
define void @plaza_use_palette(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = call i64 (...) @has_colors()
%8 = load i64, i64* @TRUE
%9 = icmp eq i64 %7, %8
br i1 %9, label %10, label %22
10: ; preds = %3
%11 = load i32*, i32** %4
%12 = load i32, i32* %5
%13 = call i32 @COLOR_PAIR(i32 %12)
%14 = call i32 @wattron(i32* %11, i32 %13)
%15 = load i32, i32* %6
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %10
%18 = load i32*, i32** %4
%19 = load i32, i32* @A_BOLD
%20 = call i32 @wattron(i32* %18, i32 %19)
br label %21
21: ; preds = %17, %10
br label %22
22: ; preds = %21, %3
ret void
}

LLVM IR (-O2):
@TRUE = global i64 0
@A_BOLD = global i32 0
define void @plaza_use_palette(i32* %0, i32 %1, i32 %2) {
%4 = tail call i64 (...) @has_colors()
%5 = load i64, i64* @TRUE
%6 = icmp eq i64 %4, %5
br i1 %6, label %7, label %14
7: ; preds = %3
%8 = tail call i32 @COLOR_PAIR(i32 %1)
%9 = tail call i32 @wattron(i32* %0, i32 %8)
%10 = icmp eq i32 %2, 0
br i1 %10, label %14, label %11
11: ; preds = %7
%12 = load i32, i32* @A_BOLD
%13 = tail call i32 @wattron(i32* %0, i32 %12)
br label %14
14: ; preds = %7, %11, %3
ret void
}