#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 EXIT_SUCCESS;
int /*<<< orphan*/ ausgabe(int, int, int);
int erg(int);
int /*<<< orphan*/ init();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ setbuf(int /*<<< orphan*/, int /*<<< orphan*/ *);
int spalte();
int /*<<< orphan*/ stdout;
int zeile();
int main(void) {
  setbuf(stdout, NULL);
  int runde = 64;
  int z;
  int s;
  int spieler = 1;
  init();
  while ((runde > 0) && (erg(spieler) < 4)) {
    z = zeile();
    s = spalte();
    spieler *= -1;
    ausgabe(z, s, spieler);
    printf("\n");
    runde--;
  }
  if (runde > 0) {
    printf("Gewonnen!");
  } else {
    printf("Unentschieden!");
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e5a(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <setbuf@plt>
movl   $0x40,-0x8(%rbp)
movl   $0x1,-0x14(%rbp)
mov    $0x0,%al
call   1070 <init@plt>
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x15(%rbp)
jle    11c6 <main+0x56>
mov    -0x14(%rbp),%edi
call   1060 <erg@plt>
cmp    $0x4,%eax
setl   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    11d6 <main+0x66>
jmp    1219 <main+0xa9>
mov    $0x0,%al
call   1090 <zeile@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1080 <spalte@plt>
mov    %eax,-0x10(%rbp)
imul   $0xffffffff,-0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1030 <ausgabe@plt>
lea    0xdfa(%rip),%rdi
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    11a6 <main+0x36>
cmpl   $0x0,-0x8(%rbp)
jle    1234 <main+0xc4>
lea    0xdd8(%rip),%rdi
call   1050 <printf@plt>
jmp    1240 <main+0xd0>
lea    0xdd1(%rip),%rdi
call   1050 <printf@plt>
mov    0x2d91(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    0x2e51(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1050 <setbuf@plt>
xor    %eax,%eax
call   1080 <init@plt>
mov    $0x1,%ebp
mov    $0x41,%ebx
lea    0xe50(%rip),%r14
lea    0xe53(%rip),%r12
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1070 <erg@plt>
cmp    $0x3,%eax
jg     1200 <main+0x80>
xor    %eax,%eax
call   10a0 <zeile@plt>
mov    %eax,%r15d
xor    %eax,%eax
call   1090 <spalte@plt>
neg    %ebp
mov    %r15d,%edi
mov    %eax,%esi
mov    %ebp,%edx
call   1040 <ausgabe@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     11c0 <main+0x40>
mov    %r12,%r14
mov    %r14,%rdi
call   1060 <printf@plt>
mov    0x2dc9(%rip),%rax
mov    (%rax),%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [2 x i8] c"\0A\00"
@.str.1 = [10 x i8] c"Gewonnen!\00"
@.str.2 = [15 x i8] c"Unentschieden!\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = load i32, i32* @stdout
%7 = call i32 @setbuf(i32 %6, i32* null)
store i32 64, i32* %2
store i32 1, i32* %5
%8 = call i32 (...) @init()
br label %9
9: ; preds = %18, %0
%10 = load i32, i32* %2
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = load i32, i32* %5
%14 = call i32 @erg(i32 %13)
%15 = icmp slt i32 %14, 4
br label %16
16: ; preds = %12, %9
%17 = phi i1 [ false, %9 ], [ %15, %12 ]
br i1 %17, label %18, label %30
18: ; preds = %16
%19 = call i32 (...) @zeile()
store i32 %19, i32* %3
%20 = call i32 (...) @spalte()
store i32 %20, i32* %4
%21 = load i32, i32* %5
%22 = mul nsw i32 %21, -1
store i32 %22, i32* %5
%23 = load i32, i32* %3
%24 = load i32, i32* %4
%25 = load i32, i32* %5
%26 = call i32 @ausgabe(i32 %23, i32 %24, i32 %25)
%27 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%28 = load i32, i32* %2
%29 = add nsw i32 %28, -1
store i32 %29, i32* %2
br label %9
30: ; preds = %16
%31 = load i32, i32* %2
%32 = icmp sgt i32 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %37
35: ; preds = %30
%36 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %37
37: ; preds = %35, %33
%38 = load i32, i32* @EXIT_SUCCESS
ret i32 %38
}

LLVM IR (-O2):
@stdout = global i32 0
@.str.1 = [10 x i8] c"Gewonnen!\00"
@.str.2 = [15 x i8] c"Unentschieden!\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @setbuf(i32 %1, i32* null)
%3 = tail call i32 (...) @init()
br label %4
4: ; preds = %0, %9
%5 = phi i32 [ 1, %0 ], [ %12, %9 ]
%6 = phi i32 [ 64, %0 ], [ %15, %9 ]
%7 = tail call i32 @erg(i32 %5)
%8 = icmp slt i32 %7, 4
br i1 %8, label %9, label %17
9: ; preds = %4
%10 = tail call i32 (...) @zeile()
%11 = tail call i32 (...) @spalte()
%12 = sub nsw i32 0, %5
%13 = tail call i32 @ausgabe(i32 %10, i32 %11, i32 %12)
%14 = tail call i32 @putchar(i32 10)
%15 = add nsw i32 %6, -1
%16 = icmp ugt i32 %6, 1
br i1 %16, label %4, label %17
17: ; preds = %9, %4
%18 = phi i8* [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), %4 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), %9 ]
%19 = tail call i32 @printf(i8* dereferenceable(1) %18)
%20 = load i32, i32* @EXIT_SUCCESS
ret i32 %20
}