#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*/ battle(int, int, char *, char *);
int /*<<< orphan*/ edit(int, int, char *);
int getch();
int /*<<< orphan*/ map(int, int, char *);
int /*<<< orphan*/ map_print(int, int, char *);
int /*<<< orphan*/ move_d(int, int, int, char *);
int /*<<< orphan*/ move_r(int, int, int, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ system(char *);
main() {
  int order_r, order_c;
  order_r = 10;
  order_c = 10;
  int p;
  p = (order_r * order_c) - 1;
  char matrix[p];
  printf("\nMONSTER WARS\n");
  printf("Welcome To NewFound Town");
  char name[1000];
  printf("\nWhat's Your Name?");
  scanf("%s", name);
  getch();
  map(10, 10, matrix);
  printf("\nStart Game?\n");
  system("cls");
  edit(order_r, order_c, matrix);
  map_print(order_r, order_c, matrix);
  getch();
  int c, i;
  i = 0;
  while (i >= 0) {
    if ((c = getch()) == 'd') {
      system("cls");
      move_r(order_r, order_c, i, matrix);
      map_print(order_r, order_c, matrix);
      ++i;
    } else if ((c = getch()) == 's') {
      system("cls");
      move_d(order_r, order_c, i, matrix);
      map_print(order_r, order_c, matrix);
      ++i;
    }
  }
  char opp[] = "Pika";
  int mystat = 10;
  int pikastat = 10;
  battle(mystat, pikastat, name, opp);
  getch();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0xa,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
imul   %ecx,%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x430(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
lea    0xe01(%rip),%rdi
call   1060 <printf@plt>
lea    0xe04(%rip),%rdi
call   1060 <printf@plt>
lea    0xe11(%rip),%rdi
call   1060 <printf@plt>
lea    -0x410(%rbp),%rsi
lea    0xe11(%rip),%rdi
call   1090 <scanf@plt>
mov    $0x0,%al
call   10a0 <getch@plt>
mov    -0x430(%rbp),%rdx
mov    $0xa,%esi
mov    %esi,%edi
call   1070 <map@plt>
lea    0xdee(%rip),%rdi
call   1060 <printf@plt>
lea    0xdf0(%rip),%rdi
call   1050 <system@plt>
mov    -0x430(%rbp),%rdx
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <edit@plt>
mov    -0x430(%rbp),%rdx
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1080 <map_print@plt>
mov    $0x0,%al
call   10a0 <getch@plt>
movl   $0x0,-0x418(%rbp)
cmpl   $0x0,-0x418(%rbp)
jl     1368 <main+0x1c8>
mov    $0x0,%al
call   10a0 <getch@plt>
mov    %eax,-0x414(%rbp)
cmp    $0x64,%eax
jne    1303 <main+0x163>
lea    0xd8c(%rip),%rdi
call   1050 <system@plt>
mov    -0x430(%rbp),%rcx
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x418(%rbp),%edx
call   10b0 <move_r@plt>
mov    -0x430(%rbp),%rdx
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1080 <map_print@plt>
mov    -0x418(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x418(%rbp)
jmp    1363 <main+0x1c3>
mov    $0x0,%al
call   10a0 <getch@plt>
mov    %eax,-0x414(%rbp)
cmp    $0x73,%eax
jne    135e <main+0x1be>
lea    0xd2c(%rip),%rdi
call   1050 <system@plt>
mov    -0x430(%rbp),%rcx
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x418(%rbp),%edx
call   1040 <move_d@plt>
mov    -0x430(%rbp),%rdx
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1080 <map_print@plt>
mov    -0x418(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x418(%rbp)
jmp    1363 <main+0x1c3>
jmp    1296 <main+0xf6>
mov    0xce2(%rip),%eax
mov    %eax,-0x41d(%rbp)
mov    0xcda(%rip),%al
mov    %al,-0x419(%rbp)
movl   $0xa,-0x424(%rbp)
movl   $0xa,-0x428(%rbp)
mov    -0x424(%rbp),%edi
mov    -0x428(%rbp),%esi
lea    -0x410(%rbp),%rdx
lea    -0x41d(%rbp),%rcx
call   10c0 <battle@plt>
mov    $0x0,%al
call   10a0 <getch@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x460,%rsp
lea    0xe81(%rip),%rdi
call   1030 <puts@plt>
lea    0xe42(%rip),%rdi
call   1070 <printf@plt>
lea    0xe4f(%rip),%rdi
call   1070 <printf@plt>
lea    0xe56(%rip),%rdi
lea    0x70(%rsp),%rsi
call   10a0 <scanf@plt>
xor    %eax,%eax
call   10b0 <getch@plt>
mov    %rsp,%rbx
mov    $0xa,%edi
mov    $0xa,%esi
mov    %rbx,%rdx
call   1080 <map@plt>
lea    0xe3e(%rip),%rdi
call   1030 <puts@plt>
lea    0xe20(%rip),%r14
mov    %r14,%rdi
call   1060 <system@plt>
mov    $0xa,%edi
mov    $0xa,%esi
mov    %rbx,%rdx
call   1040 <edit@plt>
mov    $0xa,%edi
mov    $0xa,%esi
mov    %rbx,%rdx
call   1090 <map_print@plt>
xor    %eax,%eax
call   10b0 <getch@plt>
xor    %ebp,%ebp
jmp    1280 <main+0xe0>
mov    %r14,%rdi
call   1060 <system@plt>
mov    $0xa,%edi
mov    $0xa,%esi
mov    %ebp,%edx
mov    %rbx,%rcx
call   10c0 <move_r@plt>
mov    $0xa,%edi
mov    $0xa,%esi
mov    %rbx,%rdx
call   1090 <map_print@plt>
add    $0x1,%ebp
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10b0 <getch@plt>
cmp    $0x64,%eax
je     1246 <main+0xa6>
xor    %eax,%eax
call   10b0 <getch@plt>
cmp    $0x73,%eax
jne    1280 <main+0xe0>
mov    %r14,%rdi
call   1060 <system@plt>
mov    $0xa,%edi
mov    $0xa,%esi
mov    %ebp,%edx
mov    %rbx,%rcx
call   1050 <move_d@plt>
jmp    1262 <main+0xc2>

LLVM IR (-O0):
@.str = [15 x i8] c"\0AMONSTER WARS\0A\00"
@.str.1 = [25 x i8] c"Welcome To NewFound Town\00"
@.str.2 = [19 x i8] c"\0AWhat's Your Name?\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [14 x i8] c"\0AStart Game?\0A\00"
@.str.5 = [4 x i8] c"cls\00"
@__const.main.opp = [5 x i8] c"Pika\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca [1000 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca [5 x i8]
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %2
store i32 10, i32* %3
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = mul nsw i32 %13, %14
%16 = sub nsw i32 %15, 1
store i32 %16, i32* %4
%17 = load i32, i32* %4
%18 = zext i32 %17 to i64
%19 = call i8* @llvm.stacksave()
store i8* %19, i8** %5
%20 = alloca i8, i64 %18
store i64 %18, i64* %6
%21 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%22 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%23 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%24 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 0
%25 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %24)
%26 = call i32 (...) @getch()
%27 = call i32 @map(i32 10, i32 10, i8* %20)
%28 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%29 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%30 = load i32, i32* %2
%31 = load i32, i32* %3
%32 = call i32 @edit(i32 %30, i32 %31, i8* %20)
%33 = load i32, i32* %2
%34 = load i32, i32* %3
%35 = call i32 @map_print(i32 %33, i32 %34, i8* %20)
%36 = call i32 (...) @getch()
store i32 0, i32* %9
br label %37
37: ; preds = %69, %0
%38 = load i32, i32* %9
%39 = icmp sge i32 %38, 0
br i1 %39, label %40, label %70
40: ; preds = %37
%41 = call i32 (...) @getch()
store i32 %41, i32* %8
%42 = icmp eq i32 %41, 100
br i1 %42, label %43, label %54
43: ; preds = %40
%44 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%45 = load i32, i32* %2
%46 = load i32, i32* %3
%47 = load i32, i32* %9
%48 = call i32 @move_r(i32 %45, i32 %46, i32 %47, i8* %20)
%49 = load i32, i32* %2
%50 = load i32, i32* %3
%51 = call i32 @map_print(i32 %49, i32 %50, i8* %20)
%52 = load i32, i32* %9
%53 = add nsw i32 %52, 1
store i32 %53, i32* %9
br label %69
54: ; preds = %40
%55 = call i32 (...) @getch()
store i32 %55, i32* %8
%56 = icmp eq i32 %55, 115
br i1 %56, label %57, label %68
57: ; preds = %54
%58 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%59 = load i32, i32* %2
%60 = load i32, i32* %3
%61 = load i32, i32* %9
%62 = call i32 @move_d(i32 %59, i32 %60, i32 %61, i8* %20)
%63 = load i32, i32* %2
%64 = load i32, i32* %3
%65 = call i32 @map_print(i32 %63, i32 %64, i8* %20)
%66 = load i32, i32* %9
%67 = add nsw i32 %66, 1
store i32 %67, i32* %9
br label %68
68: ; preds = %57, %54
br label %69
69: ; preds = %68, %43
br label %37
70: ; preds = %37
%71 = bitcast [5 x i8]* %10 to i8*
store i32 10, i32* %11
store i32 10, i32* %12
%72 = load i32, i32* %11
%73 = load i32, i32* %12
%74 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 0
%75 = getelementptr inbounds [5 x i8], [5 x i8]* %10, i64 0, i64 0
%76 = call i32 @battle(i32 %72, i32 %73, i8* %74, i8* %75)
%77 = call i32 (...) @getch()
%78 = load i8*, i8** %5
%79 = load i32, i32* %1
ret i32 %79
}

LLVM IR (-O2):
@.str.1 = [25 x i8] c"Welcome To NewFound Town\00"
@.str.2 = [19 x i8] c"\0AWhat's Your Name?\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.5 = [4 x i8] c"cls\00"
@str = [14 x i8] c"\0AMONSTER WARS\00"
@str.6 = [13 x i8] c"\0AStart Game?\00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = alloca [99 x i8]
%3 = getelementptr inbounds [99 x i8], [99 x i8]* %2, i64 0, i64 0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%6 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %6)
%9 = call i32 (...) @getch()
%10 = call i32 @map(i32 10, i32 10, i8* %3)
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.6, i64 0, i64 0))
%12 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%13 = call i32 @edit(i32 10, i32 10, i8* %3)
%14 = call i32 @map_print(i32 10, i32 10, i8* %3)
%15 = call i32 (...) @getch()
br label %16
16: ; preds = %30, %0
%17 = phi i32 [ %32, %30 ], [ 0, %0 ]
br label %18
18: ; preds = %16, %24
%19 = call i32 (...) @getch()
%20 = icmp eq i32 %19, 100
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%23 = call i32 @move_r(i32 10, i32 10, i32 %17, i8* %3)
br label %30
24: ; preds = %18
%25 = call i32 (...) @getch()
%26 = icmp eq i32 %25, 115
br i1 %26, label %27, label %18
27: ; preds = %24
%28 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%29 = call i32 @move_d(i32 10, i32 10, i32 %17, i8* %3)
br label %30
30: ; preds = %21, %27
%31 = call i32 @map_print(i32 10, i32 10, i8* %3)
%32 = add nuw nsw i32 %17, 1
br label %16
}