#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 *);
scalar_t__ malloc(int);
int *clyde(int ghost[3], int pac[3]) {
  int *t = (int *)malloc(sizeof(int) * 2);
  int d;
  d = dist(ghost, pac);
  if (d > 8) {
    t[0] = pac[0];
    t[1] = pac[1];
  } else {
    t[0] = 22;
    t[1] = 0;
  }
  return t;
}


x86 assembly (clang, -O0):
<clyde>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x8,%edi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <dist@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x8,-0x1c(%rbp)
jle    1177 <clyde+0x57>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x4(%rax)
jmp    118c <clyde+0x6c>
mov    -0x18(%rbp),%rax
movl   $0x16,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x0,0x4(%rax)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clyde>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    $0x8,%edi
call   1030 <malloc@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <dist@plt>
cmp    $0x9,%eax
jl     1153 <clyde+0x33>
mov    (%r14),%eax
mov    %eax,(%rbx)
mov    0x4(%r14),%eax
jmp    115b <clyde+0x3b>
movl   $0x16,(%rbx)
xor    %eax,%eax
mov    %eax,0x4(%rbx)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32* @clyde(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%7 = call i64 @malloc(i32 8)
%8 = inttoptr i64 %7 to i32*
store i32* %8, i32** %5
%9 = load i32*, i32** %3
%10 = load i32*, i32** %4
%11 = call i32 @dist(i32* %9, i32* %10)
store i32 %11, i32* %6
%12 = load i32, i32* %6
%13 = icmp sgt i32 %12, 8
br i1 %13, label %14, label %25
14: ; preds = %2
%15 = load i32*, i32** %4
%16 = getelementptr inbounds i32, i32* %15, i64 0
%17 = load i32, i32* %16
%18 = load i32*, i32** %5
%19 = getelementptr inbounds i32, i32* %18, i64 0
store i32 %17, i32* %19
%20 = load i32*, i32** %4
%21 = getelementptr inbounds i32, i32* %20, i64 1
%22 = load i32, i32* %21
%23 = load i32*, i32** %5
%24 = getelementptr inbounds i32, i32* %23, i64 1
store i32 %22, i32* %24
br label %30
25: ; preds = %2
%26 = load i32*, i32** %5
%27 = getelementptr inbounds i32, i32* %26, i64 0
store i32 22, i32* %27
%28 = load i32*, i32** %5
%29 = getelementptr inbounds i32, i32* %28, i64 1
store i32 0, i32* %29
br label %30
30: ; preds = %25, %14
%31 = load i32*, i32** %5
ret i32* %31
}

LLVM IR (-O2):
define i32* @clyde(i32* %0, i32* %1) {
%3 = tail call i64 @malloc(i32 8)
%4 = inttoptr i64 %3 to i32*
%5 = tail call i32 @dist(i32* %0, i32* %1)
%6 = icmp sgt i32 %5, 8
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load i32, i32* %1
store i32 %8, i32* %4
%9 = getelementptr inbounds i32, i32* %1, i64 1
%10 = load i32, i32* %9
br label %12
11: ; preds = %2
store i32 22, i32* %4
br label %12
12: ; preds = %11, %7
%13 = phi i32 [ %10, %7 ], [ 0, %11 ]
%14 = getelementptr inbounds i32, i32* %4, i64 1
store i32 %13, i32* %14
ret i32* %4
}