#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*/ TRUE;
int /*<<< orphan*/ cbreak();
int /*<<< orphan*/ define_colors();
int /*<<< orphan*/ endwin();
scalar_t__ has_colors();
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ keypad(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ main_loop();
int /*<<< orphan*/ noecho();
int /*<<< orphan*/ start_color();
int /*<<< orphan*/ stdscr;
int /*<<< orphan*/ use_default_colors();
int main() {
  initscr();
  cbreak();
  keypad(stdscr, TRUE);
  noecho();
  if (has_colors()) {
    start_color();
    use_default_colors();
    define_colors();
  }
  main_loop();
  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   1050 <cbreak@plt>
mov    0x2e24(%rip),%rax
mov    (%rax),%edi
mov    0x2e13(%rip),%rax
mov    (%rax),%esi
call   1060 <keypad@plt>
mov    $0x0,%al
call   10c0 <noecho@plt>
mov    $0x0,%al
call   1040 <has_colors@plt>
cmp    $0x0,%rax
je     1201 <main+0x61>
mov    $0x0,%al
call   1080 <start_color@plt>
mov    $0x0,%al
call   1030 <use_default_colors@plt>
mov    $0x0,%al
call   1090 <define_colors@plt>
mov    $0x0,%al
call   10b0 <main_loop@plt>
mov    $0x0,%al
call   10a0 <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 <cbreak@plt>
mov    0x2e32(%rip),%rax
mov    (%rax),%edi
mov    0x2e21(%rip),%rax
mov    (%rax),%esi
call   1060 <keypad@plt>
xor    %eax,%eax
call   10c0 <noecho@plt>
xor    %eax,%eax
call   1040 <has_colors@plt>
test   %rax,%rax
je     11ee <main+0x4e>
xor    %eax,%eax
call   1080 <start_color@plt>
xor    %eax,%eax
call   1030 <use_default_colors@plt>
xor    %eax,%eax
call   1090 <define_colors@plt>
xor    %eax,%eax
call   10b0 <main_loop@plt>
xor    %eax,%eax
call   10a0 <endwin@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stdscr = global i32 0
@TRUE = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @initscr()
%3 = call i32 (...) @cbreak()
%4 = load i32, i32* @stdscr
%5 = load i32, i32* @TRUE
%6 = call i32 @keypad(i32 %4, i32 %5)
%7 = call i32 (...) @noecho()
%8 = call i64 (...) @has_colors()
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %0
%11 = call i32 (...) @start_color()
%12 = call i32 (...) @use_default_colors()
%13 = call i32 (...) @define_colors()
br label %14
14: ; preds = %10, %0
%15 = call i32 (...) @main_loop()
%16 = call i32 (...) @endwin()
ret i32 0
}

LLVM IR (-O2):
@stdscr = global i32 0
@TRUE = global i32 0
define i32 @main() {
%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 (...) @noecho()
%7 = tail call i64 (...) @has_colors()
%8 = icmp eq i64 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %0
%10 = tail call i32 (...) @start_color()
%11 = tail call i32 (...) @use_default_colors()
%12 = tail call i32 (...) @define_colors()
br label %13
13: ; preds = %9, %0
%14 = tail call i32 (...) @main_loop()
%15 = tail call i32 (...) @endwin()
ret i32 0
}