void simuliere_vier_gewinnt(int zeilen, int spalten, const char spieler1[],
                            const char spieler2[]) {
  int spielfeld[zeilen][spalten];
  initialisiere_2dim_int_array(zeilen, spalten, spielfeld, 0);
  int max_anzahl_zuege = (zeilen * spalten) / 2;
  _Bool beenden = 0;
  int spielstein = -1;
  schreibe_spielfeld(zeilen, spalten, spielfeld);
  for (int j = 0; j < max_anzahl_zuege && beenden == 0; j++) {
    if (beenden == 0) {
      schreibe_zeichenkette(spieler1);
      printf(" ist am Zug...");
      beenden = nechster_zug(zeilen, spalten, spielfeld, spielstein);
      spielstein = 1;
      if (beenden != 0) {
        schreibe_zeichenkette(spieler1);
        printf(" hat gewonnen! Glueckwunsch!\n\n");
      }
    }
    if (beenden == 0) {
      schreibe_zeichenkette(spieler2);
      printf(" ist am Zug...");
      beenden = nechster_zug(zeilen, spalten, spielfeld, spielstein);
      spielstein = -1;
      if (beenden != 0) {
        schreibe_zeichenkette(spieler2);
        printf(" hat gewonnen! Glueckwunsch!\n\n");
      }
    }
  }
  if (beenden == 0) {
    printf("Spiel ist vorbei, Unentschieden!\n\n");
  }
}


