#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 */
typedef int /*<<< orphan*/ players;

/* Variables and functions */
int /*<<< orphan*/ init();
int /*<<< orphan*/ printf(char *, ...);
int turn(int, int);
int main() {
  int players[3] = {1, 1, 1};
  int i, ns;
  init();
  while (true) {
    for (i = 0; i < sizeof(players) / sizeof(int); ++i) {
      ns = turn(i + 1, players[i]);
      if (ns == 100) {
        printf("Player %d wins!\n", i + 1);
        goto out;
      }
      players[i] = ns;
      printf("\n");
    }
  }
out:
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xeb8(%rip),%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <init@plt>
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rax
cmp    $0x3,%rax
jae    11cf <main+0x9f>
mov    -0x14(%rbp),%edi
add    $0x1,%edi
movslq -0x14(%rbp),%rax
mov    -0x10(%rbp,%rax,4),%esi
call   1030 <turn@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x64,-0x18(%rbp)
jne    11a8 <main+0x78>
mov    -0x14(%rbp),%esi
add    $0x1,%esi
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11d4 <main+0xa4>
mov    -0x18(%rbp),%ecx
movslq -0x14(%rbp),%rax
mov    %ecx,-0x10(%rbp,%rax,4)
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1161 <main+0x31>
jmp    115a <main+0x2a>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1060 <init@plt>
mov    $0x1,%ebp
mov    $0x1,%edi
mov    $0x1,%esi
call   1040 <turn@plt>
cmp    $0x64,%eax
je     11ea <main+0xaa>
mov    %eax,%r14d
mov    $0x1,%r15d
mov    $0x1,%ebx
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x2,%ebp
mov    $0x2,%edi
mov    %r15d,%esi
call   1040 <turn@plt>
cmp    $0x64,%eax
je     11ea <main+0xaa>
mov    %eax,%r15d
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x3,%ebp
mov    $0x3,%edi
mov    %ebx,%esi
call   1040 <turn@plt>
cmp    $0x64,%eax
je     11ea <main+0xaa>
mov    %eax,%ebx
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%ebp
mov    $0x1,%edi
mov    %r14d,%esi
call   1040 <turn@plt>
mov    %eax,%r14d
cmp    $0x64,%eax
jne    1180 <main+0x40>
lea    0xe0f(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.players = [3 x i32] [i32 1, i32 1, i32 1]
@.str = [17 x i8] c"Player %d wins!\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [3 x i32]* %2 to i8*
%6 = call i32 (...) @init()
br label %7
7: ; preds = %0, %35
store i32 0, i32* %3
br label %8
8: ; preds = %32, %7
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = icmp ult i64 %10, 3
br i1 %11, label %12, label %35
12: ; preds = %8
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 %16
%18 = load i32, i32* %17
%19 = call i32 @turn(i32 %14, i32 %18)
store i32 %19, i32* %4
%20 = load i32, i32* %4
%21 = icmp eq i32 %20, 100
br i1 %21, label %22, label %26
22: ; preds = %12
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %24)
br label %36
26: ; preds = %12
%27 = load i32, i32* %4
%28 = load i32, i32* %3
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 %29
store i32 %27, i32* %30
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %32
32: ; preds = %26
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
br label %8
35: ; preds = %8
br label %7
36: ; preds = %22
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"Player %d wins!\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @init()
%2 = tail call i32 @turn(i32 1, i32 1)
%3 = icmp eq i32 %2, 100
br i1 %3, label %4, label %7
4: ; preds = %18, %7, %14, %0
%5 = phi i32 [ 1, %0 ], [ 1, %18 ], [ 2, %7 ], [ 3, %14 ]
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
7: ; preds = %0, %18
%8 = phi i32 [ %20, %18 ], [ %2, %0 ]
%9 = phi i32 [ %12, %18 ], [ 1, %0 ]
%10 = phi i32 [ %16, %18 ], [ 1, %0 ]
%11 = tail call i32 @putchar(i32 10)
%12 = tail call i32 @turn(i32 2, i32 %9)
%13 = icmp eq i32 %12, 100
br i1 %13, label %4, label %14
14: ; preds = %7
%15 = tail call i32 @putchar(i32 10)
%16 = tail call i32 @turn(i32 3, i32 %10)
%17 = icmp eq i32 %16, 100
br i1 %17, label %4, label %18
18: ; preds = %14
%19 = tail call i32 @putchar(i32 10)
%20 = tail call i32 @turn(i32 1, i32 %8)
%21 = icmp eq i32 %20, 100
br i1 %21, label %4, label %7
}