#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 */
double sqrt(double);
int correl(double x[], double y[], int n, double *mx, double *my, double *vxx,
           double *vxy, double *vyy, double *r) {
  int i;
  double dx, dy;
  *mx = *my = *vxx = *vxy = *vyy = 0.0;
  for (i = 0; i < n; i++) {
    dx = x[i] - *mx;
    dy = y[i] - *my;
    *vxx += dx * dx * i / (i + 1.);
    *vyy += dy * dy * i / (i + 1.);
    *vxy += dx * dy * i / (i + 1.);
    *mx += dx / (i + 1.);
    *my += dy / (i + 1.);
  }
  *vxx /= (n - 1.0);
  *vyy /= (n - 1.0);
  *vxy /= (n - 1.0);
  if (*vxx > 0.0 && *vyy > 0.0)
    *r = *vxy / sqrt(*vxx * *vyy);
  else
    *r = -9;
  return (0);
}


x86 assembly (clang, -O0):
<correl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x30(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    12af <correl+0x19f>
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
cvtsi2sdl -0x34(%rbp),%xmm1
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x34(%rbp),%xmm1
movsd  0xe27(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
movsd  -0x48(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
cvtsi2sdl -0x34(%rbp),%xmm1
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x34(%rbp),%xmm1
movsd  0xdf3(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
mov    0x18(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
movsd  -0x40(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
cvtsi2sdl -0x34(%rbp),%xmm1
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x34(%rbp),%xmm1
movsd  0xdbf(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
mov    0x10(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
movsd  -0x40(%rbp),%xmm0
cvtsi2sdl -0x34(%rbp),%xmm1
movsd  0xd99(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
movsd  -0x48(%rbp),%xmm0
cvtsi2sdl -0x34(%rbp),%xmm1
movsd  0xd73(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1179 <correl+0x69>
cvtsi2sdl -0x14(%rbp),%xmm1
movsd  0xd44(%rip),%xmm0
subsd  %xmm0,%xmm1
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
cvtsi2sdl -0x14(%rbp),%xmm1
movsd  0xd23(%rip),%xmm0
subsd  %xmm0,%xmm1
mov    0x18(%rbp),%rax
movsd  (%rax),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
cvtsi2sdl -0x14(%rbp),%xmm1
movsd  0xd02(%rip),%xmm0
subsd  %xmm0,%xmm1
mov    0x10(%rbp),%rax
movsd  (%rax),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1377 <correl+0x267>
mov    0x18(%rbp),%rax
movsd  (%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1377 <correl+0x267>
mov    0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm0
mov    0x18(%rbp),%rax
mulsd  (%rax),%xmm0
call   1030 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
divsd  %xmm1,%xmm0
mov    0x20(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    1387 <correl+0x277>
mov    0x20(%rbp),%rax
movsd  0xc85(%rip),%xmm0
movsd  %xmm0,(%rax)
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<correl>:
push   %rbx
sub    $0x10,%rsp
mov    0x28(%rsp),%r10
mov    0x20(%rsp),%r11
movq   $0x0,(%r10)
movq   $0x0,(%r11)
movq   $0x0,(%r9)
movq   $0x0,(%r8)
movq   $0x0,(%rcx)
test   %edx,%edx
jle    120b <correl+0xfb>
mov    %edx,%eax
movsd  (%r8),%xmm3
add    $0xffffffffffffffff,%rax
xorpd  %xmm2,%xmm2
xor    %ebx,%ebx
movsd  0xe9d(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  (%rdi,%rbx,8),%xmm1
subsd  %xmm2,%xmm1
movsd  (%rsi,%rbx,8),%xmm2
subsd  %xmm3,%xmm2
movapd %xmm1,%xmm3
xorps  %xmm4,%xmm4
cvtsi2sd %ebx,%xmm4
mulsd  %xmm1,%xmm3
mulsd  %xmm4,%xmm3
movapd %xmm2,%xmm5
mulsd  %xmm2,%xmm5
mulsd  %xmm4,%xmm5
movapd %xmm1,%xmm6
mulsd  %xmm2,%xmm6
mulsd  %xmm4,%xmm6
addsd  %xmm0,%xmm4
divsd  %xmm4,%xmm3
addsd  (%r9),%xmm3
movsd  %xmm3,(%r9)
divsd  %xmm4,%xmm5
addsd  (%r10),%xmm5
movsd  %xmm5,(%r10)
divsd  %xmm4,%xmm6
addsd  (%r11),%xmm6
movsd  %xmm6,(%r11)
divsd  %xmm4,%xmm1
addsd  (%rcx),%xmm1
movsd  %xmm1,(%rcx)
divsd  %xmm4,%xmm2
movapd %xmm2,%xmm3
addsd  (%r8),%xmm3
movsd  %xmm3,(%r8)
cmp    %rbx,%rax
je     120b <correl+0xfb>
movsd  (%rcx),%xmm2
add    $0x1,%rbx
jmp    1170 <correl+0x60>
mov    0x30(%rsp),%rbx
xorps  %xmm0,%xmm0
cvtsi2sd %edx,%xmm0
addsd  0xde9(%rip),%xmm0
movsd  (%r9),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%r9)
movsd  (%r10),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%r10)
movsd  (%r11),%xmm4
divsd  %xmm0,%xmm4
movsd  %xmm4,(%r11)
movsd  (%r9),%xmm0
movsd  0xdba(%rip),%xmm1
xorpd  %xmm3,%xmm3
ucomisd %xmm3,%xmm0
jbe    1298 <correl+0x188>
movsd  (%r10),%xmm2
ucomisd %xmm3,%xmm2
jbe    1298 <correl+0x188>
mulsd  %xmm2,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     127f <correl+0x16f>
sqrtsd %xmm0,%xmm0
jmp    1290 <correl+0x180>
movsd  %xmm4,0x8(%rsp)
call   1030 <sqrt@plt>
movsd  0x8(%rsp),%xmm4
divsd  %xmm0,%xmm4
movapd %xmm4,%xmm1
movsd  %xmm1,(%rbx)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @correl(double* %0, double* %1, i32 %2, double* %3, double* %4, double* %5, double* %6, double* %7, double* %8) {
%10 = alloca double*
%11 = alloca double*
%12 = alloca i32
%13 = alloca double*
%14 = alloca double*
%15 = alloca double*
%16 = alloca double*
%17 = alloca double*
%18 = alloca double*
%19 = alloca i32
%20 = alloca double
%21 = alloca double
store double* %0, double** %10
store double* %1, double** %11
store i32 %2, i32* %12
store double* %3, double** %13
store double* %4, double** %14
store double* %5, double** %15
store double* %6, double** %16
store double* %7, double** %17
store double* %8, double** %18
%22 = load double*, double** %17
store double 0.000000e+00, double* %22
%23 = load double*, double** %16
store double 0.000000e+00, double* %23
%24 = load double*, double** %15
store double 0.000000e+00, double* %24
%25 = load double*, double** %14
store double 0.000000e+00, double* %25
%26 = load double*, double** %13
store double 0.000000e+00, double* %26
store i32 0, i32* %19
br label %27
27: ; preds = %103, %9
%28 = load i32, i32* %19
%29 = load i32, i32* %12
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %106
31: ; preds = %27
%32 = load double*, double** %10
%33 = load i32, i32* %19
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds double, double* %32, i64 %34
%36 = load double, double* %35
%37 = load double*, double** %13
%38 = load double, double* %37
%39 = fsub double %36, %38
store double %39, double* %20
%40 = load double*, double** %11
%41 = load i32, i32* %19
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds double, double* %40, i64 %42
%44 = load double, double* %43
%45 = load double*, double** %14
%46 = load double, double* %45
%47 = fsub double %44, %46
store double %47, double* %21
%48 = load double, double* %20
%49 = load double, double* %20
%50 = fmul double %48, %49
%51 = load i32, i32* %19
%52 = sitofp i32 %51 to double
%53 = fmul double %50, %52
%54 = load i32, i32* %19
%55 = sitofp i32 %54 to double
%56 = fadd double %55, 1.000000e+00
%57 = fdiv double %53, %56
%58 = load double*, double** %15
%59 = load double, double* %58
%60 = fadd double %59, %57
store double %60, double* %58
%61 = load double, double* %21
%62 = load double, double* %21
%63 = fmul double %61, %62
%64 = load i32, i32* %19
%65 = sitofp i32 %64 to double
%66 = fmul double %63, %65
%67 = load i32, i32* %19
%68 = sitofp i32 %67 to double
%69 = fadd double %68, 1.000000e+00
%70 = fdiv double %66, %69
%71 = load double*, double** %17
%72 = load double, double* %71
%73 = fadd double %72, %70
store double %73, double* %71
%74 = load double, double* %20
%75 = load double, double* %21
%76 = fmul double %74, %75
%77 = load i32, i32* %19
%78 = sitofp i32 %77 to double
%79 = fmul double %76, %78
%80 = load i32, i32* %19
%81 = sitofp i32 %80 to double
%82 = fadd double %81, 1.000000e+00
%83 = fdiv double %79, %82
%84 = load double*, double** %16
%85 = load double, double* %84
%86 = fadd double %85, %83
store double %86, double* %84
%87 = load double, double* %20
%88 = load i32, i32* %19
%89 = sitofp i32 %88 to double
%90 = fadd double %89, 1.000000e+00
%91 = fdiv double %87, %90
%92 = load double*, double** %13
%93 = load double, double* %92
%94 = fadd double %93, %91
store double %94, double* %92
%95 = load double, double* %21
%96 = load i32, i32* %19
%97 = sitofp i32 %96 to double
%98 = fadd double %97, 1.000000e+00
%99 = fdiv double %95, %98
%100 = load double*, double** %14
%101 = load double, double* %100
%102 = fadd double %101, %99
store double %102, double* %100
br label %103
103: ; preds = %31
%104 = load i32, i32* %19
%105 = add nsw i32 %104, 1
store i32 %105, i32* %19
br label %27
106: ; preds = %27
%107 = load i32, i32* %12
%108 = sitofp i32 %107 to double
%109 = fsub double %108, 1.000000e+00
%110 = load double*, double** %15
%111 = load double, double* %110
%112 = fdiv double %111, %109
store double %112, double* %110
%113 = load i32, i32* %12
%114 = sitofp i32 %113 to double
%115 = fsub double %114, 1.000000e+00
%116 = load double*, double** %17
%117 = load double, double* %116
%118 = fdiv double %117, %115
store double %118, double* %116
%119 = load i32, i32* %12
%120 = sitofp i32 %119 to double
%121 = fsub double %120, 1.000000e+00
%122 = load double*, double** %16
%123 = load double, double* %122
%124 = fdiv double %123, %121
store double %124, double* %122
%125 = load double*, double** %15
%126 = load double, double* %125
%127 = fcmp ogt double %126, 0.000000e+00
br i1 %127, label %128, label %143
128: ; preds = %106
%129 = load double*, double** %17
%130 = load double, double* %129
%131 = fcmp ogt double %130, 0.000000e+00
br i1 %131, label %132, label %143
132: ; preds = %128
%133 = load double*, double** %16
%134 = load double, double* %133
%135 = load double*, double** %15
%136 = load double, double* %135
%137 = load double*, double** %17
%138 = load double, double* %137
%139 = fmul double %136, %138
%140 = call double @sqrt(double %139)
%141 = fdiv double %134, %140
%142 = load double*, double** %18
store double %141, double* %142
br label %145
143: ; preds = %128, %106
%144 = load double*, double** %18
store double -9.000000e+00, double* %144
br label %145
145: ; preds = %143, %132
ret i32 0
}

LLVM IR (-O2):
define i32 @correl(double* nocapture %0, double* nocapture %1, i32 %2, double* nocapture %3, double* nocapture %4, double* nocapture %5, double* nocapture %6, double* nocapture %7, double* nocapture writeonly %8) {
store double 0.000000e+00, double* %7
store double 0.000000e+00, double* %6
store double 0.000000e+00, double* %5
store double 0.000000e+00, double* %4
store double 0.000000e+00, double* %3
%10 = icmp sgt i32 %2, 0
br i1 %10, label %11, label %52
11: ; preds = %9
%12 = zext i32 %2 to i64
%13 = load double, double* %4
br label %14
14: ; preds = %50, %11
%15 = phi double [ %13, %11 ], [ %47, %50 ]
%16 = phi double [ 0.000000e+00, %11 ], [ %51, %50 ]
%17 = phi i64 [ 0, %11 ], [ %48, %50 ]
%18 = getelementptr inbounds double, double* %0, i64 %17
%19 = load double, double* %18
%20 = fsub double %19, %16
%21 = getelementptr inbounds double, double* %1, i64 %17
%22 = load double, double* %21
%23 = fsub double %22, %15
%24 = fmul double %20, %20
%25 = trunc i64 %17 to i32
%26 = sitofp i32 %25 to double
%27 = fmul double %24, %26
%28 = fadd double %26, 1.000000e+00
%29 = fdiv double %27, %28
%30 = load double, double* %5
%31 = fadd double %30, %29
store double %31, double* %5
%32 = fmul double %23, %23
%33 = fmul double %32, %26
%34 = fdiv double %33, %28
%35 = load double, double* %7
%36 = fadd double %35, %34
store double %36, double* %7
%37 = fmul double %20, %23
%38 = fmul double %37, %26
%39 = fdiv double %38, %28
%40 = load double, double* %6
%41 = fadd double %39, %40
store double %41, double* %6
%42 = fdiv double %20, %28
%43 = load double, double* %3
%44 = fadd double %42, %43
store double %44, double* %3
%45 = fdiv double %23, %28
%46 = load double, double* %4
%47 = fadd double %45, %46
store double %47, double* %4
%48 = add nuw nsw i64 %17, 1
%49 = icmp eq i64 %48, %12
br i1 %49, label %52, label %50
50: ; preds = %14
%51 = load double, double* %3
br label %14
52: ; preds = %14, %9
%53 = sitofp i32 %2 to double
%54 = fadd double %53, -1.000000e+00
%55 = load double, double* %5
%56 = fdiv double %55, %54
store double %56, double* %5
%57 = load double, double* %7
%58 = fdiv double %57, %54
store double %58, double* %7
%59 = load double, double* %6
%60 = fdiv double %59, %54
store double %60, double* %6
%61 = load double, double* %5
%62 = fcmp ogt double %61, 0.000000e+00
br i1 %62, label %63, label %70
63: ; preds = %52
%64 = load double, double* %7
%65 = fcmp ogt double %64, 0.000000e+00
br i1 %65, label %66, label %70
66: ; preds = %63
%67 = fmul double %61, %64
%68 = tail call double @sqrt(double %67)
%69 = fdiv double %60, %68
br label %70
70: ; preds = %52, %63, %66
%71 = phi double [ %69, %66 ], [ -9.000000e+00, %63 ], [ -9.000000e+00, %52 ]
store double %71, double* %8
ret i32 0
}