void freeDbl3DMatrix(double ***p) {
  ;
  if (p == 0L)
    return;
  if (p[0] != 0L) {
    if (p[0][0] != 0L) {
      free(p[0][0]);
    }
    free(p[0]);
  }
  free(p);
}


x86 assembly (clang, -O0):
<freeDbl3DMatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    112c <freeDbl3DMatrix+0x1c>
jmp    116f <freeDbl3DMatrix+0x5f>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1166 <freeDbl3DMatrix+0x56>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
cmpq   $0x0,(%rax)
je     115a <freeDbl3DMatrix+0x4a>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<freeDbl3DMatrix>:
test   %rdi,%rdi
je     1142 <freeDbl3DMatrix+0x32>
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1139 <freeDbl3DMatrix+0x29>
mov    (%rdi),%rax
test   %rax,%rax
je     1134 <freeDbl3DMatrix+0x24>
mov    %rax,%rdi
call   1030 <free@plt>
mov    (%rbx),%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>
ret

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

LLVM IR (-O2):
define void @freeDbl3DMatrix(double*** %0) {
%2 = icmp eq double*** %0, null
br i1 %2, label %18, label %3
3: ; preds = %1
%4 = load double**, double*** %0
%5 = icmp eq double** %4, null
br i1 %5, label %16, label %6
6: ; preds = %3
%7 = bitcast double** %4 to i8*
%8 = load double*, double** %4
%9 = icmp eq double* %8, null
br i1 %9, label %14, label %10
10: ; preds = %6
%11 = bitcast double* %8 to i8*
tail call void @free(i8* %11)
%12 = bitcast double*** %0 to i8**
%13 = load i8*, i8** %12
br label %14
14: ; preds = %6, %10
%15 = phi i8* [ %13, %10 ], [ %7, %6 ]
tail call void @free(i8* %15)
br label %16
16: ; preds = %14, %3
%17 = bitcast double*** %0 to i8*
tail call void @free(i8* %17)
br label %18
18: ; preds = %1, %16
ret void
}