#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 */
float fabs(float);
void extractnz_boundaries_vector(float *v, long nl, long nh, long *nlnz,
                                 long *nhnz, float epsillon) {
  long left = nl, right = nh;
  ;
  while (fabs(v[left]) < epsillon && left <= nh)
    left++;
  while (fabs(v[right]) < epsillon && right >= nl)
    right--;
  *nlnz = left;
  *nhnz = right;
}


x86 assembly (clang, -O0):
<extractnz_boundaries_vector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movss  %xmm0,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x38(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
call   1030 <fabs@plt>
movaps %xmm0,%xmm1
movss  -0x2c(%rbp),%xmm0
xor    %eax,%eax
ucomiss %xmm1,%xmm0
mov    %al,-0x41(%rbp)
jbe    1177 <extractnz_boundaries_vector+0x67>
mov    -0x38(%rbp),%rax
cmp    -0x18(%rbp),%rax
setle  %al
mov    %al,-0x41(%rbp)
mov    -0x41(%rbp),%al
test   $0x1,%al
jne    1187 <extractnz_boundaries_vector+0x77>
jmp    1198 <extractnz_boundaries_vector+0x88>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1141 <extractnz_boundaries_vector+0x31>
jmp    119d <extractnz_boundaries_vector+0x8d>
mov    -0x8(%rbp),%rax
mov    -0x40(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
call   1030 <fabs@plt>
movaps %xmm0,%xmm1
movss  -0x2c(%rbp),%xmm0
xor    %eax,%eax
ucomiss %xmm1,%xmm0
mov    %al,-0x42(%rbp)
jbe    11d3 <extractnz_boundaries_vector+0xc3>
mov    -0x40(%rbp),%rax
cmp    -0x10(%rbp),%rax
setge  %al
mov    %al,-0x42(%rbp)
mov    -0x42(%rbp),%al
test   $0x1,%al
jne    11e3 <extractnz_boundaries_vector+0xd3>
jmp    11f4 <extractnz_boundaries_vector+0xe4>
mov    -0x40(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x40(%rbp)
jmp    119d <extractnz_boundaries_vector+0x8d>
mov    -0x38(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x40(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extractnz_boundaries_vector>:
movaps 0xef9(%rip),%xmm1
mov    %rsi,%rax
nopw   0x0(%rax,%rax,1)
movss  (%rdi,%rax,4),%xmm2
andps  %xmm1,%xmm2
lea    0x1(%rax),%r9
ucomiss %xmm2,%xmm0
jbe    1129 <extractnz_boundaries_vector+0x29>
cmp    %rdx,%rax
mov    %r9,%rax
jle    1110 <extractnz_boundaries_vector+0x10>
add    $0xffffffffffffffff,%r9
nopl   (%rax)
movss  (%rdi,%rdx,4),%xmm2
andps  %xmm1,%xmm2
lea    -0x1(%rdx),%rax
ucomiss %xmm2,%xmm0
jbe    1149 <extractnz_boundaries_vector+0x49>
cmp    %rsi,%rdx
mov    %rax,%rdx
jge    1130 <extractnz_boundaries_vector+0x30>
mov    %r9,(%rcx)
add    $0x1,%rax
mov    %rax,(%r8)
ret

LLVM IR (-O0):
define void @extractnz_boundaries_vector(float* %0, i64 %1, i64 %2, i64* %3, i64* %4, float %5) {
%7 = alloca float*
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64*
%11 = alloca i64*
%12 = alloca float
%13 = alloca i64
%14 = alloca i64
store float* %0, float** %7
store i64 %1, i64* %8
store i64 %2, i64* %9
store i64* %3, i64** %10
store i64* %4, i64** %11
store float %5, float* %12
%15 = load i64, i64* %8
store i64 %15, i64* %13
%16 = load i64, i64* %9
store i64 %16, i64* %14
br label %17
17: ; preds = %31, %6
%18 = load float*, float** %7
%19 = load i64, i64* %13
%20 = getelementptr inbounds float, float* %18, i64 %19
%21 = load float, float* %20
%22 = call float @fabs(float %21)
%23 = load float, float* %12
%24 = fcmp olt float %22, %23
br i1 %24, label %25, label %29
25: ; preds = %17
%26 = load i64, i64* %13
%27 = load i64, i64* %9
%28 = icmp sle i64 %26, %27
br label %29
29: ; preds = %25, %17
%30 = phi i1 [ false, %17 ], [ %28, %25 ]
br i1 %30, label %31, label %34
31: ; preds = %29
%32 = load i64, i64* %13
%33 = add nsw i64 %32, 1
store i64 %33, i64* %13
br label %17
34: ; preds = %29
br label %35
35: ; preds = %49, %34
%36 = load float*, float** %7
%37 = load i64, i64* %14
%38 = getelementptr inbounds float, float* %36, i64 %37
%39 = load float, float* %38
%40 = call float @fabs(float %39)
%41 = load float, float* %12
%42 = fcmp olt float %40, %41
br i1 %42, label %43, label %47
43: ; preds = %35
%44 = load i64, i64* %14
%45 = load i64, i64* %8
%46 = icmp sge i64 %44, %45
br label %47
47: ; preds = %43, %35
%48 = phi i1 [ false, %35 ], [ %46, %43 ]
br i1 %48, label %49, label %52
49: ; preds = %47
%50 = load i64, i64* %14
%51 = add nsw i64 %50, -1
store i64 %51, i64* %14
br label %35
52: ; preds = %47
%53 = load i64, i64* %13
%54 = load i64*, i64** %10
store i64 %53, i64* %54
%55 = load i64, i64* %14
%56 = load i64*, i64** %11
store i64 %55, i64* %56
ret void
}

LLVM IR (-O2):
define void @extractnz_boundaries_vector(float* nocapture %0, i64 %1, i64 %2, i64* nocapture writeonly %3, i64* nocapture writeonly %4, float %5) {
br label %7
7: ; preds = %7, %6
%8 = phi i64 [ %1, %6 ], [ %15, %7 ]
%9 = getelementptr inbounds float, float* %0, i64 %8
%10 = load float, float* %9
%11 = tail call float @llvm.fabs.f32(float %10)
%12 = fcmp olt float %11, %5
%13 = icmp sle i64 %8, %2
%14 = select i1 %12, i1 %13, i1 false
%15 = add nsw i64 %8, 1
br i1 %14, label %7, label %16
16: ; preds = %7, %16
%17 = phi i64 [ %24, %16 ], [ %2, %7 ]
%18 = getelementptr inbounds float, float* %0, i64 %17
%19 = load float, float* %18
%20 = tail call float @llvm.fabs.f32(float %19)
%21 = fcmp olt float %20, %5
%22 = icmp sge i64 %17, %1
%23 = select i1 %21, i1 %22, i1 false
%24 = add nsw i64 %17, -1
br i1 %23, label %16, label %25
25: ; preds = %16
store i64 %8, i64* %3
store i64 %17, i64* %4
ret void
}