#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 COLOR_BLACK;
int COLOR_BLUE;
int COLOR_GREEN;
int /*<<< orphan*/ COLOR_PAIR(int);
int COLOR_RED;
int /*<<< orphan*/ attroff(int /*<<< orphan*/);
int /*<<< orphan*/ attron(int /*<<< orphan*/);
int /*<<< orphan*/ cbreak();
int /*<<< orphan*/ clear();
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ getch();
int /*<<< orphan*/ init_pair(int, int, int);
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ mvaddstr(int, int, char *);
int /*<<< orphan*/ noecho();
int /*<<< orphan*/ start_color();
int /*<<< orphan*/ use_default_colors();
int main() {
  initscr();
  start_color();
  use_default_colors();
  noecho();
  cbreak();
  init_pair(1, COLOR_BLUE, -1);
  init_pair(2, COLOR_RED, COLOR_BLACK);
  init_pair(3, COLOR_BLACK, COLOR_RED);
  init_pair(4, COLOR_GREEN, -1);
  attron(COLOR_PAIR(1));
  clear();
  attroff(COLOR_PAIR(1));
  for (int i = 1; i <= 4; i++) {
    attron(COLOR_PAIR(i));
    mvaddstr(i, 3, "Hello, press key...");
    attroff(COLOR_PAIR(i));
  }
  getch();
  endwin();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1070 <initscr@plt>
mov    $0x0,%al
call   1080 <start_color@plt>
mov    $0x0,%al
call   1040 <use_default_colors@plt>
mov    $0x0,%al
call   10d0 <noecho@plt>
mov    $0x0,%al
call   1050 <cbreak@plt>
mov    0x2dc7(%rip),%rax
mov    (%rax),%esi
mov    $0x1,%edi
mov    $0xffffffff,%edx
call   1060 <init_pair@plt>
mov    0x2da7(%rip),%rax
mov    (%rax),%esi
mov    0x2dbe(%rip),%rax
mov    (%rax),%edx
mov    $0x2,%edi
call   1060 <init_pair@plt>
mov    0x2dab(%rip),%rax
mov    (%rax),%esi
mov    0x2d82(%rip),%rax
mov    (%rax),%edx
mov    $0x3,%edi
call   1060 <init_pair@plt>
mov    0x2d87(%rip),%rax
mov    (%rax),%esi
mov    $0x4,%edi
mov    $0xffffffff,%edx
call   1060 <init_pair@plt>
mov    $0x1,%edi
call   10a0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1090 <attron@plt>
mov    $0x0,%al
call   10f0 <clear@plt>
mov    $0x1,%edi
call   10a0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1030 <attroff@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jg     12e4 <main+0x114>
mov    -0x8(%rbp),%edi
call   10a0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1090 <attron@plt>
mov    -0x8(%rbp),%edi
mov    $0x3,%esi
lea    0xd3e(%rip),%rdx
call   10e0 <mvaddstr@plt>
mov    -0x8(%rbp),%edi
call   10a0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1030 <attroff@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    129a <main+0xca>
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   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1070 <initscr@plt>
xor    %eax,%eax
call   1080 <start_color@plt>
xor    %eax,%eax
call   1040 <use_default_colors@plt>
xor    %eax,%eax
call   10d0 <noecho@plt>
xor    %eax,%eax
call   1050 <cbreak@plt>
mov    0x2dd2(%rip),%rax
mov    (%rax),%esi
mov    $0x1,%edi
mov    $0xffffffff,%edx
call   1060 <init_pair@plt>
mov    0x2db2(%rip),%r14
mov    (%r14),%esi
mov    0x2dc8(%rip),%rbx
mov    (%rbx),%edx
mov    $0x2,%edi
call   1060 <init_pair@plt>
mov    (%rbx),%esi
mov    (%r14),%edx
mov    $0x3,%edi
call   1060 <init_pair@plt>
mov    0x2d9e(%rip),%rax
mov    (%rax),%esi
mov    $0x4,%edi
mov    $0xffffffff,%edx
call   1060 <init_pair@plt>
mov    $0x1,%edi
call   10a0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1090 <attron@plt>
xor    %eax,%eax
call   10f0 <clear@plt>
mov    $0x1,%edi
call   10a0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1030 <attroff@plt>
mov    $0x1,%edi
call   10a0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1090 <attron@plt>
lea    0xd6c(%rip),%rbx
mov    $0x1,%edi
mov    $0x3,%esi
mov    %rbx,%rdx
call   10e0 <mvaddstr@plt>
mov    $0x1,%edi
call   10a0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1030 <attroff@plt>
mov    $0x2,%edi
call   10a0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1090 <attron@plt>
mov    $0x2,%edi
mov    $0x3,%esi
mov    %rbx,%rdx
call   10e0 <mvaddstr@plt>
mov    $0x2,%edi
call   10a0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1030 <attroff@plt>
mov    $0x3,%edi
call   10a0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1090 <attron@plt>
mov    $0x3,%edi
mov    $0x3,%esi
mov    %rbx,%rdx
call   10e0 <mvaddstr@plt>
mov    $0x3,%edi
call   10a0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1030 <attroff@plt>
mov    $0x4,%edi
call   10a0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1090 <attron@plt>
mov    $0x4,%edi
mov    $0x3,%esi
mov    %rbx,%rdx
call   10e0 <mvaddstr@plt>
mov    $0x4,%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
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@COLOR_BLUE = global i32 0
@COLOR_RED = global i32 0
@COLOR_BLACK = global i32 0
@COLOR_GREEN = global i32 0
@.str = [20 x i8] c"Hello, press key...\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @initscr()
%4 = call i32 (...) @start_color()
%5 = call i32 (...) @use_default_colors()
%6 = call i32 (...) @noecho()
%7 = call i32 (...) @cbreak()
%8 = load i32, i32* @COLOR_BLUE
%9 = call i32 @init_pair(i32 1, i32 %8, i32 -1)
%10 = load i32, i32* @COLOR_RED
%11 = load i32, i32* @COLOR_BLACK
%12 = call i32 @init_pair(i32 2, i32 %10, i32 %11)
%13 = load i32, i32* @COLOR_BLACK
%14 = load i32, i32* @COLOR_RED
%15 = call i32 @init_pair(i32 3, i32 %13, i32 %14)
%16 = load i32, i32* @COLOR_GREEN
%17 = call i32 @init_pair(i32 4, i32 %16, i32 -1)
%18 = call i32 @COLOR_PAIR(i32 1)
%19 = call i32 @attron(i32 %18)
%20 = call i32 (...) @clear()
%21 = call i32 @COLOR_PAIR(i32 1)
%22 = call i32 @attroff(i32 %21)
store i32 1, i32* %2
br label %23
23: ; preds = %35, %0
%24 = load i32, i32* %2
%25 = icmp sle i32 %24, 4
br i1 %25, label %26, label %38
26: ; preds = %23
%27 = load i32, i32* %2
%28 = call i32 @COLOR_PAIR(i32 %27)
%29 = call i32 @attron(i32 %28)
%30 = load i32, i32* %2
%31 = call i32 @mvaddstr(i32 %30, i32 3, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%32 = load i32, i32* %2
%33 = call i32 @COLOR_PAIR(i32 %32)
%34 = call i32 @attroff(i32 %33)
br label %35
35: ; preds = %26
%36 = load i32, i32* %2
%37 = add nsw i32 %36, 1
store i32 %37, i32* %2
br label %23
38: ; preds = %23
%39 = call i32 (...) @getch()
%40 = call i32 (...) @endwin()
ret i32 0
}

LLVM IR (-O2):
@COLOR_BLUE = global i32 0
@COLOR_RED = global i32 0
@COLOR_BLACK = global i32 0
@COLOR_GREEN = global i32 0
@.str = [20 x i8] c"Hello, press key...\00"
define i32 @main() {
%1 = tail call i32 (...) @initscr()
%2 = tail call i32 (...) @start_color()
%3 = tail call i32 (...) @use_default_colors()
%4 = tail call i32 (...) @noecho()
%5 = tail call i32 (...) @cbreak()
%6 = load i32, i32* @COLOR_BLUE
%7 = tail call i32 @init_pair(i32 1, i32 %6, i32 -1)
%8 = load i32, i32* @COLOR_RED
%9 = load i32, i32* @COLOR_BLACK
%10 = tail call i32 @init_pair(i32 2, i32 %8, i32 %9)
%11 = load i32, i32* @COLOR_BLACK
%12 = load i32, i32* @COLOR_RED
%13 = tail call i32 @init_pair(i32 3, i32 %11, i32 %12)
%14 = load i32, i32* @COLOR_GREEN
%15 = tail call i32 @init_pair(i32 4, i32 %14, i32 -1)
%16 = tail call i32 @COLOR_PAIR(i32 1)
%17 = tail call i32 @attron(i32 %16)
%18 = tail call i32 (...) @clear()
%19 = tail call i32 @COLOR_PAIR(i32 1)
%20 = tail call i32 @attroff(i32 %19)
%21 = tail call i32 @COLOR_PAIR(i32 1)
%22 = tail call i32 @attron(i32 %21)
%23 = tail call i32 @mvaddstr(i32 1, i32 3, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%24 = tail call i32 @COLOR_PAIR(i32 1)
%25 = tail call i32 @attroff(i32 %24)
%26 = tail call i32 @COLOR_PAIR(i32 2)
%27 = tail call i32 @attron(i32 %26)
%28 = tail call i32 @mvaddstr(i32 2, i32 3, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%29 = tail call i32 @COLOR_PAIR(i32 2)
%30 = tail call i32 @attroff(i32 %29)
%31 = tail call i32 @COLOR_PAIR(i32 3)
%32 = tail call i32 @attron(i32 %31)
%33 = tail call i32 @mvaddstr(i32 3, i32 3, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%34 = tail call i32 @COLOR_PAIR(i32 3)
%35 = tail call i32 @attroff(i32 %34)
%36 = tail call i32 @COLOR_PAIR(i32 4)
%37 = tail call i32 @attron(i32 %36)
%38 = tail call i32 @mvaddstr(i32 4, i32 3, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%39 = tail call i32 @COLOR_PAIR(i32 4)
%40 = tail call i32 @attroff(i32 %39)
%41 = tail call i32 (...) @getch()
%42 = tail call i32 (...) @endwin()
ret i32 0
}