#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*/ roadmap_tile_edges(int, int *, int *, int *, int *);
int roadmap_tile_is_adjacent(int tile1, int tile2) {
  int west[2], east[2], south[2], north[2];
  roadmap_tile_edges(tile1, west, east, south, north);
  roadmap_tile_edges(tile2, west + 1, east + 1, south + 1, north + 1);
  return (
      (south[0] == south[1] && (west[0] == east[1] || east[0] == west[1])) ||
      (west[0] == west[1] && (south[0] == north[1] || north[0] == south[1])));
}


x86 assembly (clang, -O0):
<roadmap_tile_is_adjacent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rcx
lea    -0x28(%rbp),%r8
call   1030 <roadmap_tile_edges@plt>
mov    -0x8(%rbp),%edi
lea    -0x10(%rbp),%rsi
add    $0x4,%rsi
lea    -0x18(%rbp),%rdx
add    $0x4,%rdx
lea    -0x20(%rbp),%rcx
add    $0x4,%rcx
lea    -0x28(%rbp),%r8
add    $0x4,%r8
call   1030 <roadmap_tile_edges@plt>
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jne    118c <roadmap_tile_is_adjacent+0x7c>
mov    -0x10(%rbp),%ecx
mov    $0x1,%al
cmp    -0x14(%rbp),%ecx
mov    %al,-0x29(%rbp)
je     11c6 <roadmap_tile_is_adjacent+0xb6>
mov    -0x18(%rbp),%ecx
mov    $0x1,%al
cmp    -0xc(%rbp),%ecx
mov    %al,-0x29(%rbp)
je     11c6 <roadmap_tile_is_adjacent+0xb6>
mov    -0x10(%rbp),%ecx
xor    %eax,%eax
cmp    -0xc(%rbp),%ecx
mov    %al,-0x2a(%rbp)
jne    11c0 <roadmap_tile_is_adjacent+0xb0>
mov    -0x20(%rbp),%ecx
mov    $0x1,%al
cmp    -0x24(%rbp),%ecx
mov    %al,-0x2b(%rbp)
je     11ba <roadmap_tile_is_adjacent+0xaa>
mov    -0x28(%rbp),%eax
cmp    -0x1c(%rbp),%eax
sete   %al
mov    %al,-0x2b(%rbp)
mov    -0x2b(%rbp),%al
mov    %al,-0x2a(%rbp)
mov    -0x2a(%rbp),%al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<roadmap_tile_is_adjacent>:
push   %rbx
sub    $0x20,%rsp
mov    %esi,%ebx
mov    %rsp,%rsi
lea    0x18(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0x8(%rsp),%r8
call   1030 <roadmap_tile_edges@plt>
lea    0x4(%rsp),%rsi
lea    0x1c(%rsp),%rdx
lea    0x14(%rsp),%rcx
lea    0xc(%rsp),%r8
mov    %ebx,%edi
call   1030 <roadmap_tile_edges@plt>
mov    0x10(%rsp),%edx
mov    0x14(%rsp),%ecx
mov    (%rsp),%esi
cmp    %ecx,%edx
jne    116f <roadmap_tile_is_adjacent+0x5f>
mov    $0x1,%eax
cmp    0x1c(%rsp),%esi
je     118c <roadmap_tile_is_adjacent+0x7c>
mov    0x4(%rsp),%edi
cmp    %edi,0x18(%rsp)
jne    1173 <roadmap_tile_is_adjacent+0x63>
jmp    118c <roadmap_tile_is_adjacent+0x7c>
mov    0x4(%rsp),%edi
xor    %eax,%eax
cmp    %edi,%esi
jne    118c <roadmap_tile_is_adjacent+0x7c>
cmp    0xc(%rsp),%edx
sete   %al
cmp    %ecx,0x8(%rsp)
sete   %cl
or     %al,%cl
movzbl %cl,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @roadmap_tile_is_adjacent(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [2 x i32]
%6 = alloca [2 x i32]
%7 = alloca [2 x i32]
%8 = alloca [2 x i32]
store i32 %0, i32* %3
store i32 %1, i32* %4
%9 = load i32, i32* %3
%10 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%12 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%13 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%14 = call i32 @roadmap_tile_edges(i32 %9, i32* %10, i32* %11, i32* %12, i32* %13)
%15 = load i32, i32* %4
%16 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
%17 = getelementptr inbounds i32, i32* %16, i64 1
%18 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%19 = getelementptr inbounds i32, i32* %18, i64 1
%20 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%21 = getelementptr inbounds i32, i32* %20, i64 1
%22 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%23 = getelementptr inbounds i32, i32* %22, i64 1
%24 = call i32 @roadmap_tile_edges(i32 %15, i32* %17, i32* %19, i32* %21, i32* %23)
%25 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%26 = load i32, i32* %25
%27 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%28 = load i32, i32* %27
%29 = icmp eq i32 %26, %28
br i1 %29, label %30, label %42
30: ; preds = %2
%31 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
%32 = load i32, i32* %31
%33 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%34 = load i32, i32* %33
%35 = icmp eq i32 %32, %34
br i1 %35, label %64, label %36
36: ; preds = %30
%37 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%38 = load i32, i32* %37
%39 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 1
%40 = load i32, i32* %39
%41 = icmp eq i32 %38, %40
br i1 %41, label %64, label %42
42: ; preds = %36, %2
%43 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
%44 = load i32, i32* %43
%45 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 1
%46 = load i32, i32* %45
%47 = icmp eq i32 %44, %46
br i1 %47, label %48, label %62
48: ; preds = %42
%49 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%50 = load i32, i32* %49
%51 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 1
%52 = load i32, i32* %51
%53 = icmp eq i32 %50, %52
br i1 %53, label %60, label %54
54: ; preds = %48
%55 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%56 = load i32, i32* %55
%57 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%58 = load i32, i32* %57
%59 = icmp eq i32 %56, %58
br label %60
60: ; preds = %54, %48
%61 = phi i1 [ true, %48 ], [ %59, %54 ]
br label %62
62: ; preds = %60, %42
%63 = phi i1 [ false, %42 ], [ %61, %60 ]
br label %64
64: ; preds = %62, %36, %30
%65 = phi i1 [ true, %36 ], [ true, %30 ], [ %63, %62 ]
%66 = zext i1 %65 to i32
ret i32 %66
}

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