#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 print_table(char **t, int n, int k) {
  int i, j, count;
  count = 1;
  printf(" ");
  printf(" ");
  for (i = 0; i < n; i++) {
    printf(" ");
    printf("%d", count);
    printf(" ");
    printf(" ");
    count++;
  }
  printf("\n");
  count = 1;
  printf(" ");
  printf(" ");
  for (i = 0; i < n; i++) {
    printf("--");
    printf(" ");
    printf(" ");
  }
  printf("\n");
  for (i = 0; i < n; i++) {
    printf("%d", count);
    printf("|");
    for (j = 0; j < k; j++) {
      printf(" ");
      if (t[i][j] == 'O')
        printf("#");
      else
        printf("%c", t[i][j]);
      printf(" ");
      printf(" ");
    }
    printf("\n\n");
    count++;
  }
}


x86 assembly (clang, -O0):
<print_table>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x1,-0x1c(%rbp)
lea    0xed0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11aa <print_table+0x9a>
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114c <print_table+0x3c>
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x1c(%rbp)
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1226 <print_table+0x116>
lea    0xe10(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdef(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11e2 <print_table+0xd2>
lea    0xde3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1328 <print_table+0x218>
mov    -0x1c(%rbp),%esi
lea    0xdb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xda9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1303 <print_table+0x1f3>
lea    0xd80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x4f,%eax
jne    12b7 <print_table+0x1a7>
lea    0xd5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12d9 <print_table+0x1c9>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xd3a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd20(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd12(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    126d <print_table+0x15d>
lea    0xd05(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    123b <print_table+0x12b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_table>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edx,0xc(%rsp)
mov    %esi,%r14d
mov    %rdi,%rbx
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
test   %r14d,%r14d
jle    12e3 <print_table+0x1b3>
mov    %r14d,%r15d
neg    %r15d
mov    $0x1,%ebp
lea    0xe89(%rip),%r12
nopw   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    %r12,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
lea    (%r15,%rbp,1),%eax
add    $0x1,%eax
mov    %ebp,%ecx
add    $0x1,%ecx
mov    %ecx,%ebp
cmp    $0x1,%eax
jne    1180 <print_table+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
test   %r14d,%r14d
jle    1301 <print_table+0x1d1>
lea    0xe18(%rip),%r15
mov    %r14d,%ebp
xchg   %ax,%ax
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11f0 <print_table+0xc0>
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %r14d,%r14d
jle    1319 <print_table+0x1e9>
mov    %r14d,%eax
mov    %rax,0x10(%rsp)
mov    0xc(%rsp),%r14d
mov    $0x1,%ebp
mov    $0x23,%r15d
xor    %r12d,%r12d
jmp    126e <print_table+0x13e>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0xdaf(%rip),%rdi
call   1040 <puts@plt>
add    $0x1,%ebp
add    $0x1,%r12
cmp    0x10(%rsp),%r12
je     1319 <print_table+0x1e9>
lea    0xd8b(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x7c,%edi
call   1030 <putchar@plt>
cmpl   $0x0,0xc(%rsp)
jle    1250 <print_table+0x120>
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    (%rbx,%r12,8),%rax
movzbl (%rax,%r13,1),%eax
cmp    $0x4f,%al
cmove  %r15d,%eax
movsbl %al,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%r13
cmp    %r13,%r14
jne    12a0 <print_table+0x170>
jmp    1250 <print_table+0x120>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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