#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 */

/* Variables and functions */
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ nrerror(char *);
void free_ucmatrix(unsigned char **m, long nrl, long nrh, long ncl, long nch) {
  if ((nch < 0) | (nrh < 0))
    nrerror("free_ucmatrix: nch must be >=0");
  free((char *)(m[nrl] + ncl - 1));
  free((char *)(m + nrl - 1));
}


x86 assembly (clang, -O0):
<free_ucmatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%eax
cmpq   $0x0,-0x18(%rbp)
setl   %cl
and    $0x1,%cl
movzbl %cl,%ecx
or     %ecx,%eax
cmp    $0x0,%eax
je     116e <free_ucmatrix+0x4e>
lea    0xe97(%rip),%rdi
call   1040 <nrerror@plt>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
add    -0x20(%rbp),%rdi
add    $0xffffffffffffffff,%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
add    $0xfffffffffffffff8,%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_ucmatrix>:
push   %r15
push   %r14
push   %rbx
mov    %rcx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
or     %r8,%rdx
jns    113f <free_ucmatrix+0x1f>
lea    0xec6(%rip),%rdi
call   1040 <nrerror@plt>
mov    (%rbx,%r14,8),%rax
lea    (%rax,%r15,1),%rdi
add    $0xffffffffffffffff,%rdi
call   1030 <free@plt>
lea    (%rbx,%r14,8),%rdi
add    $0xfffffffffffffff8,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"free_ucmatrix: nch must be >=0\00"
define void @free_ucmatrix(i8** %0, i64 %1, i64 %2, i64 %3, i64 %4) {
%6 = alloca i8**
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
store i8** %0, i8*** %6
store i64 %1, i64* %7
store i64 %2, i64* %8
store i64 %3, i64* %9
store i64 %4, i64* %10
%11 = load i64, i64* %10
%12 = icmp slt i64 %11, 0
%13 = zext i1 %12 to i32
%14 = load i64, i64* %8
%15 = icmp slt i64 %14, 0
%16 = zext i1 %15 to i32
%17 = or i32 %13, %16
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %5
%20 = call i32 @nrerror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %21
21: ; preds = %19, %5
%22 = load i8**, i8*** %6
%23 = load i64, i64* %7
%24 = getelementptr inbounds i8*, i8** %22, i64 %23
%25 = load i8*, i8** %24
%26 = load i64, i64* %9
%27 = getelementptr inbounds i8, i8* %25, i64 %26
%28 = getelementptr inbounds i8, i8* %27, i64 -1
%29 = call i32 @free(i8* %28)
%30 = load i8**, i8*** %6
%31 = load i64, i64* %7
%32 = getelementptr inbounds i8*, i8** %30, i64 %31
%33 = getelementptr inbounds i8*, i8** %32, i64 -1
%34 = bitcast i8** %33 to i8*
%35 = call i32 @free(i8* %34)
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"free_ucmatrix: nch must be >=0\00"
define void @free_ucmatrix(i8** nocapture %0, i64 %1, i64 %2, i64 %3, i64 %4) {
%6 = or i64 %4, %2
%7 = icmp sgt i64 %6, -1
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 @nrerror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %5
%11 = getelementptr inbounds i8*, i8** %0, i64 %1
%12 = load i8*, i8** %11
%13 = getelementptr inbounds i8, i8* %12, i64 %3
%14 = getelementptr inbounds i8, i8* %13, i64 -1
%15 = tail call i32 @free(i8* %14)
%16 = getelementptr inbounds i8*, i8** %11, i64 -1
%17 = bitcast i8** %16 to i8*
%18 = tail call i32 @free(i8* %17)
ret void
}