#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 *dist(int *);
int /*<<< orphan*/ inky(int *, int *, char **, int *);
int *malloc(int);
int main(int argc, const char *argv[]) {
  char maze[23][30] = {{'0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
                        '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
                        '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'},
                       {'0', ' ', ' ', ' ', ' ', ' ', '7', ' ', ' ', ' ',
                        ' ', ' ', ' ', ' ', '0', ' ', ' ', ' ', ' ', ' ',
                        ' ', ' ', '7', ' ', ' ', ' ', ' ', ' ', ' ', '0'},
                       {'0', ' ', '0', '0', '0', '0', ' ', '0', '0', '0',
                        '0', '0', '0', ' ', '0', ' ', '0', '0', '0', '0',
                        '0', '0', ' ', '0', '0', '0', '0', '0', ' ', '0'},
                       {'0', ' ', '0', '0', '0', '0', ' ', '0', '0', '0',
                        '0', '0', '0', ' ', '0', ' ', '0', '0', '0', '0',
                        '0', '0', ' ', '0', '0', '0', '0', '0', ' ', '0'},
                       {'0', '7', ' ', ' ', ' ', ' ', '7', ' ', ' ', ' ',
                        ' ', ' ', ' ', '7', ' ', '7', ' ', ' ', ' ', ' ',
                        ' ', ' ', '7', ' ', ' ', ' ', ' ', ' ', '7', '0'},
                       {'0', ' ', '0', '0', '0', '0', ' ', '0', ' ', '0',
                        '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
                        ' ', '0', ' ', '0', '0', '0', '0', '0', ' ', '0'},
                       {'0', ' ', ' ', ' ', ' ', ' ', '7', '0', ' ', ' ',
                        ' ', ' ', ' ', ' ', '0', ' ', ' ', ' ', ' ', ' ',
                        ' ', '0', '7', ' ', ' ', ' ', ' ', ' ', ' ', '0'},
                       {'0', ' ', '0', '0', '0', '0', ' ', '0', '0', '0',
                        '0', '0', '0', ' ', '0', ' ', '0', '0', '0', '0',
                        '0', '0', ' ', '0', '0', '0', '0', '0', ' ', '0'},
                       {'0', ' ', '0', '0', '0', '0', ' ', '0', ' ', ' ',
                        ' ', ' ', ' ', '6', ' ', '6', ' ', ' ', ' ', ' ',
                        ' ', '0', ' ', '0', '0', '0', '0', '0', ' ', '0'},
                       {'0', ' ', '0', '0', '0', '0', ' ', '0', ' ', '0',
                        '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
                        ' ', '0', ' ', '0', '0', '0', '0', '0', ' ', '0'},
                       {'0', ' ', '0', '0', '0', '0', ' ', ' ', '7', '0',
                        '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
                        '7', ' ', ' ', '0', '0', '0', '0', '0', ' ', '0'},
                       {'0', ' ', '0', '0', '0', '0', ' ', '0', ' ', '0',
                        '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
                        ' ', '0', ' ', '0', '0', '0', '0', '0', ' ', '0'},
                       {'0', ' ', '0', '0', '0', '0', ' ', '0', ' ', '0',
                        '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
                        ' ', '0', ' ', '0', '0', '0', '0', '0', ' ', '0'},
                       {'0', ' ', '0', '0', '0', '0', ' ', '0', '7', ' ',
                        ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
                        '7', '0', ' ', '0', '0', '0', '0', '0', ' ', '0'},
                       {'0', ' ', '0', '0', '0', '0', ' ', '0', ' ', '0',
                        '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
                        ' ', '0', ' ', '0', '0', '0', '0', '0', ' ', '0'},
                       {'0', ' ', ' ', ' ', ' ', ' ', '7', ' ', '7', ' ',
                        ' ', ' ', ' ', ' ', '0', ' ', ' ', ' ', ' ', ' ',
                        '7', ' ', '7', ' ', ' ', ' ', ' ', ' ', ' ', '0'},
                       {'0', ' ', '0', '0', '0', '0', ' ', '0', '0', '0',
                        '0', '0', '0', ' ', '0', ' ', '0', '0', '0', '0',
                        '0', '0', ' ', '0', '0', '0', '0', '0', ' ', '0'},
                       {'0', '7', ' ', ' ', ' ', ' ', '7', ' ', '7', ' ',
                        ' ', ' ', ' ', '6', ' ', '6', ' ', ' ', ' ', ' ',
                        '7', ' ', '7', '0', ' ', ' ', ' ', ' ', '7', '0'},
                       {'0', ' ', '0', '0', '0', '0', ' ', '0', ' ', '0',
                        '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
                        ' ', '0', ' ', '0', ' ', '0', '0', '0', ' ', '0'},
                       {'0', '7', ' ', ' ', ' ', ' ', ' ', '0', ' ', ' ',
                        ' ', ' ', ' ', ' ', '0', ' ', ' ', ' ', ' ', ' ',
                        ' ', '0', ' ', ' ', '7', ' ', ' ', ' ', '7', '0'},
                       {'0', ' ', '0', '0', '0', '0', '0', '0', '0', '0',
                        '0', '0', '0', ' ', '0', ' ', '0', '0', '0', '0',
                        '0', '0', '0', '0', '0', '0', '0', '0', ' ', '0'},
                       {'0', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
                        ' ', ' ', ' ', '7', ' ', '7', ' ', ' ', ' ', ' ',
                        ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '0'},
                       {'0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
                        '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
                        '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'}};
  int red[3], pacman[3], *dis, ghost[3];
  dis = malloc(sizeof(int) * 2);
  red[0] = 4;
  red[1] = 2;
  red[2] = 2;
  pacman[0] = 4;
  pacman[1] = 7;
  pacman[2] = 2;
  ghost[0] = 1;
  ghost[1] = 1;
  ghost[2] = 2;
  dis = dist(pacman);
  inky(dis, red, maze, ghost);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x300,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x2d0(%rbp),%rdi
lea    0xe99(%rip),%rsi
mov    $0x2b2,%edx
call   1040 <memcpy@plt>
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,-0x2f0(%rbp)
movl   $0x4,-0x2dc(%rbp)
movl   $0x2,-0x2d8(%rbp)
movl   $0x2,-0x2d4(%rbp)
movl   $0x4,-0x2e8(%rbp)
movl   $0x7,-0x2e4(%rbp)
movl   $0x2,-0x2e0(%rbp)
movl   $0x1,-0x2fc(%rbp)
movl   $0x1,-0x2f8(%rbp)
movl   $0x2,-0x2f4(%rbp)
lea    -0x2e8(%rbp),%rdi
call   1060 <dist@plt>
mov    %rax,-0x2f0(%rbp)
mov    -0x2f0(%rbp),%rdi
lea    -0x2dc(%rbp),%rsi
lea    -0x2d0(%rbp),%rdx
lea    -0x2fc(%rbp),%rcx
call   1030 <inky@plt>
xor    %eax,%eax
add    $0x300,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x2f0,%rsp
lea    0xeb1(%rip),%rsi
lea    0x30(%rsp),%rbx
mov    $0x2b2,%edx
mov    %rbx,%rdi
call   1040 <memcpy@plt>
mov    $0x8,%edi
call   1050 <malloc@plt>
movabs $0x200000004,%rax
mov    %rax,0x24(%rsp)
movl   $0x2,0x2c(%rsp)
movabs $0x700000004,%rax
mov    %rax,0x18(%rsp)
movl   $0x2,0x20(%rsp)
movabs $0x100000001,%rax
mov    %rax,0xc(%rsp)
movl   $0x2,0x14(%rsp)
lea    0x18(%rsp),%rdi
call   1060 <dist@plt>
lea    0x24(%rsp),%rsi
lea    0xc(%rsp),%rcx
mov    %rax,%rdi
mov    %rbx,%rdx
call   1030 <inky@plt>
xor    %eax,%eax
add    $0x2f0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.maze = [23 x [30 x i8]] [[30 x i8] c"000000000000000000000000000000", [30 x i8] c"0 7 0 7 0", [30 x i8] c"0 0000 000000 0 000000 00000 0", [30 x i8] c"0 0000 000000 0 000000 00000 0", [30 x i8] c"07 7 7 7 7 70", [30 x i8] c"0 0000 0 00000000000 0 00000 0", [30 x i8] c"0 70 0 07 0", [30 x i8] c"0 0000 000000 0 000000 00000 0", [30 x i8] c"0 0000 0 6 6 0 00000 0", [30 x i8] c"0 0000 0 00000000000 0 00000 0", [30 x i8] c"0 0000 7000000000007 00000 0", [30 x i8] c"0 0000 0 00000000000 0 00000 0", [30 x i8] c"0 0000 0 00000000000 0 00000 0", [30 x i8] c"0 0000 07 70 00000 0", [30 x i8] c"0 0000 0 00000000000 0 00000 0", [30 x i8] c"0 7 7 0 7 7 0", [30 x i8] c"0 0000 000000 0 000000 00000 0", [30 x i8] c"07 7 7 6 6 7 70 70", [30 x i8] c"0 0000 0 00000000000 0 0 000 0", [30 x i8] c"07 0 0 0 7 70", [30 x i8] c"0 00000000000 0 000000000000 0", [30 x i8] c"0 7 7 0", [30 x i8] c"000000000000000000000000000000"]
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [23 x [30 x i8]]
%7 = alloca [3 x i32]
%8 = alloca [3 x i32]
%9 = alloca i32*
%10 = alloca [3 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = bitcast [23 x [30 x i8]]* %6 to i8*
%12 = call i32* @malloc(i32 8)
store i32* %12, i32** %9
%13 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
store i32 4, i32* %13
%14 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 1
store i32 2, i32* %14
%15 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 2
store i32 2, i32* %15
%16 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 0
store i32 4, i32* %16
%17 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 1
store i32 7, i32* %17
%18 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 2
store i32 2, i32* %18
%19 = getelementptr inbounds [3 x i32], [3 x i32]* %10, i64 0, i64 0
store i32 1, i32* %19
%20 = getelementptr inbounds [3 x i32], [3 x i32]* %10, i64 0, i64 1
store i32 1, i32* %20
%21 = getelementptr inbounds [3 x i32], [3 x i32]* %10, i64 0, i64 2
store i32 2, i32* %21
%22 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 0
%23 = call i32* @dist(i32* %22)
store i32* %23, i32** %9
%24 = load i32*, i32** %9
%25 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
%26 = getelementptr inbounds [23 x [30 x i8]], [23 x [30 x i8]]* %6, i64 0, i64 0
%27 = bitcast [30 x i8]* %26 to i8**
%28 = getelementptr inbounds [3 x i32], [3 x i32]* %10, i64 0, i64 0
%29 = call i32 @inky(i32* %24, i32* %25, i8** %27, i32* %28)
ret i32 0
}

LLVM IR (-O2):
@__const.main.maze = [23 x [30 x i8]] [[30 x i8] c"000000000000000000000000000000", [30 x i8] c"0 7 0 7 0", [30 x i8] c"0 0000 000000 0 000000 00000 0", [30 x i8] c"0 0000 000000 0 000000 00000 0", [30 x i8] c"07 7 7 7 7 70", [30 x i8] c"0 0000 0 00000000000 0 00000 0", [30 x i8] c"0 70 0 07 0", [30 x i8] c"0 0000 000000 0 000000 00000 0", [30 x i8] c"0 0000 0 6 6 0 00000 0", [30 x i8] c"0 0000 0 00000000000 0 00000 0", [30 x i8] c"0 0000 7000000000007 00000 0", [30 x i8] c"0 0000 0 00000000000 0 00000 0", [30 x i8] c"0 0000 0 00000000000 0 00000 0", [30 x i8] c"0 0000 07 70 00000 0", [30 x i8] c"0 0000 0 00000000000 0 00000 0", [30 x i8] c"0 7 7 0 7 7 0", [30 x i8] c"0 0000 000000 0 000000 00000 0", [30 x i8] c"07 7 7 6 6 7 70 70", [30 x i8] c"0 0000 0 00000000000 0 0 000 0", [30 x i8] c"07 0 0 0 7 70", [30 x i8] c"0 00000000000 0 000000000000 0", [30 x i8] c"0 7 7 0", [30 x i8] c"000000000000000000000000000000"]
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [23 x [30 x i8]]
%4 = alloca [3 x i32]
%5 = alloca [3 x i32]
%6 = alloca [3 x i32]
%7 = getelementptr inbounds [23 x [30 x i8]], [23 x [30 x i8]]* %3, i64 0, i64 0, i64 0
%8 = bitcast [3 x i32]* %4 to i8*
%9 = bitcast [3 x i32]* %5 to i8*
%10 = bitcast [3 x i32]* %6 to i8*
%11 = tail call i32* @malloc(i32 8)
%12 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 0
store i32 4, i32* %12
%13 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 1
store i32 2, i32* %13
%14 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 2
store i32 2, i32* %14
%15 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 0
store i32 4, i32* %15
%16 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 1
store i32 7, i32* %16
%17 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 2
store i32 2, i32* %17
%18 = getelementptr inbounds [3 x i32], [3 x i32]* %6, i64 0, i64 0
store i32 1, i32* %18
%19 = getelementptr inbounds [3 x i32], [3 x i32]* %6, i64 0, i64 1
store i32 1, i32* %19
%20 = getelementptr inbounds [3 x i32], [3 x i32]* %6, i64 0, i64 2
store i32 2, i32* %20
%21 = call i32* @dist(i32* %15)
%22 = bitcast [23 x [30 x i8]]* %3 to i8**
%23 = call i32 @inky(i32* %21, i32* %12, i8** %22, i32* %18)
ret i32 0
}