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


x86 assembly (clang, -O0):
<free_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     1165 <free_matrix+0x55>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
call   1030 <free@plt>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    112f <free_matrix+0x1f>
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_matrix>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
cmp    %esi,%edx
jge    1124 <free_matrix+0x14>
movslq %esi,%r15
jmp    1156 <free_matrix+0x46>
movslq %ecx,%r12
movslq %edx,%rbx
movslq %esi,%r15
add    $0x1,%rbx
shl    $0x2,%r12
cs nopw 0x0(%rax,%rax,1)
nop
mov    -0x8(%r14,%rbx,8),%rdi
add    %r12,%rdi
call   1030 <free@plt>
add    $0xffffffffffffffff,%rbx
cmp    %r15,%rbx
jg     1140 <free_matrix+0x30>
lea    (%r14,%r15,8),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

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