#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*/ debug(char *, double);
double jaccard(double *s, double *z, int len, double bsf, double epsilon) {
  double dist;
  double diff = 0;
  double mul = 0;
  while (--len) {
    diff += (*s - *z) * (*s - *z);
    mul += *s * *z;
    s++;
    z++;
  }
  dist = diff / (diff + mul);
  debug(" %.6f\n", dist);
  return dist;
}


x86 assembly (clang, -O0):
<jaccard>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     11c0 <jaccard+0xb0>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm2
movsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
movsd  -0x40(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    113d <jaccard+0x2d>
movsd  -0x38(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
addsd  -0x40(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
lea    0xe1c(%rip),%rdi
call   1030 <debug@plt>
movsd  -0x30(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jaccard>:
sub    $0x18,%rsp
mov    %edx,%eax
add    $0xffffffff,%eax
je     112d <jaccard+0x1d>
test   $0x1,%al
jne    1136 <jaccard+0x26>
xorpd  %xmm0,%xmm0
cmp    $0x2,%edx
jne    116e <jaccard+0x5e>
jmp    11e2 <jaccard+0xd2>
xorpd  %xmm0,%xmm0
jmp    11e2 <jaccard+0xd2>
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
movapd %xmm0,%xmm2
subsd  %xmm1,%xmm2
movapd %xmm2,%xmm3
unpcklpd %xmm0,%xmm3
unpcklpd %xmm1,%xmm2
mulpd  %xmm3,%xmm2
xorpd  %xmm0,%xmm0
addpd  %xmm2,%xmm0
add    $0x8,%rdi
add    $0x8,%rsi
lea    -0x2(%rdx),%eax
cmp    $0x2,%edx
je     11e2 <jaccard+0xd2>
mov    %eax,%eax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%rdi,%rcx,8),%xmm1
movsd  0x8(%rdi,%rcx,8),%xmm2
movsd  (%rsi,%rcx,8),%xmm3
movsd  0x8(%rsi,%rcx,8),%xmm4
movapd %xmm1,%xmm6
subsd  %xmm3,%xmm6
movapd %xmm6,%xmm5
unpcklpd %xmm1,%xmm5
unpcklpd %xmm3,%xmm6
mulpd  %xmm5,%xmm6
addpd  %xmm0,%xmm6
movapd %xmm2,%xmm1
subsd  %xmm4,%xmm1
movapd %xmm1,%xmm3
unpcklpd %xmm2,%xmm3
unpcklpd %xmm4,%xmm1
mulpd  %xmm3,%xmm1
movapd %xmm1,%xmm0
addpd  %xmm6,%xmm0
add    $0x2,%rcx
cmp    %ecx,%eax
jne    1180 <jaccard+0x70>
addpd  %xmm6,%xmm1
movapd %xmm1,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
divsd  %xmm1,%xmm0
movapd %xmm0,(%rsp)
lea    0xe02(%rip),%rdi
call   1030 <debug@plt>
movaps (%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [7 x i8] c" %.6f\0A\00"
define double @jaccard(double* %0, double* %1, i32 %2, double %3, double %4) {
%6 = alloca double*
%7 = alloca double*
%8 = alloca i32
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
store double* %0, double** %6
store double* %1, double** %7
store i32 %2, i32* %8
store double %3, double* %9
store double %4, double* %10
store double 0.000000e+00, double* %12
store double 0.000000e+00, double* %13
br label %14
14: ; preds = %18, %5
%15 = load i32, i32* %8
%16 = add nsw i32 %15, -1
store i32 %16, i32* %8
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %41
18: ; preds = %14
%19 = load double*, double** %6
%20 = load double, double* %19
%21 = load double*, double** %7
%22 = load double, double* %21
%23 = fsub double %20, %22
%24 = load double*, double** %6
%25 = load double, double* %24
%26 = load double*, double** %7
%27 = load double, double* %26
%28 = fsub double %25, %27
%29 = load double, double* %12
%30 = call double @llvm.fmuladd.f64(double %23, double %28, double %29)
store double %30, double* %12
%31 = load double*, double** %6
%32 = load double, double* %31
%33 = load double*, double** %7
%34 = load double, double* %33
%35 = load double, double* %13
%36 = call double @llvm.fmuladd.f64(double %32, double %34, double %35)
store double %36, double* %13
%37 = load double*, double** %6
%38 = getelementptr inbounds double, double* %37, i32 1
store double* %38, double** %6
%39 = load double*, double** %7
%40 = getelementptr inbounds double, double* %39, i32 1
store double* %40, double** %7
br label %14
41: ; preds = %14
%42 = load double, double* %12
%43 = load double, double* %12
%44 = load double, double* %13
%45 = fadd double %43, %44
%46 = fdiv double %42, %45
store double %46, double* %11
%47 = load double, double* %11
%48 = call i32 @debug(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %47)
%49 = load double, double* %11
ret double %49
}

LLVM IR (-O2):
@.str = [7 x i8] c" %.6f\0A\00"
define double @jaccard(double* nocapture %0, double* nocapture %1, i32 %2, double %3, double %4) {
%6 = add i32 %2, -1
%7 = icmp eq i32 %6, 0
br i1 %7, label %57, label %8
8: ; preds = %5
%9 = and i32 %6, 1
%10 = icmp eq i32 %9, 0
br i1 %10, label %23, label %11
11: ; preds = %8
%12 = load double, double* %0
%13 = load double, double* %1
%14 = fsub double %12, %13
%15 = insertelement <2 x double> poison, double %14, i64 0
%16 = insertelement <2 x double> %15, double %12, i64 1
%17 = insertelement <2 x double> %15, double %13, i64 1
%18 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %16, <2 x double> %17, <2 x double> zeroinitializer)
%19 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %16, <2 x double> %17, <2 x double> zeroinitializer)
%20 = getelementptr inbounds double, double* %0, i64 1
%21 = getelementptr inbounds double, double* %1, i64 1
%22 = add i32 %2, -2
br label %23
23: ; preds = %11, %8
%24 = phi <2 x double> [ undef, %8 ], [ %19, %11 ]
%25 = phi i32 [ %6, %8 ], [ %22, %11 ]
%26 = phi double* [ %0, %8 ], [ %20, %11 ]
%27 = phi double* [ %1, %8 ], [ %21, %11 ]
%28 = phi <2 x double> [ zeroinitializer, %8 ], [ %18, %11 ]
%29 = icmp eq i32 %2, 2
br i1 %29, label %57, label %30
30: ; preds = %23, %30
%31 = phi i32 [ %53, %30 ], [ %25, %23 ]
%32 = phi double* [ %51, %30 ], [ %26, %23 ]
%33 = phi double* [ %52, %30 ], [ %27, %23 ]
%34 = phi <2 x double> [ %50, %30 ], [ %28, %23 ]
%35 = load double, double* %32
%36 = load double, double* %33
%37 = fsub double %35, %36
%38 = insertelement <2 x double> poison, double %37, i64 0
%39 = insertelement <2 x double> %38, double %35, i64 1
%40 = insertelement <2 x double> %38, double %36, i64 1
%41 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %39, <2 x double> %40, <2 x double> %34)
%42 = getelementptr inbounds double, double* %32, i64 1
%43 = getelementptr inbounds double, double* %33, i64 1
%44 = load double, double* %42
%45 = load double, double* %43
%46 = fsub double %44, %45
%47 = insertelement <2 x double> poison, double %46, i64 0
%48 = insertelement <2 x double> %47, double %44, i64 1
%49 = insertelement <2 x double> %47, double %45, i64 1
%50 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %48, <2 x double> %49, <2 x double> %41)
%51 = getelementptr inbounds double, double* %32, i64 2
%52 = getelementptr inbounds double, double* %33, i64 2
%53 = add nsw i32 %31, -2
%54 = icmp eq i32 %53, 0
br i1 %54, label %55, label %30
55: ; preds = %30
%56 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %48, <2 x double> %49, <2 x double> %41)
br label %57
57: ; preds = %55, %23, %5
%58 = phi <2 x double> [ zeroinitializer, %5 ], [ %24, %23 ], [ %56, %55 ]
%59 = extractelement <2 x double> %58, i64 0
%60 = shufflevector <2 x double> %58, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%61 = fadd <2 x double> %58, %60
%62 = extractelement <2 x double> %61, i64 0
%63 = fdiv double %59, %62
%64 = tail call i32 @debug(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %63)
ret double %63
}