void close_full_2D(float **wt_tensor, float **v, float *w, double *rv1) {
  int z;
  for (z = 0; z < 2; z++) {
    free((void *)wt_tensor[z]);
    free((void *)v[z]);
  }
  free(w);
  free(rv1);
}


x86 assembly (clang, -O0):
<close_full_2D>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x2,-0x24(%rbp)
jge    1169 <close_full_2D+0x59>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    112f <close_full_2D+0x1f>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<close_full_2D>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1030 <free@plt>
mov    (%r12),%rdi
call   1030 <free@plt>
mov    0x8(%rbx),%rdi
call   1030 <free@plt>
mov    0x8(%r12),%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @close_full_2D(float** nocapture %0, float** nocapture %1, float* nocapture %2, double* nocapture %3) {
%5 = bitcast float** %0 to i8**
%6 = load i8*, i8** %5
tail call void @free(i8* %6)
%7 = bitcast float** %1 to i8**
%8 = load i8*, i8** %7
tail call void @free(i8* %8)
%9 = getelementptr inbounds float*, float** %0, i64 1
%10 = bitcast float** %9 to i8**
%11 = load i8*, i8** %10
tail call void @free(i8* %11)
%12 = getelementptr inbounds float*, float** %1, i64 1
%13 = bitcast float** %12 to i8**
%14 = load i8*, i8** %13
tail call void @free(i8* %14)
%15 = bitcast float* %2 to i8*
tail call void @free(i8* %15)
%16 = bitcast double* %3 to i8*
tail call void @free(i8* %16)
ret void
}