#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*/ draw_track(int /*<<< orphan*/);
int /*<<< orphan*/ endwin();
int getch();
int /*<<< orphan*/ info();
scalar_t__ init();
int /*<<< orphan*/ mvaddstr(int, int, char *);
int /*<<< orphan*/ play();
int main() {
  int ch;
  if (init())
    return 0;
  draw_track(0);
  info();
  do {
    play();
    mvaddstr(15, 31, "Press 'R' to replay");
    mvaddstr(16, 31, "Press 'Q' to quit");
    do {
      ch = getch();
    } while ((ch != 'q') && (ch != 'Q') && (ch != 'r') && (ch != 'R'));
  } while ((ch != 'q') && (ch != 'Q'));
  endwin();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <init@plt>
cmp    $0x0,%rax
je     119c <main+0x2c>
movl   $0x0,-0x4(%rbp)
jmp    1260 <main+0xf0>
xor    %edi,%edi
call   1050 <draw_track@plt>
mov    $0x0,%al
call   1090 <info@plt>
mov    $0x0,%al
call   1030 <play@plt>
mov    $0xf,%edi
mov    $0x1f,%esi
lea    0xe3e(%rip),%rdx
call   1080 <mvaddstr@plt>
mov    $0x10,%edi
mov    $0x1f,%esi
lea    0xe3c(%rip),%rdx
call   1080 <mvaddstr@plt>
mov    $0x0,%al
call   1060 <getch@plt>
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x71,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     121e <main+0xae>
xor    %eax,%eax
cmpl   $0x51,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     121e <main+0xae>
xor    %eax,%eax
cmpl   $0x72,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     121e <main+0xae>
cmpl   $0x52,-0x8(%rbp)
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    11dd <main+0x6d>
jmp    122e <main+0xbe>
xor    %eax,%eax
cmpl   $0x71,-0x8(%rbp)
mov    %al,-0xa(%rbp)
je     1247 <main+0xd7>
cmpl   $0x51,-0x8(%rbp)
setne  %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
test   $0x1,%al
jne    11aa <main+0x3a>
mov    $0x0,%al
call   1070 <endwin@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1040 <init@plt>
test   %rax,%rax
jne    1204 <main+0x94>
xor    %edi,%edi
call   1050 <draw_track@plt>
xor    %eax,%eax
call   1090 <info@plt>
lea    0xe66(%rip),%r14
lea    0xe73(%rip),%r15
movabs $0x300000003,%rbx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <play@plt>
mov    $0xf,%edi
mov    $0x1f,%esi
mov    %r14,%rdx
call   1080 <mvaddstr@plt>
mov    $0x10,%edi
mov    $0x1f,%esi
mov    %r15,%rdx
call   1080 <mvaddstr@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <getch@plt>
lea    -0x51(%rax),%ecx
cmp    $0x21,%ecx
ja     11e0 <main+0x70>
bt     %rcx,%rbx
jae    11e0 <main+0x70>
and    $0xffffffdf,%eax
cmp    $0x51,%eax
jne    11b0 <main+0x40>
xor    %eax,%eax
call   1070 <endwin@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Press 'R' to replay\00"
@.str.1 = [18 x i8] c"Press 'Q' to quit\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i64 (...) @init()
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %0
store i32 0, i32* %1
br label %40
6: ; preds = %0
%7 = call i32 @draw_track(i32 0)
%8 = call i32 (...) @info()
br label %9
9: ; preds = %36, %6
%10 = call i32 (...) @play()
%11 = call i32 @mvaddstr(i32 15, i32 31, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @mvaddstr(i32 16, i32 31, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %27, %9
%14 = call i32 (...) @getch()
store i32 %14, i32* %2
br label %15
15: ; preds = %13
%16 = load i32, i32* %2
%17 = icmp ne i32 %16, 113
br i1 %17, label %18, label %27
18: ; preds = %15
%19 = load i32, i32* %2
%20 = icmp ne i32 %19, 81
br i1 %20, label %21, label %27
21: ; preds = %18
%22 = load i32, i32* %2
%23 = icmp ne i32 %22, 114
br i1 %23, label %24, label %27
24: ; preds = %21
%25 = load i32, i32* %2
%26 = icmp ne i32 %25, 82
br label %27
27: ; preds = %24, %21, %18, %15
%28 = phi i1 [ false, %21 ], [ false, %18 ], [ false, %15 ], [ %26, %24 ]
br i1 %28, label %13, label %29
29: ; preds = %27
br label %30
30: ; preds = %29
%31 = load i32, i32* %2
%32 = icmp ne i32 %31, 113
br i1 %32, label %33, label %36
33: ; preds = %30
%34 = load i32, i32* %2
%35 = icmp ne i32 %34, 81
br label %36
36: ; preds = %33, %30
%37 = phi i1 [ false, %30 ], [ %35, %33 ]
br i1 %37, label %9, label %38
38: ; preds = %36
%39 = call i32 (...) @endwin()
store i32 0, i32* %1
br label %40
40: ; preds = %38, %5
%41 = load i32, i32* %1
ret i32 %41
}

LLVM IR (-O2):
@.str = [20 x i8] c"Press 'R' to replay\00"
@.str.1 = [18 x i8] c"Press 'Q' to quit\00"
define i32 @main() {
%1 = tail call i64 (...) @init()
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %17
3: ; preds = %0
%4 = tail call i32 @draw_track(i32 0)
%5 = tail call i32 (...) @info()
br label %6
6: ; preds = %12, %3
%7 = tail call i32 (...) @play()
%8 = tail call i32 @mvaddstr(i32 15, i32 31, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @mvaddstr(i32 16, i32 31, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %10, %6
%11 = tail call i32 (...) @getch()
switch i32 %11, label %10 [
i32 114, label %12
i32 113, label %12
i32 82, label %12
i32 81, label %12
]
12: ; preds = %10, %10, %10, %10
%13 = and i32 %11, -33
%14 = icmp eq i32 %13, 81
br i1 %14, label %15, label %6
15: ; preds = %12
%16 = tail call i32 (...) @endwin()
br label %17
17: ; preds = %0, %15
ret i32 0
}