#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__ diagonally1(char **, int, int);
scalar_t__ diagonally2(char **, int, int);
scalar_t__ horizontal(char **, int, int);
scalar_t__ vertical(char **, int, int);
int finish_game(char board[12][12], int columnNumber, int rowNumber) {
  if (diagonally1(board, columnNumber, rowNumber) ||
      diagonally2(board, columnNumber, rowNumber) ||
      horizontal(board, columnNumber, rowNumber) ||
      vertical(board, columnNumber, rowNumber))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<finish_game>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1050 <diagonally1@plt>
cmp    $0x0,%rax
jne    11b6 <finish_game+0x76>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1030 <diagonally2@plt>
cmp    $0x0,%rax
jne    11b6 <finish_game+0x76>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1060 <horizontal@plt>
cmp    $0x0,%rax
jne    11b6 <finish_game+0x76>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1040 <vertical@plt>
cmp    $0x0,%rax
je     11c2 <finish_game+0x82>
movl   $0x1,-0x4(%rbp)
jmp    11c9 <finish_game+0x89>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<finish_game>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %esi,%ebp
mov    %rdi,%rbx
call   1050 <diagonally1@plt>
mov    $0x1,%r14d
test   %rax,%rax
jne    119a <finish_game+0x5a>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r15d,%edx
call   1030 <diagonally2@plt>
test   %rax,%rax
jne    119a <finish_game+0x5a>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r15d,%edx
call   1060 <horizontal@plt>
test   %rax,%rax
jne    119a <finish_game+0x5a>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r15d,%edx
call   1040 <vertical@plt>
xor    %r14d,%r14d
test   %rax,%rax
setne  %r14b
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @finish_game([12 x i8]* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca [12 x i8]*
%6 = alloca i32
%7 = alloca i32
store [12 x i8]* %0, [12 x i8]** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%8 = load [12 x i8]*, [12 x i8]** %5
%9 = bitcast [12 x i8]* %8 to i8**
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = call i64 @diagonally1(i8** %9, i32 %10, i32 %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %35, label %14
14: ; preds = %3
%15 = load [12 x i8]*, [12 x i8]** %5
%16 = bitcast [12 x i8]* %15 to i8**
%17 = load i32, i32* %6
%18 = load i32, i32* %7
%19 = call i64 @diagonally2(i8** %16, i32 %17, i32 %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %35, label %21
21: ; preds = %14
%22 = load [12 x i8]*, [12 x i8]** %5
%23 = bitcast [12 x i8]* %22 to i8**
%24 = load i32, i32* %6
%25 = load i32, i32* %7
%26 = call i64 @horizontal(i8** %23, i32 %24, i32 %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %35, label %28
28: ; preds = %21
%29 = load [12 x i8]*, [12 x i8]** %5
%30 = bitcast [12 x i8]* %29 to i8**
%31 = load i32, i32* %6
%32 = load i32, i32* %7
%33 = call i64 @vertical(i8** %30, i32 %31, i32 %32)
%34 = icmp ne i64 %33, 0
br i1 %34, label %35, label %36
35: ; preds = %28, %21, %14, %3
store i32 1, i32* %4
br label %37
36: ; preds = %28
store i32 0, i32* %4
br label %37
37: ; preds = %36, %35
%38 = load i32, i32* %4
ret i32 %38
}

LLVM IR (-O2):
define i32 @finish_game([12 x i8]* %0, i32 %1, i32 %2) {
%4 = bitcast [12 x i8]* %0 to i8**
%5 = tail call i64 @diagonally1(i8** %4, i32 %1, i32 %2)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %17
7: ; preds = %3
%8 = tail call i64 @diagonally2(i8** %4, i32 %1, i32 %2)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %17
10: ; preds = %7
%11 = tail call i64 @horizontal(i8** %4, i32 %1, i32 %2)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %10
%14 = tail call i64 @vertical(i8** %4, i32 %1, i32 %2)
%15 = icmp ne i64 %14, 0
%16 = zext i1 %15 to i32
br label %17
17: ; preds = %13, %3, %7, %10
%18 = phi i32 [ 1, %10 ], [ 1, %7 ], [ 1, %3 ], [ %16, %13 ]
ret i32 %18
}