#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*/ cbreak();
int /*<<< orphan*/ checkTerminalSize();
int /*<<< orphan*/ curs_set(int /*<<< orphan*/);
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ keypad(int /*<<< orphan*/, int);
int /*<<< orphan*/ mainloop();
int /*<<< orphan*/ noecho();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ start_color();
int /*<<< orphan*/ stdscr;
int main() {
  initscr();
  checkTerminalSize();
  curs_set(0);
  start_color();
  cbreak();
  noecho();
  keypad(stdscr, 1);
  refresh();
  mainloop();
  endwin();
  printf("\n Player exited. Thanks for playing.\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <initscr@plt>
mov    $0x0,%al
call   10a0 <checkTerminalSize@plt>
xor    %edi,%edi
call   10d0 <curs_set@plt>
mov    $0x0,%al
call   1070 <start_color@plt>
mov    $0x0,%al
call   1030 <cbreak@plt>
mov    $0x0,%al
call   10b0 <noecho@plt>
mov    0x2df8(%rip),%rax
mov    (%rax),%edi
mov    $0x1,%esi
call   1050 <keypad@plt>
mov    $0x0,%al
call   1080 <refresh@plt>
mov    $0x0,%al
call   10c0 <mainloop@plt>
mov    $0x0,%al
call   1090 <endwin@plt>
lea    0xde8(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1060 <initscr@plt>
xor    %eax,%eax
call   10a0 <checkTerminalSize@plt>
xor    %edi,%edi
call   10d0 <curs_set@plt>
xor    %eax,%eax
call   1070 <start_color@plt>
xor    %eax,%eax
call   1040 <cbreak@plt>
xor    %eax,%eax
call   10b0 <noecho@plt>
mov    0x2e06(%rip),%rax
mov    (%rax),%edi
mov    $0x1,%esi
call   1050 <keypad@plt>
xor    %eax,%eax
call   1080 <refresh@plt>
xor    %eax,%eax
call   10c0 <mainloop@plt>
xor    %eax,%eax
call   1090 <endwin@plt>
lea    0xdf6(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stdscr = global i32 0
@.str = [39 x i8] c"\0A Player exited. Thanks for playing.\0A\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @initscr()
%3 = call i32 (...) @checkTerminalSize()
%4 = call i32 @curs_set(i32 0)
%5 = call i32 (...) @start_color()
%6 = call i32 (...) @cbreak()
%7 = call i32 (...) @noecho()
%8 = load i32, i32* @stdscr
%9 = call i32 @keypad(i32 %8, i32 1)
%10 = call i32 (...) @refresh()
%11 = call i32 (...) @mainloop()
%12 = call i32 (...) @endwin()
%13 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stdscr = global i32 0
@str = [38 x i8] c"\0A Player exited. Thanks for playing.\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @initscr()
%2 = tail call i32 (...) @checkTerminalSize()
%3 = tail call i32 @curs_set(i32 0)
%4 = tail call i32 (...) @start_color()
%5 = tail call i32 (...) @cbreak()
%6 = tail call i32 (...) @noecho()
%7 = load i32, i32* @stdscr
%8 = tail call i32 @keypad(i32 %7, i32 1)
%9 = tail call i32 (...) @refresh()
%10 = tail call i32 (...) @mainloop()
%11 = tail call i32 (...) @endwin()
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
ret i32 0
}