#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 get_matrix(unsigned int **, int, int);
int /*<<< orphan*/ printf(char *, ...);
void print_M(unsigned int **M, int r, int c) {
  for (int i = 0; i < r; ++i) {
    for (int j = 0; j < c; ++j)
      printf("%u, ", get_matrix(M, i, j));
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<print_M>:
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    11a1 <print_M+0x81>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1185 <print_M+0x65>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1030 <get_matrix@plt>
mov    %eax,%esi
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114c <print_M+0x2c>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1139 <print_M+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_M>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    11a2 <print_M+0x72>
mov    %edx,%r13d
mov    %esi,%r14d
mov    %rdi,%r12
lea    0xeb1(%rip),%r15
xor    %ebp,%ebp
jmp    1172 <print_M+0x42>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    %r14d,%ebp
je     11a2 <print_M+0x72>
test   %r13d,%r13d
jle    1160 <print_M+0x30>
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    %r12,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1040 <get_matrix@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%ebx
cmp    %ebx,%r13d
jne    1180 <print_M+0x50>
jmp    1160 <print_M+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%u, \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @print_M(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 = %29, %3
%10 = load i32, i32* %7
%11 = load i32, i32* %5
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %32
13: ; preds = %9
store i32 0, i32* %8
br label %14
14: ; preds = %24, %13
%15 = load i32, i32* %8
%16 = load i32, i32* %6
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %27
18: ; preds = %14
%19 = load i32**, i32*** %4
%20 = load i32, i32* %7
%21 = load i32, i32* %8
%22 = call i32 @get_matrix(i32** %19, i32 %20, i32 %21)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %22)
br label %24
24: ; preds = %18
%25 = load i32, i32* %8
%26 = add nsw i32 %25, 1
store i32 %26, i32* %8
br label %14
27: ; preds = %14
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %29
29: ; preds = %27
%30 = load i32, i32* %7
%31 = add nsw i32 %30, 1
store i32 %31, i32* %7
br label %9
32: ; preds = %9
ret void
}

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