#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_PAIR(int);
int /*<<< orphan*/ COLOR_RED;
scalar_t__ FALSE;
int LINES;
int /*<<< orphan*/ attroff(int /*<<< orphan*/);
int /*<<< orphan*/ attron(int /*<<< orphan*/);
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ getch();
scalar_t__ has_colors();
int /*<<< orphan*/ init_pair(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ print_in_middle(int /*<<< orphan*/, int, int /*<<< orphan*/,
                                   int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ start_color();
int /*<<< orphan*/ stdscr;
int main(int argc, char *argv[]) {
  initscr();
  if (has_colors() == FALSE) {
    endwin();
    printf("Your terminal does not support color\n");
    exit(1);
  }
  start_color();
  init_pair(1, COLOR_RED, COLOR_BLACK);
  attron(COLOR_PAIR(1));
  print_in_middle(stdscr, LINES / 2, 0, 0, "Viola !!! In color ...");
  attroff(COLOR_PAIR(1));
  getch();
  endwin();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1070 <initscr@plt>
mov    $0x0,%al
call   1040 <has_colors@plt>
mov    0x2de4(%rip),%rcx
cmp    (%rcx),%rax
jne    120a <main+0x4a>
mov    $0x0,%al
call   10c0 <endwin@plt>
lea    0xe05(%rip),%rdi
call   1060 <printf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    $0x0,%al
call   1080 <start_color@plt>
mov    0x2da8(%rip),%rax
mov    (%rax),%esi
mov    0x2db7(%rip),%rax
mov    (%rax),%edx
mov    $0x1,%edi
call   1050 <init_pair@plt>
mov    $0x1,%edi
call   10a0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1090 <attron@plt>
mov    0x2d9b(%rip),%rax
mov    (%rax),%edi
mov    0x2d9a(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
xor    %ecx,%ecx
lea    0xdc3(%rip),%r8
mov    %ecx,%edx
call   10d0 <print_in_middle@plt>
mov    $0x1,%edi
call   10a0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1030 <attroff@plt>
mov    $0x0,%al
call   10b0 <getch@plt>
mov    $0x0,%al
call   10c0 <endwin@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1070 <initscr@plt>
xor    %eax,%eax
call   1050 <has_colors@plt>
mov    0x2df2(%rip),%rcx
cmp    (%rcx),%rax
je     1261 <main+0xa1>
xor    %eax,%eax
call   1080 <start_color@plt>
mov    0x2dd3(%rip),%rax
mov    (%rax),%esi
mov    0x2de2(%rip),%rax
mov    (%rax),%edx
mov    $0x1,%edi
call   1060 <init_pair@plt>
mov    $0x1,%edi
call   10a0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1090 <attron@plt>
mov    0x2dc6(%rip),%rax
mov    (%rax),%edi
mov    0x2dc5(%rip),%rax
mov    (%rax),%eax
mov    %eax,%esi
shr    $0x1f,%esi
add    %eax,%esi
sar    %esi
lea    0xdcb(%rip),%r8
xor    %edx,%edx
xor    %ecx,%ecx
call   10d0 <print_in_middle@plt>
mov    $0x1,%edi
call   10a0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1030 <attroff@plt>
xor    %eax,%eax
call   10b0 <getch@plt>
xor    %eax,%eax
call   10c0 <endwin@plt>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   10c0 <endwin@plt>
lea    0xda8(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>

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

LLVM IR (-O2):
@FALSE = global i64 0
@COLOR_RED = global i32 0
@COLOR_BLACK = global i32 0
@stdscr = global i32 0
@LINES = global i32 0
@.str.1 = [23 x i8] c"Viola !!! In color ...\00"
@str = [37 x i8] c"Your terminal does not support color\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @initscr()
%4 = tail call i64 (...) @has_colors()
%5 = load i64, i64* @FALSE
%6 = icmp eq i64 %4, %5
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = tail call i32 (...) @endwin()
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %2
%12 = tail call i32 (...) @start_color()
%13 = load i32, i32* @COLOR_RED
%14 = load i32, i32* @COLOR_BLACK
%15 = tail call i32 @init_pair(i32 1, i32 %13, i32 %14)
%16 = tail call i32 @COLOR_PAIR(i32 1)
%17 = tail call i32 @attron(i32 %16)
%18 = load i32, i32* @stdscr
%19 = load i32, i32* @LINES
%20 = sdiv i32 %19, 2
%21 = tail call i32 @print_in_middle(i32 %18, i32 %20, i32 0, i32 0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%22 = tail call i32 @COLOR_PAIR(i32 1)
%23 = tail call i32 @attroff(i32 %22)
%24 = tail call i32 (...) @getch()
%25 = tail call i32 (...) @endwin()
ret i32 0
}