void free_dmatrix(m, nrl, nrh, ncl, nch) double **m;
int nrl, nrh, ncl, nch;
{
  int i;
  nch = nch;
  for (i = nrh; i >= nrl; i--)
    free((char *)(m[i] + ncl));
  free((char *)(m + nrl));
}


x86 assembly (clang, -O0):
<free_dmatrix>:
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    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     116b <free_dmatrix+0x5b>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
call   1030 <free@plt>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    1135 <free_dmatrix+0x25>
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_dmatrix>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
cmp    %esi,%edx
jge    1124 <free_dmatrix+0x14>
movslq %esi,%r15
jmp    1156 <free_dmatrix+0x46>
movslq %ecx,%r12
movslq %edx,%rbx
movslq %esi,%r15
add    $0x1,%rbx
shl    $0x3,%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_dmatrix+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_dmatrix(double** %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca double**
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store double** %0, double*** %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* %10
store i32 %12, i32* %10
%13 = load i32, i32* %8
store i32 %13, i32* %11
br label %14
14: ; preds = %28, %5
%15 = load i32, i32* %11
%16 = load i32, i32* %7
%17 = icmp sge i32 %15, %16
br i1 %17, label %18, label %31
18: ; preds = %14
%19 = load double**, double*** %6
%20 = load i32, i32* %11
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds double*, double** %19, i64 %21
%23 = load double*, double** %22
%24 = load i32, i32* %9
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds double, double* %23, i64 %25
%27 = bitcast double* %26 to i8*
br label %28
28: ; preds = %18
%29 = load i32, i32* %11
%30 = add nsw i32 %29, -1
store i32 %30, i32* %11
br label %14
31: ; preds = %14
%32 = load double**, double*** %6
%33 = load i32, i32* %7
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds double*, double** %32, i64 %34
%36 = bitcast double** %35 to i8*
ret void
}

LLVM IR (-O2):
define void @free_dmatrix(double** 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 %21
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 ], [ %19, %13 ]
%15 = getelementptr inbounds double*, double** %0, i64 %14
%16 = load double*, double** %15
%17 = getelementptr inbounds double, double* %16, i64 %10
%18 = bitcast double* %17 to i8*
tail call void @free(i8* %18)
%19 = add nsw i64 %14, -1
%20 = icmp sgt i64 %14, %12
br i1 %20, label %13, label %21
21: ; preds = %13, %7
%22 = phi i64 [ %8, %7 ], [ %12, %13 ]
%23 = getelementptr inbounds double*, double** %0, i64 %22
%24 = bitcast double** %23 to i8*
tail call void @free(i8* %24)
ret void
}