#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 */
struct llk_info {
  int dummy;
};

/* Variables and functions */
scalar_t__ direct_link(struct llk_info *, int, int, int, int);
scalar_t__ one_corner_link(struct llk_info *, int, int, int, int);
scalar_t__ two_corner_link(struct llk_info *, int, int, int, int);
int is_linkable(struct llk_info *info, int row1, int col1, int row2, int col2) {
  if (direct_link(info, row1, col1, row2, col2) ||
      one_corner_link(info, row1, col1, row2, col2) ||
      two_corner_link(info, row1, col1, row2, col2)) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<is_linkable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1030 <direct_link@plt>
cmp    $0x0,%rax
jne    11a9 <is_linkable+0x79>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1050 <one_corner_link@plt>
cmp    $0x0,%rax
jne    11a9 <is_linkable+0x79>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1040 <two_corner_link@plt>
cmp    $0x0,%rax
je     11b5 <is_linkable+0x85>
movl   $0x1,-0x4(%rbp)
jmp    11bc <is_linkable+0x8c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_linkable>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8d,%r14d
mov    %ecx,%r15d
mov    %edx,%r12d
mov    %esi,%r13d
mov    %rdi,%rbx
call   1030 <direct_link@plt>
mov    $0x1,%ebp
test   %rax,%rax
jne    118f <is_linkable+0x5f>
mov    %rbx,%rdi
mov    %r13d,%esi
mov    %r12d,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
call   1050 <one_corner_link@plt>
test   %rax,%rax
jne    118f <is_linkable+0x5f>
mov    %rbx,%rdi
mov    %r13d,%esi
mov    %r12d,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
call   1040 <two_corner_link@plt>
xor    %ebp,%ebp
test   %rax,%rax
setne  %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.llk_info = type { i32 }
define i32 @is_linkable(%struct.llk_info* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca %struct.llk_info*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store %struct.llk_info* %0, %struct.llk_info** %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
%12 = load %struct.llk_info*, %struct.llk_info** %7
%13 = load i32, i32* %8
%14 = load i32, i32* %9
%15 = load i32, i32* %10
%16 = load i32, i32* %11
%17 = call i64 @direct_link(%struct.llk_info* %12, i32 %13, i32 %14, i32 %15, i32 %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %35, label %19
19: ; preds = %5
%20 = load %struct.llk_info*, %struct.llk_info** %7
%21 = load i32, i32* %8
%22 = load i32, i32* %9
%23 = load i32, i32* %10
%24 = load i32, i32* %11
%25 = call i64 @one_corner_link(%struct.llk_info* %20, i32 %21, i32 %22, i32 %23, i32 %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %35, label %27
27: ; preds = %19
%28 = load %struct.llk_info*, %struct.llk_info** %7
%29 = load i32, i32* %8
%30 = load i32, i32* %9
%31 = load i32, i32* %10
%32 = load i32, i32* %11
%33 = call i64 @two_corner_link(%struct.llk_info* %28, i32 %29, i32 %30, i32 %31, i32 %32)
%34 = icmp ne i64 %33, 0
br i1 %34, label %35, label %36
35: ; preds = %27, %19, %5
store i32 1, i32* %6
br label %37
36: ; preds = %27
store i32 0, i32* %6
br label %37
37: ; preds = %36, %35
%38 = load i32, i32* %6
ret i32 %38
}

LLVM IR (-O2):
%struct.llk_info = type { i32 }
define i32 @is_linkable(%struct.llk_info* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i64 @direct_link(%struct.llk_info* %0, i32 %1, i32 %2, i32 %3, i32 %4)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %15
8: ; preds = %5
%9 = tail call i64 @one_corner_link(%struct.llk_info* %0, i32 %1, i32 %2, i32 %3, i32 %4)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %8
%12 = tail call i64 @two_corner_link(%struct.llk_info* %0, i32 %1, i32 %2, i32 %3, i32 %4)
%13 = icmp ne i64 %12, 0
%14 = zext i1 %13 to i32
br label %15
15: ; preds = %11, %5, %8
%16 = phi i32 [ 1, %8 ], [ 1, %5 ], [ %14, %11 ]
ret i32 %16
}