#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 */
typedef int /*<<< orphan*/ mpfr_t;

/* Variables and functions */
int /*<<< orphan*/ cfree(int /*<<< orphan*/ ***);
int /*<<< orphan*/ m_clear(int /*<<< orphan*/);
void freeMatrix(const size_t m, const size_t n, mpfr_t (*matrix)[m][n]) {
  for (int i = 0; i < m; ++i) {
    for (int j = 0; j < n; ++j) {
      m_clear((*matrix)[i][j]);
    }
  }
  cfree(matrix);
}


x86 assembly (clang, -O0):
<freeMatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    11aa <freeMatrix+0x8a>
movl   $0x0,-0x20(%rbp)
movslq -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1197 <freeMatrix+0x77>
mov    -0x28(%rbp),%rdx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1030 <m_clear@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1158 <freeMatrix+0x38>
jmp    119c <freeMatrix+0x7c>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1143 <freeMatrix+0x23>
mov    -0x18(%rbp),%rdi
call   1040 <cfree@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<freeMatrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,(%rsp)
test   %rdi,%rdi
je     1185 <freeMatrix+0x65>
mov    %rsi,%rbx
mov    %rdi,%r15
lea    0x0(,%rsi,4),%r12
xor    %r13d,%r13d
mov    (%rsp),%rbp
jmp    115c <freeMatrix+0x3c>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r13
add    %r12,%rbp
cmp    %r15,%r13
je     1185 <freeMatrix+0x65>
test   %rbx,%rbx
je     1150 <freeMatrix+0x30>
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x0(%rbp,%r14,4),%edi
call   1030 <m_clear@plt>
add    $0x1,%r14
cmp    %r14,%rbx
jne    1170 <freeMatrix+0x50>
jmp    1150 <freeMatrix+0x30>
mov    (%rsp),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <cfree@plt>

LLVM IR (-O0):
define void @freeMatrix(i64 %0, i64 %1, i32* %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i64 %0, i64* %4
store i64 %1, i64* %5
store i32* %2, i32** %6
%9 = load i64, i64* %4
%10 = load i64, i64* %5
store i32 0, i32* %7
br label %11
11: ; preds = %37, %3
%12 = load i32, i32* %7
%13 = sext i32 %12 to i64
%14 = load i64, i64* %4
%15 = icmp ult i64 %13, %14
br i1 %15, label %16, label %40
16: ; preds = %11
store i32 0, i32* %8
br label %17
17: ; preds = %33, %16
%18 = load i32, i32* %8
%19 = sext i32 %18 to i64
%20 = load i64, i64* %5
%21 = icmp ult i64 %19, %20
br i1 %21, label %22, label %36
22: ; preds = %17
%23 = load i32*, i32** %6
%24 = load i32, i32* %7
%25 = sext i32 %24 to i64
%26 = mul nsw i64 %25, %10
%27 = getelementptr inbounds i32, i32* %23, i64 %26
%28 = load i32, i32* %8
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %27, i64 %29
%31 = load i32, i32* %30
%32 = call i32 @m_clear(i32 %31)
br label %33
33: ; preds = %22
%34 = load i32, i32* %8
%35 = add nsw i32 %34, 1
store i32 %35, i32* %8
br label %17
36: ; preds = %17
br label %37
37: ; preds = %36
%38 = load i32, i32* %7
%39 = add nsw i32 %38, 1
store i32 %39, i32* %7
br label %11
40: ; preds = %11
%41 = load i32*, i32** %6
%42 = bitcast i32* %41 to i32***
%43 = call i32 @cfree(i32*** %42)
ret void
}

LLVM IR (-O2):
define void @freeMatrix(i64 %0, i64 %1, i32* %2) {
%4 = icmp eq i64 %0, 0
br i1 %4, label %12, label %5
5: ; preds = %3
%6 = icmp eq i64 %1, 0
br label %7
7: ; preds = %5, %15
%8 = phi i64 [ 0, %5 ], [ %16, %15 ]
br i1 %6, label %15, label %9
9: ; preds = %7
%10 = mul nsw i64 %8, %1
%11 = getelementptr inbounds i32, i32* %2, i64 %10
br label %18
12: ; preds = %15, %3
%13 = bitcast i32* %2 to i32***
%14 = tail call i32 @cfree(i32*** %13)
ret void
15: ; preds = %18, %7
%16 = add nuw i64 %8, 1
%17 = icmp eq i64 %16, %0
br i1 %17, label %12, label %7
18: ; preds = %9, %18
%19 = phi i64 [ 0, %9 ], [ %23, %18 ]
%20 = getelementptr inbounds i32, i32* %11, i64 %19
%21 = load i32, i32* %20
%22 = tail call i32 @m_clear(i32 %21)
%23 = add nuw i64 %19, 1
%24 = icmp eq i64 %23, %1
br i1 %24, label %15, label %18
}