x86 assembly (clang, -O0):
<simuliere_vier_gewinnt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
mov    %rsp,%rdx
mov    %rdx,-0x20(%rbp)
mov    %rcx,%rdx
imul   %rax,%rdx
lea    0xf(,%rdx,4),%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x48(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x28(%rbp)
mov    %rax,-0x30(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
xor    %ecx,%ecx
mov    $0x0,%al
call   1060 <initialisiere_2dim_int_array@plt>
mov    -0x4(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    -0x48(%rbp),%rdx
mov    %eax,-0x34(%rbp)
movb   $0x0,-0x35(%rbp)
movl   $0xffffffff,-0x3c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0x0,%al
call   1070 <schreibe_spielfeld@plt>
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%ecx
xor    %eax,%eax
cmp    -0x34(%rbp),%ecx
mov    %al,-0x49(%rbp)
jge    1203 <simuliere_vier_gewinnt+0xb3>
mov    -0x35(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x0,%eax
sete   %al
mov    %al,-0x49(%rbp)
mov    -0x49(%rbp),%al
test   $0x1,%al
jne    1213 <simuliere_vier_gewinnt+0xc3>
jmp    1324 <simuliere_vier_gewinnt+0x1d4>
mov    -0x35(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x0,%eax
jne    1292 <simuliere_vier_gewinnt+0x142>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1040 <schreibe_zeichenkette@plt>
lea    0xdca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%rdx
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x3c(%rbp),%ecx
mov    $0x0,%al
call   1050 <nechster_zug@plt>
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
mov    %al,-0x35(%rbp)
movl   $0x1,-0x3c(%rbp)
mov    -0x35(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x0,%eax
je     128d <simuliere_vier_gewinnt+0x13d>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1040 <schreibe_zeichenkette@plt>
lea    0xd89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1292 <simuliere_vier_gewinnt+0x142>
mov    -0x35(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x0,%eax
jne    1311 <simuliere_vier_gewinnt+0x1c1>
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   1040 <schreibe_zeichenkette@plt>
lea    0xd4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%rdx
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x3c(%rbp),%ecx
mov    $0x0,%al
call   1050 <nechster_zug@plt>
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
mov    %al,-0x35(%rbp)
movl   $0xffffffff,-0x3c(%rbp)
mov    -0x35(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x0,%eax
je     130c <simuliere_vier_gewinnt+0x1bc>
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   1040 <schreibe_zeichenkette@plt>
lea    0xd0a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1311 <simuliere_vier_gewinnt+0x1c1>
jmp    1316 <simuliere_vier_gewinnt+0x1c6>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    11e1 <simuliere_vier_gewinnt+0x91>
mov    -0x35(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x0,%eax
jne    1343 <simuliere_vier_gewinnt+0x1f3>
lea    0xcf2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<simuliere_vier_gewinnt>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rcx,-0x38(%rbp)
mov    %rdx,%r15
mov    %esi,%r12d
mov    %edi,%r13d
mov    %edi,%eax
mov    %esi,%ecx
imul   %rax,%rcx
lea    0xf(,%rcx,4),%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%rbx
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %rbx,%rdx
xor    %ecx,%ecx
xor    %eax,%eax
call   1070 <initialisiere_2dim_int_array@plt>
mov    %r12d,%r14d
imul   %r13d,%r14d
mov    %r13d,%edi
mov    %r12d,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1080 <schreibe_spielfeld@plt>
lea    0xe4a(%rip),%rdi
cmp    $0x2,%r14d
jl     1273 <simuliere_vier_gewinnt+0x113>
mov    %r15,-0x30(%rbp)
mov    %r14d,%r15d
shr    $0x1f,%r15d
add    %r14d,%r15d
sar    %r15d
lea    0xe19(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    -0x30(%rbp),%rdi
xor    %eax,%eax
call   1050 <schreibe_zeichenkette@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13d,%edi
mov    %r12d,%esi
mov    %rbx,%rdx
mov    $0xffffffff,%ecx
xor    %eax,%eax
call   1060 <nechster_zug@plt>
test   %eax,%eax
jne    125b <simuliere_vier_gewinnt+0xfb>
mov    -0x38(%rbp),%rdi
xor    %eax,%eax
call   1050 <schreibe_zeichenkette@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13d,%edi
mov    %r12d,%esi
mov    %rbx,%rdx
mov    $0x1,%ecx
xor    %eax,%eax
call   1060 <nechster_zug@plt>
test   %eax,%eax
jne    1261 <simuliere_vier_gewinnt+0x101>
add    $0xffffffff,%r15d
jne    11f0 <simuliere_vier_gewinnt+0x90>
lea    0xdb6(%rip),%rdi
jmp    1273 <simuliere_vier_gewinnt+0x113>
mov    -0x30(%rbp),%rdi
jmp    1265 <simuliere_vier_gewinnt+0x105>
mov    -0x38(%rbp),%rdi
xor    %eax,%eax
call   1050 <schreibe_zeichenkette@plt>
lea    0xdbe(%rip),%rdi
call   1030 <puts@plt>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c" ist am Zug...\00"
@.str.1 = [31 x i8] c" hat gewonnen! Glueckwunsch!\0A\0A\00"
@.str.2 = [35 x i8] c"Spiel ist vorbei, Unentschieden!\0A\0A\00"
define void @simuliere_vier_gewinnt(i32 %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i64
%12 = alloca i32
%13 = alloca i8
%14 = alloca i32
%15 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%16 = load i32, i32* %5
%17 = zext i32 %16 to i64
%18 = load i32, i32* %6
%19 = zext i32 %18 to i64
%20 = call i8* @llvm.stacksave()
store i8* %20, i8** %9
%21 = mul nuw i64 %17, %19
%22 = alloca i32, i64 %21
store i64 %17, i64* %10
store i64 %19, i64* %11
%23 = load i32, i32* %5
%24 = load i32, i32* %6
%25 = call i32 (i32, i32, i32*, i32, ...) bitcast (i32 (...)* @initialisiere_2dim_int_array to i32 (i32, i32, i32*, i32, ...)*)(i32 %23, i32 %24, i32* %22, i32 0)
%26 = load i32, i32* %5
%27 = load i32, i32* %6
%28 = mul nsw i32 %26, %27
%29 = sdiv i32 %28, 2
store i32 %29, i32* %12
store i8 0, i8* %13
store i32 -1, i32* %14
%30 = load i32, i32* %5
%31 = load i32, i32* %6
%32 = call i32 (i32, i32, i32*, ...) bitcast (i32 (...)* @schreibe_spielfeld to i32 (i32, i32, i32*, ...)*)(i32 %30, i32 %31, i32* %22)
store i32 0, i32* %15
br label %33
33: ; preds = %93, %4
%34 = load i32, i32* %15
%35 = load i32, i32* %12
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %42
37: ; preds = %33
%38 = load i8, i8* %13
%39 = trunc i8 %38 to i1
%40 = zext i1 %39 to i32
%41 = icmp eq i32 %40, 0
br label %42
42: ; preds = %37, %33
%43 = phi i1 [ false, %33 ], [ %41, %37 ]
br i1 %43, label %44, label %96
44: ; preds = %42
%45 = load i8, i8* %13
%46 = trunc i8 %45 to i1
%47 = zext i1 %46 to i32
%48 = icmp eq i32 %47, 0
br i1 %48, label %49, label %68
49: ; preds = %44
%50 = load i8*, i8** %7
%51 = call i32 (i8*, ...) bitcast (i32 (...)* @schreibe_zeichenkette to i32 (i8*, ...)*)(i8* %50)
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%53 = load i32, i32* %5
%54 = load i32, i32* %6
%55 = load i32, i32* %14
%56 = call i32 (i32, i32, i32*, i32, ...) bitcast (i32 (...)* @nechster_zug to i32 (i32, i32, i32*, i32, ...)*)(i32 %53, i32 %54, i32* %22, i32 %55)
%57 = icmp ne i32 %56, 0
%58 = zext i1 %57 to i8
store i8 %58, i8* %13
store i32 1, i32* %14
%59 = load i8, i8* %13
%60 = trunc i8 %59 to i1
%61 = zext i1 %60 to i32
%62 = icmp ne i32 %61, 0
br i1 %62, label %63, label %67
63: ; preds = %49
%64 = load i8*, i8** %7
%65 = call i32 (i8*, ...) bitcast (i32 (...)* @schreibe_zeichenkette to i32 (i8*, ...)*)(i8* %64)
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
br label %67
67: ; preds = %63, %49
br label %68
68: ; preds = %67, %44
%69 = load i8, i8* %13
%70 = trunc i8 %69 to i1
%71 = zext i1 %70 to i32
%72 = icmp eq i32 %71, 0
br i1 %72, label %73, label %92
73: ; preds = %68
%74 = load i8*, i8** %8
%75 = call i32 (i8*, ...) bitcast (i32 (...)* @schreibe_zeichenkette to i32 (i8*, ...)*)(i8* %74)
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%77 = load i32, i32* %5
%78 = load i32, i32* %6
%79 = load i32, i32* %14
%80 = call i32 (i32, i32, i32*, i32, ...) bitcast (i32 (...)* @nechster_zug to i32 (i32, i32, i32*, i32, ...)*)(i32 %77, i32 %78, i32* %22, i32 %79)
%81 = icmp ne i32 %80, 0
%82 = zext i1 %81 to i8
store i8 %82, i8* %13
store i32 -1, i32* %14
%83 = load i8, i8* %13
%84 = trunc i8 %83 to i1
%85 = zext i1 %84 to i32
%86 = icmp ne i32 %85, 0
br i1 %86, label %87, label %91
87: ; preds = %73
%88 = load i8*, i8** %8
%89 = call i32 (i8*, ...) bitcast (i32 (...)* @schreibe_zeichenkette to i32 (i8*, ...)*)(i8* %88)
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
br label %91
91: ; preds = %87, %73
br label %92
92: ; preds = %91, %68
br label %93
93: ; preds = %92
%94 = load i32, i32* %15
%95 = add nsw i32 %94, 1
store i32 %95, i32* %15
br label %33
96: ; preds = %42
%97 = load i8, i8* %13
%98 = trunc i8 %97 to i1
%99 = zext i1 %98 to i32
%100 = icmp eq i32 %99, 0
br i1 %100, label %101, label %103
101: ; preds = %96
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
br label %103
103: ; preds = %101, %96
%104 = load i8*, i8** %9
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c" ist am Zug...\00"
@str = [34 x i8] c"Spiel ist vorbei, Unentschieden!\0A\00"
@str.4 = [30 x i8] c" hat gewonnen! Glueckwunsch!\0A\00"
define void @simuliere_vier_gewinnt(i32 %0, i32 %1, i8* %2, i8* %3) {
%5 = zext i32 %0 to i64
%6 = zext i32 %1 to i64
%7 = mul nuw i64 %6, %5
%8 = alloca i32, i64 %7
%9 = call i32 (i32, i32, i32*, i32, ...) bitcast (i32 (...)* @initialisiere_2dim_int_array to i32 (i32, i32, i32*, i32, ...)*)(i32 %0, i32 %1, i32* %8, i32 0)
%10 = mul nsw i32 %1, %0
%11 = sdiv i32 %10, 2
%12 = call i32 (i32, i32, i32*, ...) bitcast (i32 (...)* @schreibe_spielfeld to i32 (i32, i32, i32*, ...)*)(i32 %0, i32 %1, i32* %8)
%13 = icmp slt i32 %10, 2
br i1 %13, label %32, label %14
14: ; preds = %4, %29
%15 = phi i32 [ %30, %29 ], [ 0, %4 ]
%16 = call i32 (i8*, ...) bitcast (i32 (...)* @schreibe_zeichenkette to i32 (i8*, ...)*)(i8* %2)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%18 = call i32 (i32, i32, i32*, i32, ...) bitcast (i32 (...)* @nechster_zug to i32 (i32, i32, i32*, i32, ...)*)(i32 %0, i32 %1, i32* %8, i32 -1)
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %25
20: ; preds = %14
%21 = call i32 (i8*, ...) bitcast (i32 (...)* @schreibe_zeichenkette to i32 (i8*, ...)*)(i8* %3)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%23 = call i32 (i32, i32, i32*, i32, ...) bitcast (i32 (...)* @nechster_zug to i32 (i32, i32, i32*, i32, ...)*)(i32 %0, i32 %1, i32* %8, i32 1)
%24 = icmp eq i32 %23, 0
br i1 %24, label %29, label %25
25: ; preds = %20, %14
%26 = phi i8* [ %2, %14 ], [ %3, %20 ]
%27 = phi i8* [ getelementptr inbounds ([30 x i8], [30 x i8]* @str.4, i64 0, i64 0), %14 ], [ getelementptr inbounds ([30 x i8], [30 x i8]* @str.4, i64 0, i64 0), %20 ]
%28 = call i32 (i8*, ...) bitcast (i32 (...)* @schreibe_zeichenkette to i32 (i8*, ...)*)(i8* %26)
br label %32
29: ; preds = %20
%30 = add nuw nsw i32 %15, 1
%31 = icmp eq i32 %30, %11
br i1 %31, label %32, label %14
32: ; preds = %29, %4, %25
%33 = phi i8* [ %27, %25 ], [ getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0), %4 ], [ getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0), %29 ]
%34 = call i32 @puts(i8* dereferenceable(1) %33)
ret void
}