#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*/ anda(int *, char **, int *);
int /*<<< orphan*/ marca_ghost(char **, int *);
int /*<<< orphan*/ marca_red(char **, int *);
int /*<<< orphan*/ marca_target(char **, int *);
int /*<<< orphan*/ print_maze(char **);
int /*<<< orphan*/ printf(char *, int, int);
void inky(int pacman[3], int red[3], char maze[23][30], int ghost[3]) {
  int target[2];
  target[0] = (pacman[0] - red[0]) + pacman[0];
  target[1] = (pacman[1] - red[1]) + pacman[1];
  printf("%d %d\n\n", target[0], target[1]);
  marca_red(maze, red);
  marca_ghost(maze, ghost);
  marca_target(maze, target);
  print_maze(maze);
  anda(ghost, maze, target);
}


x86 assembly (clang, -O0):
<inky>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
sub    (%rcx),%eax
mov    -0x8(%rbp),%rcx
add    (%rcx),%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
mov    -0x10(%rbp),%rcx
sub    0x4(%rcx),%eax
mov    -0x8(%rbp),%rcx
add    0x4(%rcx),%eax
mov    %eax,-0x24(%rbp)
mov    -0x28(%rbp),%esi
mov    -0x24(%rbp),%edx
lea    0xe4e(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1070 <marca_red@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <marca_ghost@plt>
mov    -0x18(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1060 <marca_target@plt>
mov    -0x18(%rbp),%rdi
call   1080 <print_maze@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x28(%rbp),%rdx
call   1050 <anda@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inky>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r15
mov    (%rdi),%eax
mov    %eax,%esi
sub    (%r15),%esi
mov    %rcx,%r14
mov    %rdx,%rbx
add    %eax,%esi
mov    %esi,0x8(%rsp)
mov    0x4(%rdi),%eax
mov    %eax,%edx
sub    0x4(%r15),%edx
add    %eax,%edx
mov    %edx,0xc(%rsp)
lea    0xe6b(%rip),%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <marca_red@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <marca_ghost@plt>
lea    0x8(%rsp),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <marca_target@plt>
mov    %rbx,%rdi
call   1080 <print_maze@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1050 <anda@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%d %d\0A\0A\00"
define void @inky(i32* %0, i32* %1, [30 x i8]* %2, i32* %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca [30 x i8]*
%8 = alloca i32*
%9 = alloca [2 x i32]
store i32* %0, i32** %5
store i32* %1, i32** %6
store [30 x i8]* %2, [30 x i8]** %7
store i32* %3, i32** %8
%10 = load i32*, i32** %5
%11 = getelementptr inbounds i32, i32* %10, i64 0
%12 = load i32, i32* %11
%13 = load i32*, i32** %6
%14 = getelementptr inbounds i32, i32* %13, i64 0
%15 = load i32, i32* %14
%16 = sub nsw i32 %12, %15
%17 = load i32*, i32** %5
%18 = getelementptr inbounds i32, i32* %17, i64 0
%19 = load i32, i32* %18
%20 = add nsw i32 %16, %19
%21 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
store i32 %20, i32* %21
%22 = load i32*, i32** %5
%23 = getelementptr inbounds i32, i32* %22, i64 1
%24 = load i32, i32* %23
%25 = load i32*, i32** %6
%26 = getelementptr inbounds i32, i32* %25, i64 1
%27 = load i32, i32* %26
%28 = sub nsw i32 %24, %27
%29 = load i32*, i32** %5
%30 = getelementptr inbounds i32, i32* %29, i64 1
%31 = load i32, i32* %30
%32 = add nsw i32 %28, %31
%33 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 1
store i32 %32, i32* %33
%34 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%35 = load i32, i32* %34
%36 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 1
%37 = load i32, i32* %36
%38 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %35, i32 %37)
%39 = load [30 x i8]*, [30 x i8]** %7
%40 = bitcast [30 x i8]* %39 to i8**
%41 = load i32*, i32** %6
%42 = call i32 @marca_red(i8** %40, i32* %41)
%43 = load [30 x i8]*, [30 x i8]** %7
%44 = bitcast [30 x i8]* %43 to i8**
%45 = load i32*, i32** %8
%46 = call i32 @marca_ghost(i8** %44, i32* %45)
%47 = load [30 x i8]*, [30 x i8]** %7
%48 = bitcast [30 x i8]* %47 to i8**
%49 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%50 = call i32 @marca_target(i8** %48, i32* %49)
%51 = load [30 x i8]*, [30 x i8]** %7
%52 = bitcast [30 x i8]* %51 to i8**
%53 = call i32 @print_maze(i8** %52)
%54 = load i32*, i32** %8
%55 = load [30 x i8]*, [30 x i8]** %7
%56 = bitcast [30 x i8]* %55 to i8**
%57 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%58 = call i32 @anda(i32* %54, i8** %56, i32* %57)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"%d %d\0A\0A\00"
define void @inky(i32* nocapture %0, i32* %1, [30 x i8]* %2, i32* %3) {
%5 = alloca [2 x i32]
%6 = bitcast [2 x i32]* %5 to i8*
%7 = load i32, i32* %0
%8 = load i32, i32* %1
%9 = sub nsw i32 %7, %8
%10 = add nsw i32 %9, %7
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
store i32 %10, i32* %11
%12 = getelementptr inbounds i32, i32* %0, i64 1
%13 = load i32, i32* %12
%14 = getelementptr inbounds i32, i32* %1, i64 1
%15 = load i32, i32* %14
%16 = sub nsw i32 %13, %15
%17 = add nsw i32 %16, %13
%18 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 1
store i32 %17, i32* %18
%19 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %17)
%20 = bitcast [30 x i8]* %2 to i8**
%21 = tail call i32 @marca_red(i8** %20, i32* %1)
%22 = tail call i32 @marca_ghost(i8** %20, i32* %3)
%23 = call i32 @marca_target(i8** %20, i32* %11)
%24 = call i32 @print_maze(i8** %20)
%25 = call i32 @anda(i32* %3, i8** %20, i32* %11)
ret void
}