#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*/ drawbox(int **, char *, int);
int endgame(int **, char *, int *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ intro();
scalar_t__ playmore();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ setup(int **, char *);
scalar_t__ shoot(int, char *, char *, int **);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  int board[8 + 2][8 + 2], ray, score, done;
  char hints[8 * 4];
  char token;
  srand(time(NULL));
  intro();
  do {
    setup(board, hints);
    token = 'a';
    score = 0;
    done = 0;
    do {
      drawbox(board, hints, 1);
      printf("Ray # ? ");
      scanf("%d", &ray);
      if (ray && ray < 4 * 8)
        score += shoot(ray, hints, &token, board);
      if (!ray)
        done = endgame(board, hints, &score);
    } while (!done);
  } while (playmore());
  puts("Goodbye!");
  puts(
      "\n\n\n\n\n\n\n\n\tCymon's Games\n\n\thttp://WWW.CYMONSGAMES.COM\n\n\n"
      "   This game and its code is a 2008 Cymon's Games game.\n"
      "   If you have enjoyed this game or would just like to have a new game\n"
      "   each week please visit:\n"
      "   http://WWW.CYMONSGAMES.COM for C/C++ programming resources and "
      "programs\n"
      "   for everyone, beginners and advanced users alike.\n\n");
  printf("\n\tPress ENTER to continue...\n\n\n\n\n\n");
  getchar();
  getchar();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1e0,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <time@plt>
mov    %eax,%edi
call   1080 <srand@plt>
mov    $0x0,%al
call   1040 <intro@plt>
lea    -0x1a0(%rbp),%rdi
lea    -0x1d0(%rbp),%rsi
call   10f0 <setup@plt>
movb   $0x61,-0x1d1(%rbp)
movl   $0x0,-0x1a8(%rbp)
movl   $0x0,-0x1ac(%rbp)
lea    -0x1a0(%rbp),%rdi
lea    -0x1d0(%rbp),%rsi
mov    $0x1,%edx
call   10c0 <drawbox@plt>
lea    0xdba(%rip),%rdi
call   1070 <printf@plt>
lea    0xdb7(%rip),%rdi
lea    -0x1a4(%rbp),%rsi
call   10d0 <scanf@plt>
cmpl   $0x0,-0x1a4(%rbp)
je     12ab <main+0xdb>
cmpl   $0x20,-0x1a4(%rbp)
jge    12ab <main+0xdb>
mov    -0x1a4(%rbp),%edi
lea    -0x1d0(%rbp),%rsi
lea    -0x1a0(%rbp),%rcx
lea    -0x1d1(%rbp),%rdx
call   1060 <shoot@plt>
mov    %rax,%rcx
movslq -0x1a8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x1a8(%rbp)
cmpl   $0x0,-0x1a4(%rbp)
jne    12d8 <main+0x108>
lea    -0x1a0(%rbp),%rdi
lea    -0x1d0(%rbp),%rsi
lea    -0x1a8(%rbp),%rdx
call   1030 <endgame@plt>
mov    %eax,-0x1ac(%rbp)
jmp    12dd <main+0x10d>
cmpl   $0x0,-0x1ac(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1227 <main+0x57>
jmp    12f6 <main+0x126>
mov    $0x0,%al
call   10b0 <playmore@plt>
cmp    $0x0,%rax
jne    11f9 <main+0x29>
lea    0xcfe(%rip),%rdi
call   1050 <puts@plt>
lea    0xcfb(%rip),%rdi
call   1050 <puts@plt>
lea    0xe41(%rip),%rdi
call   1070 <printf@plt>
mov    $0x0,%al
call   1090 <getchar@plt>
mov    $0x0,%al
call   1090 <getchar@plt>
xor    %edi,%edi
call   10e0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1c8,%rsp
xor    %edi,%edi
call   10a0 <time@plt>
mov    %eax,%edi
call   1080 <srand@plt>
xor    %eax,%eax
call   1040 <intro@plt>
lea    0x30(%rsp),%r14
lea    0x10(%rsp),%rbx
lea    0xdf9(%rip),%r15
lea    0xdfb(%rip),%r12
lea    0xc(%rsp),%r13
lea    0x7(%rsp),%rbp
jmp    1230 <main+0x60>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10b0 <playmore@plt>
test   %rax,%rax
je     12b2 <main+0xe2>
mov    %r14,%rdi
mov    %rbx,%rsi
call   10f0 <setup@plt>
movb   $0x61,0x7(%rsp)
movl   $0x0,0x8(%rsp)
jmp    1254 <main+0x84>
nopw   0x0(%rax,%rax,1)
test   %eax,%eax
jne    1220 <main+0x50>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
call   10c0 <drawbox@plt>
mov    %r15,%rdi
call   1070 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   10d0 <scanf@plt>
mov    0xc(%rsp),%edi
test   %edi,%edi
je     129a <main+0xca>
cmp    $0x1f,%edi
jg     129a <main+0xca>
mov    %rbx,%rsi
mov    %rbp,%rdx
mov    %r14,%rcx
call   1060 <shoot@plt>
add    %eax,0x8(%rsp)
mov    0xc(%rsp),%edi
xor    %eax,%eax
test   %edi,%edi
jne    1250 <main+0x80>
mov    %r14,%rdi
mov    %rbx,%rsi
lea    0x8(%rsp),%rdx
call   1030 <endgame@plt>
jmp    1250 <main+0x80>
lea    0xd53(%rip),%rdi
call   1050 <puts@plt>
lea    0xd50(%rip),%rdi
call   1050 <puts@plt>
lea    0xe96(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   1090 <getchar@plt>
xor    %eax,%eax
call   1090 <getchar@plt>
xor    %edi,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"Ray # ? \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [9 x i8] c"Goodbye!\00"
@.str.3 = [338 x i8] c"\0A\0A\0A\0A\0A\0A\0A\0A\09Cymon's Games\0A\0A\09http://WWW.CYMONSGAMES.COM\0A\0A\0A This game and its code is a 2008 Cymon's Games game.\0A If you have enjoyed this game or would just like to have a new game\0A each week please visit:\0A http://WWW.CYMONSGAMES.COM for C/C++ programming resources and programs\0A for everyone, beginners and advanced users alike.\0A\0A\00"
@.str.4 = [35 x i8] c"\0A\09Press ENTER to continue...\0A\0A\0A\0A\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x [10 x i32]]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [32 x i8]
%7 = alloca i8
store i32 0, i32* %1
%8 = call i32 @time(i32* null)
%9 = call i32 @srand(i32 %8)
%10 = call i32 (...) @intro()
br label %11
11: ; preds = %52, %0
%12 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %2, i64 0, i64 0
%13 = bitcast [10 x i32]* %12 to i32**
%14 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%15 = call i32 @setup(i32** %13, i8* %14)
store i8 97, i8* %7
store i32 0, i32* %4
store i32 0, i32* %5
br label %16
16: ; preds = %47, %11
%17 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %2, i64 0, i64 0
%18 = bitcast [10 x i32]* %17 to i32**
%19 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%20 = call i32 @drawbox(i32** %18, i8* %19, i32 1)
%21 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%23 = load i32, i32* %3
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %38
25: ; preds = %16
%26 = load i32, i32* %3
%27 = icmp slt i32 %26, 32
br i1 %27, label %28, label %38
28: ; preds = %25
%29 = load i32, i32* %3
%30 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%31 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %2, i64 0, i64 0
%32 = bitcast [10 x i32]* %31 to i32**
%33 = call i64 @shoot(i32 %29, i8* %30, i8* %7, i32** %32)
%34 = load i32, i32* %4
%35 = sext i32 %34 to i64
%36 = add nsw i64 %35, %33
%37 = trunc i64 %36 to i32
store i32 %37, i32* %4
br label %38
38: ; preds = %28, %25, %16
%39 = load i32, i32* %3
%40 = icmp ne i32 %39, 0
br i1 %40, label %46, label %41
41: ; preds = %38
%42 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %2, i64 0, i64 0
%43 = bitcast [10 x i32]* %42 to i32**
%44 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%45 = call i32 @endgame(i32** %43, i8* %44, i32* %4)
store i32 %45, i32* %5
br label %46
46: ; preds = %41, %38
br label %47
47: ; preds = %46
%48 = load i32, i32* %5
%49 = icmp ne i32 %48, 0
%50 = xor i1 %49, true
br i1 %50, label %16, label %51
51: ; preds = %47
br label %52
52: ; preds = %51
%53 = call i64 (...) @playmore()
%54 = icmp ne i64 %53, 0
br i1 %54, label %11, label %55
55: ; preds = %52
%56 = call i32 @puts(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%57 = call i32 @puts(i8* getelementptr inbounds ([338 x i8], [338 x i8]* @.str.3, i64 0, i64 0))
%58 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0))
%59 = call i32 (...) @getchar()
%60 = call i32 (...) @getchar()
%61 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [9 x i8] c"Ray # ? \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [9 x i8] c"Goodbye!\00"
@.str.3 = [338 x i8] c"\0A\0A\0A\0A\0A\0A\0A\0A\09Cymon's Games\0A\0A\09http://WWW.CYMONSGAMES.COM\0A\0A\0A This game and its code is a 2008 Cymon's Games game.\0A If you have enjoyed this game or would just like to have a new game\0A each week please visit:\0A http://WWW.CYMONSGAMES.COM for C/C++ programming resources and programs\0A for everyone, beginners and advanced users alike.\0A\0A\00"
@str = [34 x i8] c"\0A\09Press ENTER to continue...\0A\0A\0A\0A\0A\00"
define i32 @main() {
%1 = alloca [10 x [10 x i32]]
%2 = alloca i32
%3 = alloca i32
%4 = alloca [32 x i8]
%5 = alloca i8
%6 = bitcast [10 x [10 x i32]]* %1 to i8*
%7 = bitcast i32* %2 to i8*
%8 = bitcast i32* %3 to i8*
%9 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%10 = tail call i32 @time(i32* null)
%11 = tail call i32 @srand(i32 %10)
%12 = tail call i32 (...) @intro()
%13 = bitcast [10 x [10 x i32]]* %1 to i32**
br label %14
14: ; preds = %38, %0
%15 = call i32 @setup(i32** %13, i8* %9)
store i8 97, i8* %5
store i32 0, i32* %3
br label %16
16: ; preds = %35, %14
%17 = call i32 @drawbox(i32** %13, i8* %9, i32 1)
%18 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%20 = load i32, i32* %2
%21 = icmp ne i32 %20, 0
%22 = icmp slt i32 %20, 32
%23 = and i1 %21, %22
br i1 %23, label %24, label %30
24: ; preds = %16
%25 = call i64 @shoot(i32 %20, i8* %9, i8* %5, i32** %13)
%26 = load i32, i32* %3
%27 = trunc i64 %25 to i32
%28 = add i32 %26, %27
store i32 %28, i32* %3
%29 = load i32, i32* %2
br label %30
30: ; preds = %24, %16
%31 = phi i32 [ %29, %24 ], [ %20, %16 ]
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = call i32 @endgame(i32** %13, i8* %9, i32* %3)
br label %35
35: ; preds = %30, %33
%36 = phi i32 [ 0, %30 ], [ %34, %33 ]
%37 = icmp eq i32 %36, 0
br i1 %37, label %16, label %38
38: ; preds = %35
%39 = call i64 (...) @playmore()
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %14
41: ; preds = %38
%42 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([338 x i8], [338 x i8]* @.str.3, i64 0, i64 0))
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%45 = call i32 (...) @getchar()
%46 = call i32 (...) @getchar()
%47 = call i32 @exit(i32 0)
unreachable
}