#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_usmatrix(unsigned short **m, long nrl, long nrh, long ncl, long nch) {
  if ((nch < 0) | (nrh < 0))
    nrerror("free_usmatrix: nch must be >=0");
  free((char *)(m[nrl] + ncl - 1));
  free((char *)(m + nrl - 1));
}


x86 assembly (clang, -O0):
<free_usmatrix>:
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_usmatrix+0x4e>
lea    0xe97(%rip),%rdi
call   1040 <nrerror@plt>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x20(%rbp),%rax
shl    $0x1,%rax
add    %rax,%rdi
add    $0xfffffffffffffffe,%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_usmatrix>:
push   %r15
push   %r14
push   %rbx
mov    %rcx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
or     %r8,%rdx
jns    113f <free_usmatrix+0x1f>
lea    0xec6(%rip),%rdi
call   1040 <nrerror@plt>
mov    (%rbx,%r14,8),%rax
lea    (%rax,%r15,2),%rdi
add    $0xfffffffffffffffe,%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_usmatrix: nch must be >=0\00"
define void @free_usmatrix(i16** %0, i64 %1, i64 %2, i64 %3, i64 %4) {
%6 = alloca i16**
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
store i16** %0, i16*** %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 i16**, i16*** %6
%23 = load i64, i64* %7
%24 = getelementptr inbounds i16*, i16** %22, i64 %23
%25 = load i16*, i16** %24
%26 = load i64, i64* %9
%27 = getelementptr inbounds i16, i16* %25, i64 %26
%28 = getelementptr inbounds i16, i16* %27, i64 -1
%29 = bitcast i16* %28 to i8*
%30 = call i32 @free(i8* %29)
%31 = load i16**, i16*** %6
%32 = load i64, i64* %7
%33 = getelementptr inbounds i16*, i16** %31, i64 %32
%34 = getelementptr inbounds i16*, i16** %33, i64 -1
%35 = bitcast i16** %34 to i8*
%36 = call i32 @free(i8* %35)
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"free_usmatrix: nch must be >=0\00"
define void @free_usmatrix(i16** 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 i16*, i16** %0, i64 %1
%12 = load i16*, i16** %11
%13 = getelementptr inbounds i16, i16* %12, i64 %3
%14 = getelementptr inbounds i16, i16* %13, i64 -1
%15 = bitcast i16* %14 to i8*
%16 = tail call i32 @free(i8* %15)
%17 = getelementptr inbounds i16*, i16** %11, i64 -1
%18 = bitcast i16** %17 to i8*
%19 = tail call i32 @free(i8* %18)
ret void
}