#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 /*<<< orphan*/ Colonne(int *);
int /*<<< orphan*/ Diagonali(int *);
int /*<<< orphan*/ Print();
int /*<<< orphan*/ Righe(int *);
int /*<<< orphan*/ Turno(int, int, int);
int /*<<< orphan*/ printf(char *);
int main() {
  int r, c, sum, count = 0;
  do {
    Turno(r, c, count++ % 2 + 1);
  } while (!Righe(&sum) && !Colonne(&sum) && !Diagonali(&sum));
  Print();
  if (sum < 0)
    printf("Ha vinto il giocatore 1");
  else
    printf("Ha vinto il giocatore 2");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
mov    $0x2,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
call   1060 <Turno@plt>
lea    -0x10(%rbp),%rdi
call   1070 <Righe@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x15(%rbp)
jne    11dd <main+0x7d>
lea    -0x10(%rbp),%rdi
call   1050 <Colonne@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x15(%rbp)
jne    11dd <main+0x7d>
lea    -0x10(%rbp),%rdi
call   1030 <Diagonali@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1176 <main+0x16>
mov    $0x0,%al
call   1080 <Print@plt>
cmpl   $0x0,-0x10(%rbp)
jge    120a <main+0xaa>
lea    0xe00(%rip),%rdi
call   1040 <printf@plt>
jmp    1216 <main+0xb6>
lea    0xe07(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
lea    0x4(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edx
and    $0x1,%edx
add    $0x1,%edx
call   1060 <Turno@plt>
mov    %rbx,%rdi
call   1070 <Righe@plt>
test   %eax,%eax
jne    11a4 <main+0x44>
mov    %rbx,%rdi
call   1050 <Colonne@plt>
test   %eax,%eax
jne    11a4 <main+0x44>
mov    %rbx,%rdi
call   1030 <Diagonali@plt>
add    $0x1,%ebp
test   %eax,%eax
je     1170 <main+0x10>
xor    %eax,%eax
call   1080 <Print@plt>
cmpl   $0x0,0x4(%rsp)
lea    0xe49(%rip),%rax
lea    0xe5a(%rip),%rdi
cmovs  %rax,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Ha vinto il giocatore 1\00"
@.str.1 = [24 x i8] c"Ha vinto il giocatore 2\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
br label %6
6: ; preds = %24, %0
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = load i32, i32* %5
%10 = add nsw i32 %9, 1
store i32 %10, i32* %5
%11 = srem i32 %9, 2
%12 = add nsw i32 %11, 1
%13 = call i32 @Turno(i32 %7, i32 %8, i32 %12)
br label %14
14: ; preds = %6
%15 = call i32 @Righe(i32* %4)
%16 = icmp ne i32 %15, 0
br i1 %16, label %24, label %17
17: ; preds = %14
%18 = call i32 @Colonne(i32* %4)
%19 = icmp ne i32 %18, 0
br i1 %19, label %24, label %20
20: ; preds = %17
%21 = call i32 @Diagonali(i32* %4)
%22 = icmp ne i32 %21, 0
%23 = xor i1 %22, true
br label %24
24: ; preds = %20, %17, %14
%25 = phi i1 [ false, %17 ], [ false, %14 ], [ %23, %20 ]
br i1 %25, label %6, label %26
26: ; preds = %24
%27 = call i32 (...) @Print()
%28 = load i32, i32* %4
%29 = icmp slt i32 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %34
32: ; preds = %26
%33 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
br label %34
34: ; preds = %32, %30
%35 = load i32, i32* %1
ret i32 %35
}

LLVM IR (-O2):
@.str = [24 x i8] c"Ha vinto il giocatore 1\00"
@.str.1 = [24 x i8] c"Ha vinto il giocatore 2\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %14, %0
%4 = phi i32 [ 0, %0 ], [ %5, %14 ]
%5 = add nuw nsw i32 %4, 1
%6 = and i32 %4, 1
%7 = add nuw nsw i32 %6, 1
%8 = call i32 @Turno(i32 undef, i32 undef, i32 %7)
%9 = call i32 @Righe(i32* %1)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %17
11: ; preds = %3
%12 = call i32 @Colonne(i32* %1)
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = call i32 @Diagonali(i32* %1)
%16 = icmp eq i32 %15, 0
br i1 %16, label %3, label %17
17: ; preds = %3, %11, %14
%18 = call i32 (...) @Print()
%19 = load i32, i32* %1
%20 = icmp slt i32 %19, 0
%21 = select i1 %20, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0)
%22 = call i32 @printf(i8* dereferenceable(1) %21)
ret i32 0
}