void free_mem3Ddb_offset(double ***array3D, int rows, int columns, int offset) {
  int i, j;
  if (array3D) {
    for (i = 0; i < rows; i++) {
      for (j = -offset; j < columns - offset; j++) {
        if (array3D[i][j])
          free(array3D[i][j]);
        else
          error("free_mem3Ddb_offset: trying to free unused memory", 100);
      }
    }
    array3D[0] -= offset;
    if (array3D[0])
      free(array3D[0]);
    else
      error("free_mem3Ddb_offset: trying to free unused memory", 100);
    free(array3D);
  } else {
    error("free_mem3Ddb_offset: trying to free unused memory", 100);
  }
}


x86 assembly (clang, -O0):
<free_mem3Ddb_offset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     123a <free_mem3Ddb_offset+0x11a>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11de <free_mem3Ddb_offset+0xbe>
xor    %eax,%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    -0x14(%rbp),%ecx
cmp    %ecx,%eax
jge    11cb <free_mem3Ddb_offset+0xab>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x1c(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     11a5 <free_mem3Ddb_offset+0x85>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
jmp    11b8 <free_mem3Ddb_offset+0x98>
lea    0xe54(%rip),%rdi
mov    $0x64,%esi
mov    $0x0,%al
call   1040 <error@plt>
jmp    11bd <free_mem3Ddb_offset+0x9d>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    115b <free_mem3Ddb_offset+0x3b>
jmp    11d0 <free_mem3Ddb_offset+0xb0>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1147 <free_mem3Ddb_offset+0x27>
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
movslq %edx,%rsi
xor    %edx,%edx
sub    %rsi,%rdx
shl    $0x3,%rdx
add    %rdx,%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1219 <free_mem3Ddb_offset+0xf9>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
jmp    122c <free_mem3Ddb_offset+0x10c>
lea    0xde0(%rip),%rdi
mov    $0x64,%esi
mov    $0x0,%al
call   1040 <error@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
jmp    124d <free_mem3Ddb_offset+0x12d>
lea    0xdbf(%rip),%rdi
mov    $0x64,%esi
mov    $0x0,%al
call   1040 <error@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_mem3Ddb_offset>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %ecx,0x8(%rsp)
mov    %edx,0xc(%rsp)
test   %rdi,%rdi
je     11dd <free_mem3Ddb_offset+0xbd>
mov    %rdi,%rbx
test   %esi,%esi
jle    11bc <free_mem3Ddb_offset+0x9c>
mov    0x8(%rsp),%edx
mov    %edx,%eax
neg    %eax
mov    0xc(%rsp),%ecx
sub    %edx,%ecx
cltq
mov    %rax,0x10(%rsp)
movslq %ecx,%rbp
mov    %esi,%r14d
lea    0xe98(%rip),%r13
xor    %r12d,%r12d
jmp    1179 <free_mem3Ddb_offset+0x59>
nopl   (%rax)
add    $0x1,%r12
cmp    %r14,%r12
je     11bc <free_mem3Ddb_offset+0x9c>
cmpl   $0x0,0xc(%rsp)
jle    1170 <free_mem3Ddb_offset+0x50>
mov    0x10(%rsp),%r15
jmp    11a8 <free_mem3Ddb_offset+0x88>
nopw   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    $0x64,%esi
xor    %eax,%eax
call   1040 <error@plt>
add    $0x1,%r15
cmp    %rbp,%r15
jge    1170 <free_mem3Ddb_offset+0x50>
mov    (%rbx,%r12,8),%rax
mov    (%rax,%r15,8),%rdi
test   %rdi,%rdi
je     1190 <free_mem3Ddb_offset+0x70>
call   1030 <free@plt>
jmp    119f <free_mem3Ddb_offset+0x7f>
mov    (%rbx),%rax
movslq 0x8(%rsp),%rcx
shl    $0x3,%rcx
mov    %rax,%rdi
sub    %rcx,%rdi
mov    %rdi,(%rbx)
test   %rax,%rax
je     11fe <free_mem3Ddb_offset+0xde>
call   1030 <free@plt>
jmp    1211 <free_mem3Ddb_offset+0xf1>
lea    0xe1c(%rip),%rdi
mov    $0x64,%esi
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <error@plt>
lea    0xdfb(%rip),%rdi
mov    $0x64,%esi
xor    %eax,%eax
call   1040 <error@plt>
mov    %rbx,%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [50 x i8] c"free_mem3Ddb_offset: trying to free unused memory\00"
define void @free_mem3Ddb_offset(double*** %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca double***
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store double*** %0, double**** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = load double***, double**** %5
%12 = icmp ne double*** %11, null
br i1 %12, label %13, label %81
13: ; preds = %4
store i32 0, i32* %9
br label %14
14: ; preds = %56, %13
%15 = load i32, i32* %9
%16 = load i32, i32* %6
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %59
18: ; preds = %14
%19 = load i32, i32* %8
%20 = sub nsw i32 0, %19
store i32 %20, i32* %10
br label %21
21: ; preds = %52, %18
%22 = load i32, i32* %10
%23 = load i32, i32* %7
%24 = load i32, i32* %8
%25 = sub nsw i32 %23, %24
%26 = icmp slt i32 %22, %25
br i1 %26, label %27, label %55
27: ; preds = %21
%28 = load double***, double**** %5
%29 = load i32, i32* %9
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds double**, double*** %28, i64 %30
%32 = load double**, double*** %31
%33 = load i32, i32* %10
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds double*, double** %32, i64 %34
%36 = load double*, double** %35
%37 = icmp ne double* %36, null
br i1 %37, label %38, label %49
38: ; preds = %27
%39 = load double***, double**** %5
%40 = load i32, i32* %9
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds double**, double*** %39, i64 %41
%43 = load double**, double*** %42
%44 = load i32, i32* %10
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds double*, double** %43, i64 %45
%47 = load double*, double** %46
%48 = bitcast double* %47 to i8*
br label %51
49: ; preds = %27
%50 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @error to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 100)
br label %51
51: ; preds = %49, %38
br label %52
52: ; preds = %51
%53 = load i32, i32* %10
%54 = add nsw i32 %53, 1
store i32 %54, i32* %10
br label %21
55: ; preds = %21
br label %56
56: ; preds = %55
%57 = load i32, i32* %9
%58 = add nsw i32 %57, 1
store i32 %58, i32* %9
br label %14
59: ; preds = %14
%60 = load i32, i32* %8
%61 = load double***, double**** %5
%62 = getelementptr inbounds double**, double*** %61, i64 0
%63 = load double**, double*** %62
%64 = sext i32 %60 to i64
%65 = sub i64 0, %64
%66 = getelementptr inbounds double*, double** %63, i64 %65
store double** %66, double*** %62
%67 = load double***, double**** %5
%68 = getelementptr inbounds double**, double*** %67, i64 0
%69 = load double**, double*** %68
%70 = icmp ne double** %69, null
br i1 %70, label %71, label %76
71: ; preds = %59
%72 = load double***, double**** %5
%73 = getelementptr inbounds double**, double*** %72, i64 0
%74 = load double**, double*** %73
%75 = bitcast double** %74 to i8*
br label %78
76: ; preds = %59
%77 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @error to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 100)
br label %78
78: ; preds = %76, %71
%79 = load double***, double**** %5
%80 = bitcast double*** %79 to i8*
br label %83
81: ; preds = %4
%82 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @error to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 100)
br label %83
83: ; preds = %81, %78
ret void
}

