#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 printMatrix(const int **const matrix, size_t m, size_t n) {
  for (size_t i = 0UL; i < n; ++i) {
    for (size_t j = 0UL; j < m; ++j) {
      printf("%i ", matrix[i][j]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<printMatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    11a1 <printMatrix+0x91>
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1182 <printMatrix+0x72>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1142 <printMatrix+0x32>
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    112c <printMatrix+0x1c>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printMatrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %rdx,%rdx
je     118c <printMatrix+0x6c>
mov    %rdx,%r14
mov    %rsi,%r13
mov    %rdi,%r15
lea    0xec0(%rip),%r12
xor    %ebx,%ebx
jmp    1163 <printMatrix+0x43>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %r14,%rbx
je     118c <printMatrix+0x6c>
test   %r13,%r13
je     1150 <printMatrix+0x30>
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    (%r15,%rbx,8),%rax
mov    (%rax,%rbp,4),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r13
jne    1170 <printMatrix+0x50>
jmp    1150 <printMatrix+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%i \00"
define void @printMatrix(i32** nocapture %0, i64 %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %11, label %5
5: ; preds = %3
%6 = icmp eq i64 %1, 0
br label %7
7: ; preds = %5, %12
%8 = phi i64 [ 0, %5 ], [ %14, %12 ]
br i1 %6, label %12, label %9
9: ; preds = %7
%10 = getelementptr inbounds i32*, i32** %0, i64 %8
br label %16
11: ; preds = %12, %3
ret void
12: ; preds = %16, %7
%13 = tail call i32 @putchar(i32 10)
%14 = add nuw i64 %8, 1
%15 = icmp eq i64 %14, %2
br i1 %15, label %11, label %7
16: ; preds = %9, %16
%17 = phi i64 [ 0, %9 ], [ %22, %16 ]
%18 = load i32*, i32** %10
%19 = getelementptr inbounds i32, i32* %18, i64 %17
%20 = load i32, i32* %19
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = add nuw i64 %17, 1
%23 = icmp eq i64 %22, %1
br i1 %23, label %12, label %16
}