#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ ****uint8_t;

/* Variables and functions */
int /*<<< orphan*/ free(int /*<<< orphan*/ ******);
void free_ui8matrix(uint8_t **m, const size_t nrow) {
  for (size_t i = 0; i < nrow; i++) {
    free(m[i]);
    m[i] = NULL;
  }
  free(m);
  m = NULL;
}


x86 assembly (clang, -O0):
<free_ui8matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1168 <free_ui8matrix+0x58>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movq   $0x0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <free_ui8matrix+0x18>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x8(%rbp)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_ui8matrix>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
test   %rsi,%rsi
je     114a <free_ui8matrix+0x3a>
mov    %rsi,%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r15,%rbx,8),%rdi
call   1030 <free@plt>
movq   $0x0,(%r15,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1130 <free_ui8matrix+0x20>
mov    %r15,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

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