void free_mem2Ddb_offset(double **array2D, int offset) {
  if (array2D) {
    array2D[0] -= offset;
    if (array2D[0])
      free(array2D[0]);
    else
      error("free_mem2Ddb_offset: trying to free unused memory", 100);
    free(array2D);
  } else {
    error("free_mem2Ddb_offset: trying to free unused memory", 100);
  }
}


x86 assembly (clang, -O0):
<free_mem2Ddb_offset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1196 <free_mem2Ddb_offset+0x76>
mov    -0xc(%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     1175 <free_mem2Ddb_offset+0x55>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
jmp    1188 <free_mem2Ddb_offset+0x68>
lea    0xe84(%rip),%rdi
mov    $0x64,%esi
mov    $0x0,%al
call   1040 <error@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
jmp    11a9 <free_mem2Ddb_offset+0x89>
lea    0xe63(%rip),%rdi
mov    $0x64,%esi
mov    $0x0,%al
call   1040 <error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_mem2Ddb_offset>:
test   %rdi,%rdi
je     1148 <free_mem2Ddb_offset+0x28>
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rax
movslq %esi,%rcx
shl    $0x3,%rcx
mov    %rax,%rdi
sub    %rcx,%rdi
mov    %rdi,(%rbx)
test   %rax,%rax
je     115b <free_mem2Ddb_offset+0x3b>
call   1030 <free@plt>
jmp    116e <free_mem2Ddb_offset+0x4e>
lea    0xeb1(%rip),%rdi
mov    $0x64,%esi
xor    %eax,%eax
jmp    1040 <error@plt>
lea    0xe9e(%rip),%rdi
mov    $0x64,%esi
xor    %eax,%eax
call   1040 <error@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [50 x i8] c"free_mem2Ddb_offset: trying to free unused memory\00"
define void @free_mem2Ddb_offset(double** %0, i32 %1) {
%3 = alloca double**
%4 = alloca i32
store double** %0, double*** %3
store i32 %1, i32* %4
%5 = load double**, double*** %3
%6 = icmp ne double** %5, null
br i1 %6, label %7, label %29
7: ; preds = %2
%8 = load i32, i32* %4
%9 = load double**, double*** %3
%10 = getelementptr inbounds double*, double** %9, i64 0
%11 = load double*, double** %10
%12 = sext i32 %8 to i64
%13 = sub i64 0, %12
%14 = getelementptr inbounds double, double* %11, i64 %13
store double* %14, double** %10
%15 = load double**, double*** %3
%16 = getelementptr inbounds double*, double** %15, i64 0
%17 = load double*, double** %16
%18 = icmp ne double* %17, null
br i1 %18, label %19, label %24
19: ; preds = %7
%20 = load double**, double*** %3
%21 = getelementptr inbounds double*, double** %20, i64 0
%22 = load double*, double** %21
%23 = bitcast double* %22 to i8*
br label %26
24: ; preds = %7
%25 = 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 %26
26: ; preds = %24, %19
%27 = load double**, double*** %3
%28 = bitcast double** %27 to i8*
br label %31
29: ; preds = %2
%30 = 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 %31
31: ; preds = %29, %26
ret void
}

LLVM IR (-O2):
@.str = [50 x i8] c"free_mem2Ddb_offset: trying to free unused memory\00"
define void @free_mem2Ddb_offset(double** %0, i32 %1) {
%3 = icmp eq double** %0, null
br i1 %3, label %16, label %4
4: ; preds = %2
%5 = load double*, double** %0
%6 = sext i32 %1 to i64
%7 = sub nsw i64 0, %6
%8 = getelementptr inbounds double, double* %5, i64 %7
store double* %8, double** %0
%9 = icmp eq double* %5, null
br i1 %9, label %12, label %10
10: ; preds = %4
%11 = bitcast double* %8 to i8*
tail call void @free(i8* %11)
br label %14
12: ; preds = %4
%13 = 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 %14
14: ; preds = %12, %10
%15 = bitcast double** %0 to i8*
tail call void @free(i8* %15)
br label %18
16: ; preds = %2
%17 = 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 %18
18: ; preds = %16, %14
ret void
}