#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 */
scalar_t__ on_column(short, short, short);
short on_left_side(short side, short piece) {
  short c;
  for (c = 0; c < 4; c++) {
    if (on_column(side, piece, c))
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<on_left_side>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x4(%rbp)
mov    %ax,-0x6(%rbp)
movw   $0x0,-0x8(%rbp)
movswl -0x8(%rbp),%eax
cmp    $0x4,%eax
jge    117b <on_left_side+0x6b>
mov    -0x4(%rbp),%cx
mov    -0x6(%rbp),%ax
movswl %cx,%edi
movswl %ax,%esi
movswl -0x8(%rbp),%edx
call   1030 <on_column@plt>
cmp    $0x0,%rax
je     1165 <on_left_side+0x55>
movw   $0x1,-0x2(%rbp)
jmp    1181 <on_left_side+0x71>
jmp    116a <on_left_side+0x5a>
mov    -0x8(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x8(%rbp)
jmp    112c <on_left_side+0x1c>
movw   $0x0,-0x2(%rbp)
movswl -0x2(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<on_left_side>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%ebp
mov    %edi,%ebx
xor    %edx,%edx
call   1030 <on_column@plt>
mov    $0x1,%r12w
test   %rax,%rax
jne    1179 <on_left_side+0x69>
movswl %bx,%r15d
movswl %bp,%r14d
mov    %r15d,%edi
mov    %r14d,%esi
mov    $0x1,%edx
call   1030 <on_column@plt>
test   %rax,%rax
jne    1179 <on_left_side+0x69>
mov    %r15d,%edi
mov    %r14d,%esi
mov    $0x2,%edx
call   1030 <on_column@plt>
test   %rax,%rax
jne    1179 <on_left_side+0x69>
mov    %r15d,%edi
mov    %r14d,%esi
mov    $0x3,%edx
call   1030 <on_column@plt>
xor    %r12d,%r12d
test   %rax,%rax
setne  %r12b
mov    %r12d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define signext i16 @on_left_side(i16 signext %0, i16 signext %1) {
%3 = alloca i16
%4 = alloca i16
%5 = alloca i16
%6 = alloca i16
store i16 %0, i16* %4
store i16 %1, i16* %5
store i16 0, i16* %6
br label %7
7: ; preds = %19, %2
%8 = load i16, i16* %6
%9 = sext i16 %8 to i32
%10 = icmp slt i32 %9, 4
br i1 %10, label %11, label %22
11: ; preds = %7
%12 = load i16, i16* %4
%13 = load i16, i16* %5
%14 = load i16, i16* %6
%15 = call i64 @on_column(i16 signext %12, i16 signext %13, i16 signext %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %11
store i16 1, i16* %3
br label %23
18: ; preds = %11
br label %19
19: ; preds = %18
%20 = load i16, i16* %6
%21 = add i16 %20, 1
store i16 %21, i16* %6
br label %7
22: ; preds = %7
store i16 0, i16* %3
br label %23
23: ; preds = %22, %17
%24 = load i16, i16* %3
ret i16 %24
}

LLVM IR (-O2):
define signext i16 @on_left_side(i16 signext %0, i16 signext %1) {
%3 = tail call i64 @on_column(i16 signext %0, i16 signext %1, i16 signext 0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %15
5: ; preds = %2
%6 = tail call i64 @on_column(i16 signext %0, i16 signext %1, i16 signext 1)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %15
8: ; preds = %5
%9 = tail call i64 @on_column(i16 signext %0, i16 signext %1, i16 signext 2)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %8
%12 = tail call i64 @on_column(i16 signext %0, i16 signext %1, i16 signext 3)
%13 = icmp ne i64 %12, 0
%14 = zext i1 %13 to i16
br label %15
15: ; preds = %11, %8, %5, %2
%16 = phi i16 [ 1, %2 ], [ 1, %5 ], [ 1, %8 ], [ %14, %11 ]
ret i16 %16
}