#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*/ clip(int /*<<< orphan*/, float, float);
void nclip(float *dst, float *src, size_t len, float lo, float hi) {
  int i;
  for (i = 0; i < len; i++) {
    *dst++ = clip(*src++, lo, hi);
  }
}


x86 assembly (clang, -O0):
<nclip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movss  %xmm0,-0x1c(%rbp)
movss  %xmm1,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movslq -0x24(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    118a <nclip+0x7a>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x10(%rbp)
cvttss2si (%rax),%edi
movss  -0x1c(%rbp),%xmm0
movss  -0x20(%rbp),%xmm1
call   1030 <clip@plt>
cvtsi2ss %eax,%xmm0
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x8(%rbp)
movss  %xmm0,(%rax)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1135 <nclip+0x25>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nclip>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rdx,%rdx
je     116c <nclip+0x5c>
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
movss  %xmm1,0x4(%rsp)
movss  %xmm0,(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cvttss2si (%r14,%rbx,4),%edi
movss  (%rsp),%xmm0
movss  0x4(%rsp),%xmm1
call   1030 <clip@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,(%r15,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <nclip+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @nclip(float* %0, float* %1, i64 %2, float %3, float %4) {
%6 = alloca float*
%7 = alloca float*
%8 = alloca i64
%9 = alloca float
%10 = alloca float
%11 = alloca i32
store float* %0, float** %6
store float* %1, float** %7
store i64 %2, i64* %8
store float %3, float* %9
store float %4, float* %10
store i32 0, i32* %11
br label %12
12: ; preds = %28, %5
%13 = load i32, i32* %11
%14 = sext i32 %13 to i64
%15 = load i64, i64* %8
%16 = icmp ult i64 %14, %15
br i1 %16, label %17, label %31
17: ; preds = %12
%18 = load float*, float** %7
%19 = getelementptr inbounds float, float* %18, i32 1
store float* %19, float** %7
%20 = load float, float* %18
%21 = fptosi float %20 to i32
%22 = load float, float* %9
%23 = load float, float* %10
%24 = call i32 @clip(i32 %21, float %22, float %23)
%25 = sitofp i32 %24 to float
%26 = load float*, float** %6
%27 = getelementptr inbounds float, float* %26, i32 1
store float* %27, float** %6
store float %25, float* %26
br label %28
28: ; preds = %17
%29 = load i32, i32* %11
%30 = add nsw i32 %29, 1
store i32 %30, i32* %11
br label %12
31: ; preds = %12
ret void
}

LLVM IR (-O2):
define void @nclip(float* nocapture writeonly %0, float* nocapture %1, i64 %2, float %3, float %4) {
%6 = icmp eq i64 %2, 0
br i1 %6, label %19, label %7
7: ; preds = %5, %7
%8 = phi i64 [ %17, %7 ], [ 0, %5 ]
%9 = phi float* [ %16, %7 ], [ %0, %5 ]
%10 = phi float* [ %11, %7 ], [ %1, %5 ]
%11 = getelementptr inbounds float, float* %10, i64 1
%12 = load float, float* %10
%13 = fptosi float %12 to i32
%14 = tail call i32 @clip(i32 %13, float %3, float %4)
%15 = sitofp i32 %14 to float
%16 = getelementptr inbounds float, float* %9, i64 1
store float %15, float* %9
%17 = add nuw i64 %8, 1
%18 = icmp eq i64 %17, %2
br i1 %18, label %19, label %7
19: ; preds = %7, %5
ret void
}