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


x86 assembly (clang, -O0):
<free_cmatrix>:
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     1168 <free_cmatrix+0x58>
mov    -0x8(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
add    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x30(%rbp)
jmp    1134 <free_cmatrix+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_cmatrix>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r12
cmp    %rsi,%rdx
jl     1146 <free_cmatrix+0x36>
mov    %rcx,%r14
mov    %rdx,%rbx
add    $0x1,%rbx
nopl   (%rax)
mov    -0x8(%r12,%rbx,8),%rdi
add    %r14,%rdi
call   1030 <free@plt>
add    $0xffffffffffffffff,%rbx
cmp    %r15,%rbx
jg     1130 <free_cmatrix+0x20>
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_cmatrix(i8** %0, i64 %1, i64 %2, i64 %3, i64 %4) {
%6 = alloca i8**
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
store i8** %0, i8*** %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 = %25, %5
%14 = load i64, i64* %11
%15 = load i64, i64* %7
%16 = icmp sge i64 %14, %15
br i1 %16, label %17, label %28
17: ; preds = %13
%18 = load i8**, i8*** %6
%19 = load i64, i64* %11
%20 = getelementptr inbounds i8*, i8** %18, i64 %19
%21 = load i8*, i8** %20
%22 = load i64, i64* %9
%23 = getelementptr inbounds i8, i8* %21, i64 %22
%24 = call i32 @free(i8* %23)
br label %25
25: ; preds = %17
%26 = load i64, i64* %11
%27 = add nsw i64 %26, -1
store i64 %27, i64* %11
br label %13
28: ; preds = %13
%29 = load i8**, i8*** %6
%30 = load i64, i64* %7
%31 = getelementptr inbounds i8*, i8** %29, i64 %30
%32 = bitcast i8** %31 to i8*
%33 = call i32 @free(i8* %32)
ret void
}

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