void delet4Darray_continuousMem(double ****tmp, int a1, int a2, int a3,
                                int a4) {
  free(tmp[0][0][0]);
  for (int i = 0; i < a1; i++) {
    for (int j = 0; j < a2; j++) {
      free(tmp[i][j]);
    }
    free(tmp[i]);
  }
  free(tmp);
}


x86 assembly (clang, -O0):
<delet4Darray_continuousMem>:
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    %r8d,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11a7 <delet4Darray_continuousMem+0x97>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1188 <delet4Darray_continuousMem+0x78>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1155 <delet4Darray_continuousMem+0x45>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1142 <delet4Darray_continuousMem+0x32>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<delet4Darray_continuousMem>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %esi,%r14d
mov    %rdi,%r12
mov    (%rdi),%rax
mov    (%rax),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
test   %r14d,%r14d
jle    1188 <delet4Darray_continuousMem+0x78>
mov    %r14d,%r14d
mov    %r15d,%r13d
xor    %ebx,%ebx
jmp    1162 <delet4Darray_continuousMem+0x52>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r12,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %r14,%rbx
je     1188 <delet4Darray_continuousMem+0x78>
test   %r15d,%r15d
jle    1150 <delet4Darray_continuousMem+0x40>
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    (%r12,%rbx,8),%rax
mov    (%rax,%rbp,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbp
cmp    %rbp,%r13
jne    1170 <delet4Darray_continuousMem+0x60>
jmp    1150 <delet4Darray_continuousMem+0x40>
mov    %r12,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @delet4Darray_continuousMem(double**** %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca double****
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store double**** %0, double***** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%13 = load double****, double***** %6
%14 = getelementptr inbounds double***, double**** %13, i64 0
%15 = load double***, double**** %14
%16 = getelementptr inbounds double**, double*** %15, i64 0
%17 = load double**, double*** %16
%18 = getelementptr inbounds double*, double** %17, i64 0
%19 = load double*, double** %18
%20 = bitcast double* %19 to i8*
store i32 0, i32* %11
br label %21
21: ; preds = %51, %5
%22 = load i32, i32* %11
%23 = load i32, i32* %7
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %54
25: ; preds = %21
store i32 0, i32* %12
br label %26
26: ; preds = %41, %25
%27 = load i32, i32* %12
%28 = load i32, i32* %8
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %44
30: ; preds = %26
%31 = load double****, double***** %6
%32 = load i32, i32* %11
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds double***, double**** %31, i64 %33
%35 = load double***, double**** %34
%36 = load i32, i32* %12
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds double**, double*** %35, i64 %37
%39 = load double**, double*** %38
%40 = bitcast double** %39 to i8*
br label %41
41: ; preds = %30
%42 = load i32, i32* %12
%43 = add nsw i32 %42, 1
store i32 %43, i32* %12
br label %26
44: ; preds = %26
%45 = load double****, double***** %6
%46 = load i32, i32* %11
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds double***, double**** %45, i64 %47
%49 = load double***, double**** %48
%50 = bitcast double*** %49 to i8*
br label %51
51: ; preds = %44
%52 = load i32, i32* %11
%53 = add nsw i32 %52, 1
store i32 %53, i32* %11
br label %21
54: ; preds = %21
%55 = load double****, double***** %6
%56 = bitcast double**** %55 to i8*
ret void
}

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