#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 NAN;
scalar_t__ pow(float, int);
float sqrt(float);
float isFartherThan_l2_float(float *p1, float *p2, int len, float dist) {
  float ret = 0;
  float dist2 = dist * dist;
  int i = 0;
  for (i = 0; i < len; i++) {
    ret += pow((p1[i] - p2[i]), 2);
    if (ret > dist2)
      return NAN;
  }
  return sqrt(ret);
}


x86 assembly (clang, -O0):
<isFartherThan_l2_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movss  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x20(%rbp),%xmm0
mulss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11d3 <isFartherThan_l2_float+0xb3>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
subss  (%rax,%rcx,4),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
cvtsi2ss %rax,%xmm0
addss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
ucomiss -0x28(%rbp),%xmm0
jbe    11c0 <isFartherThan_l2_float+0xa0>
mov    0x2e46(%rip),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11e2 <isFartherThan_l2_float+0xc2>
jmp    11c5 <isFartherThan_l2_float+0xa5>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    115d <isFartherThan_l2_float+0x3d>
movss  -0x24(%rbp),%xmm0
call   1040 <sqrt@plt>
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isFartherThan_l2_float>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movss  %xmm0,(%rsp)
xorps  %xmm0,%xmm0
test   %edx,%edx
jle    1189 <isFartherThan_l2_float+0x69>
mov    %rsi,%r14
mov    %rdi,%r15
movss  (%rsp),%xmm0
mulss  %xmm0,%xmm0
movss  %xmm0,(%rsp)
mov    %edx,%r12d
xorps  %xmm0,%xmm0
xor    %ebx,%ebx
movss  %xmm0,0x4(%rsp)
movss  (%r15,%rbx,4),%xmm0
subss  (%r14,%rbx,4),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
addss  0x4(%rsp),%xmm0
ucomiss (%rsp),%xmm0
ja     1198 <isFartherThan_l2_float+0x78>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1150 <isFartherThan_l2_float+0x30>
ucomiss 0xe70(%rip),%xmm0
jb     11af <isFartherThan_l2_float+0x8f>
sqrtss %xmm0,%xmm0
jmp    11a3 <isFartherThan_l2_float+0x83>
mov    0x2e59(%rip),%rax
movss  (%rax),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <sqrt@plt>

LLVM IR (-O0):
@NAN = global float 0.000000e+00
define float @isFartherThan_l2_float(float* %0, float* %1, i32 %2, float %3) {
%5 = alloca float
%6 = alloca float*
%7 = alloca float*
%8 = alloca i32
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca i32
store float* %0, float** %6
store float* %1, float** %7
store i32 %2, i32* %8
store float %3, float* %9
store float 0.000000e+00, float* %10
%13 = load float, float* %9
%14 = load float, float* %9
%15 = fmul float %13, %14
store float %15, float* %11
store i32 0, i32* %12
store i32 0, i32* %12
br label %16
16: ; preds = %42, %4
%17 = load i32, i32* %12
%18 = load i32, i32* %8
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %45
20: ; preds = %16
%21 = load float*, float** %6
%22 = load i32, i32* %12
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds float, float* %21, i64 %23
%25 = load float, float* %24
%26 = load float*, float** %7
%27 = load i32, i32* %12
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds float, float* %26, i64 %28
%30 = load float, float* %29
%31 = fsub float %25, %30
%32 = call i64 @pow(float %31, i32 2)
%33 = sitofp i64 %32 to float
%34 = load float, float* %10
%35 = fadd float %34, %33
store float %35, float* %10
%36 = load float, float* %10
%37 = load float, float* %11
%38 = fcmp ogt float %36, %37
br i1 %38, label %39, label %41
39: ; preds = %20
%40 = load float, float* @NAN
store float %40, float* %5
br label %48
41: ; preds = %20
br label %42
42: ; preds = %41
%43 = load i32, i32* %12
%44 = add nsw i32 %43, 1
store i32 %44, i32* %12
br label %16
45: ; preds = %16
%46 = load float, float* %10
%47 = call float @sqrt(float %46)
store float %47, float* %5
br label %48
48: ; preds = %45, %39
%49 = load float, float* %5
ret float %49
}

LLVM IR (-O2):
@NAN = global float 0.000000e+00
define float @isFartherThan_l2_float(float* nocapture %0, float* nocapture %1, i32 %2, float %3) {
%5 = fmul float %3, %3
%6 = icmp sgt i32 %2, 0
br i1 %6, label %7, label %26
7: ; preds = %4
%8 = zext i32 %2 to i64
br label %11
9: ; preds = %11
%10 = icmp eq i64 %23, %8
br i1 %10, label %26, label %11
11: ; preds = %7, %9
%12 = phi i64 [ 0, %7 ], [ %23, %9 ]
%13 = phi float [ 0.000000e+00, %7 ], [ %21, %9 ]
%14 = getelementptr inbounds float, float* %0, i64 %12
%15 = load float, float* %14
%16 = getelementptr inbounds float, float* %1, i64 %12
%17 = load float, float* %16
%18 = fsub float %15, %17
%19 = tail call i64 @pow(float %18, i32 2)
%20 = sitofp i64 %19 to float
%21 = fadd float %13, %20
%22 = fcmp ogt float %21, %5
%23 = add nuw nsw i64 %12, 1
br i1 %22, label %24, label %9
24: ; preds = %11
%25 = load float, float* @NAN
br label %29
26: ; preds = %9, %4
%27 = phi float [ 0.000000e+00, %4 ], [ %21, %9 ]
%28 = tail call float @sqrt(float %27)
br label %29
29: ; preds = %26, %24
%30 = phi float [ %25, %24 ], [ %28, %26 ]
ret float %30
}