#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*/ extractnz_boundaries_dvector(double *, long, long, long *,
                                                long *, double);
void extractnz_boundaries_dmatrix(double **m, long nrl, long nrh, long ncl,
                                  long nch, long *nclnz, long *nchnz,
                                  double epsillon) {
  int i;
  long a, b;
  long left, right;
  extractnz_boundaries_dvector(m[nrl], ncl, nch, &left, &right, epsillon);
  for (i = nrl + 1; i <= nrh; i++) {
    extractnz_boundaries_dvector(m[i], ncl, nch, &a, &b, epsillon);
    if (a < left)
      left = a;
    if (b > right)
      right = b;
  }
  *nclnz = left;
  *nchnz = right;
}


x86 assembly (clang, -O0):
<extractnz_boundaries_dmatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movsd  %xmm0,-0x38(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
movsd  -0x38(%rbp),%xmm0
lea    -0x58(%rbp),%rcx
lea    -0x60(%rbp),%r8
call   1030 <extractnz_boundaries_dvector@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %eax,-0x3c(%rbp)
movslq -0x3c(%rbp),%rax
cmp    -0x18(%rbp),%rax
jg     11dd <extractnz_boundaries_dmatrix+0xcd>
mov    -0x8(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
movsd  -0x38(%rbp),%xmm0
lea    -0x48(%rbp),%rcx
lea    -0x50(%rbp),%r8
call   1030 <extractnz_boundaries_dvector@plt>
mov    -0x48(%rbp),%rax
cmp    -0x58(%rbp),%rax
jge    11b4 <extractnz_boundaries_dmatrix+0xa4>
mov    -0x48(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x50(%rbp),%rax
cmp    -0x60(%rbp),%rax
jle    11ca <extractnz_boundaries_dmatrix+0xba>
mov    -0x50(%rbp),%rax
mov    %rax,-0x60(%rbp)
jmp    11cf <extractnz_boundaries_dmatrix+0xbf>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    116a <extractnz_boundaries_dmatrix+0x5a>
mov    -0x58(%rbp),%rcx
mov    -0x30(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x60(%rbp),%rcx
mov    0x10(%rbp),%rax
mov    %rcx,(%rax)
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extractnz_boundaries_dmatrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r9,0x18(%rsp)
mov    %r8,%r15
mov    %rcx,%r12
mov    %rdx,%r13
mov    %rsi,%rbp
mov    %rdi,%rbx
mov    (%rdi,%rsi,8),%rdi
lea    0x10(%rsp),%rcx
lea    0x8(%rsp),%r8
mov    %r12,%rsi
mov    %r15,%rdx
movsd  %xmm0,0x20(%rsp)
call   1030 <extractnz_boundaries_dvector@plt>
add    $0x1,%ebp
movslq %ebp,%rbp
cmp    %r13,%rbp
jle    1185 <extractnz_boundaries_dmatrix+0x75>
mov    0x10(%rsp),%rax
mov    0x8(%rsp),%rcx
mov    0x18(%rsp),%rdx
mov    %rax,(%rdx)
mov    0x70(%rsp),%rax
mov    %rcx,(%rax)
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x28(%rsp),%r14
jmp    11aa <extractnz_boundaries_dmatrix+0x9a>
nopl   0x0(%rax)
shl    $0x20,%rbp
movabs $0x100000000,%rdx
add    %rdx,%rbp
sar    $0x20,%rbp
cmp    %r13,%rbp
jg     1166 <extractnz_boundaries_dmatrix+0x56>
mov    (%rbx,%rbp,8),%rdi
mov    %r12,%rsi
mov    %r15,%rdx
lea    0x30(%rsp),%rcx
mov    %r14,%r8
movsd  0x20(%rsp),%xmm0
call   1030 <extractnz_boundaries_dvector@plt>
mov    0x30(%rsp),%rcx
mov    0x10(%rsp),%rax
cmp    %rax,%rcx
jge    11de <extractnz_boundaries_dmatrix+0xce>
mov    %rcx,0x10(%rsp)
mov    %rcx,%rax
mov    0x28(%rsp),%rdx
mov    0x8(%rsp),%rcx
cmp    %rcx,%rdx
jle    1190 <extractnz_boundaries_dmatrix+0x80>
mov    %rdx,0x8(%rsp)
mov    %rdx,%rcx
jmp    1190 <extractnz_boundaries_dmatrix+0x80>

LLVM IR (-O0):
define void @extractnz_boundaries_dmatrix(double** %0, i64 %1, i64 %2, i64 %3, i64 %4, i64* %5, i64* %6, double %7) {
%9 = alloca double**
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64*
%15 = alloca i64*
%16 = alloca double
%17 = alloca i32
%18 = alloca i64
%19 = alloca i64
%20 = alloca i64
%21 = alloca i64
store double** %0, double*** %9
store i64 %1, i64* %10
store i64 %2, i64* %11
store i64 %3, i64* %12
store i64 %4, i64* %13
store i64* %5, i64** %14
store i64* %6, i64** %15
store double %7, double* %16
%22 = load double**, double*** %9
%23 = load i64, i64* %10
%24 = getelementptr inbounds double*, double** %22, i64 %23
%25 = load double*, double** %24
%26 = load i64, i64* %12
%27 = load i64, i64* %13
%28 = load double, double* %16
%29 = call i32 @extractnz_boundaries_dvector(double* %25, i64 %26, i64 %27, i64* %20, i64* %21, double %28)
%30 = load i64, i64* %10
%31 = add nsw i64 %30, 1
%32 = trunc i64 %31 to i32
store i32 %32, i32* %17
br label %33
33: ; preds = %60, %8
%34 = load i32, i32* %17
%35 = sext i32 %34 to i64
%36 = load i64, i64* %11
%37 = icmp sle i64 %35, %36
br i1 %37, label %38, label %63
38: ; preds = %33
%39 = load double**, double*** %9
%40 = load i32, i32* %17
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds double*, double** %39, i64 %41
%43 = load double*, double** %42
%44 = load i64, i64* %12
%45 = load i64, i64* %13
%46 = load double, double* %16
%47 = call i32 @extractnz_boundaries_dvector(double* %43, i64 %44, i64 %45, i64* %18, i64* %19, double %46)
%48 = load i64, i64* %18
%49 = load i64, i64* %20
%50 = icmp slt i64 %48, %49
br i1 %50, label %51, label %53
51: ; preds = %38
%52 = load i64, i64* %18
store i64 %52, i64* %20
br label %53
53: ; preds = %51, %38
%54 = load i64, i64* %19
%55 = load i64, i64* %21
%56 = icmp sgt i64 %54, %55
br i1 %56, label %57, label %59
57: ; preds = %53
%58 = load i64, i64* %19
store i64 %58, i64* %21
br label %59
59: ; preds = %57, %53
br label %60
60: ; preds = %59
%61 = load i32, i32* %17
%62 = add nsw i32 %61, 1
store i32 %62, i32* %17
br label %33
63: ; preds = %33
%64 = load i64, i64* %20
%65 = load i64*, i64** %14
store i64 %64, i64* %65
%66 = load i64, i64* %21
%67 = load i64*, i64** %15
store i64 %66, i64* %67
ret void
}

LLVM IR (-O2):
define void @extractnz_boundaries_dmatrix(double** nocapture %0, i64 %1, i64 %2, i64 %3, i64 %4, i64* nocapture writeonly %5, i64* nocapture writeonly %6, double %7) {
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = bitcast i64* %9 to i8*
%14 = bitcast i64* %10 to i8*
%15 = bitcast i64* %11 to i8*
%16 = bitcast i64* %12 to i8*
%17 = getelementptr inbounds double*, double** %0, i64 %1
%18 = load double*, double** %17
%19 = call i32 @extractnz_boundaries_dvector(double* %18, i64 %3, i64 %4, i64* %11, i64* %12, double %7)
%20 = shl i64 %1, 32
%21 = add i64 %20, 4294967296
%22 = ashr exact i64 %21, 32
%23 = icmp sgt i64 %22, %2
br i1 %23, label %24, label %27
24: ; preds = %8
%25 = load i64, i64* %11
%26 = load i64, i64* %12
br label %48
27: ; preds = %8, %42
%28 = phi i64 [ %46, %42 ], [ %22, %8 ]
%29 = getelementptr inbounds double*, double** %0, i64 %28
%30 = load double*, double** %29
%31 = call i32 @extractnz_boundaries_dvector(double* %30, i64 %3, i64 %4, i64* %9, i64* %10, double %7)
%32 = load i64, i64* %9
%33 = load i64, i64* %11
%34 = icmp slt i64 %32, %33
br i1 %34, label %35, label %36
35: ; preds = %27
store i64 %32, i64* %11
br label %36
36: ; preds = %35, %27
%37 = phi i64 [ %32, %35 ], [ %33, %27 ]
%38 = load i64, i64* %10
%39 = load i64, i64* %12
%40 = icmp sgt i64 %38, %39
br i1 %40, label %41, label %42
41: ; preds = %36
store i64 %38, i64* %12
br label %42
42: ; preds = %36, %41
%43 = phi i64 [ %39, %36 ], [ %38, %41 ]
%44 = shl nsw i64 %28, 32
%45 = add i64 %44, 4294967296
%46 = ashr exact i64 %45, 32
%47 = icmp sgt i64 %46, %2
br i1 %47, label %48, label %27
48: ; preds = %42, %24
%49 = phi i64 [ %26, %24 ], [ %43, %42 ]
%50 = phi i64 [ %25, %24 ], [ %37, %42 ]
store i64 %50, i64* %5
store i64 %49, i64* %6
ret void
}