#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);
void PCorr(const double *in, double *outcorr) {
  double sum, ysum, prod;
  const double *x, *inptr;
  int k, n;
  ysum = 1e-13;
  sum = 0.0;
  x = in + 140 / 2 + 2;
  for (n = 0; n < 60; n++) {
    ysum += in[n] * in[n];
    sum += x[n] * in[n];
  }
  outcorr += (140 / 2 - 20 / 2 + 5) - 1;
  *outcorr = sum / sqrt(ysum);
  for (k = 1; k < (140 / 2 - 20 / 2 + 5); k++) {
    ysum -= in[k - 1] * in[k - 1];
    ysum += in[60 + k - 1] * in[60 + k - 1];
    sum = 0.0;
    inptr = &in[k];
    prod = x[0] * inptr[0];
    for (n = 1; n < 60; n++) {
      sum += prod;
      prod = x[n] * inptr[n];
    }
    sum += prod;
    outcorr--;
    *outcorr = sum / sqrt(ysum);
  }
}


x86 assembly (clang, -O0):
<PCorr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  0xed8(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
add    $0x230,%rax
add    $0x10,%rax
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x40(%rbp)
cmpl   $0x3c,-0x40(%rbp)
jge    11be <PCorr+0xae>
mov    -0x8(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x30(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    114e <PCorr+0x3e>
mov    -0x10(%rbp),%rax
add    $0x200,%rax
mov    %rax,-0x10(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x1,-0x3c(%rbp)
cmpl   $0x41,-0x3c(%rbp)
jge    135c <PCorr+0x24c>
mov    -0x8(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x20(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x3c(%rbp),%ecx
add    $0x3c,%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x3c(%rbp),%ecx
add    $0x3c,%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x3c(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x38(%rbp),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x1,-0x40(%rbp)
cmpl   $0x3c,-0x40(%rbp)
jge    130b <PCorr+0x1fb>
movsd  -0x28(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x30(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x40(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    12c5 <PCorr+0x1b5>
movsd  -0x28(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0xfffffffffffffff8,%rax
mov    %rax,-0x10(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11fb <PCorr+0xeb>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PCorr>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
xorpd  %xmm3,%xmm3
movhpd 0xed3(%rip),%xmm3
xor    %eax,%eax
nop
movsd  0x240(%r15,%rax,8),%xmm0
movsd  (%r15,%rax,8),%xmm1
movsd  0x8(%r15,%rax,8),%xmm2
unpcklpd %xmm1,%xmm0
unpcklpd %xmm1,%xmm1
mulpd  %xmm0,%xmm1
addpd  %xmm3,%xmm1
movsd  0x10(%r15,%rax,8),%xmm0
movsd  0x248(%r15,%rax,8),%xmm3
unpcklpd %xmm2,%xmm3
unpcklpd %xmm2,%xmm2
mulpd  %xmm3,%xmm2
addpd  %xmm1,%xmm2
movsd  0x250(%r15,%rax,8),%xmm1
unpcklpd %xmm0,%xmm1
unpcklpd %xmm0,%xmm0
mulpd  %xmm1,%xmm0
movapd %xmm0,%xmm3
addpd  %xmm2,%xmm3
add    $0x3,%rax
cmp    $0x3c,%rax
jne    1130 <PCorr+0x20>
add    $0x200,%r14
movapd %xmm3,%xmm5
unpckhpd %xmm3,%xmm5
xorpd  %xmm8,%xmm8
ucomisd %xmm8,%xmm5
jb     11c4 <PCorr+0xb4>
xorps  %xmm0,%xmm0
sqrtsd %xmm5,%xmm0
jmp    11e8 <PCorr+0xd8>
movapd %xmm5,%xmm0
movapd %xmm5,0x10(%rsp)
movapd %xmm3,(%rsp)
call   1030 <sqrt@plt>
movapd (%rsp),%xmm3
movapd 0x10(%rsp),%xmm5
xorpd  %xmm8,%xmm8
divsd  %xmm0,%xmm3
movsd  %xmm3,(%r14)
lea    0x28(%r15),%rbx
mov    $0x1,%r12d
movapd 0xe0d(%rip),%xmm6
jmp    1267 <PCorr+0x157>
cs nopw 0x0(%rax,%rax,1)
nop
movapd %xmm5,%xmm0
movapd %xmm5,0x10(%rsp)
movsd  %xmm7,(%rsp)
movsd  %xmm4,0x20(%rsp)
call   1030 <sqrt@plt>
movsd  0x20(%rsp),%xmm4
movsd  (%rsp),%xmm7
movapd 0xdd3(%rip),%xmm6
movapd 0x10(%rsp),%xmm5
xorpd  %xmm8,%xmm8
addsd  %xmm4,%xmm7
divsd  %xmm0,%xmm7
movsd  %xmm7,(%r14)
add    $0x1,%r12
add    $0x8,%rbx
cmp    $0x41,%r12
je     1333 <PCorr+0x223>
movsd  -0x8(%r15,%r12,8),%xmm1
movsd  0x1d8(%r15,%r12,8),%xmm0
movapd %xmm1,%xmm2
xorpd  %xmm6,%xmm2
movsd  0x240(%r15),%xmm3
mulsd  (%r15,%r12,8),%xmm3
xorpd  %xmm7,%xmm7
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nop
addsd  %xmm3,%xmm7
movsd  0x248(%r15,%rax,8),%xmm3
movsd  0x250(%r15,%rax,8),%xmm4
mulsd  -0x18(%rbx,%rax,8),%xmm3
addsd  %xmm7,%xmm3
mulsd  -0x10(%rbx,%rax,8),%xmm4
addsd  %xmm3,%xmm4
movsd  0x258(%r15,%rax,8),%xmm7
mulsd  -0x8(%rbx,%rax,8),%xmm7
cmp    $0x38,%rax
je     1300 <PCorr+0x1f0>
addsd  %xmm4,%xmm7
movsd  0x260(%r15,%rax,8),%xmm3
mulsd  (%rbx,%rax,8),%xmm3
add    $0x4,%rax
jmp    12a0 <PCorr+0x190>
nopl   0x0(%rax,%rax,1)
mulsd  %xmm1,%xmm2
movapd %xmm5,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm0,%xmm0
movapd %xmm0,%xmm5
addsd  %xmm1,%xmm5
add    $0xfffffffffffffff8,%r14
ucomisd %xmm8,%xmm5
jb     1210 <PCorr+0x100>
xorps  %xmm0,%xmm0
sqrtsd %xmm5,%xmm0
jmp    1248 <PCorr+0x138>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @PCorr(double* nocapture %0, double* nocapture writeonly %1) {
%3 = getelementptr inbounds double, double* %0, i64 72
br label %4
4: ; preds = %4, %2
%5 = phi i64 [ 0, %2 ], [ %36, %4 ]
%6 = phi <2 x double> [ <double 0.000000e+00, double 1.000000e-13>, %2 ], [ %35, %4 ]
%7 = getelementptr inbounds double, double* %0, i64 %5
%8 = load double, double* %7
%9 = getelementptr inbounds double, double* %3, i64 %5
%10 = load double, double* %9
%11 = insertelement <2 x double> poison, double %10, i64 0
%12 = insertelement <2 x double> %11, double %8, i64 1
%13 = insertelement <2 x double> poison, double %8, i64 0
%14 = shufflevector <2 x double> %13, <2 x double> poison, <2 x i32> zeroinitializer
%15 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %12, <2 x double> %14, <2 x double> %6)
%16 = add nuw nsw i64 %5, 1
%17 = getelementptr inbounds double, double* %0, i64 %16
%18 = load double, double* %17
%19 = getelementptr inbounds double, double* %3, i64 %16
%20 = load double, double* %19
%21 = insertelement <2 x double> poison, double %20, i64 0
%22 = insertelement <2 x double> %21, double %18, i64 1
%23 = insertelement <2 x double> poison, double %18, i64 0
%24 = shufflevector <2 x double> %23, <2 x double> poison, <2 x i32> zeroinitializer
%25 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %22, <2 x double> %24, <2 x double> %15)
%26 = add nuw nsw i64 %5, 2
%27 = getelementptr inbounds double, double* %0, i64 %26
%28 = load double, double* %27
%29 = getelementptr inbounds double, double* %3, i64 %26
%30 = load double, double* %29
%31 = insertelement <2 x double> poison, double %30, i64 0
%32 = insertelement <2 x double> %31, double %28, i64 1
%33 = insertelement <2 x double> poison, double %28, i64 0
%34 = shufflevector <2 x double> %33, <2 x double> poison, <2 x i32> zeroinitializer
%35 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %32, <2 x double> %34, <2 x double> %25)
%36 = add nuw nsw i64 %5, 3
%37 = icmp eq i64 %36, 60
br i1 %37, label %38, label %4
38: ; preds = %4
%39 = getelementptr inbounds double, double* %1, i64 64
%40 = extractelement <2 x double> %35, i64 1
%41 = tail call double @sqrt(double %40)
%42 = extractelement <2 x double> %35, i64 0
%43 = fdiv double %42, %41
store double %43, double* %39
br label %44
44: ; preds = %38, %93
%45 = phi i64 [ 1, %38 ], [ %100, %93 ]
%46 = phi double* [ %39, %38 ], [ %97, %93 ]
%47 = phi double [ %40, %38 ], [ %95, %93 ]
%48 = add nsw i64 %45, -1
%49 = getelementptr inbounds double, double* %0, i64 %48
%50 = load double, double* %49
%51 = fneg double %50
%52 = add nuw nsw i64 %45, 59
%53 = getelementptr inbounds double, double* %0, i64 %52
%54 = load double, double* %53
%55 = getelementptr inbounds double, double* %0, i64 %45
%56 = load double, double* %3
%57 = load double, double* %55
%58 = fmul double %56, %57
br label %59
59: ; preds = %85, %44
%60 = phi i64 [ 1, %44 ], [ %92, %85 ]
%61 = phi double [ 0.000000e+00, %44 ], [ %86, %85 ]
%62 = phi double [ %58, %44 ], [ %91, %85 ]
%63 = fadd double %62, %61
%64 = getelementptr inbounds double, double* %3, i64 %60
%65 = load double, double* %64
%66 = getelementptr inbounds double, double* %55, i64 %60
%67 = load double, double* %66
%68 = fmul double %65, %67
%69 = add nuw nsw i64 %60, 1
%70 = fadd double %68, %63
%71 = getelementptr inbounds double, double* %3, i64 %69
%72 = load double, double* %71
%73 = getelementptr inbounds double, double* %55, i64 %69
%74 = load double, double* %73
%75 = fmul double %72, %74
%76 = add nuw nsw i64 %60, 2
%77 = fadd double %75, %70
%78 = getelementptr inbounds double, double* %3, i64 %76
%79 = load double, double* %78
%80 = getelementptr inbounds double, double* %55, i64 %76
%81 = load double, double* %80
%82 = fmul double %79, %81
%83 = add nuw nsw i64 %60, 3
%84 = icmp eq i64 %83, 60
br i1 %84, label %93, label %85
85: ; preds = %59
%86 = fadd double %82, %77
%87 = getelementptr inbounds double, double* %3, i64 %83
%88 = load double, double* %87
%89 = getelementptr inbounds double, double* %55, i64 %83
%90 = load double, double* %89
%91 = fmul double %88, %90
%92 = add nuw nsw i64 %60, 4
br label %59
93: ; preds = %59
%94 = tail call double @llvm.fmuladd.f64(double %51, double %50, double %47)
%95 = tail call double @llvm.fmuladd.f64(double %54, double %54, double %94)
%96 = fadd double %82, %77
%97 = getelementptr inbounds double, double* %46, i64 -1
%98 = tail call double @sqrt(double %95)
%99 = fdiv double %96, %98
store double %99, double* %97
%100 = add nuw nsw i64 %45, 1
%101 = icmp eq i64 %100, 65
br i1 %101, label %102, label %44
102: ; preds = %93
ret void
}