#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 */
typedef int uint64_t;
typedef double uint32_t;

/* Variables and functions */
scalar_t__ calloc(int, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(double *);
scalar_t__ malloc(int);
int /*<<< orphan*/ memcpy(double *, double *, int);
int sqrt(int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ topCorrelations(double *, double *, int, double *, double *,
                                   int);
void correlation(double **data, uint64_t sizeTimeseries, uint64_t numTimeseries,
                 uint64_t numTimesteps, uint64_t windowSize,
                 double *correlations, uint32_t *indices) {
  if (numTimeseries > (6000)) {
    fprintf(
        stderr,
        "Number of Time series should be less or equal to %d. Terminating!\n",
        (6000));
    fflush(stderr);
    exit(-1);
  }
  if (windowSize < 2) {
    fprintf(stderr,
            "Window size must be equal or greater than 2. Terminating!\n");
    fflush(stderr);
    exit(-1);
  }
  if (numTimesteps > sizeTimeseries) {
    fprintf(stderr, "Number of Time steps should be less or equal to size of "
                    "Time series. Terminating!\n");
    fflush(stderr);
    exit(-1);
  }
  uint64_t numCorrelations = (numTimeseries * (numTimeseries - 1)) / 2;
  double *sums = (double *)calloc(numTimeseries, sizeof(double));
  double *sums_sq = (double *)calloc(numTimeseries, sizeof(double));
  double *sums_xy = (double *)calloc(numCorrelations, sizeof(double));
  double *correlations_step = (double *)calloc(numCorrelations, sizeof(double));
  uint32_t *indices_step =
      (uint32_t *)calloc(2 * numCorrelations, sizeof(uint32_t));
  double *correlations_top = (double *)malloc((10) * sizeof(double));
  uint32_t *indices_top = (uint32_t *)malloc(2 * (10) * sizeof(uint32_t));
  uint64_t index_correlation;
  for (uint64_t s = 0; s < numTimesteps; s++) {
    index_correlation = 0;
    for (uint64_t i = 0; i < numTimeseries; i++) {
      double old = s >= windowSize ? data[i][s - windowSize] : 0;
      double new = data[i][s];
      sums[i] += new - old;
      sums_sq[i] += new *new - old *old;
    }
    for (uint64_t i = 0; i < numTimeseries; i++) {
      double old_x = s >= windowSize ? data[i][s - windowSize] : 0;
      double new_x = data[i][s];
      for (uint64_t j = i + 1; j < numTimeseries; j++) {
        double old_y = s >= windowSize ? data[j][s - windowSize] : 0;
        double new_y = data[j][s];
        sums_xy[index_correlation] += new_x * new_y - old_x * old_y;
        correlations_step[index_correlation] =
            (windowSize * sums_xy[index_correlation] - sums[i] * sums[j]) /
            (sqrt(windowSize * sums_sq[i] - sums[i] * sums[i]) *
             sqrt(windowSize * sums_sq[j] - sums[j] * sums[j]));
        indices_step[2 * index_correlation] = j;
        indices_step[2 * index_correlation + 1] = i;
        index_correlation++;
      }
    }
    topCorrelations(correlations_step, indices_step, numCorrelations,
                    correlations_top, indices_top, (10));
    memcpy(&correlations[s * (10)], correlations_top, (10) * sizeof(double));
    memcpy(&indices[2 * s * (10)], indices_top, 2 * (10) * sizeof(uint32_t));
  }
  free(sums);
  free(sums_sq);
  free(sums_xy);
  free(correlations_step);
  free(indices_step);
  free(correlations_top);
  free(indices_top);
}


x86 assembly (clang, -O0):
<correlation>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
cmpl   $0x1770,-0x10(%rbp)
jle    11f5 <correlation+0x65>
mov    0x2e18(%rip),%rax
mov    (%rax),%edi
lea    0xe2f(%rip),%rsi
mov    $0x1770,%edx
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2dfc(%rip),%rax
mov    (%rax),%edi
call   1090 <fflush@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
cmpl   $0x2,-0x18(%rbp)
jge    122e <correlation+0x9e>
mov    0x2dda(%rip),%rax
mov    (%rax),%edi
lea    0xe34(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2dc3(%rip),%rax
mov    (%rax),%edi
call   1090 <fflush@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1269 <correlation+0xd9>
mov    0x2d9f(%rip),%rax
mov    (%rax),%edi
lea    0xe34(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2d88(%rip),%rax
mov    (%rax),%edi
call   1090 <fflush@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
imul   %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x24(%rbp),%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,-0x40(%rbp)
mov    -0x24(%rbp),%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,-0x48(%rbp)
mov    -0x24(%rbp),%edi
shl    $0x1,%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,-0x50(%rbp)
mov    $0x50,%edi
call   1080 <malloc@plt>
mov    %rax,-0x58(%rbp)
mov    $0xa0,%edi
call   1080 <malloc@plt>
mov    %rax,-0x60(%rbp)
movl   $0x0,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    178b <correlation+0x5fb>
movl   $0x0,-0x64(%rbp)
movl   $0x0,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    13fa <correlation+0x26a>
mov    -0x68(%rbp),%eax
cmp    -0x18(%rbp),%eax
jl     1354 <correlation+0x1c4>
mov    -0x8(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x68(%rbp),%ecx
sub    -0x18(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
jmp    1364 <correlation+0x1d4>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
jmp    1364 <correlation+0x1d4>
movsd  -0xb8(%rbp),%xmm0
ff
movsd  %xmm0,-0x78(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x68(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm0
subsd  -0x78(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x6c(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x80(%rbp),%xmm0
movsd  -0x80(%rbp),%xmm2
movsd  -0x78(%rbp),%xmm1
mulsd  -0x78(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x38(%rbp),%rax
movslq -0x6c(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    1315 <correlation+0x185>
movl   $0x0,-0x84(%rbp)
mov    -0x84(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    171c <correlation+0x58c>
mov    -0x68(%rbp),%eax
cmp    -0x18(%rbp),%eax
jl     1449 <correlation+0x2b9>
mov    -0x8(%rbp),%rax
movslq -0x84(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x68(%rbp),%ecx
sub    -0x18(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
jmp    1459 <correlation+0x2c9>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
jmp    1459 <correlation+0x2c9>
movsd  -0xc0(%rbp),%xmm0
ff
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x8(%rbp),%rax
movslq -0x84(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x68(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c(%rbp)
mov    -0x9c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1703 <correlation+0x573>
mov    -0x68(%rbp),%eax
cmp    -0x18(%rbp),%eax
jl     14dd <correlation+0x34d>
mov    -0x8(%rbp),%rax
movslq -0x9c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x68(%rbp),%ecx
sub    -0x18(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
jmp    14ed <correlation+0x35d>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
jmp    14ed <correlation+0x35d>
movsd  -0xc8(%rbp),%xmm0
ff
movsd  %xmm0,-0xa8(%rbp)
ff
mov    -0x8(%rbp),%rax
movslq -0x9c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x68(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
movsd  -0xb0(%rbp),%xmm2
ff
movsd  -0x90(%rbp),%xmm1
ff
mulsd  -0xa8(%rbp),%xmm1
ff
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
movslq -0x64(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
cvtsi2sdl -0x18(%rbp),%xmm0
mov    -0x40(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x30(%rbp),%rax
movslq -0x84(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x30(%rbp),%rax
movslq -0x9c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
cvtsi2sdl -0x18(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x84(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x30(%rbp),%rax
movslq -0x84(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x30(%rbp),%rax
movslq -0x84(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   10a0 <sqrt@plt>
mov    %eax,-0xcc(%rbp)
cvtsi2sdl -0x18(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x9c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x30(%rbp),%rax
movslq -0x9c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x30(%rbp),%rax
movslq -0x9c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   10a0 <sqrt@plt>
movsd  -0xd8(%rbp),%xmm0
ff
mov    %eax,%ecx
mov    -0xcc(%rbp),%eax
imul   %ecx,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
mov    -0x48(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
cvtsi2sdl -0x9c(%rbp),%xmm0
ff
mov    -0x50(%rbp),%rax
mov    -0x64(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
cvtsi2sdl -0x84(%rbp),%xmm0
ff
mov    -0x50(%rbp),%rax
mov    -0x64(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
mov    -0x9c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c(%rbp)
jmp    1498 <correlation+0x308>
jmp    1708 <correlation+0x578>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1404 <correlation+0x274>
mov    -0x48(%rbp),%rdi
mov    -0x50(%rbp),%rsi
mov    -0x24(%rbp),%edx
mov    -0x58(%rbp),%rcx
mov    -0x60(%rbp),%r8
mov    $0xa,%r9d
call   1040 <topCorrelations@plt>
mov    -0x20(%rbp),%rdi
imul   $0xa,-0x68(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x58(%rbp),%rsi
mov    $0x50,%edx
call   1070 <memcpy@plt>
mov    0x10(%rbp),%rdi
mov    -0x68(%rbp),%eax
shl    $0x1,%eax
imul   $0xa,%eax,%eax
cltq
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x60(%rbp),%rsi
mov    $0xa0,%edx
call   1070 <memcpy@plt>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    12fb <correlation+0x16b>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
mov    -0x60(%rbp),%rdi
call   1030 <free@plt>
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<correlation>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x118,%rsp
mov    %r9,0xc0(%rsp)
mov    %rdx,(%rsp)
cmp    $0x1771,%edx
jge    16f4 <correlation+0x564>
mov    %r8d,%r13d
cmp    $0x1,%r8d
jle    1712 <correlation+0x582>
mov    %ecx,%r12d
cmp    %esi,%ecx
jg     1724 <correlation+0x594>
mov    %rdi,%r14
mov    0x150(%rsp),%rax
mov    %rax,0xb8(%rsp)
mov    (%rsp),%rbx
lea    -0x1(%rbx),%eax
imul   %ebx,%eax
mov    %eax,%r15d
shr    $0x1f,%r15d
add    %eax,%r15d
mov    %r15d,%ebp
sar    %ebp
mov    %ebx,%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,0x18(%rsp)
mov    %ebx,%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,0x10(%rsp)
mov    %ebp,%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,0x58(%rsp)
mov    %ebp,0x40(%rsp)
mov    %ebp,%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,0x28(%rsp)
and    $0xfffffffe,%r15d
mov    %r15d,%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,0x30(%rsp)
mov    $0x50,%edi
call   1080 <malloc@plt>
mov    %rax,0x50(%rsp)
mov    $0xa0,%edi
call   1080 <malloc@plt>
mov    %rax,0x48(%rsp)
test   %r12d,%r12d
jle    169d <correlation+0x50d>
cvtsi2sd %r13d,%xmm0
movsd  %xmm0,0x78(%rsp)
mov    (%rsp),%rax
movslq %eax,%r15
mov    %r13d,%ecx
mov    %rcx,0x20(%rsp)
mov    %r12d,%ecx
mov    %rcx,0xb0(%rsp)
mov    %eax,%r12d
lea    0x8(%r14),%rax
mov    %rax,0xa8(%rsp)
mov    0x10(%rsp),%rax
add    $0x8,%rax
mov    %rax,0xa0(%rsp)
mov    0x18(%rsp),%rax
add    $0x8,%rax
mov    %rax,0x98(%rsp)
mov    %r12,%rax
neg    %rax
mov    %rax,0xc8(%rsp)
xor    %esi,%esi
mov    %r14,0xe0(%rsp)
mov    %r15,0xd8(%rsp)
mov    %r12,0xd0(%rsp)
jmp    139b <correlation+0x20b>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x28(%rsp),%rdi
mov    0x30(%rsp),%rsi
mov    0x40(%rsp),%edx
mov    0x50(%rsp),%rbx
mov    %rbx,%rcx
mov    0x48(%rsp),%rbp
mov    %rbp,%r8
mov    $0xa,%r9d
call   1040 <topCorrelations@plt>
mov    0x8(%rsp),%rax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
mov    0xc0(%rsp),%rcx
lea    (%rcx,%rax,8),%rdi
mov    %rbx,%rsi
mov    $0x50,%edx
call   1070 <memcpy@plt>
mov    0x8(%rsp),%rax
lea    0x0(,%rax,4),%eax
lea    (%rax,%rax,4),%eax
mov    0xb8(%rsp),%rcx
lea    (%rcx,%rax,8),%rdi
mov    %rbp,%rsi
mov    $0xa0,%edx
call   1070 <memcpy@plt>
mov    0x8(%rsp),%rsi
add    $0x1,%rsi
cmp    0xb0(%rsp),%rsi
je     169d <correlation+0x50d>
cmpl   $0x0,(%rsp)
mov    %rsi,0x8(%rsp)
jle    1310 <correlation+0x180>
mov    %rsi,%rax
sub    0x20(%rsp),%rax
xor    %ecx,%ecx
jmp    1400 <correlation+0x270>
cs nopw 0x0(%rax,%rax,1)
movsd  (%rdx,%rsi,8),%xmm1
movapd %xmm1,%xmm2
subsd  %xmm0,%xmm2
mov    0x18(%rsp),%rdx
addsd  (%rdx,%rcx,8),%xmm2
movsd  %xmm2,(%rdx,%rcx,8)
mulsd  %xmm0,%xmm0
mulsd  %xmm1,%xmm1
subsd  %xmm0,%xmm1
mov    0x10(%rsp),%rdx
addsd  (%rdx,%rcx,8),%xmm1
movsd  %xmm1,(%rdx,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%r12
je     1420 <correlation+0x290>
mov    %rsi,%rdi
mov    (%r14,%rcx,8),%rdx
xorpd  %xmm0,%xmm0
sub    0x20(%rsp),%rdi
mov    %rdi,0x60(%rsp)
jb     13c0 <correlation+0x230>
movsd  (%rdx,%rax,8),%xmm0
jmp    13c0 <correlation+0x230>
xchg   %ax,%ax
cmpl   $0x0,(%rsp)
jle    1310 <correlation+0x180>
xor    %ecx,%ecx
mov    $0x1,%eax
mov    %rax,0x38(%rsp)
mov    0x98(%rsp),%rbp
mov    0xa0(%rsp),%rax
mov    %rax,0x70(%rsp)
mov    0xa8(%rsp),%rax
mov    %rax,0x68(%rsp)
xor    %edx,%edx
jmp    14a6 <correlation+0x316>
nopl   0x0(%rax)
mov    0x44(%rsp),%edx
add    %r15d,%edx
mov    0xe0(%rsp),%r14
mov    0xd8(%rsp),%r15
mov    0xd0(%rsp),%r12
mov    0xe8(%rsp),%rcx
addq   $0x1,0x38(%rsp)
addq   $0x8,0x68(%rsp)
addq   $0x8,0x70(%rsp)
add    $0x8,%rbp
cmp    %r12,%rcx
je     1310 <correlation+0x180>
mov    %rcx,%rbx
mov    (%r14,%rcx,8),%rax
xorpd  %xmm0,%xmm0
movapd %xmm0,0x80(%rsp)
cmp    0x20(%rsp),%rsi
jb     14d4 <correlation+0x344>
mov    0x60(%rsp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movapd %xmm0,0x80(%rsp)
lea    0x1(%rbx),%rcx
cmp    %r15,%rcx
jge    1487 <correlation+0x2f7>
mov    %rcx,0xe8(%rsp)
movsd  (%rax,%rsi,8),%xmm0
movsd  %xmm0,0x108(%rsp)
movaps 0x80(%rsp),%xmm0
xorps  0xafe(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
movsd  %xmm0,0x100(%rsp)
mov    %edx,0x44(%rsp)
movslq %edx,%r12
mov    0xc8(%rsp),%rax
mov    0x38(%rsp),%rcx
add    %rcx,%rax
mov    %rax,0xf8(%rsp)
mov    0x58(%rsp),%rax
lea    (%rax,%r12,8),%r13
mov    0x28(%rsp),%rax
lea    (%rax,%r12,8),%rax
mov    %rax,0xf0(%rsp)
add    %r12d,%r12d
xor    %r15d,%r15d
jmp    1676 <correlation+0x4e6>
xchg   %ax,%ax
mulsd  0x80(%rsp),%xmm0
movsd  (%rax,%rsi,8),%xmm2
mulsd  0x108(%rsp),%xmm2
addsd  %xmm0,%xmm2
addsd  0x0(%r13,%r15,8),%xmm2
movsd  %xmm2,0x0(%r13,%r15,8)
mov    0x18(%rsp),%rax
movsd  (%rax,%rbx,8),%xmm0
movsd  0x0(%rbp,%r15,8),%xmm1
mulsd  %xmm0,%xmm1
movsd  0x78(%rsp),%xmm3
mulsd  %xmm3,%xmm2
subsd  %xmm1,%xmm2
movsd  %xmm2,0x110(%rsp)
mulsd  %xmm0,%xmm0
mov    0x10(%rsp),%rax
movsd  (%rax,%rbx,8),%xmm1
mulsd  %xmm3,%xmm1
subsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
call   10a0 <sqrt@plt>
mov    %eax,%r14d
movsd  0x0(%rbp,%r15,8),%xmm0
mulsd  %xmm0,%xmm0
mov    0x70(%rsp),%rax
movsd  (%rax,%r15,8),%xmm1
mulsd  0x78(%rsp),%xmm1
subsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
call   10a0 <sqrt@plt>
mov    0x8(%rsp),%rsi
imul   %r14d,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x110(%rsp),%xmm1
divsd  %xmm0,%xmm1
mov    0xf0(%rsp),%rax
movsd  %xmm1,(%rax,%r15,8)
mov    0x38(%rsp),%rax
add    %r15d,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movslq %r12d,%r12
mov    0x30(%rsp),%rcx
movsd  %xmm0,(%rcx,%r12,8)
lea    0x1(%r12),%eax
cltq
movsd  0x100(%rsp),%xmm0
movsd  %xmm0,(%rcx,%rax,8)
add    $0x1,%r15
add    $0x2,%r12d
mov    0xf8(%rsp),%rax
add    %r15,%rax
je     1460 <correlation+0x2d0>
mov    0x68(%rsp),%rax
mov    (%rax,%r15,8),%rax
xorpd  %xmm0,%xmm0
cmp    0x20(%rsp),%rsi
jb     1560 <correlation+0x3d0>
mov    0x60(%rsp),%rcx
movsd  (%rax,%rcx,8),%xmm0
jmp    1560 <correlation+0x3d0>
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
mov    0x58(%rsp),%rdi
call   1030 <free@plt>
mov    0x28(%rsp),%rdi
call   1030 <free@plt>
mov    0x30(%rsp),%rdi
call   1030 <free@plt>
mov    0x50(%rsp),%rdi
call   1030 <free@plt>
mov    0x48(%rsp),%rdi
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>
mov    0x28e5(%rip),%rbx
mov    (%rbx),%edi
lea    0x90c(%rip),%rsi
mov    $0x1770,%edx
xor    %eax,%eax
call   1060 <fprintf@plt>
jmp    173b <correlation+0x5ab>
mov    0x28c7(%rip),%rbx
mov    (%rbx),%edi
lea    0x931(%rip),%rsi
jmp    1734 <correlation+0x5a4>
mov    0x28b5(%rip),%rbx
mov    (%rbx),%edi
lea    0x95a(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%rbx),%edi
call   1090 <fflush@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [67 x i8] c"Number of Time series should be less or equal to %d. Terminating!\0A\00"
@.str.1 = [59 x i8] c"Window size must be equal or greater than 2. Terminating!\0A\00"
@.str.2 = [83 x i8] c"Number of Time steps should be less or equal to size of Time series. Terminating!\0A\00"
define void @correlation(double** %0, i32 %1, i32 %2, i32 %3, i32 %4, double* %5, double* %6) {
%8 = alloca double**
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca double*
%14 = alloca double*
%15 = alloca i32
%16 = alloca double*
%17 = alloca double*
%18 = alloca double*
%19 = alloca double*
%20 = alloca double*
%21 = alloca double*
%22 = alloca double*
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca double
%27 = alloca double
%28 = alloca i32
%29 = alloca double
%30 = alloca double
%31 = alloca i32
%32 = alloca double
%33 = alloca double
store double** %0, double*** %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store double* %5, double** %13
store double* %6, double** %14
%34 = load i32, i32* %10
%35 = icmp sgt i32 %34, 6000
br i1 %35, label %36, label %42
36: ; preds = %7
%37 = load i32, i32* @stderr
%38 = call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0), i32 6000)
%39 = load i32, i32* @stderr
%40 = call i32 @fflush(i32 %39)
%41 = call i32 @exit(i32 -1)
unreachable
42: ; preds = %7
%43 = load i32, i32* %12
%44 = icmp slt i32 %43, 2
br i1 %44, label %45, label %51
45: ; preds = %42
%46 = load i32, i32* @stderr
%47 = call i32 (i32, i8*, ...) @fprintf(i32 %46, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.1, i64 0, i64 0))
%48 = load i32, i32* @stderr
%49 = call i32 @fflush(i32 %48)
%50 = call i32 @exit(i32 -1)
unreachable
51: ; preds = %42
%52 = load i32, i32* %11
%53 = load i32, i32* %9
%54 = icmp sgt i32 %52, %53
br i1 %54, label %55, label %61
55: ; preds = %51
%56 = load i32, i32* @stderr
%57 = call i32 (i32, i8*, ...) @fprintf(i32 %56, i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str.2, i64 0, i64 0))
%58 = load i32, i32* @stderr
%59 = call i32 @fflush(i32 %58)
%60 = call i32 @exit(i32 -1)
unreachable
61: ; preds = %51
%62 = load i32, i32* %10
%63 = load i32, i32* %10
%64 = sub nsw i32 %63, 1
%65 = mul nsw i32 %62, %64
%66 = sdiv i32 %65, 2
store i32 %66, i32* %15
%67 = load i32, i32* %10
%68 = call i64 @calloc(i32 %67, i32 8)
%69 = inttoptr i64 %68 to double*
store double* %69, double** %16
%70 = load i32, i32* %10
%71 = call i64 @calloc(i32 %70, i32 8)
%72 = inttoptr i64 %71 to double*
store double* %72, double** %17
%73 = load i32, i32* %15
%74 = call i64 @calloc(i32 %73, i32 8)
%75 = inttoptr i64 %74 to double*
store double* %75, double** %18
%76 = load i32, i32* %15
%77 = call i64 @calloc(i32 %76, i32 8)
%78 = inttoptr i64 %77 to double*
store double* %78, double** %19
%79 = load i32, i32* %15
%80 = mul nsw i32 2, %79
%81 = call i64 @calloc(i32 %80, i32 8)
%82 = inttoptr i64 %81 to double*
store double* %82, double** %20
%83 = call i64 @malloc(i32 80)
%84 = inttoptr i64 %83 to double*
store double* %84, double** %21
%85 = call i64 @malloc(i32 160)
%86 = inttoptr i64 %85 to double*
store double* %86, double** %22
store i32 0, i32* %24
br label %87
87: ; preds = %346, %61
%88 = load i32, i32* %24
%89 = load i32, i32* %11
%90 = icmp slt i32 %88, %89
br i1 %90, label %91, label %349
91: ; preds = %87
store i32 0, i32* %23
store i32 0, i32* %25
br label %92
92: ; preds = %146, %91
%93 = load i32, i32* %25
%94 = load i32, i32* %10
%95 = icmp slt i32 %93, %94
br i1 %95, label %96, label %149
96: ; preds = %92
%97 = load i32, i32* %24
%98 = load i32, i32* %12
%99 = icmp sge i32 %97, %98
br i1 %99, label %100, label %112
100: ; preds = %96
%101 = load double**, double*** %8
%102 = load i32, i32* %25
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds double*, double** %101, i64 %103
%105 = load double*, double** %104
%106 = load i32, i32* %24
%107 = load i32, i32* %12
%108 = sub nsw i32 %106, %107
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds double, double* %105, i64 %109
%111 = load double, double* %110
br label %113
112: ; preds = %96
br label %113
113: ; preds = %112, %100
%114 = phi double [ %111, %100 ], [ 0.000000e+00, %112 ]
store double %114, double* %26
%115 = load double**, double*** %8
%116 = load i32, i32* %25
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds double*, double** %115, i64 %117
%119 = load double*, double** %118
%120 = load i32, i32* %24
%121 = sext i32 %120 to i64
%122 = getelementptr inbounds double, double* %119, i64 %121
%123 = load double, double* %122
store double %123, double* %27
%124 = load double, double* %27
%125 = load double, double* %26
%126 = fsub double %124, %125
%127 = load double*, double** %16
%128 = load i32, i32* %25
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds double, double* %127, i64 %129
%131 = load double, double* %130
%132 = fadd double %131, %126
store double %132, double* %130
%133 = load double, double* %27
%134 = load double, double* %27
%135 = load double, double* %26
%136 = load double, double* %26
%137 = fmul double %135, %136
%138 = fneg double %137
%139 = call double @llvm.fmuladd.f64(double %133, double %134, double %138)
%140 = load double*, double** %17
%141 = load i32, i32* %25
%142 = sext i32 %141 to i64
%143 = getelementptr inbounds double, double* %140, i64 %142
%144 = load double, double* %143
%145 = fadd double %144, %139
store double %145, double* %143
br label %146
146: ; preds = %113
%147 = load i32, i32* %25
%148 = add nsw i32 %147, 1
store i32 %148, i32* %25
br label %92
149: ; preds = %92
store i32 0, i32* %28
br label %150
150: ; preds = %321, %149
%151 = load i32, i32* %28
%152 = load i32, i32* %10
%153 = icmp slt i32 %151, %152
br i1 %153, label %154, label %324
154: ; preds = %150
%155 = load i32, i32* %24
%156 = load i32, i32* %12
%157 = icmp sge i32 %155, %156
br i1 %157, label %158, label %170
158: ; preds = %154
%159 = load double**, double*** %8
%160 = load i32, i32* %28
%161 = sext i32 %160 to i64
%162 = getelementptr inbounds double*, double** %159, i64 %161
%163 = load double*, double** %162
%164 = load i32, i32* %24
%165 = load i32, i32* %12
%166 = sub nsw i32 %164, %165
%167 = sext i32 %166 to i64
%168 = getelementptr inbounds double, double* %163, i64 %167
%169 = load double, double* %168
br label %171
170: ; preds = %154
br label %171
171: ; preds = %170, %158
%172 = phi double [ %169, %158 ], [ 0.000000e+00, %170 ]
store double %172, double* %29
%173 = load double**, double*** %8
%174 = load i32, i32* %28
%175 = sext i32 %174 to i64
%176 = getelementptr inbounds double*, double** %173, i64 %175
%177 = load double*, double** %176
%178 = load i32, i32* %24
%179 = sext i32 %178 to i64
%180 = getelementptr inbounds double, double* %177, i64 %179
%181 = load double, double* %180
store double %181, double* %30
%182 = load i32, i32* %28
%183 = add nsw i32 %182, 1
store i32 %183, i32* %31
br label %184
184: ; preds = %317, %171
%185 = load i32, i32* %31
%186 = load i32, i32* %10
%187 = icmp slt i32 %185, %186
br i1 %187, label %188, label %320
188: ; preds = %184
%189 = load i32, i32* %24
%190 = load i32, i32* %12
%191 = icmp sge i32 %189, %190
br i1 %191, label %192, label %204
192: ; preds = %188
%193 = load double**, double*** %8
%194 = load i32, i32* %31
%195 = sext i32 %194 to i64
%196 = getelementptr inbounds double*, double** %193, i64 %195
%197 = load double*, double** %196
%198 = load i32, i32* %24
%199 = load i32, i32* %12
%200 = sub nsw i32 %198, %199
%201 = sext i32 %200 to i64
%202 = getelementptr inbounds double, double* %197, i64 %201
%203 = load double, double* %202
br label %205
204: ; preds = %188
br label %205
205: ; preds = %204, %192
%206 = phi double [ %203, %192 ], [ 0.000000e+00, %204 ]
store double %206, double* %32
%207 = load double**, double*** %8
%208 = load i32, i32* %31
%209 = sext i32 %208 to i64
%210 = getelementptr inbounds double*, double** %207, i64 %209
%211 = load double*, double** %210
%212 = load i32, i32* %24
%213 = sext i32 %212 to i64
%214 = getelementptr inbounds double, double* %211, i64 %213
%215 = load double, double* %214
store double %215, double* %33
%216 = load double, double* %30
%217 = load double, double* %33
%218 = load double, double* %29
%219 = load double, double* %32
%220 = fmul double %218, %219
%221 = fneg double %220
%222 = call double @llvm.fmuladd.f64(double %216, double %217, double %221)
%223 = load double*, double** %18
%224 = load i32, i32* %23
%225 = sext i32 %224 to i64
%226 = getelementptr inbounds double, double* %223, i64 %225
%227 = load double, double* %226
%228 = fadd double %227, %222
store double %228, double* %226
%229 = load i32, i32* %12
%230 = sitofp i32 %229 to double
%231 = load double*, double** %18
%232 = load i32, i32* %23
%233 = sext i32 %232 to i64
%234 = getelementptr inbounds double, double* %231, i64 %233
%235 = load double, double* %234
%236 = load double*, double** %16
%237 = load i32, i32* %28
%238 = sext i32 %237 to i64
%239 = getelementptr inbounds double, double* %236, i64 %238
%240 = load double, double* %239
%241 = load double*, double** %16
%242 = load i32, i32* %31
%243 = sext i32 %242 to i64
%244 = getelementptr inbounds double, double* %241, i64 %243
%245 = load double, double* %244
%246 = fmul double %240, %245
%247 = fneg double %246
%248 = call double @llvm.fmuladd.f64(double %230, double %235, double %247)
%249 = load i32, i32* %12
%250 = sitofp i32 %249 to double
%251 = load double*, double** %17
%252 = load i32, i32* %28
%253 = sext i32 %252 to i64
%254 = getelementptr inbounds double, double* %251, i64 %253
%255 = load double, double* %254
%256 = load double*, double** %16
%257 = load i32, i32* %28
%258 = sext i32 %257 to i64
%259 = getelementptr inbounds double, double* %256, i64 %258
%260 = load double, double* %259
%261 = load double*, double** %16
%262 = load i32, i32* %28
%263 = sext i32 %262 to i64
%264 = getelementptr inbounds double, double* %261, i64 %263
%265 = load double, double* %264
%266 = fmul double %260, %265
%267 = fneg double %266
%268 = call double @llvm.fmuladd.f64(double %250, double %255, double %267)
%269 = fptosi double %268 to i32
%270 = call i32 @sqrt(i32 %269)
%271 = load i32, i32* %12
%272 = sitofp i32 %271 to double
%273 = load double*, double** %17
%274 = load i32, i32* %31
%275 = sext i32 %274 to i64
%276 = getelementptr inbounds double, double* %273, i64 %275
%277 = load double, double* %276
%278 = load double*, double** %16
%279 = load i32, i32* %31
%280 = sext i32 %279 to i64
%281 = getelementptr inbounds double, double* %278, i64 %280
%282 = load double, double* %281
%283 = load double*, double** %16
%284 = load i32, i32* %31
%285 = sext i32 %284 to i64
%286 = getelementptr inbounds double, double* %283, i64 %285
%287 = load double, double* %286
%288 = fmul double %282, %287
%289 = fneg double %288
%290 = call double @llvm.fmuladd.f64(double %272, double %277, double %289)
%291 = fptosi double %290 to i32
%292 = call i32 @sqrt(i32 %291)
%293 = mul nsw i32 %270, %292
%294 = sitofp i32 %293 to double
%295 = fdiv double %248, %294
%296 = load double*, double** %19
%297 = load i32, i32* %23
%298 = sext i32 %297 to i64
%299 = getelementptr inbounds double, double* %296, i64 %298
store double %295, double* %299
%300 = load i32, i32* %31
%301 = sitofp i32 %300 to double
%302 = load double*, double** %20
%303 = load i32, i32* %23
%304 = mul nsw i32 2, %303
%305 = sext i32 %304 to i64
%306 = getelementptr inbounds double, double* %302, i64 %305
store double %301, double* %306
%307 = load i32, i32* %28
%308 = sitofp i32 %307 to double
%309 = load double*, double** %20
%310 = load i32, i32* %23
%311 = mul nsw i32 2, %310
%312 = add nsw i32 %311, 1
%313 = sext i32 %312 to i64
%314 = getelementptr inbounds double, double* %309, i64 %313
store double %308, double* %314
%315 = load i32, i32* %23
%316 = add nsw i32 %315, 1
store i32 %316, i32* %23
br label %317
317: ; preds = %205
%318 = load i32, i32* %31
%319 = add nsw i32 %318, 1
store i32 %319, i32* %31
br label %184
320: ; preds = %184
br label %321
321: ; preds = %320
%322 = load i32, i32* %28
%323 = add nsw i32 %322, 1
store i32 %323, i32* %28
br label %150
324: ; preds = %150
%325 = load double*, double** %19
%326 = load double*, double** %20
%327 = load i32, i32* %15
%328 = load double*, double** %21
%329 = load double*, double** %22
%330 = call i32 @topCorrelations(double* %325, double* %326, i32 %327, double* %328, double* %329, i32 10)
%331 = load double*, double** %13
%332 = load i32, i32* %24
%333 = mul nsw i32 %332, 10
%334 = sext i32 %333 to i64
%335 = getelementptr inbounds double, double* %331, i64 %334
%336 = load double*, double** %21
%337 = call i32 @memcpy(double* %335, double* %336, i32 80)
%338 = load double*, double** %14
%339 = load i32, i32* %24
%340 = mul nsw i32 2, %339
%341 = mul nsw i32 %340, 10
%342 = sext i32 %341 to i64
%343 = getelementptr inbounds double, double* %338, i64 %342
%344 = load double*, double** %22
%345 = call i32 @memcpy(double* %343, double* %344, i32 160)
br label %346
346: ; preds = %324
%347 = load i32, i32* %24
%348 = add nsw i32 %347, 1
store i32 %348, i32* %24
br label %87
349: ; preds = %87
%350 = load double*, double** %16
%351 = call i32 @free(double* %350)
%352 = load double*, double** %17
%353 = call i32 @free(double* %352)
%354 = load double*, double** %18
%355 = call i32 @free(double* %354)
%356 = load double*, double** %19
%357 = call i32 @free(double* %356)
%358 = load double*, double** %20
%359 = call i32 @free(double* %358)
%360 = load double*, double** %21
%361 = call i32 @free(double* %360)
%362 = load double*, double** %22
%363 = call i32 @free(double* %362)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [67 x i8] c"Number of Time series should be less or equal to %d. Terminating!\0A\00"
@.str.1 = [59 x i8] c"Window size must be equal or greater than 2. Terminating!\0A\00"
@.str.2 = [83 x i8] c"Number of Time steps should be less or equal to size of Time series. Terminating!\0A\00"
define void @correlation(double** nocapture %0, i32 %1, i32 %2, i32 %3, i32 %4, double* %5, double* %6) {
%8 = icmp sgt i32 %2, 6000
br i1 %8, label %9, label %15
9: ; preds = %7
%10 = load i32, i32* @stderr
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0), i32 6000)
%12 = load i32, i32* @stderr
%13 = tail call i32 @fflush(i32 %12)
%14 = tail call i32 @exit(i32 -1)
unreachable
15: ; preds = %7
%16 = icmp slt i32 %4, 2
br i1 %16, label %17, label %23
17: ; preds = %15
%18 = load i32, i32* @stderr
%19 = tail call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.1, i64 0, i64 0))
%20 = load i32, i32* @stderr
%21 = tail call i32 @fflush(i32 %20)
%22 = tail call i32 @exit(i32 -1)
unreachable
23: ; preds = %15
%24 = icmp sgt i32 %3, %1
br i1 %24, label %25, label %31
25: ; preds = %23
%26 = load i32, i32* @stderr
%27 = tail call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str.2, i64 0, i64 0))
%28 = load i32, i32* @stderr
%29 = tail call i32 @fflush(i32 %28)
%30 = tail call i32 @exit(i32 -1)
unreachable
31: ; preds = %23
%32 = add nsw i32 %2, -1
%33 = mul nsw i32 %32, %2
%34 = sdiv i32 %33, 2
%35 = tail call i64 @calloc(i32 %2, i32 8)
%36 = inttoptr i64 %35 to double*
%37 = tail call i64 @calloc(i32 %2, i32 8)
%38 = inttoptr i64 %37 to double*
%39 = tail call i64 @calloc(i32 %34, i32 8)
%40 = inttoptr i64 %39 to double*
%41 = tail call i64 @calloc(i32 %34, i32 8)
%42 = inttoptr i64 %41 to double*
%43 = shl nsw i32 %34, 1
%44 = tail call i64 @calloc(i32 %43, i32 8)
%45 = inttoptr i64 %44 to double*
%46 = tail call i64 @malloc(i32 80)
%47 = inttoptr i64 %46 to double*
%48 = tail call i64 @malloc(i32 160)
%49 = inttoptr i64 %48 to double*
%50 = icmp sgt i32 %3, 0
br i1 %50, label %51, label %64
51: ; preds = %31
%52 = icmp sgt i32 %2, 0
%53 = sitofp i32 %4 to double
%54 = sext i32 %2 to i64
%55 = zext i32 %4 to i64
%56 = zext i32 %3 to i64
%57 = zext i32 %2 to i64
%58 = zext i32 %2 to i64
br label %59
59: ; preds = %51, %105
%60 = phi i64 [ 0, %51 ], [ %115, %105 ]
br i1 %52, label %61, label %105
61: ; preds = %59
%62 = icmp ult i64 %60, %55
%63 = sub nsw i64 %60, %55
br label %76
64: ; preds = %105, %31
%65 = tail call i32 @free(double* %36)
%66 = tail call i32 @free(double* %38)
%67 = tail call i32 @free(double* %40)
%68 = tail call i32 @free(double* %42)
%69 = tail call i32 @free(double* %45)
%70 = tail call i32 @free(double* %47)
%71 = tail call i32 @free(double* %49)
ret void
72: ; preds = %83
br i1 %52, label %73, label %105
73: ; preds = %72
%74 = icmp ult i64 %60, %55
%75 = sub nsw i64 %60, %55
br label %117
76: ; preds = %61, %83
%77 = phi i64 [ 0, %61 ], [ %97, %83 ]
%78 = getelementptr inbounds double*, double** %0, i64 %77
%79 = load double*, double** %78
br i1 %62, label %83, label %80
80: ; preds = %76
%81 = getelementptr inbounds double, double* %79, i64 %63
%82 = load double, double* %81
br label %83
83: ; preds = %76, %80
%84 = phi double [ %82, %80 ], [ 0.000000e+00, %76 ]
%85 = getelementptr inbounds double, double* %79, i64 %60
%86 = load double, double* %85
%87 = fsub double %86, %84
%88 = getelementptr inbounds double, double* %36, i64 %77
%89 = load double, double* %88
%90 = fadd double %89, %87
store double %90, double* %88
%91 = fneg double %84
%92 = fmul double %84, %91
%93 = tail call double @llvm.fmuladd.f64(double %86, double %86, double %92)
%94 = getelementptr inbounds double, double* %38, i64 %77
%95 = load double, double* %94
%96 = fadd double %93, %95
store double %96, double* %94
%97 = add nuw nsw i64 %77, 1
%98 = icmp eq i64 %97, %57
br i1 %98, label %72, label %76
99: ; preds = %147
%100 = trunc i64 %188 to i32
br label %101
101: ; preds = %99, %126
%102 = phi i32 [ %120, %126 ], [ %100, %99 ]
%103 = add nuw nsw i64 %119, 1
%104 = icmp eq i64 %130, %58
br i1 %104, label %105, label %117
105: ; preds = %101, %59, %72
%106 = tail call i32 @topCorrelations(double* %42, double* %45, i32 %34, double* %47, double* %49, i32 10)
%107 = mul i64 %60, 10
%108 = and i64 %107, 4294967294
%109 = getelementptr inbounds double, double* %5, i64 %108
%110 = tail call i32 @memcpy(double* %109, double* %47, i32 80)
%111 = mul i64 %60, 20
%112 = and i64 %111, 4294967292
%113 = getelementptr inbounds double, double* %6, i64 %112
%114 = tail call i32 @memcpy(double* %113, double* %49, i32 160)
%115 = add nuw nsw i64 %60, 1
%116 = icmp eq i64 %115, %56
br i1 %116, label %64, label %59
117: ; preds = %73, %101
%118 = phi i64 [ 0, %73 ], [ %130, %101 ]
%119 = phi i64 [ 1, %73 ], [ %103, %101 ]
%120 = phi i32 [ 0, %73 ], [ %102, %101 ]
%121 = getelementptr inbounds double*, double** %0, i64 %118
%122 = load double*, double** %121
br i1 %74, label %126, label %123
123: ; preds = %117
%124 = getelementptr inbounds double, double* %122, i64 %75
%125 = load double, double* %124
br label %126
126: ; preds = %117, %123
%127 = phi double [ %125, %123 ], [ 0.000000e+00, %117 ]
%128 = getelementptr inbounds double, double* %122, i64 %60
%129 = load double, double* %128
%130 = add nuw nsw i64 %118, 1
%131 = icmp slt i64 %130, %54
br i1 %131, label %132, label %101
132: ; preds = %126
%133 = fneg double %127
%134 = getelementptr inbounds double, double* %36, i64 %118
%135 = getelementptr inbounds double, double* %38, i64 %118
%136 = trunc i64 %118 to i32
%137 = sitofp i32 %136 to double
%138 = sext i32 %120 to i64
br label %139
139: ; preds = %132, %147
%140 = phi i64 [ %119, %132 ], [ %189, %147 ]
%141 = phi i64 [ %138, %132 ], [ %188, %147 ]
%142 = getelementptr inbounds double*, double** %0, i64 %140
%143 = load double*, double** %142
br i1 %74, label %147, label %144
144: ; preds = %139
%145 = getelementptr inbounds double, double* %143, i64 %75
%146 = load double, double* %145
br label %147
147: ; preds = %139, %144
%148 = phi double [ %146, %144 ], [ 0.000000e+00, %139 ]
%149 = getelementptr inbounds double, double* %143, i64 %60
%150 = load double, double* %149
%151 = fmul double %148, %133
%152 = tail call double @llvm.fmuladd.f64(double %129, double %150, double %151)
%153 = getelementptr inbounds double, double* %40, i64 %141
%154 = load double, double* %153
%155 = fadd double %154, %152
store double %155, double* %153
%156 = load double, double* %134
%157 = getelementptr inbounds double, double* %36, i64 %140
%158 = load double, double* %157
%159 = fneg double %156
%160 = fmul double %158, %159
%161 = tail call double @llvm.fmuladd.f64(double %53, double %155, double %160)
%162 = load double, double* %135
%163 = fmul double %156, %159
%164 = tail call double @llvm.fmuladd.f64(double %53, double %162, double %163)
%165 = fptosi double %164 to i32
%166 = tail call i32 @sqrt(i32 %165)
%167 = getelementptr inbounds double, double* %38, i64 %140
%168 = load double, double* %167
%169 = load double, double* %157
%170 = fneg double %169
%171 = fmul double %169, %170
%172 = tail call double @llvm.fmuladd.f64(double %53, double %168, double %171)
%173 = fptosi double %172 to i32
%174 = tail call i32 @sqrt(i32 %173)
%175 = mul nsw i32 %174, %166
%176 = sitofp i32 %175 to double
%177 = fdiv double %161, %176
%178 = getelementptr inbounds double, double* %42, i64 %141
store double %177, double* %178
%179 = trunc i64 %140 to i32
%180 = sitofp i32 %179 to double
%181 = trunc i64 %141 to i32
%182 = shl nsw i32 %181, 1
%183 = sext i32 %182 to i64
%184 = getelementptr inbounds double, double* %45, i64 %183
store double %180, double* %184
%185 = or i32 %182, 1
%186 = sext i32 %185 to i64
%187 = getelementptr inbounds double, double* %45, i64 %186
store double %137, double* %187
%188 = add nsw i64 %141, 1
%189 = add nuw nsw i64 %140, 1
%190 = icmp eq i64 %189, %58
br i1 %190, label %99, label %139
}