void free_matrix(m, nrl, nrh, ncl, nch) float **m;
unsigned nrl, nrh, ncl, nch;
{
  register unsigned int i;
  for (i = nrl; i <= nrh; 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    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%eax
ja     1163 <free_matrix+0x53>
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    (%rax,%rcx,8),%rdi
mov    -0x14(%rbp),%eax
shl    $0x2,%rax
add    %rax,%rdi
call   1030 <free@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112f <free_matrix+0x1f>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
shl    $0x3,%rax
add    %rax,%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_matrix>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r14d
mov    %rdi,%r15
cmp    %edx,%esi
ja     1146 <free_matrix+0x36>
mov    %edx,%r12d
mov    %ecx,%ebx
shl    $0x2,%rbx
mov    %r14d,%ebp
xchg   %ax,%ax
mov    %ebp,%eax
mov    (%r15,%rax,8),%rdi
add    %rbx,%rdi
call   1030 <free@plt>
add    $0x1,%ebp
cmp    %r12d,%ebp
jbe    1130 <free_matrix+0x20>
mov    %r14d,%eax
lea    (%r15,%rax,8),%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
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* %7
store i32 %12, i32* %11
br label %13
13: ; preds = %27, %5
%14 = load i32, i32* %11
%15 = load i32, i32* %8
%16 = icmp ule i32 %14, %15
br i1 %16, label %17, label %30
17: ; preds = %13
%18 = load float**, float*** %6
%19 = load i32, i32* %11
%20 = zext i32 %19 to i64
%21 = getelementptr inbounds float*, float** %18, i64 %20
%22 = load float*, float** %21
%23 = load i32, i32* %9
%24 = zext i32 %23 to i64
%25 = getelementptr inbounds float, float* %22, i64 %24
%26 = bitcast float* %25 to i8*
br label %27
27: ; preds = %17
%28 = load i32, i32* %11
%29 = add i32 %28, 1
store i32 %29, i32* %11
br label %13
30: ; preds = %13
%31 = load float**, float*** %6
%32 = load i32, i32* %7
%33 = zext i32 %32 to i64
%34 = getelementptr inbounds float*, float** %31, i64 %33
%35 = bitcast float** %34 to i8*
ret void
}

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