LLVM IR (-O2):
@.str = [50 x i8] c"free_mem3Ddb_offset: trying to free unused memory\00"
define void @free_mem3Ddb_offset(double*** %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp eq double*** %0, null
br i1 %5, label %47, label %6
6: ; preds = %4
%7 = icmp sgt i32 %1, 0
br i1 %7, label %8, label %35
8: ; preds = %6
%9 = sub i32 0, %3
%10 = sub nsw i32 %2, %3
%11 = icmp sgt i32 %2, 0
%12 = sext i32 %9 to i64
%13 = sext i32 %10 to i64
%14 = zext i32 %1 to i64
br label %15
15: ; preds = %8, %32
%16 = phi i64 [ 0, %8 ], [ %33, %32 ]
br i1 %11, label %17, label %32
17: ; preds = %15
%18 = getelementptr inbounds double**, double*** %0, i64 %16
br label %19
19: ; preds = %17, %29
%20 = phi i64 [ %12, %17 ], [ %30, %29 ]
%21 = load double**, double*** %18
%22 = getelementptr inbounds double*, double** %21, i64 %20
%23 = load double*, double** %22
%24 = icmp eq double* %23, null
br i1 %24, label %27, label %25
25: ; preds = %19
%26 = bitcast double* %23 to i8*
tail call void @free(i8* %26)
br label %29
27: ; preds = %19
%28 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @error to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 100)
br label %29
29: ; preds = %25, %27
%30 = add nsw i64 %20, 1
%31 = icmp slt i64 %30, %13
br i1 %31, label %19, label %32
32: ; preds = %29, %15
%33 = add nuw nsw i64 %16, 1
%34 = icmp eq i64 %33, %14
br i1 %34, label %35, label %15
35: ; preds = %32, %6
%36 = load double**, double*** %0
%37 = sext i32 %3 to i64
%38 = sub nsw i64 0, %37
%39 = getelementptr inbounds double*, double** %36, i64 %38
store double** %39, double*** %0
%40 = icmp eq double** %36, null
br i1 %40, label %43, label %41
41: ; preds = %35
%42 = bitcast double** %39 to i8*
tail call void @free(i8* %42)
br label %45
43: ; preds = %35
%44 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @error to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 100)
br label %45
45: ; preds = %43, %41
%46 = bitcast double*** %0 to i8*
tail call void @free(i8* %46)
br label %49
47: ; preds = %4
%48 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @error to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 100)
br label %49
49: ; preds = %47, %45
ret void
}