#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 *, int);
void printMatrix(int **A, int n, int m) {
  int i = 0;
  while (i < n) {
    for (int j = 0; j < m - 1; j++) {
      printf("%d ", A[i][j]);
    }
    printf("%d\n", A[i][m - 1]);
    ++i;
  }
}


x86 assembly (clang, -O0):
<printMatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11ac <printMatrix+0x9c>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    117a <printMatrix+0x6a>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    113c <printMatrix+0x2c>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1129 <printMatrix+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printMatrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,0x8(%rsp)
test   %esi,%esi
jle    119b <printMatrix+0x8b>
mov    %rdi,%r13
mov    0x8(%rsp),%rax
lea    -0x1(%rax),%ebx
movslq %ebx,%rax
mov    %rax,0x10(%rsp)
mov    %esi,%r12d
xor    %r14d,%r14d
lea    0xeb9(%rip),%r15
jmp    1172 <printMatrix+0x62>
nopl   0x0(%rax)
mov    0x0(%r13,%r14,8),%rax
mov    0x10(%rsp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
add    $0x1,%r14
cmp    %r12,%r14
je     119b <printMatrix+0x8b>
cmpl   $0x2,0x8(%rsp)
jl     1150 <printMatrix+0x40>
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    0x0(%r13,%r14,8),%rax
mov    (%rax,%rbp,4),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1180 <printMatrix+0x70>
jmp    1150 <printMatrix+0x40>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
@.str.1 = [4 x i8] c"%d\0A\00"
define void @printMatrix(i32** nocapture %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %31
5: ; preds = %3
%6 = add i32 %2, -1
%7 = icmp sgt i32 %2, 1
%8 = sext i32 %6 to i64
%9 = zext i32 %1 to i64
%10 = zext i32 %6 to i64
br label %11
11: ; preds = %5, %15
%12 = phi i64 [ 0, %5 ], [ %21, %15 ]
br i1 %7, label %13, label %15
13: ; preds = %11
%14 = getelementptr inbounds i32*, i32** %0, i64 %12
br label %23
15: ; preds = %23, %11
%16 = getelementptr inbounds i32*, i32** %0, i64 %12
%17 = load i32*, i32** %16
%18 = getelementptr inbounds i32, i32* %17, i64 %8
%19 = load i32, i32* %18
%20 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %19)
%21 = add nuw nsw i64 %12, 1
%22 = icmp eq i64 %21, %9
br i1 %22, label %31, label %11
23: ; preds = %13, %23
%24 = phi i64 [ 0, %13 ], [ %29, %23 ]
%25 = load i32*, i32** %14
%26 = getelementptr inbounds i32, i32* %25, i64 %24
%27 = load i32, i32* %26
%28 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %27)
%29 = add nuw nsw i64 %24, 1
%30 = icmp eq i64 %29, %10
br i1 %30, label %15, label %23
31: ; preds = %15, %3
ret void
}