#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_BLUE;
int /*<<< orphan*/ COLOR_CYAN;
int /*<<< orphan*/ COLOR_GREEN;
int /*<<< orphan*/ COLOR_MAGENTA;
int /*<<< orphan*/ COLOR_RED;
int /*<<< orphan*/ COLOR_WHITE;
int /*<<< orphan*/ COLOR_YELLOW;
scalar_t__ FALSE;
int /*<<< orphan*/ TRUE;
int /*<<< orphan*/ cbreak();
int /*<<< orphan*/ echo();
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ exit(int);
scalar_t__ has_colors();
int /*<<< orphan*/ init_pair(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ keypad(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mvaddstr(int, int, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ start_color();
int /*<<< orphan*/ stdscr;
void start() {
  initscr();
  cbreak();
  keypad(stdscr, TRUE);
  echo();
  if (has_colors() == FALSE) {
    endwin();
    printf("Your terminal does not support color\n");
    exit(1);
  }
  start_color();
  init_pair(0, COLOR_WHITE, COLOR_BLACK);
  init_pair(1, COLOR_YELLOW, COLOR_BLACK);
  init_pair(2, COLOR_GREEN, COLOR_BLACK);
  init_pair(3, COLOR_CYAN, COLOR_BLACK);
  init_pair(4, COLOR_BLUE, COLOR_BLACK);
  init_pair(5, COLOR_MAGENTA, COLOR_BLACK);
  init_pair(6, COLOR_RED, COLOR_BLACK);
  mvaddstr(5, 5, "Hallo");
}


x86 assembly (clang, -O0):
<start>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1090 <initscr@plt>
mov    $0x0,%al
call   1050 <cbreak@plt>
mov    0x2e1f(%rip),%rax
mov    (%rax),%edi
mov    0x2e0e(%rip),%rax
mov    (%rax),%esi
call   1080 <keypad@plt>
mov    $0x0,%al
call   1030 <echo@plt>
mov    $0x0,%al
call   1040 <has_colors@plt>
mov    0x2daa(%rip),%rcx
cmp    (%rcx),%rax
jne    1214 <start+0x64>
mov    $0x0,%al
call   10b0 <endwin@plt>
lea    0xdfb(%rip),%rdi
call   1070 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    $0x0,%al
call   10a0 <start_color@plt>
mov    0x2d8e(%rip),%rax
mov    (%rax),%esi
mov    0x2dad(%rip),%rax
mov    (%rax),%edx
xor    %edi,%edi
call   1060 <init_pair@plt>
mov    0x2d6d(%rip),%rax
mov    (%rax),%esi
mov    0x2d94(%rip),%rax
mov    (%rax),%edx
mov    $0x1,%edi
call   1060 <init_pair@plt>
mov    0x2d71(%rip),%rax
mov    (%rax),%esi
mov    0x2d78(%rip),%rax
mov    (%rax),%edx
mov    $0x2,%edi
call   1060 <init_pair@plt>
mov    0x2d5d(%rip),%rax
mov    (%rax),%esi
mov    0x2d5c(%rip),%rax
mov    (%rax),%edx
mov    $0x3,%edi
call   1060 <init_pair@plt>
mov    0x2d11(%rip),%rax
mov    (%rax),%esi
mov    0x2d40(%rip),%rax
mov    (%rax),%edx
mov    $0x4,%edi
call   1060 <init_pair@plt>
mov    0x2d0d(%rip),%rax
mov    (%rax),%esi
mov    0x2d24(%rip),%rax
mov    (%rax),%edx
mov    $0x5,%edi
call   1060 <init_pair@plt>
mov    0x2cc9(%rip),%rax
mov    (%rax),%esi
mov    0x2d08(%rip),%rax
mov    (%rax),%edx
mov    $0x6,%edi
call   1060 <init_pair@plt>
mov    $0x5,%esi
lea    0xd3e(%rip),%rdx
mov    %esi,%edi
call   10c0 <mvaddstr@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<start>:
push   %rbx
xor    %eax,%eax
call   1090 <initscr@plt>
xor    %eax,%eax
call   1060 <cbreak@plt>
mov    0x2e22(%rip),%rax
mov    (%rax),%edi
mov    0x2e11(%rip),%rax
mov    (%rax),%esi
call   1080 <keypad@plt>
xor    %eax,%eax
call   1030 <echo@plt>
xor    %eax,%eax
call   1050 <has_colors@plt>
mov    0x2dad(%rip),%rcx
cmp    (%rcx),%rax
je     12a9 <start+0xf9>
xor    %eax,%eax
call   10a0 <start_color@plt>
mov    0x2dae(%rip),%rax
mov    (%rax),%esi
mov    0x2dcd(%rip),%rbx
mov    (%rbx),%edx
xor    %edi,%edi
call   1070 <init_pair@plt>
mov    0x2d8d(%rip),%rax
mov    (%rax),%esi
mov    (%rbx),%edx
mov    $0x1,%edi
call   1070 <init_pair@plt>
mov    0x2d98(%rip),%rax
mov    (%rax),%esi
mov    (%rbx),%edx
mov    $0x2,%edi
call   1070 <init_pair@plt>
mov    0x2d8b(%rip),%rax
mov    (%rax),%esi
mov    (%rbx),%edx
mov    $0x3,%edi
call   1070 <init_pair@plt>
mov    0x2d46(%rip),%rax
mov    (%rax),%esi
mov    (%rbx),%edx
mov    $0x4,%edi
call   1070 <init_pair@plt>
mov    0x2d49(%rip),%rax
mov    (%rax),%esi
mov    (%rbx),%edx
mov    $0x5,%edi
call   1070 <init_pair@plt>
mov    0x2d0c(%rip),%rax
mov    (%rax),%esi
mov    (%rbx),%edx
mov    $0x6,%edi
call   1070 <init_pair@plt>
lea    0xd67(%rip),%rdx
mov    $0x5,%edi
mov    $0x5,%esi
pop    %rbx
jmp    10c0 <mvaddstr@plt>
xor    %eax,%eax
call   10b0 <endwin@plt>
lea    0xd4f(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
@stdscr = global i32 0
@TRUE = global i32 0
@FALSE = global i64 0
@.str = [38 x i8] c"Your terminal does not support color\0A\00"
@COLOR_WHITE = global i32 0
@COLOR_BLACK = global i32 0
@COLOR_YELLOW = global i32 0
@COLOR_GREEN = global i32 0
@COLOR_CYAN = global i32 0
@COLOR_BLUE = global i32 0
@COLOR_MAGENTA = global i32 0
@COLOR_RED = global i32 0
@.str.1 = [6 x i8] c"Hallo\00"
define void @start() {
%1 = call i32 (...) @initscr()
%2 = call i32 (...) @cbreak()
%3 = load i32, i32* @stdscr
%4 = load i32, i32* @TRUE
%5 = call i32 @keypad(i32 %3, i32 %4)
%6 = call i32 (...) @echo()
%7 = call i64 (...) @has_colors()
%8 = load i64, i64* @FALSE
%9 = icmp eq i64 %7, %8
br i1 %9, label %10, label %14
10: ; preds = %0
%11 = call i32 (...) @endwin()
%12 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %0
%15 = call i32 (...) @start_color()
%16 = load i32, i32* @COLOR_WHITE
%17 = load i32, i32* @COLOR_BLACK
%18 = call i32 @init_pair(i32 0, i32 %16, i32 %17)
%19 = load i32, i32* @COLOR_YELLOW
%20 = load i32, i32* @COLOR_BLACK
%21 = call i32 @init_pair(i32 1, i32 %19, i32 %20)
%22 = load i32, i32* @COLOR_GREEN
%23 = load i32, i32* @COLOR_BLACK
%24 = call i32 @init_pair(i32 2, i32 %22, i32 %23)
%25 = load i32, i32* @COLOR_CYAN
%26 = load i32, i32* @COLOR_BLACK
%27 = call i32 @init_pair(i32 3, i32 %25, i32 %26)
%28 = load i32, i32* @COLOR_BLUE
%29 = load i32, i32* @COLOR_BLACK
%30 = call i32 @init_pair(i32 4, i32 %28, i32 %29)
%31 = load i32, i32* @COLOR_MAGENTA
%32 = load i32, i32* @COLOR_BLACK
%33 = call i32 @init_pair(i32 5, i32 %31, i32 %32)
%34 = load i32, i32* @COLOR_RED
%35 = load i32, i32* @COLOR_BLACK
%36 = call i32 @init_pair(i32 6, i32 %34, i32 %35)
%37 = call i32 @mvaddstr(i32 5, i32 5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stdscr = global i32 0
@TRUE = global i32 0
@FALSE = global i64 0
@COLOR_WHITE = global i32 0
@COLOR_BLACK = global i32 0
@COLOR_YELLOW = global i32 0
@COLOR_GREEN = global i32 0
@COLOR_CYAN = global i32 0
@COLOR_BLUE = global i32 0
@COLOR_MAGENTA = global i32 0
@COLOR_RED = global i32 0
@.str.1 = [6 x i8] c"Hallo\00"
@str = [37 x i8] c"Your terminal does not support color\00"
define void @start() {
%1 = tail call i32 (...) @initscr()
%2 = tail call i32 (...) @cbreak()
%3 = load i32, i32* @stdscr
%4 = load i32, i32* @TRUE
%5 = tail call i32 @keypad(i32 %3, i32 %4)
%6 = tail call i32 (...) @echo()
%7 = tail call i64 (...) @has_colors()
%8 = load i64, i64* @FALSE
%9 = icmp eq i64 %7, %8
br i1 %9, label %10, label %14
10: ; preds = %0
%11 = tail call i32 (...) @endwin()
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%13 = tail call i32 @exit(i32 1)
unreachable
14: ; preds = %0
%15 = tail call i32 (...) @start_color()
%16 = load i32, i32* @COLOR_WHITE
%17 = load i32, i32* @COLOR_BLACK
%18 = tail call i32 @init_pair(i32 0, i32 %16, i32 %17)
%19 = load i32, i32* @COLOR_YELLOW
%20 = load i32, i32* @COLOR_BLACK
%21 = tail call i32 @init_pair(i32 1, i32 %19, i32 %20)
%22 = load i32, i32* @COLOR_GREEN
%23 = load i32, i32* @COLOR_BLACK
%24 = tail call i32 @init_pair(i32 2, i32 %22, i32 %23)
%25 = load i32, i32* @COLOR_CYAN
%26 = load i32, i32* @COLOR_BLACK
%27 = tail call i32 @init_pair(i32 3, i32 %25, i32 %26)
%28 = load i32, i32* @COLOR_BLUE
%29 = load i32, i32* @COLOR_BLACK
%30 = tail call i32 @init_pair(i32 4, i32 %28, i32 %29)
%31 = load i32, i32* @COLOR_MAGENTA
%32 = load i32, i32* @COLOR_BLACK
%33 = tail call i32 @init_pair(i32 5, i32 %31, i32 %32)
%34 = load i32, i32* @COLOR_RED
%35 = load i32, i32* @COLOR_BLACK
%36 = tail call i32 @init_pair(i32 6, i32 %34, i32 %35)
%37 = tail call i32 @mvaddstr(i32 5, i32 5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret void
}