#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__ calloc(int, int);
int hasWon(int *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int *board1;
  board1 = (int *)calloc(9, sizeof(int));
  int *board2;
  board2 = (int *)calloc(9, sizeof(int));
  int *board3;
  board3 = (int *)calloc(9, sizeof(int));
  int *board4;
  board4 = (int *)calloc(9, sizeof(int));
  board1[0] = 1;
  board1[1] = 1;
  board1[2] = 1;
  board2[0] = 1;
  board2[3] = 1;
  board2[6] = 1;
  board3[2] = 1;
  board3[4] = 1;
  board3[6] = 1;
  printf("\ndid they win: %d \n", hasWon(board1));
  printf("\ndid they win: %d \n", hasWon(board2));
  printf("\ndid they win: %d \n", hasWon(board3));
  printf("\ndid they win: %d \n", hasWon(board4));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x9,%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,-0x8(%rbp)
mov    $0x9,%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x9,%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,-0x18(%rbp)
mov    $0x9,%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x8(%rbp),%rax
movl   $0x1,0x4(%rax)
mov    -0x8(%rbp),%rax
movl   $0x1,0x8(%rax)
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x1,0xc(%rax)
mov    -0x10(%rbp),%rax
movl   $0x1,0x18(%rax)
mov    -0x18(%rbp),%rax
movl   $0x1,0x8(%rax)
mov    -0x18(%rbp),%rax
movl   $0x1,0x10(%rax)
mov    -0x18(%rbp),%rax
movl   $0x1,0x18(%rax)
mov    -0x8(%rbp),%rdi
call   1030 <hasWon@plt>
mov    %eax,%esi
lea    0xe09(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <hasWon@plt>
mov    %eax,%esi
lea    0xdf2(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <hasWon@plt>
mov    %eax,%esi
lea    0xddb(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <hasWon@plt>
mov    %eax,%esi
lea    0xdc4(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    $0x9,%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,%r12
mov    $0x9,%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,%rbx
mov    $0x9,%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,%r15
mov    $0x9,%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,%r14
movabs $0x100000001,%rax
mov    %rax,(%r12)
movl   $0x1,0x8(%r12)
movl   $0x1,(%rbx)
movl   $0x1,0xc(%rbx)
movl   $0x1,0x18(%rbx)
movl   $0x1,0x8(%r15)
movl   $0x1,0x10(%r15)
movl   $0x1,0x18(%r15)
mov    %r12,%rdi
call   1030 <hasWon@plt>
lea    0xe2e(%rip),%r12
mov    %r12,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <hasWon@plt>
mov    %r12,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %r15,%rdi
call   1030 <hasWon@plt>
mov    %r12,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %r14,%rdi
call   1030 <hasWon@plt>
mov    %r12,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [20 x i8] c"\0Adid they win: %d \0A\00"
define i32 @main() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32*
%5 = call i64 @calloc(i32 9, i32 4)
%6 = inttoptr i64 %5 to i32*
store i32* %6, i32** %1
%7 = call i64 @calloc(i32 9, i32 4)
%8 = inttoptr i64 %7 to i32*
store i32* %8, i32** %2
%9 = call i64 @calloc(i32 9, i32 4)
%10 = inttoptr i64 %9 to i32*
store i32* %10, i32** %3
%11 = call i64 @calloc(i32 9, i32 4)
%12 = inttoptr i64 %11 to i32*
store i32* %12, i32** %4
%13 = load i32*, i32** %1
%14 = getelementptr inbounds i32, i32* %13, i64 0
store i32 1, i32* %14
%15 = load i32*, i32** %1
%16 = getelementptr inbounds i32, i32* %15, i64 1
store i32 1, i32* %16
%17 = load i32*, i32** %1
%18 = getelementptr inbounds i32, i32* %17, i64 2
store i32 1, i32* %18
%19 = load i32*, i32** %2
%20 = getelementptr inbounds i32, i32* %19, i64 0
store i32 1, i32* %20
%21 = load i32*, i32** %2
%22 = getelementptr inbounds i32, i32* %21, i64 3
store i32 1, i32* %22
%23 = load i32*, i32** %2
%24 = getelementptr inbounds i32, i32* %23, i64 6
store i32 1, i32* %24
%25 = load i32*, i32** %3
%26 = getelementptr inbounds i32, i32* %25, i64 2
store i32 1, i32* %26
%27 = load i32*, i32** %3
%28 = getelementptr inbounds i32, i32* %27, i64 4
store i32 1, i32* %28
%29 = load i32*, i32** %3
%30 = getelementptr inbounds i32, i32* %29, i64 6
store i32 1, i32* %30
%31 = load i32*, i32** %1
%32 = call i32 @hasWon(i32* %31)
%33 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %32)
%34 = load i32*, i32** %2
%35 = call i32 @hasWon(i32* %34)
%36 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %35)
%37 = load i32*, i32** %3
%38 = call i32 @hasWon(i32* %37)
%39 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %38)
%40 = load i32*, i32** %4
%41 = call i32 @hasWon(i32* %40)
%42 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %41)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"\0Adid they win: %d \0A\00"
define i32 @main() {
%1 = tail call i64 @calloc(i32 9, i32 4)
%2 = inttoptr i64 %1 to i32*
%3 = tail call i64 @calloc(i32 9, i32 4)
%4 = inttoptr i64 %3 to i32*
%5 = tail call i64 @calloc(i32 9, i32 4)
%6 = inttoptr i64 %5 to i32*
%7 = tail call i64 @calloc(i32 9, i32 4)
%8 = inttoptr i64 %7 to i32*
store i32 1, i32* %2
%9 = getelementptr inbounds i32, i32* %2, i64 1
store i32 1, i32* %9
%10 = getelementptr inbounds i32, i32* %2, i64 2
store i32 1, i32* %10
store i32 1, i32* %4
%11 = getelementptr inbounds i32, i32* %4, i64 3
store i32 1, i32* %11
%12 = getelementptr inbounds i32, i32* %4, i64 6
store i32 1, i32* %12
%13 = getelementptr inbounds i32, i32* %6, i64 2
store i32 1, i32* %13
%14 = getelementptr inbounds i32, i32* %6, i64 4
store i32 1, i32* %14
%15 = getelementptr inbounds i32, i32* %6, i64 6
store i32 1, i32* %15
%16 = tail call i32 @hasWon(i32* %2)
%17 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = tail call i32 @hasWon(i32* %4)
%19 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = tail call i32 @hasWon(i32* %6)
%21 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = tail call i32 @hasWon(i32* %8)
%23 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %22)
ret i32 0
}