#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_dmatrix(double **m, int nrl, int nrh, int ncl) {
  int i;
  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    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     1161 <free_dmatrix+0x51>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    112b <free_dmatrix+0x1b>
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) {
%5 = alloca double**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store double** %0, double*** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i32, i32* %7
store i32 %10, i32* %9
br label %11
11: ; preds = %26, %4
%12 = load i32, i32* %9
%13 = load i32, i32* %6
%14 = icmp sge i32 %12, %13
br i1 %14, label %15, label %29
15: ; preds = %11
%16 = load double**, double*** %5
%17 = load i32, i32* %9
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds double*, double** %16, i64 %18
%20 = load double*, double** %19
%21 = load i32, i32* %8
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds double, double* %20, i64 %22
%24 = bitcast double* %23 to i8*
%25 = call i32 @free(i8* %24)
br label %26
26: ; preds = %15
%27 = load i32, i32* %9
%28 = add nsw i32 %27, -1
store i32 %28, i32* %9
br label %11
29: ; preds = %11
%30 = load double**, double*** %5
%31 = load i32, i32* %6
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds double*, double** %30, i64 %32
%34 = bitcast double** %33 to i8*
%35 = call i32 @free(i8* %34)
ret void
}

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