void rfprof_free(double **obj) {
  int i, N;
  N = rfprof_len(obj);
  for (i = 1; i <= N; i++) {
    free_double_vector(obj[i]);
  }
  free(obj[0]);
  free(obj);
}


x86 assembly (clang, -O0):
<rfprof_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1050 <rfprof_len@plt>
mov    %eax,-0x10(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     117e <rfprof_free+0x4e>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    $0x0,%al
call   1040 <free_double_vector@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1151 <rfprof_free+0x21>
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):
<rfprof_free>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
xor    %eax,%eax
call   1050 <rfprof_len@plt>
test   %eax,%eax
jle    1164 <rfprof_free+0x34>
mov    %eax,%r15d
add    $0x1,%r15d
mov    $0x1,%ebx
nop
mov    (%r14,%rbx,8),%rdi
xor    %eax,%eax
call   1040 <free_double_vector@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1150 <rfprof_free+0x20>
mov    (%r14),%rdi
call   1030 <free@plt>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @rfprof_free(double** %0) {
%2 = tail call i32 (double**, ...) bitcast (i32 (...)* @rfprof_len to i32 (double**, ...)*)(double** %0)
%3 = icmp slt i32 %2, 1
br i1 %3, label %14, label %4
4: ; preds = %1
%5 = add nuw i32 %2, 1
%6 = zext i32 %5 to i64
br label %7
7: ; preds = %4, %7
%8 = phi i64 [ 1, %4 ], [ %12, %7 ]
%9 = getelementptr inbounds double*, double** %0, i64 %8
%10 = load double*, double** %9
%11 = tail call i32 (double*, ...) bitcast (i32 (...)* @free_double_vector to i32 (double*, ...)*)(double* %10)
%12 = add nuw nsw i64 %8, 1
%13 = icmp eq i64 %12, %6
br i1 %13, label %14, label %7
14: ; preds = %7, %1
%15 = bitcast double** %0 to i8**
%16 = load i8*, i8** %15
tail call void @free(i8* %16)
%17 = bitcast double** %0 to i8*
tail call void @free(i8* %17)
ret void
}