#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 */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int 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;
int EOF;
scalar_t__ ERR;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ curs_set(int /*<<< orphan*/);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ game();
int getopt(int, char **, char *);
scalar_t__ has_colors();
int /*<<< orphan*/ init_pair(int, int /*<<< orphan*/, int);
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ nl();
int /*<<< orphan*/ noecho();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ quit(int /*<<< orphan*/);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ start_color();
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int /*<<< orphan*/ usage();
scalar_t__ use_default_colors();
int main(int argc, char *argv[]) {
  int transparent_bg = 0;
  int optchr;
  while ((optchr = getopt(argc, argv, "t")) != EOF) {
    switch (optchr) {
    case 't':
      transparent_bg = 1;
      break;
    case 'h':
    case '?':
      usage();
      exit(0);
    }
  }
  srand(time((time_t *)0));
  initscr();
  if (has_colors()) {
    int bg = COLOR_BLACK;
    if (transparent_bg) {
      if (use_default_colors() != ERR) {
        bg = -1;
      }
    }
    start_color();
    init_pair(1, COLOR_GREEN, bg);
    init_pair(2, COLOR_CYAN, bg);
    init_pair(3, COLOR_WHITE, bg);
    init_pair(4, COLOR_YELLOW, bg);
    init_pair(5, COLOR_MAGENTA, bg);
    init_pair(6, COLOR_BLUE, bg);
    init_pair(7, COLOR_GREEN, bg);
    init_pair(8, COLOR_WHITE, bg);
    init_pair(9, COLOR_RED, bg);
  } else {
    printf("This game is very unplayable without colors.");
    quit(EXIT_FAILURE);
  }
  nl();
  noecho();
  curs_set(0);
  game();
  quit(0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xdd5(%rip),%rdx
call   10f0 <getopt@plt>
mov    %eax,-0x18(%rbp)
mov    0x2da6(%rip),%rcx
cmp    (%rcx),%eax
je     1297 <main+0x97>
mov    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
sub    $0x3f,%eax
je     1284 <main+0x84>
jmp    1256 <main+0x56>
mov    -0x20(%rbp),%eax
sub    $0x68,%eax
je     1284 <main+0x84>
jmp    1267 <main+0x67>
mov    -0x20(%rbp),%eax
sub    $0x74,%eax
jne    1292 <main+0x92>
jmp    1278 <main+0x78>
movl   $0x1,-0x14(%rbp)
jmp    1292 <main+0x92>
mov    $0x0,%al
call   10d0 <usage@plt>
xor    %edi,%edi
call   1110 <exit@plt>
jmp    121d <main+0x1d>
xor    %eax,%eax
mov    %eax,%edi
call   10c0 <time@plt>
mov    %eax,%edi
call   10b0 <srand@plt>
mov    $0x0,%al
call   1080 <initscr@plt>
mov    $0x0,%al
call   1050 <has_colors@plt>
cmp    $0x0,%rax
je     13ca <main+0x1ca>
mov    0x2d12(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     12f8 <main+0xf8>
mov    $0x0,%al
call   1030 <use_default_colors@plt>
mov    0x2d05(%rip),%rcx
cmp    (%rcx),%rax
je     12f3 <main+0xf3>
movl   $0xffffffff,-0x1c(%rbp)
jmp    12f8 <main+0xf8>
mov    $0x0,%al
call   10a0 <start_color@plt>
mov    0x2cc2(%rip),%rax
mov    (%rax),%esi
mov    -0x1c(%rbp),%edx
mov    $0x1,%edi
call   1060 <init_pair@plt>
mov    0x2cb4(%rip),%rax
mov    (%rax),%esi
mov    -0x1c(%rbp),%edx
mov    $0x2,%edi
call   1060 <init_pair@plt>
mov    0x2c7e(%rip),%rax
mov    (%rax),%esi
mov    -0x1c(%rbp),%edx
mov    $0x3,%edi
call   1060 <init_pair@plt>
mov    0x2c60(%rip),%rax
mov    (%rax),%esi
mov    -0x1c(%rbp),%edx
mov    $0x4,%edi
call   1060 <init_pair@plt>
mov    0x2c5a(%rip),%rax
mov    (%rax),%esi
mov    -0x1c(%rbp),%edx
mov    $0x5,%edi
call   1060 <init_pair@plt>
mov    0x2c24(%rip),%rax
mov    (%rax),%esi
mov    -0x1c(%rbp),%edx
mov    $0x6,%edi
call   1060 <init_pair@plt>
mov    0x2c3e(%rip),%rax
mov    (%rax),%esi
mov    -0x1c(%rbp),%edx
mov    $0x7,%edi
call   1060 <init_pair@plt>
mov    0x2c10(%rip),%rax
mov    (%rax),%esi
mov    -0x1c(%rbp),%edx
mov    $0x8,%edi
call   1060 <init_pair@plt>
mov    0x2bda(%rip),%rax
mov    (%rax),%esi
mov    -0x1c(%rbp),%edx
mov    $0x9,%edi
call   1060 <init_pair@plt>
jmp    13e4 <main+0x1e4>
lea    0xc31(%rip),%rdi
call   1070 <printf@plt>
mov    0x2bc3(%rip),%rax
mov    (%rax),%edi
call   1090 <quit@plt>
mov    $0x0,%al
call   1040 <nl@plt>
mov    $0x0,%al
call   1100 <noecho@plt>
xor    %edi,%edi
call   1120 <curs_set@plt>
mov    $0x0,%al
call   10e0 <game@plt>
xor    %edi,%edi
call   1090 <quit@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xdec(%rip),%rdx
call   10f0 <getopt@plt>
mov    0x2dc0(%rip),%r12
xor    %r15d,%r15d
cmp    (%r12),%eax
jne    1335 <main+0x135>
xor    %edi,%edi
call   10c0 <time@plt>
mov    %eax,%edi
call   10b0 <srand@plt>
xor    %eax,%eax
call   1080 <initscr@plt>
xor    %eax,%eax
call   1050 <has_colors@plt>
test   %rax,%rax
je     138a <main+0x18a>
mov    0x2d7f(%rip),%rax
mov    (%rax),%ebx
test   %r15d,%r15d
je     1279 <main+0x79>
xor    %eax,%eax
call   1030 <use_default_colors@plt>
mov    0x2d7a(%rip),%rcx
cmp    (%rcx),%rax
mov    $0xffffffff,%eax
cmovne %eax,%ebx
xor    %eax,%eax
call   10a0 <start_color@plt>
mov    0x2d41(%rip),%r14
mov    (%r14),%esi
mov    $0x1,%edi
mov    %ebx,%edx
call   1060 <init_pair@plt>
mov    0x2d33(%rip),%rax
mov    (%rax),%esi
mov    $0x2,%edi
mov    %ebx,%edx
call   1060 <init_pair@plt>
mov    0x2cfe(%rip),%rbp
mov    0x0(%rbp),%esi
mov    $0x3,%edi
mov    %ebx,%edx
call   1060 <init_pair@plt>
mov    0x2ce0(%rip),%rax
mov    (%rax),%esi
mov    $0x4,%edi
mov    %ebx,%edx
call   1060 <init_pair@plt>
mov    0x2cdb(%rip),%rax
mov    (%rax),%esi
mov    $0x5,%edi
mov    %ebx,%edx
call   1060 <init_pair@plt>
mov    0x2ca6(%rip),%rax
mov    (%rax),%esi
mov    $0x6,%edi
mov    %ebx,%edx
call   1060 <init_pair@plt>
mov    (%r14),%esi
mov    $0x7,%edi
mov    %ebx,%edx
call   1060 <init_pair@plt>
mov    0x0(%rbp),%esi
mov    $0x8,%edi
mov    %ebx,%edx
call   1060 <init_pair@plt>
mov    0x2c6b(%rip),%rax
mov    (%rax),%esi
mov    $0x9,%edi
mov    %ebx,%edx
call   1060 <init_pair@plt>
jmp    13a4 <main+0x1a4>
xor    %r15d,%r15d
lea    0xcc1(%rip),%r14
jmp    136d <main+0x16d>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x1,%r15d
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   10f0 <getopt@plt>
cmp    (%r12),%eax
je     122d <main+0x2d>
cmp    $0x74,%eax
je     1350 <main+0x150>
cmp    $0x3f,%eax
je     137c <main+0x17c>
cmp    $0x68,%eax
jne    1356 <main+0x156>
xor    %eax,%eax
call   10d0 <usage@plt>
xor    %edi,%edi
call   1110 <exit@plt>
lea    0xc71(%rip),%rdi
call   1070 <printf@plt>
mov    0x2c03(%rip),%rax
mov    (%rax),%edi
call   1090 <quit@plt>
xor    %eax,%eax
call   1040 <nl@plt>
xor    %eax,%eax
call   1100 <noecho@plt>
xor    %edi,%edi
call   1120 <curs_set@plt>
xor    %eax,%eax
call   10e0 <game@plt>
xor    %edi,%edi
call   1090 <quit@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"t\00"
@EOF = global i32 0
@COLOR_BLACK = global i32 0
@ERR = global i64 0
@COLOR_GREEN = global i32 0
@COLOR_CYAN = global i32 0
@COLOR_WHITE = global i32 0
@COLOR_YELLOW = global i32 0
@COLOR_MAGENTA = global i32 0
@COLOR_BLUE = global i32 0
@COLOR_RED = global i32 0
@.str.1 = [45 x i8] c"This game is very unplayable without colors.\00"
@EXIT_FAILURE = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
br label %9
9: ; preds = %21, %2
%10 = load i32, i32* %4
%11 = load i8**, i8*** %5
%12 = call i32 @getopt(i32 %10, i8** %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 %12, i32* %7
%13 = load i32, i32* @EOF
%14 = icmp ne i32 %12, %13
br i1 %14, label %15, label %22
15: ; preds = %9
%16 = load i32, i32* %7
switch i32 %16, label %21 [
i32 116, label %17
i32 104, label %18
i32 63, label %18
]
17: ; preds = %15
store i32 1, i32* %6
br label %21
18: ; preds = %15, %15
%19 = call i32 (...) @usage()
%20 = call i32 @exit(i32 0)
unreachable
21: ; preds = %15, %17
br label %9
22: ; preds = %9
%23 = call i32 @time(i32* null)
%24 = call i32 @srand(i32 %23)
%25 = call i32 (...) @initscr()
%26 = call i64 (...) @has_colors()
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %67
28: ; preds = %22
%29 = load i32, i32* @COLOR_BLACK
store i32 %29, i32* %8
%30 = load i32, i32* %6
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %38
32: ; preds = %28
%33 = call i64 (...) @use_default_colors()
%34 = load i64, i64* @ERR
%35 = icmp ne i64 %33, %34
br i1 %35, label %36, label %37
36: ; preds = %32
store i32 -1, i32* %8
br label %37
37: ; preds = %36, %32
br label %38
38: ; preds = %37, %28
%39 = call i32 (...) @start_color()
%40 = load i32, i32* @COLOR_GREEN
%41 = load i32, i32* %8
%42 = call i32 @init_pair(i32 1, i32 %40, i32 %41)
%43 = load i32, i32* @COLOR_CYAN
%44 = load i32, i32* %8
%45 = call i32 @init_pair(i32 2, i32 %43, i32 %44)
%46 = load i32, i32* @COLOR_WHITE
%47 = load i32, i32* %8
%48 = call i32 @init_pair(i32 3, i32 %46, i32 %47)
%49 = load i32, i32* @COLOR_YELLOW
%50 = load i32, i32* %8
%51 = call i32 @init_pair(i32 4, i32 %49, i32 %50)
%52 = load i32, i32* @COLOR_MAGENTA
%53 = load i32, i32* %8
%54 = call i32 @init_pair(i32 5, i32 %52, i32 %53)
%55 = load i32, i32* @COLOR_BLUE
%56 = load i32, i32* %8
%57 = call i32 @init_pair(i32 6, i32 %55, i32 %56)
%58 = load i32, i32* @COLOR_GREEN
%59 = load i32, i32* %8
%60 = call i32 @init_pair(i32 7, i32 %58, i32 %59)
%61 = load i32, i32* @COLOR_WHITE
%62 = load i32, i32* %8
%63 = call i32 @init_pair(i32 8, i32 %61, i32 %62)
%64 = load i32, i32* @COLOR_RED
%65 = load i32, i32* %8
%66 = call i32 @init_pair(i32 9, i32 %64, i32 %65)
br label %71
67: ; preds = %22
%68 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
%69 = load i32, i32* @EXIT_FAILURE
%70 = call i32 @quit(i32 %69)
br label %71
71: ; preds = %67, %38
%72 = call i32 (...) @nl()
%73 = call i32 (...) @noecho()
%74 = call i32 @curs_set(i32 0)
%75 = call i32 (...) @game()
%76 = call i32 @quit(i32 0)
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"t\00"
@EOF = global i32 0
@COLOR_BLACK = global i32 0
@ERR = global i64 0
@COLOR_GREEN = global i32 0
@COLOR_CYAN = global i32 0
@COLOR_WHITE = global i32 0
@COLOR_YELLOW = global i32 0
@COLOR_MAGENTA = global i32 0
@COLOR_BLUE = global i32 0
@COLOR_RED = global i32 0
@.str.1 = [45 x i8] c"This game is very unplayable without colors.\00"
@EXIT_FAILURE = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %18, label %6
6: ; preds = %2, %13
%7 = phi i32 [ %15, %13 ], [ %3, %2 ]
%8 = phi i32 [ %14, %13 ], [ 0, %2 ]
switch i32 %7, label %13 [
i32 116, label %9
i32 104, label %10
i32 63, label %10
]
9: ; preds = %6
br label %13
10: ; preds = %6, %6
%11 = tail call i32 (...) @usage()
%12 = tail call i32 @exit(i32 0)
unreachable
13: ; preds = %6, %9
%14 = phi i32 [ %8, %6 ], [ 1, %9 ]
%15 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%16 = load i32, i32* @EOF
%17 = icmp eq i32 %15, %16
br i1 %17, label %18, label %6
18: ; preds = %13, %2
%19 = phi i32 [ 0, %2 ], [ %14, %13 ]
%20 = tail call i32 @time(i32* null)
%21 = tail call i32 @srand(i32 %20)
%22 = tail call i32 (...) @initscr()
%23 = tail call i64 (...) @has_colors()
%24 = icmp eq i64 %23, 0
br i1 %24, label %54, label %25
25: ; preds = %18
%26 = load i32, i32* @COLOR_BLACK
%27 = icmp eq i32 %19, 0
br i1 %27, label %33, label %28
28: ; preds = %25
%29 = tail call i64 (...) @use_default_colors()
%30 = load i64, i64* @ERR
%31 = icmp eq i64 %29, %30
%32 = select i1 %31, i32 %26, i32 -1
br label %33
33: ; preds = %28, %25
%34 = phi i32 [ %26, %25 ], [ %32, %28 ]
%35 = tail call i32 (...) @start_color()
%36 = load i32, i32* @COLOR_GREEN
%37 = tail call i32 @init_pair(i32 1, i32 %36, i32 %34)
%38 = load i32, i32* @COLOR_CYAN
%39 = tail call i32 @init_pair(i32 2, i32 %38, i32 %34)
%40 = load i32, i32* @COLOR_WHITE
%41 = tail call i32 @init_pair(i32 3, i32 %40, i32 %34)
%42 = load i32, i32* @COLOR_YELLOW
%43 = tail call i32 @init_pair(i32 4, i32 %42, i32 %34)
%44 = load i32, i32* @COLOR_MAGENTA
%45 = tail call i32 @init_pair(i32 5, i32 %44, i32 %34)
%46 = load i32, i32* @COLOR_BLUE
%47 = tail call i32 @init_pair(i32 6, i32 %46, i32 %34)
%48 = load i32, i32* @COLOR_GREEN
%49 = tail call i32 @init_pair(i32 7, i32 %48, i32 %34)
%50 = load i32, i32* @COLOR_WHITE
%51 = tail call i32 @init_pair(i32 8, i32 %50, i32 %34)
%52 = load i32, i32* @COLOR_RED
%53 = tail call i32 @init_pair(i32 9, i32 %52, i32 %34)
br label %58
54: ; preds = %18
%55 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
%56 = load i32, i32* @EXIT_FAILURE
%57 = tail call i32 @quit(i32 %56)
br label %58
58: ; preds = %54, %33
%59 = tail call i32 (...) @nl()
%60 = tail call i32 (...) @noecho()
%61 = tail call i32 @curs_set(i32 0)
%62 = tail call i32 (...) @game()
%63 = tail call i32 @quit(i32 0)
ret i32 0
}