#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_dm(double **m, int rows) {
  int i;
  if (!rows)
    rows = 1;
  for (i = 1; i <= rows; i++)
    free((char *)(m[i] + 1));
  free((char *)(m + 1));
}


x86 assembly (clang, -O0):
<free_dm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1130 <free_dm+0x20>
movl   $0x1,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1166 <free_dm+0x56>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
add    $0x8,%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1137 <free_dm+0x27>
mov    -0x8(%rbp),%rdi
add    $0x8,%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_dm>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %esi,%esi
mov    $0x1,%r15d
cmovne %esi,%r15d
test   %r15d,%r15d
jle    1156 <free_dm+0x46>
add    $0x1,%r15d
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r14,%rbx,8),%rdi
add    $0x8,%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1140 <free_dm+0x30>
add    $0x8,%r14
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

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