#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*/ delField(char *);
int /*<<< orphan*/ drawField(char *, int, int);
char gameLoop(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ system(char *);
int main() {
  char c = 0;
  char playground[9];
  delField(playground);
  c = gameLoop(playground);
  system("cls");
  drawField(playground, 2, 2);
  if (c != 0)
    printf("Spieler %c hat gewonnen!\n", c);
  else
    printf("Spielende! Unentschieden!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x0,-0x5(%rbp)
lea    -0xe(%rbp),%rdi
call   1070 <delField@plt>
lea    -0xe(%rbp),%rdi
call   1030 <gameLoop@plt>
mov    %al,-0x5(%rbp)
lea    0xe81(%rip),%rdi
call   1040 <system@plt>
lea    -0xe(%rbp),%rdi
mov    $0x2,%edx
mov    %edx,%esi
call   1060 <drawField@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x0,%eax
je     11b8 <main+0x68>
movsbl -0x5(%rbp),%esi
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    11c6 <main+0x76>
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xf(%rsp),%r14
mov    %r14,%rdi
call   1080 <delField@plt>
mov    %r14,%rdi
call   1030 <gameLoop@plt>
mov    %eax,%ebx
lea    0xe7b(%rip),%rdi
call   1050 <system@plt>
mov    %r14,%rdi
mov    $0x2,%esi
mov    $0x2,%edx
call   1070 <drawField@plt>
test   %bl,%bl
je     11b3 <main+0x53>
movsbl %bl,%esi
lea    0xe5a(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    11bf <main+0x5f>
lea    0xe64(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"cls\00"
@.str.1 = [26 x i8] c"Spieler %c hat gewonnen!\0A\00"
@.str.2 = [27 x i8] c"Spielende! Unentschieden!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca [9 x i8]
store i32 0, i32* %1
store i8 0, i8* %2
%4 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 0
%5 = call i32 @delField(i8* %4)
%6 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 0
%7 = call signext i8 @gameLoop(i8* %6)
store i8 %7, i8* %2
%8 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 0
%10 = call i32 @drawField(i8* %9, i32 2, i32 2)
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %0
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %16)
br label %20
18: ; preds = %0
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
br label %20
20: ; preds = %18, %14
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"cls\00"
@.str.1 = [26 x i8] c"Spieler %c hat gewonnen!\0A\00"
@str = [26 x i8] c"Spielende! Unentschieden!\00"
define i32 @main() {
%1 = alloca [9 x i8]
%2 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 0
%3 = call i32 @delField(i8* %2)
%4 = call signext i8 @gameLoop(i8* %2)
%5 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @drawField(i8* %2, i32 2, i32 2)
%7 = icmp eq i8 %4, 0
br i1 %7, label %11, label %8
8: ; preds = %0
%9 = sext i8 %4 to i32
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %9)
br label %13
11: ; preds = %0
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
br label %13
13: ; preds = %11, %8
ret i32 0
}