#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*/ printf(char *);
int eatFood(int snakeXY[][310], int foodXY[]) {
  if (snakeXY[0][0] == foodXY[0] && snakeXY[1][0] == foodXY[1]) {
    foodXY[0] = 0;
    foodXY[1] = 0;
    printf("\7");
    return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<eatFood>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jne    1176 <eatFood+0x66>
mov    -0x10(%rbp),%rax
mov    0x4d8(%rax),%eax
mov    -0x18(%rbp),%rcx
cmp    0x4(%rcx),%eax
jne    1176 <eatFood+0x66>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x0,0x4(%rax)
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    117d <eatFood+0x6d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eatFood>:
push   %rax
mov    (%rdi),%ecx
xor    %eax,%eax
cmp    (%rsi),%ecx
jne    113a <eatFood+0x2a>
mov    0x4d8(%rdi),%ecx
cmp    0x4(%rsi),%ecx
jne    113a <eatFood+0x2a>
movq   $0x0,(%rsi)
mov    $0x7,%edi
call   1030 <putchar@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\07\00"
define i32 @eatFood([310 x i32]* %0, i32* %1) {
%3 = alloca i32
%4 = alloca [310 x i32]*
%5 = alloca i32*
store [310 x i32]* %0, [310 x i32]** %4
store i32* %1, i32** %5
%6 = load [310 x i32]*, [310 x i32]** %4
%7 = getelementptr inbounds [310 x i32], [310 x i32]* %6, i64 0
%8 = getelementptr inbounds [310 x i32], [310 x i32]* %7, i64 0, i64 0
%9 = load i32, i32* %8
%10 = load i32*, i32** %5
%11 = getelementptr inbounds i32, i32* %10, i64 0
%12 = load i32, i32* %11
%13 = icmp eq i32 %9, %12
br i1 %13, label %14, label %29
14: ; preds = %2
%15 = load [310 x i32]*, [310 x i32]** %4
%16 = getelementptr inbounds [310 x i32], [310 x i32]* %15, i64 1
%17 = getelementptr inbounds [310 x i32], [310 x i32]* %16, i64 0, i64 0
%18 = load i32, i32* %17
%19 = load i32*, i32** %5
%20 = getelementptr inbounds i32, i32* %19, i64 1
%21 = load i32, i32* %20
%22 = icmp eq i32 %18, %21
br i1 %22, label %23, label %29
23: ; preds = %14
%24 = load i32*, i32** %5
%25 = getelementptr inbounds i32, i32* %24, i64 0
store i32 0, i32* %25
%26 = load i32*, i32** %5
%27 = getelementptr inbounds i32, i32* %26, i64 1
store i32 0, i32* %27
%28 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %30
29: ; preds = %14, %2
store i32 0, i32* %3
br label %30
30: ; preds = %29, %23
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
define i32 @eatFood([310 x i32]* nocapture %0, i32* nocapture %1) {
%3 = getelementptr inbounds [310 x i32], [310 x i32]* %0, i64 0, i64 0
%4 = load i32, i32* %3
%5 = load i32, i32* %1
%6 = icmp eq i32 %4, %5
br i1 %6, label %7, label %15
7: ; preds = %2
%8 = getelementptr inbounds [310 x i32], [310 x i32]* %0, i64 1, i64 0
%9 = load i32, i32* %8
%10 = getelementptr inbounds i32, i32* %1, i64 1
%11 = load i32, i32* %10
%12 = icmp eq i32 %9, %11
br i1 %12, label %13, label %15
13: ; preds = %7
store i32 0, i32* %1
store i32 0, i32* %10
%14 = tail call i32 @putchar(i32 7)
br label %15
15: ; preds = %2, %7, %13
%16 = phi i32 [ 1, %13 ], [ 0, %7 ], [ 0, %2 ]
ret i32 %16
}