#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*/ print_list(int *, int, int);
int /*<<< orphan*/ printf(char *);
void print_array(int *array, int m, int n, int nl) {
  int j;
  printf("{");
  if (nl)
    printf("\n");
  for (j = 0; j < m; j++) {
    printf(" ");
    print_list(array + j * n, n, nl);
  }
  if (!nl)
    printf(" ");
  printf("}\n");
}


x86 assembly (clang, -O0):
<print_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
lea    0xec4(%rip),%rdi
call   1040 <printf@plt>
cmpl   $0x0,-0x14(%rbp)
je     1157 <print_array+0x37>
lea    0xeb3(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11a3 <print_array+0x83>
lea    0xe91(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%eax
imul   -0x10(%rbp),%eax
cltq
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1030 <print_list@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    115e <print_array+0x3e>
cmpl   $0x0,-0x14(%rbp)
jne    11b9 <print_array+0x99>
lea    0xe4e(%rip),%rdi
call   1040 <printf@plt>
lea    0xe44(%rip),%rdi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_array>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%r12d
mov    %edx,%r14d
mov    %esi,%r15d
mov    %rdi,%rbp
mov    $0x7b,%edi
call   1030 <putchar@plt>
test   %r12d,%r12d
je     1160 <print_array+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %r15d,%r15d
jle    1191 <print_array+0x61>
movslq %r14d,%r13
mov    %r15d,%ebx
shl    $0x2,%r13
nop
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    %rbp,%rdi
mov    %r14d,%esi
mov    %r12d,%edx
call   1050 <print_list@plt>
add    %r13,%rbp
add    $0xffffffffffffffff,%rbx
jne    1170 <print_array+0x40>
test   %r12d,%r12d
jne    11a0 <print_array+0x70>
mov    $0x20,%edi
call   1030 <putchar@plt>
lea    0xe59(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"{\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [3 x i8] c"}\0A\00"
define void @print_array(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* %8
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %4
%14 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %13, %4
store i32 0, i32* %9
br label %16
16: ; preds = %31, %15
%17 = load i32, i32* %9
%18 = load i32, i32* %6
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %34
20: ; preds = %16
%21 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%22 = load i32*, i32** %5
%23 = load i32, i32* %9
%24 = load i32, i32* %7
%25 = mul nsw i32 %23, %24
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %22, i64 %26
%28 = load i32, i32* %7
%29 = load i32, i32* %8
%30 = call i32 @print_list(i32* %27, i32 %28, i32 %29)
br label %31
31: ; preds = %20
%32 = load i32, i32* %9
%33 = add nsw i32 %32, 1
store i32 %33, i32* %9
br label %16
34: ; preds = %16
%35 = load i32, i32* %8
%36 = icmp ne i32 %35, 0
br i1 %36, label %39, label %37
37: ; preds = %34
%38 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %39
39: ; preds = %37, %34
%40 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [2 x i8] c"}\00"
define void @print_array(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @putchar(i32 123)
%6 = icmp eq i32 %3, 0
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 @putchar(i32 10)
br label %9
9: ; preds = %7, %4
%10 = icmp sgt i32 %1, 0
br i1 %10, label %11, label %22
11: ; preds = %9
%12 = sext i32 %2 to i64
%13 = zext i32 %1 to i64
br label %14
14: ; preds = %11, %14
%15 = phi i64 [ 0, %11 ], [ %20, %14 ]
%16 = tail call i32 @putchar(i32 32)
%17 = mul nsw i64 %15, %12
%18 = getelementptr inbounds i32, i32* %0, i64 %17
%19 = tail call i32 @print_list(i32* %18, i32 %2, i32 %3)
%20 = add nuw nsw i64 %15, 1
%21 = icmp eq i64 %20, %13
br i1 %21, label %22, label %14
22: ; preds = %14, %9
br i1 %6, label %23, label %25
23: ; preds = %22
%24 = tail call i32 @putchar(i32 32)
br label %25
25: ; preds = %23, %22
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret void
}