#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*/ arr_init_linspace(double *, double, double, size_t);
double arr_mean(double *, size_t);
int /*<<< orphan*/ arr_sca_add(double *, double, size_t);
size_t arr_util_getstep(double, double, double);
double cos(double);
int /*<<< orphan*/ fourier(double *, double *, double *, double *, size_t,
                           size_t, double *, double *, double *, int);
int /*<<< orphan*/ free(double *);
double *malloc(size_t);
int /*<<< orphan*/ printf(char *, ...);
double sin(double);
double windowsum(double, double, double, double, double *, double *, size_t,
                 int, int);
void bandpass(double time[], double flux[], double weight[], size_t N,
              double f1, double f2, double low, double high, double rate,
              double result[], int useweight, int quiet) {
  if (quiet == 0)
    printf(" -- TASK: Calculating window function ... \n");
  double fwin = (low + high) / 2.0;
  double sumwin =
      windowsum(fwin, low, high, rate, time, weight, N, useweight, quiet);
  if (quiet == 0)
    printf("      ... Done!\n");
  size_t M = arr_util_getstep(f1, f2, rate);
  double *freq = malloc(M * sizeof(double));
  arr_init_linspace(freq, f1, rate, M);
  if (quiet == 0)
    printf(" -- INFO: Number of sampling frequencies = %li\n", M);
  double *power = malloc(M * sizeof(double));
  double *alpha = malloc(M * sizeof(double));
  double *beta = malloc(M * sizeof(double));
  double fmean = arr_mean(flux, N);
  arr_sca_add(flux, -fmean, N);
  if (quiet == 0)
    printf(" -- TASK: Calculating power spectrum ... \n");
  fourier(time, flux, weight, freq, N, M, power, alpha, beta, useweight);
  if (quiet == 0)
    printf("      ... Done!\n");
  if (quiet == 0)
    printf(" -- TASK: Calculating new time series ... \n");
  double sumfilt, ny;
#pragma omp parallel default(shared) private(sumfilt, ny)
  {
#pragma omp for schedule(static)
    for (size_t i = 0; i < N; ++i) {
      sumfilt = 0;
      for (size_t j = 0; j < M; ++j) {
        ny = freq[j] * 6.28318530717958647692528676655900576839433879875e-6;
        sumfilt += alpha[j] * sin(ny * time[i]) + beta[j] * cos(ny * time[i]);
      }
      result[i] = sumfilt / sumwin;
    }
  }
  if (quiet == 0)
    printf("      ... Done!\n");
  arr_sca_add(flux, fmean, N);
  arr_sca_add(result, fmean, N);
  free(freq);
  free(power);
  free(alpha);
  free(beta);
}


