#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 calculate_winner(char, char, char);
int analize_board(char board[][3]) {
  int winner = 0;
  winner = calculate_winner(board[0][0], board[0][1], board[0][2]);
  if (winner != 0)
    return winner;
  winner = calculate_winner(board[1][0], board[1][1], board[1][2]);
  if (winner != 0)
    return winner;
  winner = calculate_winner(board[2][0], board[2][1], board[2][2]);
  if (winner != 0)
    return winner;
  winner = calculate_winner(board[0][0], board[1][0], board[2][0]);
  if (winner != 0)
    return winner;
  winner = calculate_winner(board[0][1], board[1][1], board[2][1]);
  if (winner != 0)
    return winner;
  winner = calculate_winner(board[0][2], board[1][2], board[2][2]);
  if (winner != 0)
    return winner;
  winner = calculate_winner(board[0][0], board[1][1], board[2][2]);
  if (winner != 0)
    return winner;
  winner = calculate_winner(board[0][2], board[1][1], board[2][0]);
  if (winner != 0)
    return winner;
  return 0;
}


x86 assembly (clang, -O0):
<analize_board>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%dl
mov    -0x10(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x10(%rbp),%rax
movsbl %dl,%edi
movsbl %cl,%esi
movsbl 0x2(%rax),%edx
call   1030 <calculate_winner@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     115b <analize_board+0x4b>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    12ef <analize_board+0x1df>
mov    -0x10(%rbp),%rax
mov    0x3(%rax),%dl
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%cl
mov    -0x10(%rbp),%rax
movsbl %dl,%edi
movsbl %cl,%esi
movsbl 0x5(%rax),%edx
call   1030 <calculate_winner@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1194 <analize_board+0x84>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    12ef <analize_board+0x1df>
mov    -0x10(%rbp),%rax
mov    0x6(%rax),%dl
mov    -0x10(%rbp),%rax
mov    0x7(%rax),%cl
mov    -0x10(%rbp),%rax
movsbl %dl,%edi
movsbl %cl,%esi
movsbl 0x8(%rax),%edx
call   1030 <calculate_winner@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11cd <analize_board+0xbd>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    12ef <analize_board+0x1df>
mov    -0x10(%rbp),%rax
mov    (%rax),%dl
mov    -0x10(%rbp),%rax
mov    0x3(%rax),%cl
mov    -0x10(%rbp),%rax
movsbl %dl,%edi
movsbl %cl,%esi
movsbl 0x6(%rax),%edx
call   1030 <calculate_winner@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1205 <analize_board+0xf5>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    12ef <analize_board+0x1df>
mov    -0x10(%rbp),%rax
mov    0x1(%rax),%dl
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%cl
mov    -0x10(%rbp),%rax
movsbl %dl,%edi
movsbl %cl,%esi
movsbl 0x7(%rax),%edx
call   1030 <calculate_winner@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     123e <analize_board+0x12e>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    12ef <analize_board+0x1df>
mov    -0x10(%rbp),%rax
mov    0x2(%rax),%dl
mov    -0x10(%rbp),%rax
mov    0x5(%rax),%cl
mov    -0x10(%rbp),%rax
movsbl %dl,%edi
movsbl %cl,%esi
movsbl 0x8(%rax),%edx
call   1030 <calculate_winner@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1277 <analize_board+0x167>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    12ef <analize_board+0x1df>
mov    -0x10(%rbp),%rax
mov    (%rax),%dl
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%cl
mov    -0x10(%rbp),%rax
movsbl %dl,%edi
movsbl %cl,%esi
movsbl 0x8(%rax),%edx
call   1030 <calculate_winner@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     12af <analize_board+0x19f>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    12ef <analize_board+0x1df>
mov    -0x10(%rbp),%rax
mov    0x2(%rax),%dl
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%cl
mov    -0x10(%rbp),%rax
movsbl %dl,%edi
movsbl %cl,%esi
movsbl 0x6(%rax),%edx
call   1030 <calculate_winner@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     12e8 <analize_board+0x1d8>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    12ef <analize_board+0x1df>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<analize_board>:
push   %rbx
mov    %rdi,%rbx
movsbl (%rdi),%edi
movsbl 0x1(%rbx),%esi
movsbl 0x2(%rbx),%edx
call   1030 <calculate_winner@plt>
test   %eax,%eax
jne    11a4 <analize_board+0x94>
movsbl 0x3(%rbx),%edi
movsbl 0x4(%rbx),%esi
movsbl 0x5(%rbx),%edx
call   1030 <calculate_winner@plt>
test   %eax,%eax
jne    11a4 <analize_board+0x94>
movsbl 0x6(%rbx),%edi
movsbl 0x7(%rbx),%esi
movsbl 0x8(%rbx),%edx
call   1030 <calculate_winner@plt>
test   %eax,%eax
jne    11a4 <analize_board+0x94>
movsbl (%rbx),%edi
movsbl 0x3(%rbx),%esi
movsbl 0x6(%rbx),%edx
call   1030 <calculate_winner@plt>
test   %eax,%eax
jne    11a4 <analize_board+0x94>
movsbl 0x1(%rbx),%edi
movsbl 0x4(%rbx),%esi
movsbl 0x7(%rbx),%edx
call   1030 <calculate_winner@plt>
test   %eax,%eax
jne    11a4 <analize_board+0x94>
movsbl 0x2(%rbx),%edi
movsbl 0x5(%rbx),%esi
movsbl 0x8(%rbx),%edx
call   1030 <calculate_winner@plt>
test   %eax,%eax
jne    11a4 <analize_board+0x94>
movsbl (%rbx),%edi
movsbl 0x4(%rbx),%esi
movsbl 0x8(%rbx),%edx
call   1030 <calculate_winner@plt>
test   %eax,%eax
je     11a6 <analize_board+0x96>
pop    %rbx
ret
movsbl 0x2(%rbx),%edi
movsbl 0x4(%rbx),%esi
movsbl 0x6(%rbx),%edx
pop    %rbx
jmp    1030 <calculate_winner@plt>

LLVM IR (-O0):
define i32 @analize_board([3 x i8]* %0) {
%2 = alloca i32
%3 = alloca [3 x i8]*
%4 = alloca i32
store [3 x i8]* %0, [3 x i8]** %3
store i32 0, i32* %4
%5 = load [3 x i8]*, [3 x i8]** %3
%6 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0
%7 = getelementptr inbounds [3 x i8], [3 x i8]* %6, i64 0, i64 0
%8 = load i8, i8* %7
%9 = load [3 x i8]*, [3 x i8]** %3
%10 = getelementptr inbounds [3 x i8], [3 x i8]* %9, i64 0
%11 = getelementptr inbounds [3 x i8], [3 x i8]* %10, i64 0, i64 1
%12 = load i8, i8* %11
%13 = load [3 x i8]*, [3 x i8]** %3
%14 = getelementptr inbounds [3 x i8], [3 x i8]* %13, i64 0
%15 = getelementptr inbounds [3 x i8], [3 x i8]* %14, i64 0, i64 2
%16 = load i8, i8* %15
%17 = call i32 @calculate_winner(i8 signext %8, i8 signext %12, i8 signext %16)
store i32 %17, i32* %4
%18 = load i32, i32* %4
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %1
%21 = load i32, i32* %4
store i32 %21, i32* %2
br label %149
22: ; preds = %1
%23 = load [3 x i8]*, [3 x i8]** %3
%24 = getelementptr inbounds [3 x i8], [3 x i8]* %23, i64 1
%25 = getelementptr inbounds [3 x i8], [3 x i8]* %24, i64 0, i64 0
%26 = load i8, i8* %25
%27 = load [3 x i8]*, [3 x i8]** %3
%28 = getelementptr inbounds [3 x i8], [3 x i8]* %27, i64 1
%29 = getelementptr inbounds [3 x i8], [3 x i8]* %28, i64 0, i64 1
%30 = load i8, i8* %29
%31 = load [3 x i8]*, [3 x i8]** %3
%32 = getelementptr inbounds [3 x i8], [3 x i8]* %31, i64 1
%33 = getelementptr inbounds [3 x i8], [3 x i8]* %32, i64 0, i64 2
%34 = load i8, i8* %33
%35 = call i32 @calculate_winner(i8 signext %26, i8 signext %30, i8 signext %34)
store i32 %35, i32* %4
%36 = load i32, i32* %4
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %22
%39 = load i32, i32* %4
store i32 %39, i32* %2
br label %149
40: ; preds = %22
%41 = load [3 x i8]*, [3 x i8]** %3
%42 = getelementptr inbounds [3 x i8], [3 x i8]* %41, i64 2
%43 = getelementptr inbounds [3 x i8], [3 x i8]* %42, i64 0, i64 0
%44 = load i8, i8* %43
%45 = load [3 x i8]*, [3 x i8]** %3
%46 = getelementptr inbounds [3 x i8], [3 x i8]* %45, i64 2
%47 = getelementptr inbounds [3 x i8], [3 x i8]* %46, i64 0, i64 1
%48 = load i8, i8* %47
%49 = load [3 x i8]*, [3 x i8]** %3
%50 = getelementptr inbounds [3 x i8], [3 x i8]* %49, i64 2
%51 = getelementptr inbounds [3 x i8], [3 x i8]* %50, i64 0, i64 2
%52 = load i8, i8* %51
%53 = call i32 @calculate_winner(i8 signext %44, i8 signext %48, i8 signext %52)
store i32 %53, i32* %4
%54 = load i32, i32* %4
%55 = icmp ne i32 %54, 0
br i1 %55, label %56, label %58
56: ; preds = %40
%57 = load i32, i32* %4
store i32 %57, i32* %2
br label %149
58: ; preds = %40
%59 = load [3 x i8]*, [3 x i8]** %3
%60 = getelementptr inbounds [3 x i8], [3 x i8]* %59, i64 0
%61 = getelementptr inbounds [3 x i8], [3 x i8]* %60, i64 0, i64 0
%62 = load i8, i8* %61
%63 = load [3 x i8]*, [3 x i8]** %3
%64 = getelementptr inbounds [3 x i8], [3 x i8]* %63, i64 1
%65 = getelementptr inbounds [3 x i8], [3 x i8]* %64, i64 0, i64 0
%66 = load i8, i8* %65
%67 = load [3 x i8]*, [3 x i8]** %3
%68 = getelementptr inbounds [3 x i8], [3 x i8]* %67, i64 2
%69 = getelementptr inbounds [3 x i8], [3 x i8]* %68, i64 0, i64 0
%70 = load i8, i8* %69
%71 = call i32 @calculate_winner(i8 signext %62, i8 signext %66, i8 signext %70)
store i32 %71, i32* %4
%72 = load i32, i32* %4
%73 = icmp ne i32 %72, 0
br i1 %73, label %74, label %76
74: ; preds = %58
%75 = load i32, i32* %4
store i32 %75, i32* %2
br label %149
76: ; preds = %58
%77 = load [3 x i8]*, [3 x i8]** %3
%78 = getelementptr inbounds [3 x i8], [3 x i8]* %77, i64 0
%79 = getelementptr inbounds [3 x i8], [3 x i8]* %78, i64 0, i64 1
%80 = load i8, i8* %79
%81 = load [3 x i8]*, [3 x i8]** %3
%82 = getelementptr inbounds [3 x i8], [3 x i8]* %81, i64 1
%83 = getelementptr inbounds [3 x i8], [3 x i8]* %82, i64 0, i64 1
%84 = load i8, i8* %83
%85 = load [3 x i8]*, [3 x i8]** %3
%86 = getelementptr inbounds [3 x i8], [3 x i8]* %85, i64 2
%87 = getelementptr inbounds [3 x i8], [3 x i8]* %86, i64 0, i64 1
%88 = load i8, i8* %87
%89 = call i32 @calculate_winner(i8 signext %80, i8 signext %84, i8 signext %88)
store i32 %89, i32* %4
%90 = load i32, i32* %4
%91 = icmp ne i32 %90, 0
br i1 %91, label %92, label %94
92: ; preds = %76
%93 = load i32, i32* %4
store i32 %93, i32* %2
br label %149
94: ; preds = %76
%95 = load [3 x i8]*, [3 x i8]** %3
%96 = getelementptr inbounds [3 x i8], [3 x i8]* %95, i64 0
%97 = getelementptr inbounds [3 x i8], [3 x i8]* %96, i64 0, i64 2
%98 = load i8, i8* %97
%99 = load [3 x i8]*, [3 x i8]** %3
%100 = getelementptr inbounds [3 x i8], [3 x i8]* %99, i64 1
%101 = getelementptr inbounds [3 x i8], [3 x i8]* %100, i64 0, i64 2
%102 = load i8, i8* %101
%103 = load [3 x i8]*, [3 x i8]** %3
%104 = getelementptr inbounds [3 x i8], [3 x i8]* %103, i64 2
%105 = getelementptr inbounds [3 x i8], [3 x i8]* %104, i64 0, i64 2
%106 = load i8, i8* %105
%107 = call i32 @calculate_winner(i8 signext %98, i8 signext %102, i8 signext %106)
store i32 %107, i32* %4
%108 = load i32, i32* %4
%109 = icmp ne i32 %108, 0
br i1 %109, label %110, label %112
110: ; preds = %94
%111 = load i32, i32* %4
store i32 %111, i32* %2
br label %149
112: ; preds = %94
%113 = load [3 x i8]*, [3 x i8]** %3
%114 = getelementptr inbounds [3 x i8], [3 x i8]* %113, i64 0
%115 = getelementptr inbounds [3 x i8], [3 x i8]* %114, i64 0, i64 0
%116 = load i8, i8* %115
%117 = load [3 x i8]*, [3 x i8]** %3
%118 = getelementptr inbounds [3 x i8], [3 x i8]* %117, i64 1
%119 = getelementptr inbounds [3 x i8], [3 x i8]* %118, i64 0, i64 1
%120 = load i8, i8* %119
%121 = load [3 x i8]*, [3 x i8]** %3
%122 = getelementptr inbounds [3 x i8], [3 x i8]* %121, i64 2
%123 = getelementptr inbounds [3 x i8], [3 x i8]* %122, i64 0, i64 2
%124 = load i8, i8* %123
%125 = call i32 @calculate_winner(i8 signext %116, i8 signext %120, i8 signext %124)
store i32 %125, i32* %4
%126 = load i32, i32* %4
%127 = icmp ne i32 %126, 0
br i1 %127, label %128, label %130
128: ; preds = %112
%129 = load i32, i32* %4
store i32 %129, i32* %2
br label %149
130: ; preds = %112
%131 = load [3 x i8]*, [3 x i8]** %3
%132 = getelementptr inbounds [3 x i8], [3 x i8]* %131, i64 0
%133 = getelementptr inbounds [3 x i8], [3 x i8]* %132, i64 0, i64 2
%134 = load i8, i8* %133
%135 = load [3 x i8]*, [3 x i8]** %3
%136 = getelementptr inbounds [3 x i8], [3 x i8]* %135, i64 1
%137 = getelementptr inbounds [3 x i8], [3 x i8]* %136, i64 0, i64 1
%138 = load i8, i8* %137
%139 = load [3 x i8]*, [3 x i8]** %3
%140 = getelementptr inbounds [3 x i8], [3 x i8]* %139, i64 2
%141 = getelementptr inbounds [3 x i8], [3 x i8]* %140, i64 0, i64 0
%142 = load i8, i8* %141
%143 = call i32 @calculate_winner(i8 signext %134, i8 signext %138, i8 signext %142)
store i32 %143, i32* %4
%144 = load i32, i32* %4
%145 = icmp ne i32 %144, 0
br i1 %145, label %146, label %148
146: ; preds = %130
%147 = load i32, i32* %4
store i32 %147, i32* %2
br label %149
148: ; preds = %130
store i32 0, i32* %2
br label %149
149: ; preds = %148, %146, %128, %110, %92, %74, %56, %38, %20
%150 = load i32, i32* %2
ret i32 %150
}

LLVM IR (-O2):
define i32 @analize_board([3 x i8]* nocapture %0) {
%2 = getelementptr inbounds [3 x i8], [3 x i8]* %0, i64 0, i64 0
%3 = load i8, i8* %2
%4 = getelementptr inbounds [3 x i8], [3 x i8]* %0, i64 0, i64 1
%5 = load i8, i8* %4
%6 = getelementptr inbounds [3 x i8], [3 x i8]* %0, i64 0, i64 2
%7 = load i8, i8* %6
%8 = tail call i32 @calculate_winner(i8 signext %3, i8 signext %5, i8 signext %7)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %57
10: ; preds = %1
%11 = getelementptr inbounds [3 x i8], [3 x i8]* %0, i64 1, i64 0
%12 = load i8, i8* %11
%13 = getelementptr inbounds [3 x i8], [3 x i8]* %0, i64 1, i64 1
%14 = load i8, i8* %13
%15 = getelementptr inbounds [3 x i8], [3 x i8]* %0, i64 1, i64 2
%16 = load i8, i8* %15
%17 = tail call i32 @calculate_winner(i8 signext %12, i8 signext %14, i8 signext %16)
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %57
19: ; preds = %10
%20 = getelementptr inbounds [3 x i8], [3 x i8]* %0, i64 2, i64 0
%21 = load i8, i8* %20
%22 = getelementptr inbounds [3 x i8], [3 x i8]* %0, i64 2, i64 1
%23 = load i8, i8* %22
%24 = getelementptr inbounds [3 x i8], [3 x i8]* %0, i64 2, i64 2
%25 = load i8, i8* %24
%26 = tail call i32 @calculate_winner(i8 signext %21, i8 signext %23, i8 signext %25)
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %57
28: ; preds = %19
%29 = load i8, i8* %2
%30 = load i8, i8* %11
%31 = load i8, i8* %20
%32 = tail call i32 @calculate_winner(i8 signext %29, i8 signext %30, i8 signext %31)
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %57
34: ; preds = %28
%35 = load i8, i8* %4
%36 = load i8, i8* %13
%37 = load i8, i8* %22
%38 = tail call i32 @calculate_winner(i8 signext %35, i8 signext %36, i8 signext %37)
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %57
40: ; preds = %34
%41 = load i8, i8* %6
%42 = load i8, i8* %15
%43 = load i8, i8* %24
%44 = tail call i32 @calculate_winner(i8 signext %41, i8 signext %42, i8 signext %43)
%45 = icmp eq i32 %44, 0
br i1 %45, label %46, label %57
46: ; preds = %40
%47 = load i8, i8* %2
%48 = load i8, i8* %13
%49 = load i8, i8* %24
%50 = tail call i32 @calculate_winner(i8 signext %47, i8 signext %48, i8 signext %49)
%51 = icmp eq i32 %50, 0
br i1 %51, label %52, label %57
52: ; preds = %46
%53 = load i8, i8* %6
%54 = load i8, i8* %13
%55 = load i8, i8* %20
%56 = tail call i32 @calculate_winner(i8 signext %53, i8 signext %54, i8 signext %55)
br label %57
57: ; preds = %52, %46, %40, %34, %28, %19, %10, %1
%58 = phi i32 [ %8, %1 ], [ %17, %10 ], [ %26, %19 ], [ %32, %28 ], [ %38, %34 ], [ %44, %40 ], [ %50, %46 ], [ %56, %52 ]
ret i32 %58
}