#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*/ free(char *);
void free_imatrix(int **m, long nrl, long nrh, long ncl, long nch) {
  long i;
  for (i = nrh; i >= nrl; i--)
    free((char *)(m[i] + ncl));
  free((char *)(m + nrl));
}


x86 assembly (clang, -O0):
<free_imatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x10(%rbp),%rax
jl     116f <free_imatrix+0x5f>
mov    -0x8(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x20(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x30(%rbp)
jmp    1134 <free_imatrix+0x24>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_imatrix>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r12
cmp    %rsi,%rdx
jl     1156 <free_imatrix+0x46>
mov    %rcx,%r14
mov    %rdx,%rbx
add    $0x1,%rbx
shl    $0x2,%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    -0x8(%r12,%rbx,8),%rdi
add    %r14,%rdi
call   1030 <free@plt>
add    $0xffffffffffffffff,%rbx
cmp    %r15,%rbx
jg     1140 <free_imatrix+0x30>
lea    (%r12,%r15,8),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @free_imatrix(i32** %0, i64 %1, i64 %2, i64 %3, i64 %4) {
%6 = alloca i32**
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
store i32** %0, i32*** %6
store i64 %1, i64* %7
store i64 %2, i64* %8
store i64 %3, i64* %9
store i64 %4, i64* %10
%12 = load i64, i64* %8
store i64 %12, i64* %11
br label %13
13: ; preds = %26, %5
%14 = load i64, i64* %11
%15 = load i64, i64* %7
%16 = icmp sge i64 %14, %15
br i1 %16, label %17, label %29
17: ; preds = %13
%18 = load i32**, i32*** %6
%19 = load i64, i64* %11
%20 = getelementptr inbounds i32*, i32** %18, i64 %19
%21 = load i32*, i32** %20
%22 = load i64, i64* %9
%23 = getelementptr inbounds i32, i32* %21, i64 %22
%24 = bitcast i32* %23 to i8*
%25 = call i32 @free(i8* %24)
br label %26
26: ; preds = %17
%27 = load i64, i64* %11
%28 = add nsw i64 %27, -1
store i64 %28, i64* %11
br label %13
29: ; preds = %13
%30 = load i32**, i32*** %6
%31 = load i64, i64* %7
%32 = getelementptr inbounds i32*, i32** %30, i64 %31
%33 = bitcast i32** %32 to i8*
%34 = call i32 @free(i8* %33)
ret void
}

LLVM IR (-O2):
define void @free_imatrix(i32** nocapture %0, i64 %1, i64 %2, i64 %3, i64 %4) {
%6 = icmp slt i64 %2, %1
br i1 %6, label %16, label %7
7: ; preds = %5, %7
%8 = phi i64 [ %14, %7 ], [ %2, %5 ]
%9 = getelementptr inbounds i32*, i32** %0, i64 %8
%10 = load i32*, i32** %9
%11 = getelementptr inbounds i32, i32* %10, i64 %3
%12 = bitcast i32* %11 to i8*
%13 = tail call i32 @free(i8* %12)
%14 = add nsw i64 %8, -1
%15 = icmp sgt i64 %8, %1
br i1 %15, label %7, label %16
16: ; preds = %7, %5
%17 = getelementptr inbounds i32*, i32** %0, i64 %1
%18 = bitcast i32** %17 to i8*
%19 = tail call i32 @free(i8* %18)
ret void
}