x86 assembly (clang, -O0):
<bandpass>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0xf8,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movsd  %xmm0,-0x30(%rbp)
movsd  %xmm1,-0x38(%rbp)
movsd  %xmm2,-0x40(%rbp)
movsd  %xmm3,-0x48(%rbp)
movsd  %xmm4,-0x50(%rbp)
mov    %r8,-0x58(%rbp)
mov    %r9d,-0x5c(%rbp)
cmpl   $0x0,0x10(%rbp)
jne    1208 <bandpass+0x58>
lea    0xe0f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movsd  -0x40(%rbp),%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  0xde6(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm3
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x5c(%rbp),%ecx
mov    0x10(%rbp),%r8d
call   10d0 <windowsum@plt>
movsd  %xmm0,-0x70(%rbp)
cmpl   $0x0,0x10(%rbp)
jne    126c <bandpass+0xbc>
lea    0xdd7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm2
call   1040 <arr_util_getstep@plt>
mov    %rax,-0x78(%rbp)
mov    -0x78(%rbp),%rdi
shl    $0x3,%rdi
call   1090 <malloc@plt>
mov    %rax,-0x80(%rbp)
mov    -0x80(%rbp),%rdi
movsd  -0x30(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
mov    -0x78(%rbp),%rsi
call   10c0 <arr_init_linspace@plt>
cmpl   $0x0,0x10(%rbp)
jne    12c8 <bandpass+0x118>
mov    -0x78(%rbp),%rsi
lea    0xd8c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x78(%rbp),%rdi
shl    $0x3,%rdi
call   1090 <malloc@plt>
mov    %rax,-0x88(%rbp)
mov    -0x78(%rbp),%rdi
shl    $0x3,%rdi
call   1090 <malloc@plt>
mov    %rax,-0x90(%rbp)
mov    -0x78(%rbp),%rdi
shl    $0x3,%rdi
call   1090 <malloc@plt>
mov    %rax,-0x98(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1080 <arr_mean@plt>
movsd  %xmm0,-0xa0(%rbp)
ff
mov    -0x18(%rbp),%rdi
movsd  -0xa0(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x28(%rbp),%rsi
call   10b0 <arr_sca_add@plt>
cmpl   $0x0,0x10(%rbp)
jne    135d <bandpass+0x1ad>
lea    0xd27(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x80(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x78(%rbp),%r9
mov    -0x88(%rbp),%rbx
mov    -0x90(%rbp),%r11
mov    -0x98(%rbp),%r10
mov    -0x5c(%rbp),%eax
mov    %rbx,(%rsp)
mov    %r11,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   1060 <fourier@plt>
cmpl   $0x0,0x10(%rbp)
jne    13bc <bandpass+0x20c>
lea    0xc87(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x0,0x10(%rbp)
jne    13d4 <bandpass+0x224>
lea    0xcdb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movq   $0x0,-0xb8(%rbp)
mov    -0xb8(%rbp),%rax
cmp    -0x28(%rbp),%rax
jae    1531 <bandpass+0x381>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movq   $0x0,-0xc0(%rbp)
mov    -0xc0(%rbp),%rax
cmp    -0x78(%rbp),%rax
jae    14fd <bandpass+0x34d>
mov    -0x80(%rbp),%rax
mov    -0xc0(%rbp),%rcx
movsd  0xbde(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
mov    -0x90(%rbp),%rax
mov    -0xc0(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0xb0(%rbp),%xmm0
ff
mov    -0x10(%rbp),%rax
mov    -0xb8(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
call   1070 <sin@plt>
movsd  %xmm0,-0xd0(%rbp)
ff
mov    -0x98(%rbp),%rax
mov    -0xc0(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0xb0(%rbp),%xmm0
ff
mov    -0x10(%rbp),%rax
mov    -0xb8(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
call   10a0 <cos@plt>
movsd  -0xd8(%rbp),%xmm1
ff
movsd  -0xd0(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0xc8(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0xa8(%rbp),%xmm0
ff
movsd  %xmm0,-0xa8(%rbp)
ff
mov    -0xc0(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xc0(%rbp)
jmp    1406 <bandpass+0x256>
movsd  -0xa8(%rbp),%xmm0
ff
divsd  -0x70(%rbp),%xmm0
mov    -0x58(%rbp),%rax
mov    -0xb8(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0xb8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xb8(%rbp)
jmp    13df <bandpass+0x22f>
cmpl   $0x0,0x10(%rbp)
jne    1549 <bandpass+0x399>
lea    0xafa(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
movsd  -0xa0(%rbp),%xmm0
ff
mov    -0x28(%rbp),%rsi
call   10b0 <arr_sca_add@plt>
mov    -0x58(%rbp),%rdi
movsd  -0xa0(%rbp),%xmm0
ff
mov    -0x28(%rbp),%rsi
call   10b0 <arr_sca_add@plt>
mov    -0x80(%rbp),%rdi
call   1030 <free@plt>
mov    -0x88(%rbp),%rdi
call   1030 <free@plt>
mov    -0x90(%rbp),%rdi
call   1030 <free@plt>
mov    -0x98(%rbp),%rdi
call   1030 <free@plt>
add    $0xf8,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<bandpass>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %r9d,%r14d
mov    %r8,0x50(%rsp)
movsd  %xmm4,0x8(%rsp)
movsd  %xmm1,0x40(%rsp)
movsd  %xmm0,0x30(%rsp)
mov    %rcx,%r12
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%rbp
mov    0xc0(%rsp),%r13d
test   %r13d,%r13d
mov    %rdx,0x28(%rsp)
mov    %r14,0x20(%rsp)
je     1248 <bandpass+0x88>
movapd %xmm2,%xmm0
addsd  %xmm3,%xmm0
mulsd  0xde2(%rip),%xmm0
movapd %xmm2,%xmm1
movapd %xmm3,%xmm2
movsd  0x8(%rsp),%xmm3
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r14d,%ecx
mov    %r13d,%r8d
call   10e0 <windowsum@plt>
movsd  %xmm0,0x18(%rsp)
jmp    12a6 <bandpass+0xe6>
lea    0xe66(%rip),%rdi
movsd  %xmm3,(%rsp)
movsd  %xmm2,0x18(%rsp)
call   1040 <puts@plt>
movsd  0x18(%rsp),%xmm1
movapd %xmm1,%xmm0
movsd  (%rsp),%xmm2
addsd  %xmm2,%xmm0
mulsd  0xd86(%rip),%xmm0
movsd  0x8(%rsp),%xmm3
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r14d,%ecx
xor    %r8d,%r8d
call   10e0 <windowsum@plt>
movsd  %xmm0,0x18(%rsp)
lea    0xe04(%rip),%rdi
call   1040 <puts@plt>
movsd  0x30(%rsp),%xmm0
movsd  0x40(%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
call   1050 <arr_util_getstep@plt>
mov    %rax,%rbx
lea    0x0(,%rax,8),%r14
mov    %r14,%rdi
call   10a0 <malloc@plt>
mov    %rax,0x10(%rsp)
mov    %rax,%rdi
movsd  0x30(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
mov    %rbx,(%rsp)
mov    %rbx,%rsi
call   10d0 <arr_init_linspace@plt>
test   %r13d,%r13d
jne    1307 <bandpass+0x147>
lea    0xd24(%rip),%rdi
mov    (%rsp),%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
call   10a0 <malloc@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   10a0 <malloc@plt>
mov    %rax,0x38(%rsp)
mov    %r14,%rdi
call   10a0 <malloc@plt>
mov    %rax,%r14
mov    %r15,%rdi
mov    %r12,%rsi
call   1090 <arr_mean@plt>
movapd %xmm0,%xmm1
movapd 0xccf(%rip),%xmm0
movapd %xmm1,0x70(%rsp)
xorpd  %xmm1,%xmm0
mov    %r15,%rdi
mov    %r12,%rsi
call   10c0 <arr_sca_add@plt>
mov    %r13d,0x4c(%rsp)
test   %r13d,%r13d
mov    0x38(%rsp),%r13
mov    %r15,0x58(%rsp)
je     1395 <bandpass+0x1d5>
mov    %rbp,%rdi
mov    %r15,%rsi
mov    0x28(%rsp),%rdx
mov    0x10(%rsp),%rcx
mov    %r12,%r8
mov    (%rsp),%r9
push   0x20(%rsp)
push   %r14
push   %r13
push   %rbx
call   1070 <fourier@plt>
add    $0x20,%rsp
jmp    13e2 <bandpass+0x222>
lea    0xcdf(%rip),%rdi
call   1040 <puts@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
mov    0x28(%rsp),%rdx
mov    0x10(%rsp),%rcx
mov    %r12,%r8
mov    (%rsp),%r9
push   0x20(%rsp)
push   %r14
push   %r13
push   %rbx
call   1070 <fourier@plt>
add    $0x20,%rsp
lea    0xcd4(%rip),%rdi
call   1040 <puts@plt>
lea    0xc73(%rip),%rdi
call   1040 <puts@plt>
test   %r12,%r12
mov    (%rsp),%rcx
je     14f4 <bandpass+0x334>
xor    %r13d,%r13d
movsd  0xc0e(%rip),%xmm0
mov    %r12,0x68(%rsp)
mov    %rbx,0x60(%rsp)
jmp    143e <bandpass+0x27e>
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%r15
divsd  0x18(%rsp),%xmm1
mov    0x50(%rsp),%rax
movsd  %xmm1,(%rax,%r13,8)
add    $0x1,%r13
mov    0x68(%rsp),%r12
cmp    %r12,%r13
mov    0x60(%rsp),%rbx
mov    %r15,%r14
je     14f4 <bandpass+0x334>
xorpd  %xmm1,%xmm1
test   %rcx,%rcx
je     1410 <bandpass+0x250>
xor    %ebx,%ebx
mov    0x10(%rsp),%r12
mov    %r14,%r15
mov    0x38(%rsp),%r14
cs nopw 0x0(%rax,%rax,1)
movsd  %xmm1,0x8(%rsp)
movsd  (%r12,%rbx,8),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x40(%rsp)
movsd  (%r14,%rbx,8),%xmm0
movsd  %xmm0,0x30(%rsp)
movsd  0x0(%rbp,%r13,8),%xmm0
mulsd  %xmm1,%xmm0
call   1080 <sin@plt>
movsd  %xmm0,0x28(%rsp)
movsd  (%r15,%rbx,8),%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0x40(%rsp),%xmm0
mulsd  0x0(%rbp,%r13,8),%xmm0
call   10b0 <cos@plt>
movsd  0x8(%rsp),%xmm1
mov    (%rsp),%rcx
mulsd  0x20(%rsp),%xmm0
movsd  0x28(%rsp),%xmm2
mulsd  0x30(%rsp),%xmm2
addsd  %xmm0,%xmm2
movsd  0xb2a(%rip),%xmm0
addsd  %xmm2,%xmm1
add    $0x1,%rbx
cmp    %rbx,%rcx
jne    1460 <bandpass+0x2a0>
jmp    1413 <bandpass+0x253>
cmpl   $0x0,0x4c(%rsp)
jne    1507 <bandpass+0x347>
lea    0xba3(%rip),%rdi
call   1040 <puts@plt>
mov    0x58(%rsp),%rdi
movaps 0x70(%rsp),%xmm0
mov    %r12,%rsi
call   10c0 <arr_sca_add@plt>
mov    0x50(%rsp),%rdi
movaps 0x70(%rsp),%xmm0
mov    %r12,%rsi
call   10c0 <arr_sca_add@plt>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    0x38(%rsp),%rdi
call   1030 <free@plt>
mov    %r14,%rdi
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [44 x i8] c" -- TASK: Calculating window function ... \0A\00"
@.str.1 = [17 x i8] c" ... Done!\0A\00"
@.str.2 = [48 x i8] c" -- INFO: Number of sampling frequencies = %li\0A\00"
@.str.3 = [43 x i8] c" -- TASK: Calculating power spectrum ... \0A\00"
@.str.4 = [44 x i8] c" -- TASK: Calculating new time series ... \0A\00"
define void @bandpass(double* %0, double* %1, double* %2, i64 %3, double %4, double %5, double %6, double %7, double %8, double* %9, i32 %10, i32 %11) {
%13 = alloca double*
%14 = alloca double*
%15 = alloca double*
%16 = alloca i64
%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 double
%26 = alloca double
%27 = alloca i64
%28 = alloca double*
%29 = alloca double*
%30 = alloca double*
%31 = alloca double*
%32 = alloca double
%33 = alloca double
%34 = alloca double
%35 = alloca i64
%36 = alloca i64
store double* %0, double** %13
store double* %1, double** %14
store double* %2, double** %15
store i64 %3, i64* %16
store double %4, double* %17
store double %5, double* %18
store double %6, double* %19
store double %7, double* %20
store double %8, double* %21
store double* %9, double** %22
store i32 %10, i32* %23
store i32 %11, i32* %24
%37 = load i32, i32* %24
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %12
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
br label %41
41: ; preds = %39, %12
%42 = load double, double* %19
%43 = load double, double* %20
%44 = fadd double %42, %43
%45 = fdiv double %44, 2.000000e+00
store double %45, double* %25
%46 = load double, double* %25
%47 = load double, double* %19
%48 = load double, double* %20
%49 = load double, double* %21
%50 = load double*, double** %13
%51 = load double*, double** %15
%52 = load i64, i64* %16
%53 = load i32, i32* %23
%54 = load i32, i32* %24
%55 = call double @windowsum(double %46, double %47, double %48, double %49, double* %50, double* %51, i64 %52, i32 %53, i32 %54)
store double %55, double* %26
%56 = load i32, i32* %24
%57 = icmp eq i32 %56, 0
br i1 %57, label %58, label %60
58: ; preds = %41
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %60
60: ; preds = %58, %41
%61 = load double, double* %17
%62 = load double, double* %18
%63 = load double, double* %21
%64 = call i64 @arr_util_getstep(double %61, double %62, double %63)
store i64 %64, i64* %27
%65 = load i64, i64* %27
%66 = mul i64 %65, 8
%67 = call double* @malloc(i64 %66)
store double* %67, double** %28
%68 = load double*, double** %28
%69 = load double, double* %17
%70 = load double, double* %21
%71 = load i64, i64* %27
%72 = call i32 @arr_init_linspace(double* %68, double %69, double %70, i64 %71)
%73 = load i32, i32* %24
%74 = icmp eq i32 %73, 0
br i1 %74, label %75, label %78
75: ; preds = %60
%76 = load i64, i64* %27
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0), i64 %76)
br label %78
78: ; preds = %75, %60
%79 = load i64, i64* %27
%80 = mul i64 %79, 8
%81 = call double* @malloc(i64 %80)
store double* %81, double** %29
%82 = load i64, i64* %27
%83 = mul i64 %82, 8
%84 = call double* @malloc(i64 %83)
store double* %84, double** %30
%85 = load i64, i64* %27
%86 = mul i64 %85, 8
%87 = call double* @malloc(i64 %86)
store double* %87, double** %31
%88 = load double*, double** %14
%89 = load i64, i64* %16
%90 = call double @arr_mean(double* %88, i64 %89)
store double %90, double* %32
%91 = load double*, double** %14
%92 = load double, double* %32
%93 = fneg double %92
%94 = load i64, i64* %16
%95 = call i32 @arr_sca_add(double* %91, double %93, i64 %94)
%96 = load i32, i32* %24
%97 = icmp eq i32 %96, 0
br i1 %97, label %98, label %100
98: ; preds = %78
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0))
br label %100
100: ; preds = %98, %78
%101 = load double*, double** %13
%102 = load double*, double** %14
%103 = load double*, double** %15
%104 = load double*, double** %28
%105 = load i64, i64* %16
%106 = load i64, i64* %27
%107 = load double*, double** %29
%108 = load double*, double** %30
%109 = load double*, double** %31
%110 = load i32, i32* %23
%111 = call i32 @fourier(double* %101, double* %102, double* %103, double* %104, i64 %105, i64 %106, double* %107, double* %108, double* %109, i32 %110)
%112 = load i32, i32* %24
%113 = icmp eq i32 %112, 0
br i1 %113, label %114, label %116
114: ; preds = %100
%115 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %116
116: ; preds = %114, %100
%117 = load i32, i32* %24
%118 = icmp eq i32 %117, 0
br i1 %118, label %119, label %121
119: ; preds = %116
%120 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0))
br label %121
121: ; preds = %119, %116
store i64 0, i64* %35
br label %122
122: ; preds = %173, %121
%123 = load i64, i64* %35
%124 = load i64, i64* %16
%125 = icmp ult i64 %123, %124
br i1 %125, label %126, label %176
126: ; preds = %122
store double 0.000000e+00, double* %33
store i64 0, i64* %36
br label %127
127: ; preds = %163, %126
%128 = load i64, i64* %36
%129 = load i64, i64* %27
%130 = icmp ult i64 %128, %129
br i1 %130, label %131, label %166
131: ; preds = %127
%132 = load double*, double** %28
%133 = load i64, i64* %36
%134 = getelementptr inbounds double, double* %132, i64 %133
%135 = load double, double* %134
%136 = fmul double %135, 0x3EDA5A84D380747E
store double %136, double* %34
%137 = load double*, double** %30
%138 = load i64, i64* %36
%139 = getelementptr inbounds double, double* %137, i64 %138
%140 = load double, double* %139
%141 = load double, double* %34
%142 = load double*, double** %13
%143 = load i64, i64* %35
%144 = getelementptr inbounds double, double* %142, i64 %143
%145 = load double, double* %144
%146 = fmul double %141, %145
%147 = call double @sin(double %146)
%148 = load double*, double** %31
%149 = load i64, i64* %36
%150 = getelementptr inbounds double, double* %148, i64 %149
%151 = load double, double* %150
%152 = load double, double* %34
%153 = load double*, double** %13
%154 = load i64, i64* %35
%155 = getelementptr inbounds double, double* %153, i64 %154
%156 = load double, double* %155
%157 = fmul double %152, %156
%158 = call double @cos(double %157)
%159 = fmul double %151, %158
%160 = call double @llvm.fmuladd.f64(double %140, double %147, double %159)
%161 = load double, double* %33
%162 = fadd double %161, %160
store double %162, double* %33
br label %163
163: ; preds = %131
%164 = load i64, i64* %36
%165 = add i64 %164, 1
store i64 %165, i64* %36
br label %127
166: ; preds = %127
%167 = load double, double* %33
%168 = load double, double* %26
%169 = fdiv double %167, %168
%170 = load double*, double** %22
%171 = load i64, i64* %35
%172 = getelementptr inbounds double, double* %170, i64 %171
store double %169, double* %172
br label %173
173: ; preds = %166
%174 = load i64, i64* %35
%175 = add i64 %174, 1
store i64 %175, i64* %35
br label %122
176: ; preds = %122
%177 = load i32, i32* %24
%178 = icmp eq i32 %177, 0
br i1 %178, label %179, label %181
179: ; preds = %176
%180 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %181
181: ; preds = %179, %176
%182 = load double*, double** %14
%183 = load double, double* %32
%184 = load i64, i64* %16
%185 = call i32 @arr_sca_add(double* %182, double %183, i64 %184)
%186 = load double*, double** %22
%187 = load double, double* %32
%188 = load i64, i64* %16
%189 = call i32 @arr_sca_add(double* %186, double %187, i64 %188)
%190 = load double*, double** %28
%191 = call i32 @free(double* %190)
%192 = load double*, double** %29
%193 = call i32 @free(double* %192)
%194 = load double*, double** %30
%195 = call i32 @free(double* %194)
%196 = load double*, double** %31
%197 = call i32 @free(double* %196)
ret void
}

LLVM IR (-O2):
@.str.2 = [48 x i8] c" -- INFO: Number of sampling frequencies = %li\0A\00"
@str.5 = [43 x i8] c" -- TASK: Calculating new time series ... \00"
@str.7 = [42 x i8] c" -- TASK: Calculating power spectrum ... \00"
@str.8 = [16 x i8] c" ... Done!\00"
@str.9 = [43 x i8] c" -- TASK: Calculating window function ... \00"
define void @bandpass(double* %0, double* %1, double* %2, i64 %3, double %4, double %5, double %6, double %7, double %8, double* %9, i32 %10, i32 %11) {
%13 = icmp eq i32 %11, 0
br i1 %13, label %18, label %14
14: ; preds = %12
%15 = fadd double %6, %7
%16 = fmul double %15, 5.000000e-01
%17 = tail call double @windowsum(double %16, double %6, double %7, double %8, double* %0, double* %2, i64 %3, i32 %10, i32 %11)
br label %24
18: ; preds = %12
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.9, i64 0, i64 0))
%20 = fadd double %6, %7
%21 = fmul double %20, 5.000000e-01
%22 = tail call double @windowsum(double %21, double %6, double %7, double %8, double* %0, double* %2, i64 %3, i32 %10, i32 0)
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.8, i64 0, i64 0))
br label %24
24: ; preds = %14, %18
%25 = phi double [ %22, %18 ], [ %17, %14 ]
%26 = tail call i64 @arr_util_getstep(double %4, double %5, double %8)
%27 = shl i64 %26, 3
%28 = tail call double* @malloc(i64 %27)
%29 = tail call i32 @arr_init_linspace(double* %28, double %4, double %8, i64 %26)
br i1 %13, label %30, label %32
30: ; preds = %24
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0), i64 %26)
br label %32
32: ; preds = %30, %24
%33 = tail call double* @malloc(i64 %27)
%34 = tail call double* @malloc(i64 %27)
%35 = tail call double* @malloc(i64 %27)
%36 = tail call double @arr_mean(double* %1, i64 %3)
%37 = fneg double %36
%38 = tail call i32 @arr_sca_add(double* %1, double %37, i64 %3)
br i1 %13, label %41, label %39
39: ; preds = %32
%40 = tail call i32 @fourier(double* %0, double* %1, double* %2, double* %28, i64 %3, i64 %26, double* %33, double* %34, double* %35, i32 %10)
br label %46
41: ; preds = %32
%42 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.7, i64 0, i64 0))
%43 = tail call i32 @fourier(double* %0, double* %1, double* %2, double* %28, i64 %3, i64 %26, double* %33, double* %34, double* %35, i32 %10)
%44 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.8, i64 0, i64 0))
%45 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.5, i64 0, i64 0))
br label %46
46: ; preds = %39, %41
%47 = icmp eq i64 %3, 0
br i1 %47, label %54, label %48
48: ; preds = %46
%49 = icmp eq i64 %26, 0
br label %50
50: ; preds = %48, %55
%51 = phi i64 [ 0, %48 ], [ %59, %55 ]
br i1 %49, label %55, label %52
52: ; preds = %50
%53 = getelementptr inbounds double, double* %0, i64 %51
br label %61
54: ; preds = %55, %46
br i1 %13, label %82, label %84
55: ; preds = %61, %50
%56 = phi double [ 0.000000e+00, %50 ], [ %79, %61 ]
%57 = fdiv double %56, %25
%58 = getelementptr inbounds double, double* %9, i64 %51
store double %57, double* %58
%59 = add nuw i64 %51, 1
%60 = icmp eq i64 %59, %3
br i1 %60, label %54, label %50
61: ; preds = %52, %61
%62 = phi i64 [ 0, %52 ], [ %80, %61 ]
%63 = phi double [ 0.000000e+00, %52 ], [ %79, %61 ]
%64 = getelementptr inbounds double, double* %28, i64 %62
%65 = load double, double* %64
%66 = fmul double %65, 0x3EDA5A84D380747E
%67 = getelementptr inbounds double, double* %34, i64 %62
%68 = load double, double* %67
%69 = load double, double* %53
%70 = fmul double %66, %69
%71 = tail call double @sin(double %70)
%72 = getelementptr inbounds double, double* %35, i64 %62
%73 = load double, double* %72
%74 = load double, double* %53
%75 = fmul double %66, %74
%76 = tail call double @cos(double %75)
%77 = fmul double %73, %76
%78 = tail call double @llvm.fmuladd.f64(double %68, double %71, double %77)
%79 = fadd double %63, %78
%80 = add nuw i64 %62, 1
%81 = icmp eq i64 %80, %26
br i1 %81, label %55, label %61
82: ; preds = %54
%83 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.8, i64 0, i64 0))
br label %84
84: ; preds = %82, %54
%85 = tail call i32 @arr_sca_add(double* %1, double %36, i64 %3)
%86 = tail call i32 @arr_sca_add(double* %9, double %36, i64 %3)
%87 = tail call i32 @free(double* %28)
%88 = tail call i32 @free(double* %33)
%89 = tail call i32 @free(double* %34)
%90 = tail call i32 @free(double* %35)
ret void
}