void dataframe_free(int **df) {
  int i, dim_one = df[-1][0];
  free(df[-1]);
  for (i = 0; i < dim_one; i++) {
    free(df[i] - 2);
  }
  free(df - 1);
  return;
}


x86 assembly (clang, -O0):
<dataframe_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x8(%rax),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x8(%rax),%rdi
call   1030 <free@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    116c <dataframe_free+0x5c>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
add    $0xfffffffffffffff8,%rdi
call   1030 <free@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113d <dataframe_free+0x2d>
mov    -0x8(%rbp),%rdi
add    $0xfffffffffffffff8,%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dataframe_free>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r15
lea    -0x8(%rdi),%r14
mov    -0x8(%rdi),%rdi
mov    (%rdi),%r12d
call   1030 <free@plt>
test   %r12d,%r12d
jle    1156 <dataframe_free+0x46>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r15,%rbx,8),%rdi
add    $0xfffffffffffffff8,%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <dataframe_free+0x30>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

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