#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*/ printf(char *, ...);
void schreibe_spielfeld(int zeilen, int spalten,
                        int spielfeld[zeilen][spalten]) {
  const char zeichensatz[] = {
      'O',
      '.',
      'X',
  };
  int i;
  int j;
  for (int i = 0; i < zeilen; i++) {
    printf(" %2d", i + 1);
  }
  printf("\n");
  for (i = zeilen - 1; i >= 0; i--) {
    printf("|");
    for (j = 0; j < spalten - 1; j++) {
      printf("%2c ", zeichensatz[spielfeld[i][j] + 1]);
    }
    printf("%2c |\n", zeichensatz[spielfeld[i][spalten - 1] + 1]);
  }
  printf("+");
  for (int i = 0; i < spalten; i++) {
    printf("%3s", "---");
  }
  printf("+\n");
  printf("\n");
}


x86 assembly (clang, -O0):
<schreibe_spielfeld>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %rax,-0x30(%rbp)
mov    0xed0(%rip),%ax
mov    %ax,-0x13(%rbp)
mov    0xec8(%rip),%al
mov    %al,-0x11(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1172 <schreibe_spielfeld+0x62>
mov    -0x20(%rbp),%esi
add    $0x1,%esi
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1144 <schreibe_spielfeld+0x34>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jl     1246 <schreibe_spielfeld+0x136>
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11fd <schreibe_spielfeld+0xed>
mov    -0x30(%rbp),%rdx
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
imul   %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
add    $0x1,%eax
cltq
movsbl -0x13(%rbp,%rax,1),%esi
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11a8 <schreibe_spielfeld+0x98>
mov    -0x30(%rbp),%rdx
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
imul   %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
add    $0x1,%eax
cltq
movsbl -0x13(%rbp,%rax,1),%esi
lea    0xdde(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    1189 <schreibe_spielfeld+0x79>
lea    0xdc9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    128a <schreibe_spielfeld+0x17a>
lea    0xdaa(%rip),%rdi
lea    0xda7(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    125b <schreibe_spielfeld+0x14b>
lea    0xd8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<schreibe_spielfeld>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %esi,%ebx
test   %edi,%edi
jle    1293 <schreibe_spielfeld+0x163>
mov    %rdx,%r13
mov    %edi,%r12d
mov    %ebx,%eax
mov    %rax,(%rsp)
mov    %edi,%r14d
neg    %r14d
mov    $0x1,%ebp
lea    0xe9d(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    (%r14,%rbp,1),%eax
add    $0x1,%eax
mov    %ebp,%ecx
add    $0x1,%ecx
mov    %ecx,%ebp
cmp    $0x1,%eax
jne    1170 <schreibe_spielfeld+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %r12d,%r12d
jle    129d <schreibe_spielfeld+0x16d>
lea    -0x1(%rbx),%ebp
movslq %ebp,%rax
mov    %r12d,%edx
lea    0x0(,%rax,4),%rax
add    %r13,%rax
mov    %rax,0x10(%rsp)
lea    -0x1(%rdx),%rax
mov    (%rsp),%rcx
imul   %rcx,%rax
lea    0x0(%r13,%rax,4),%r13
lea    0x0(,%rcx,4),%rax
neg    %rax
mov    %rax,0x8(%rsp)
lea    0xe1d(%rip),%r15
lea    0xe1e(%rip),%r12
mov    %rbx,0x18(%rsp)
jmp    1239 <schreibe_spielfeld+0x109>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x10(%rsp),%rax
mov    0x20(%rsp),%rcx
movslq (%rax,%rcx,4),%rax
movsbl 0x1(%rax,%r15,1),%esi
lea    0xdf2(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    0x8(%rsp),%r13
cmpq   $0x1,0x30(%rsp)
mov    0x28(%rsp),%rdx
mov    0x18(%rsp),%rbx
jle    129d <schreibe_spielfeld+0x16d>
mov    %rdx,0x30(%rsp)
lea    -0x1(%rdx),%r14
mov    $0x7c,%edi
call   1030 <putchar@plt>
mov    %r14,0x28(%rsp)
imul   (%rsp),%r14
mov    %r14,0x20(%rsp)
cmp    $0x2,%ebx
jl     1200 <schreibe_spielfeld+0xd0>
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movslq 0x0(%r13,%r14,4),%rax
movsbl 0x1(%rax,%r15,1),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r14
cmp    %r14,%rbp
jne    1270 <schreibe_spielfeld+0x140>
jmp    1200 <schreibe_spielfeld+0xd0>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x2b,%edi
call   1030 <putchar@plt>
test   %ebx,%ebx
jle    12d2 <schreibe_spielfeld+0x1a2>
lea    0xd62(%rip),%r14
lea    0xd5f(%rip),%rbp
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0xffffffff,%ebx
jne    12c0 <schreibe_spielfeld+0x190>
lea    0xd43(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@__const.schreibe_spielfeld.zeichensatz = [3 x i8] c"O.X"
@.str = [5 x i8] c" %2d\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [2 x i8] c"|\00"
@.str.3 = [5 x i8] c"%2c \00"
@.str.4 = [7 x i8] c"%2c |\0A\00"
@.str.5 = [2 x i8] c"+\00"
@.str.6 = [4 x i8] c"%3s\00"
@.str.7 = [4 x i8] c"---\00"
@.str.8 = [3 x i8] c"+\0A\00"
define void @schreibe_spielfeld(i32 %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca [3 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%12 = load i32, i32* %4
%13 = zext i32 %12 to i64
%14 = load i32, i32* %5
%15 = zext i32 %14 to i64
%16 = bitcast [3 x i8]* %7 to i8*
store i32 0, i32* %10
br label %17
17: ; preds = %25, %3
%18 = load i32, i32* %10
%19 = load i32, i32* %4
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %28
21: ; preds = %17
%22 = load i32, i32* %10
%23 = add nsw i32 %22, 1
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %21
%26 = load i32, i32* %10
%27 = add nsw i32 %26, 1
store i32 %27, i32* %10
br label %17
28: ; preds = %17
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%30 = load i32, i32* %4
%31 = sub nsw i32 %30, 1
store i32 %31, i32* %8
br label %32
32: ; preds = %78, %28
%33 = load i32, i32* %8
%34 = icmp sge i32 %33, 0
br i1 %34, label %35, label %81
35: ; preds = %32
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %9
br label %37
37: ; preds = %58, %35
%38 = load i32, i32* %9
%39 = load i32, i32* %5
%40 = sub nsw i32 %39, 1
%41 = icmp slt i32 %38, %40
br i1 %41, label %42, label %61
42: ; preds = %37
%43 = load i32*, i32** %6
%44 = load i32, i32* %8
%45 = sext i32 %44 to i64
%46 = mul nsw i64 %45, %15
%47 = getelementptr inbounds i32, i32* %43, i64 %46
%48 = load i32, i32* %9
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i32, i32* %47, i64 %49
%51 = load i32, i32* %50
%52 = add nsw i32 %51, 1
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [3 x i8], [3 x i8]* %7, i64 0, i64 %53
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %56)
br label %58
58: ; preds = %42
%59 = load i32, i32* %9
%60 = add nsw i32 %59, 1
store i32 %60, i32* %9
br label %37
61: ; preds = %37
%62 = load i32*, i32** %6
%63 = load i32, i32* %8
%64 = sext i32 %63 to i64
%65 = mul nsw i64 %64, %15
%66 = getelementptr inbounds i32, i32* %62, i64 %65
%67 = load i32, i32* %5
%68 = sub nsw i32 %67, 1
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i32, i32* %66, i64 %69
%71 = load i32, i32* %70
%72 = add nsw i32 %71, 1
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [3 x i8], [3 x i8]* %7, i64 0, i64 %73
%75 = load i8, i8* %74
%76 = sext i8 %75 to i32
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %76)
br label %78
78: ; preds = %61
%79 = load i32, i32* %8
%80 = add nsw i32 %79, -1
store i32 %80, i32* %8
br label %32
81: ; preds = %32
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %11
br label %83
83: ; preds = %89, %81
%84 = load i32, i32* %11
%85 = load i32, i32* %5
%86 = icmp slt i32 %84, %85
br i1 %86, label %87, label %92
87: ; preds = %83
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
br label %89
89: ; preds = %87
%90 = load i32, i32* %11
%91 = add nsw i32 %90, 1
store i32 %91, i32* %11
br label %83
92: ; preds = %83
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__const.schreibe_spielfeld.zeichensatz = [3 x i8] c"O.X"
@.str = [5 x i8] c" %2d\00"
@.str.3 = [5 x i8] c"%2c \00"
@.str.4 = [7 x i8] c"%2c |\0A\00"
@.str.6 = [4 x i8] c"%3s\00"
@.str.7 = [4 x i8] c"---\00"
@str = [2 x i8] c"+\00"
define void @schreibe_spielfeld(i32 %0, i32 %1, i32* nocapture %2) {
%4 = zext i32 %1 to i64
%5 = icmp sgt i32 %0, 0
br i1 %5, label %17, label %6
6: ; preds = %3
%7 = tail call i32 @putchar(i32 10)
br label %51
8: ; preds = %17
%9 = tail call i32 @putchar(i32 10)
br i1 %5, label %10, label %51
10: ; preds = %8
%11 = add i32 %1, -1
%12 = icmp sgt i32 %1, 1
%13 = sext i32 %11 to i64
%14 = zext i32 %0 to i64
%15 = zext i32 %11 to i64
%16 = getelementptr inbounds i32, i32* %2, i64 %13
br label %22
17: ; preds = %3, %17
%18 = phi i32 [ %19, %17 ], [ 0, %3 ]
%19 = add nuw nsw i32 %18, 1
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = icmp eq i32 %19, %0
br i1 %21, label %8, label %17
22: ; preds = %10, %41
%23 = phi i64 [ %14, %10 ], [ %24, %41 ]
%24 = add nsw i64 %23, -1
%25 = tail call i32 @putchar(i32 124)
%26 = mul nsw i64 %24, %4
br i1 %12, label %27, label %41
27: ; preds = %22
%28 = getelementptr inbounds i32, i32* %2, i64 %26
br label %29
29: ; preds = %27, %29
%30 = phi i64 [ 0, %27 ], [ %39, %29 ]
%31 = getelementptr inbounds i32, i32* %28, i64 %30
%32 = load i32, i32* %31
%33 = add nsw i32 %32, 1
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [3 x i8], [3 x i8]* @__const.schreibe_spielfeld.zeichensatz, i64 0, i64 %34
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %37)
%39 = add nuw nsw i64 %30, 1
%40 = icmp eq i64 %39, %15
br i1 %40, label %41, label %29
41: ; preds = %29, %22
%42 = getelementptr inbounds i32, i32* %16, i64 %26
%43 = load i32, i32* %42
%44 = add nsw i32 %43, 1
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [3 x i8], [3 x i8]* @__const.schreibe_spielfeld.zeichensatz, i64 0, i64 %45
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %48)
%50 = icmp sgt i64 %23, 1
br i1 %50, label %22, label %51
51: ; preds = %41, %6, %8
%52 = tail call i32 @putchar(i32 43)
%53 = icmp sgt i32 %1, 0
br i1 %53, label %57, label %54
54: ; preds = %57, %51
%55 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%56 = tail call i32 @putchar(i32 10)
ret void
57: ; preds = %51, %57
%58 = phi i32 [ %60, %57 ], [ 0, %51 ]
%59 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%60 = add nuw nsw i32 %58, 1
%61 = icmp eq i32 %60, %1
br i1 %61, label %54, label %57
}