void free_mem2Dint(int **array2D) {
  if (array2D) {
    if (array2D[0]) {
      h264_free(array2D[0]);
    } else {
      printf("free_mem2Dint: trying to free unused memory");
    }
    h264_free(array2D);
  } else {
    printf("free_mem2Dint: trying to free unused memory");
  }
}


x86 assembly (clang, -O0):
<free_mem2Dint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1176 <free_mem2Dint+0x56>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1158 <free_mem2Dint+0x38>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    $0x0,%al
call   1040 <h264_free@plt>
jmp    1166 <free_mem2Dint+0x46>
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1040 <h264_free@plt>
jmp    1184 <free_mem2Dint+0x64>
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_mem2Dint>:
test   %rdi,%rdi
je     113a <free_mem2Dint+0x1a>
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1148 <free_mem2Dint+0x28>
xor    %eax,%eax
call   1040 <h264_free@plt>
jmp    1156 <free_mem2Dint+0x36>
lea    0xebf(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
lea    0xeb1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
pop    %rbx
jmp    1040 <h264_free@plt>

LLVM IR (-O0):
@.str = [44 x i8] c"free_mem2Dint: trying to free unused memory\00"
define void @free_mem2Dint(i32** %0) {
%2 = alloca i32**
store i32** %0, i32*** %2
%3 = load i32**, i32*** %2
%4 = icmp ne i32** %3, null
br i1 %4, label %5, label %20
5: ; preds = %1
%6 = load i32**, i32*** %2
%7 = getelementptr inbounds i32*, i32** %6, i64 0
%8 = load i32*, i32** %7
%9 = icmp ne i32* %8, null
br i1 %9, label %10, label %15
10: ; preds = %5
%11 = load i32**, i32*** %2
%12 = getelementptr inbounds i32*, i32** %11, i64 0
%13 = load i32*, i32** %12
%14 = call i32 (i32*, ...) bitcast (i32 (...)* @h264_free to i32 (i32*, ...)*)(i32* %13)
br label %17
15: ; preds = %5
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %15, %10
%18 = load i32**, i32*** %2
%19 = call i32 (i32**, ...) bitcast (i32 (...)* @h264_free to i32 (i32**, ...)*)(i32** %18)
br label %22
20: ; preds = %1
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
br label %22
22: ; preds = %20, %17
ret void
}

LLVM IR (-O2):
@.str = [44 x i8] c"free_mem2Dint: trying to free unused memory\00"
define void @free_mem2Dint(i32** %0) {
%2 = icmp eq i32** %0, null
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = load i32*, i32** %0
%5 = icmp eq i32* %4, null
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 (i32*, ...) bitcast (i32 (...)* @h264_free to i32 (i32*, ...)*)(i32* %4)
br label %10
8: ; preds = %3
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %6
%11 = tail call i32 (i32**, ...) bitcast (i32 (...)* @h264_free to i32 (i32**, ...)*)(i32** %0)
br label %14
12: ; preds = %1
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %10
ret void
}