#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*/ in(int);
int /*<<< orphan*/ out(int, int /*<<< orphan*/);
int /*<<< orphan*/ print_maze(char **);
int /*<<< orphan*/ validate_position(char **, int *);
void partpackman(int *pacman, char maze[23][30]) {
  do {
    out(9, 0);
    in(pacman[2]);
  } while (pacman[2] > 4 || pacman[2] < 1);
  do {
    print_maze(maze);
    out(10, 0);
    out(4, 0);
    in(pacman[0]);
    out(5, 0);
    in(pacman[1]);
  } while (!validate_position(maze, pacman));
}


x86 assembly (clang, -O0):
<partpackman>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x9,%edi
xor    %esi,%esi
call   1040 <out@plt>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%edi
call   1050 <in@plt>
mov    -0x8(%rbp),%rcx
mov    $0x1,%al
cmpl   $0x4,0x8(%rcx)
mov    %al,-0x11(%rbp)
jg     1189 <partpackman+0x49>
mov    -0x8(%rbp),%rax
cmpl   $0x1,0x8(%rax)
setl   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1150 <partpackman+0x10>
jmp    1199 <partpackman+0x59>
mov    -0x10(%rbp),%rdi
call   1060 <print_maze@plt>
mov    $0xa,%edi
xor    %esi,%esi
call   1040 <out@plt>
mov    $0x4,%edi
xor    %esi,%esi
call   1040 <out@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1050 <in@plt>
mov    $0x5,%edi
xor    %esi,%esi
call   1040 <out@plt>
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%edi
call   1050 <in@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <validate_position@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1199 <partpackman+0x59>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<partpackman>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
nopw   0x0(%rax,%rax,1)
mov    $0x9,%edi
xor    %esi,%esi
call   1040 <out@plt>
mov    0x8(%rbx),%edi
call   1050 <in@plt>
mov    0x8(%rbx),%eax
add    $0xfffffffb,%eax
cmp    $0xfffffffc,%eax
jb     1150 <partpackman+0x10>
nop
mov    %r14,%rdi
call   1060 <print_maze@plt>
mov    $0xa,%edi
xor    %esi,%esi
call   1040 <out@plt>
mov    $0x4,%edi
xor    %esi,%esi
call   1040 <out@plt>
mov    (%rbx),%edi
call   1050 <in@plt>
mov    $0x5,%edi
xor    %esi,%esi
call   1040 <out@plt>
mov    0x4(%rbx),%edi
call   1050 <in@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <validate_position@plt>
test   %eax,%eax
je     1170 <partpackman+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @partpackman(i32* %0, [30 x i8]* %1) {
%3 = alloca i32*
%4 = alloca [30 x i8]*
store i32* %0, i32** %3
store [30 x i8]* %1, [30 x i8]** %4
br label %5
5: ; preds = %21, %2
%6 = call i32 @out(i32 9, i32 0)
%7 = load i32*, i32** %3
%8 = getelementptr inbounds i32, i32* %7, i64 2
%9 = load i32, i32* %8
%10 = call i32 @in(i32 %9)
br label %11
11: ; preds = %5
%12 = load i32*, i32** %3
%13 = getelementptr inbounds i32, i32* %12, i64 2
%14 = load i32, i32* %13
%15 = icmp sgt i32 %14, 4
br i1 %15, label %21, label %16
16: ; preds = %11
%17 = load i32*, i32** %3
%18 = getelementptr inbounds i32, i32* %17, i64 2
%19 = load i32, i32* %18
%20 = icmp slt i32 %19, 1
br label %21
21: ; preds = %16, %11
%22 = phi i1 [ true, %11 ], [ %20, %16 ]
br i1 %22, label %5, label %23
23: ; preds = %21
br label %24
24: ; preds = %39, %23
%25 = load [30 x i8]*, [30 x i8]** %4
%26 = bitcast [30 x i8]* %25 to i8**
%27 = call i32 @print_maze(i8** %26)
%28 = call i32 @out(i32 10, i32 0)
%29 = call i32 @out(i32 4, i32 0)
%30 = load i32*, i32** %3
%31 = getelementptr inbounds i32, i32* %30, i64 0
%32 = load i32, i32* %31
%33 = call i32 @in(i32 %32)
%34 = call i32 @out(i32 5, i32 0)
%35 = load i32*, i32** %3
%36 = getelementptr inbounds i32, i32* %35, i64 1
%37 = load i32, i32* %36
%38 = call i32 @in(i32 %37)
br label %39
39: ; preds = %24
%40 = load [30 x i8]*, [30 x i8]** %4
%41 = bitcast [30 x i8]* %40 to i8**
%42 = load i32*, i32** %3
%43 = call i32 @validate_position(i8** %41, i32* %42)
%44 = icmp ne i32 %43, 0
%45 = xor i1 %44, true
br i1 %45, label %24, label %46
46: ; preds = %39
ret void
}

LLVM IR (-O2):
define void @partpackman(i32* %0, [30 x i8]* %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 2
br label %4
4: ; preds = %4, %2
%5 = tail call i32 @out(i32 9, i32 0)
%6 = load i32, i32* %3
%7 = tail call i32 @in(i32 %6)
%8 = load i32, i32* %3
%9 = add i32 %8, -5
%10 = icmp ult i32 %9, -4
br i1 %10, label %4, label %11
11: ; preds = %4
%12 = bitcast [30 x i8]* %1 to i8**
%13 = getelementptr inbounds i32, i32* %0, i64 1
br label %14
14: ; preds = %11, %14
%15 = tail call i32 @print_maze(i8** %12)
%16 = tail call i32 @out(i32 10, i32 0)
%17 = tail call i32 @out(i32 4, i32 0)
%18 = load i32, i32* %0
%19 = tail call i32 @in(i32 %18)
%20 = tail call i32 @out(i32 5, i32 0)
%21 = load i32, i32* %13
%22 = tail call i32 @in(i32 %21)
%23 = tail call i32 @validate_position(i8** %12, i32* %0)
%24 = icmp eq i32 %23, 0
br i1 %24, label %14, label %25
25: ; preds = %14
ret void
}