#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_diff(double *, double *, size_t);
int /*<<< orphan*/ arr_init_linspace(double *, double, double, size_t);
double arr_mean(double *, size_t);
double arr_median(double *, size_t);
int /*<<< orphan*/ arr_sca_add(double *, double, size_t);
int /*<<< orphan*/ arr_sum(double *, size_t);
size_t arr_util_getstep(double, double, double);
size_t cmdarg(int, char **, char *, char *, int *, int *, int *, double *,
              double *, double *, int *, int *, int *, int *, double *, int *,
              int *, int /*<<< orphan*/ *, int /*<<< orphan*/ *);
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 *, ...);
int /*<<< orphan*/ readcols(char *, double *, double *, double *, size_t, int,
                            int, int);
int /*<<< orphan*/ windowfunction(double *, double *, double *, size_t, size_t,
                                  double, double *, int);
int /*<<< orphan*/ writecols(char *, double *, double *, size_t);
int main(int argc, char *argv[]) {
  size_t N = 0;
  size_t M = 0;
  char inname[100];
  char outname[100];
  double low, high, rate;
  double winfreq = 0;
  int quiet = 0;
  int unit = 1;
  int prep = 1;
  int autosamp = 0;
  int fast = 0;
  int useweight = 0;
  int windowmode = 0;
  int Nclean = 0;
  int filter = 0;
  N = cmdarg(argc, argv, inname, outname, &quiet, &unit, &prep, &low, &high,
             &rate, &autosamp, &fast, &useweight, &windowmode, &winfreq,
             &Nclean, &filter, NULL, NULL);
  if (quiet == 0 || fast == 1) {
    if (windowmode == 0 && useweight != 0)
      printf("\nCalculating the weighted power spectrum of \"%s\" ...\n",
             inname);
    else if (windowmode == 0)
      printf("\nCalculating the power spectrum of \"%s\" ...\n", inname);
    else
      printf("\nCalculating the window function of \"%s\" ...\n", inname);
  }
  if (quiet == 0)
    printf(" - Reading input\n");
  double *time = malloc(N * sizeof(double));
  double *flux = malloc(N * sizeof(double));
  double *weight = malloc(N * sizeof(double));
  readcols(inname, time, flux, weight, N, useweight, unit, quiet);
  if (fast == 0 && windowmode == 0) {
    double *dt = malloc(N - 1 * sizeof(double));
    double nyquist;
    arr_diff(time, dt, N);
    nyquist = 1.0 / (2.0 * arr_median(dt, N - 1)) * 1e6;
    free(dt);
    double minsamp;
    minsamp = 1.0e6 / (4 * (time[N - 1] - time[0]));
    if (quiet == 0) {
      printf(" -- INFO: Length of time series = %li\n", N);
      printf(" -- INFO: Nyquist frequency = %.2lf microHz\n", nyquist);
      printf(" -- INFO: Suggested minimum sampling = %.3lf microHz\n", minsamp);
    }
    if (autosamp != 0) {
      low = 5.0;
      high = nyquist;
      rate = minsamp;
    }
  }
  double limit = 0;
  if (windowmode != 0) {
    limit = low;
    low = winfreq - limit;
    high = winfreq + limit;
  }
  M = arr_util_getstep(low, high, rate);
  double *freq = malloc(M * sizeof(double));
  arr_init_linspace(freq, low, rate, M);
  double *power = malloc(M * sizeof(double));
  double *alpha = malloc(M * sizeof(double));
  double *beta = malloc(M * sizeof(double));
  if (windowmode == 0) {
    if (prep != 0) {
      if (quiet == 0) {
        printf(" - Subtracting the mean from time series\n");
      }
      arr_sca_add(flux, -arr_mean(flux, N), N);
    } else {
      if (quiet == 0)
        printf(" - Time series used *without* mean subtraction!\n");
    }
    if (quiet == 0) {
      printf(" - Calculating fourier transform\n");
      if (autosamp != 0) {
        printf(" -- NB: Using automatic sampling!\n");
        printf(" -- INFO: Auto-sampling (in microHz): %.2lf to %.2lf"
               " in steps of %.4lf\n",
               low, high, rate);
      } else {
        printf(" -- INFO: Sampling (in microHz): %.2lf to %.2lf in"
               " steps of %.4lf\n",
               low, high, rate);
      }
      printf(" -- INFO: Number of sampling frequencies = %li\n", M);
    }
    fourier(time, flux, weight, freq, N, M, power, alpha, beta, useweight);
  } else {
    if (quiet == 0) {
      printf(" - Calculating window function\n");
      printf(" -- INFO: Window frequency = %.2lf microHz\n", winfreq);
      printf(" -- INFO: Sampling in the range +/- %.2lf microHz in"
             " steps of %.4lf microHz\n",
             limit, rate);
      printf(" -- INFO: Number of sampling frequencies = %li\n", M);
    }
    windowfunction(time, freq, weight, N, M, winfreq, power, useweight);
    if (quiet == 0)
      printf(" - Sum of spectral window = %.4lf\n", arr_sum(power, M));
    arr_sca_add(freq, -winfreq, M);
  }
  if (quiet == 0)
    printf(" - Saving to file \"%s\"\n", outname);
  writecols(outname, freq, power, M);
  free(time);
  free(flux);
  free(weight);
  free(freq);
  free(power);
  free(alpha);
  free(beta);
  if (quiet == 0 || fast == 1)
    printf("Done!\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x228,%rsp
movl   $0x0,-0x2c(%rbp)
mov    %edi,-0x30(%rbp)
mov    %rsi,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
movq   $0x0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x140(%rbp)
ff
movl   $0x0,-0x144(%rbp)
movl   $0x1,-0x148(%rbp)
movl   $0x1,-0x14c(%rbp)
movl   $0x0,-0x150(%rbp)
movl   $0x0,-0x154(%rbp)
movl   $0x0,-0x158(%rbp)
movl   $0x0,-0x15c(%rbp)
movl   $0x0,-0x160(%rbp)
movl   $0x0,-0x164(%rbp)
mov    -0x30(%rbp),%edi
mov    -0x38(%rbp),%rsi
lea    -0xb0(%rbp),%rdx
lea    -0x120(%rbp),%rcx
lea    -0x144(%rbp),%r8
lea    -0x148(%rbp),%r9
lea    -0x14c(%rbp),%rax
mov    %rax,-0x1e0(%rbp)
lea    -0x128(%rbp),%rax
mov    %rax,-0x1d8(%rbp)
lea    -0x130(%rbp),%rax
mov    %rax,-0x1d0(%rbp)
lea    -0x138(%rbp),%r13
lea    -0x150(%rbp),%r12
lea    -0x154(%rbp),%r15
lea    -0x158(%rbp),%r14
lea    -0x15c(%rbp),%rbx
lea    -0x140(%rbp),%r11
lea    -0x160(%rbp),%r10
lea    -0x164(%rbp),%rax
mov    %rax,-0x1c8(%rbp)
xor    %eax,%eax
mov    -0x1e0(%rbp),%rax
mov    %rax,(%rsp)
mov    -0x1d8(%rbp),%rax
mov    %rax,0x8(%rsp)
mov    -0x1d0(%rbp),%rax
mov    %rax,0x10(%rsp)
mov    -0x1c8(%rbp),%rax
mov    %r13,0x18(%rsp)
mov    %r12,0x20(%rsp)
mov    %r15,0x28(%rsp)
mov    %r14,0x30(%rsp)
mov    %rbx,0x38(%rsp)
mov    %r11,0x40(%rsp)
mov    %r10,0x48(%rsp)
mov    %rax,0x50(%rsp)
movq   $0x0,0x58(%rsp)
movq   $0x0,0x60(%rsp)
call   10b0 <cmdarg@plt>
mov    %rax,-0x40(%rbp)
cmpl   $0x0,-0x144(%rbp)
je     139c <main+0x1ac>
cmpl   $0x1,-0x154(%rbp)
jne    1416 <main+0x226>
cmpl   $0x0,-0x15c(%rbp)
jne    13d0 <main+0x1e0>
cmpl   $0x0,-0x158(%rbp)
je     13d0 <main+0x1e0>
lea    -0xb0(%rbp),%rsi
lea    0xc64(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1411 <main+0x221>
cmpl   $0x0,-0x15c(%rbp)
jne    13f7 <main+0x207>
lea    -0xb0(%rbp),%rsi
lea    0xc73(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    140c <main+0x21c>
lea    -0xb0(%rbp),%rsi
lea    0xc86(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1411 <main+0x221>
jmp    1416 <main+0x226>
cmpl   $0x0,-0x144(%rbp)
jne    1431 <main+0x241>
lea    0xc8f(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x40(%rbp),%rdi
shl    $0x3,%rdi
call   10c0 <malloc@plt>
mov    %rax,-0x170(%rbp)
mov    -0x40(%rbp),%rdi
shl    $0x3,%rdi
call   10c0 <malloc@plt>
mov    %rax,-0x178(%rbp)
mov    -0x40(%rbp),%rdi
shl    $0x3,%rdi
call   10c0 <malloc@plt>
mov    %rax,-0x180(%rbp)
lea    -0xb0(%rbp),%rdi
mov    -0x170(%rbp),%rsi
mov    -0x178(%rbp),%rdx
mov    -0x180(%rbp),%rcx
mov    -0x40(%rbp),%r8
mov    -0x158(%rbp),%r9d
mov    -0x148(%rbp),%r10d
mov    -0x144(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1100 <readcols@plt>
cmpl   $0x0,-0x154(%rbp)
jne    160b <main+0x41b>
cmpl   $0x0,-0x15c(%rbp)
jne    160b <main+0x41b>
mov    -0x40(%rbp),%rdi
sub    $0x8,%rdi
call   10c0 <malloc@plt>
mov    %rax,-0x188(%rbp)
mov    -0x170(%rbp),%rdi
mov    -0x188(%rbp),%rsi
mov    -0x40(%rbp),%rdx
call   1060 <arr_diff@plt>
mov    -0x188(%rbp),%rdi
mov    -0x40(%rbp),%rsi
sub    $0x1,%rsi
call   1080 <arr_median@plt>
movsd  0xb09(%rip),%xmm1
mulsd  %xmm0,%xmm1
movsd  0xaf5(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  0xad9(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x190(%rbp)
ff
mov    -0x188(%rbp),%rdi
call   1040 <free@plt>
mov    -0x170(%rbp),%rax
mov    -0x40(%rbp),%rcx
sub    $0x1,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x170(%rbp),%rax
subsd  (%rax),%xmm0
movsd  0xaa2(%rip),%xmm1
mulsd  %xmm0,%xmm1
movsd  0xa8e(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x198(%rbp)
ff
cmpl   $0x0,-0x144(%rbp)
jne    15c9 <main+0x3d9>
mov    -0x40(%rbp),%rsi
lea    0xb35(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movsd  -0x190(%rbp),%xmm0
ff
lea    0xb46(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
movsd  -0x198(%rbp),%xmm0
ff
lea    0xb5d(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
cmpl   $0x0,-0x150(%rbp)
je     1606 <main+0x416>
movsd  0xa42(%rip),%xmm0
movsd  %xmm0,-0x128(%rbp)
ff
movsd  -0x190(%rbp),%xmm0
ff
movsd  %xmm0,-0x130(%rbp)
ff
movsd  -0x198(%rbp),%xmm0
ff
movsd  %xmm0,-0x138(%rbp)
ff
jmp    160b <main+0x41b>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x1a0(%rbp)
ff
cmpl   $0x0,-0x15c(%rbp)
je     1663 <main+0x473>
movsd  -0x128(%rbp),%xmm0
ff
movsd  %xmm0,-0x1a0(%rbp)
ff
movsd  -0x140(%rbp),%xmm0
ff
subsd  -0x1a0(%rbp),%xmm0
ff
movsd  %xmm0,-0x128(%rbp)
ff
movsd  -0x140(%rbp),%xmm0
ff
addsd  -0x1a0(%rbp),%xmm0
ff
movsd  %xmm0,-0x130(%rbp)
ff
movsd  -0x128(%rbp),%xmm0
ff
movsd  -0x130(%rbp),%xmm1
ff
movsd  -0x138(%rbp),%xmm2
ff
call   1050 <arr_util_getstep@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
shl    $0x3,%rdi
call   10c0 <malloc@plt>
mov    %rax,-0x1a8(%rbp)
mov    -0x1a8(%rbp),%rdi
movsd  -0x128(%rbp),%xmm0
ff
movsd  -0x138(%rbp),%xmm1
ff
mov    -0x48(%rbp),%rsi
call   1110 <arr_init_linspace@plt>
mov    -0x48(%rbp),%rdi
shl    $0x3,%rdi
call   10c0 <malloc@plt>
mov    %rax,-0x1b0(%rbp)
mov    -0x48(%rbp),%rdi
shl    $0x3,%rdi
call   10c0 <malloc@plt>
mov    %rax,-0x1b8(%rbp)
mov    -0x48(%rbp),%rdi
shl    $0x3,%rdi
call   10c0 <malloc@plt>
mov    %rax,-0x1c0(%rbp)
cmpl   $0x0,-0x15c(%rbp)
jne    1887 <main+0x697>
cmpl   $0x0,-0x14c(%rbp)
je     1773 <main+0x583>
cmpl   $0x0,-0x144(%rbp)
jne    1729 <main+0x539>
lea    0xa33(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x178(%rbp),%rax
mov    %rax,-0x1e8(%rbp)
mov    -0x178(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   10a0 <arr_mean@plt>
mov    -0x1e8(%rbp),%rdi
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x40(%rbp),%rsi
call   10f0 <arr_sca_add@plt>
jmp    1793 <main+0x5a3>
cmpl   $0x0,-0x144(%rbp)
jne    178e <main+0x59e>
lea    0x9f8(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1793 <main+0x5a3>
cmpl   $0x0,-0x144(%rbp)
jne    182c <main+0x63c>
lea    0xa09(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
cmpl   $0x0,-0x150(%rbp)
je     17f4 <main+0x604>
lea    0xa10(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movsd  -0x128(%rbp),%xmm0
ff
movsd  -0x130(%rbp),%xmm1
ff
movsd  -0x138(%rbp),%xmm2
ff
lea    0xa0d(%rip),%rdi
mov    $0x3,%al
call   1070 <printf@plt>
jmp    181a <main+0x62a>
movsd  -0x128(%rbp),%xmm0
ff
movsd  -0x130(%rbp),%xmm1
ff
movsd  -0x138(%rbp),%xmm2
ff
lea    0xa2a(%rip),%rdi
mov    $0x3,%al
call   1070 <printf@plt>
mov    -0x48(%rbp),%rsi
lea    0xa5b(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x170(%rbp),%rdi
mov    -0x178(%rbp),%rsi
mov    -0x180(%rbp),%rdx
mov    -0x1a8(%rbp),%rcx
mov    -0x40(%rbp),%r8
mov    -0x48(%rbp),%r9
mov    -0x1b0(%rbp),%rbx
mov    -0x1b8(%rbp),%r11
mov    -0x1c0(%rbp),%r10
mov    -0x158(%rbp),%eax
mov    %rbx,(%rsp)
mov    %r11,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   1090 <fourier@plt>
jmp    197e <main+0x78e>
cmpl   $0x0,-0x144(%rbp)
jne    18e8 <main+0x6f8>
lea    0xa15(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movsd  -0x140(%rbp),%xmm0
ff
lea    0xa1f(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
movsd  -0x1a0(%rbp),%xmm0
ff
movsd  -0x138(%rbp),%xmm1
ff
lea    0xa2d(%rip),%rdi
mov    $0x2,%al
call   1070 <printf@plt>
mov    -0x48(%rbp),%rsi
lea    0x99f(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x170(%rbp),%rdi
mov    -0x1a8(%rbp),%rsi
mov    -0x180(%rbp),%rdx
mov    -0x40(%rbp),%rcx
mov    -0x48(%rbp),%r8
movsd  -0x140(%rbp),%xmm0
ff
mov    -0x1b0(%rbp),%r9
mov    -0x158(%rbp),%eax
mov    %eax,(%rsp)
call   1030 <windowfunction@plt>
cmpl   $0x0,-0x144(%rbp)
jne    194f <main+0x75f>
mov    -0x1b0(%rbp),%rdi
mov    -0x48(%rbp),%rsi
call   10e0 <arr_sum@plt>
mov    %eax,%esi
lea    0xa01(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x1a8(%rbp),%rdi
movsd  -0x140(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x48(%rbp),%rsi
call   10f0 <arr_sca_add@plt>
cmpl   $0x0,-0x144(%rbp)
jne    19a0 <main+0x7b0>
lea    -0x120(%rbp),%rsi
lea    0x9d3(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x120(%rbp),%rdi
mov    -0x1a8(%rbp),%rsi
mov    -0x1b0(%rbp),%rdx
mov    -0x48(%rbp),%rcx
call   10d0 <writecols@plt>
mov    -0x170(%rbp),%rdi
call   1040 <free@plt>
mov    -0x178(%rbp),%rdi
call   1040 <free@plt>
mov    -0x180(%rbp),%rdi
call   1040 <free@plt>
mov    -0x1a8(%rbp),%rdi
call   1040 <free@plt>
mov    -0x1b0(%rbp),%rdi
call   1040 <free@plt>
mov    -0x1b8(%rbp),%rdi
call   1040 <free@plt>
mov    -0x1c0(%rbp),%rdi
call   1040 <free@plt>
cmpl   $0x0,-0x144(%rbp)
je     1a2c <main+0x83c>
cmpl   $0x1,-0x154(%rbp)
jne    1a3a <main+0x84a>
lea    0x951(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
xor    %eax,%eax
add    $0x228,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x158,%rsp
movq   $0x0,0x38(%rsp)
movl   $0x0,0x4(%rsp)
movl   $0x1,0x4c(%rsp)
movl   $0x1,0x48(%rsp)
movl   $0x0,0x14(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x0,0x6c(%rsp)
movl   $0x0,0x68(%rsp)
sub    $0x70,%rsp
xorpd  %xmm0,%xmm0
movupd %xmm0,0x58(%rsp)
lea    0xd8(%rsp),%rax
mov    %rax,0x50(%rsp)
lea    0xdc(%rsp),%rax
mov    %rax,0x48(%rsp)
lea    0xa8(%rsp),%rax
mov    %rax,0x40(%rsp)
lea    0x78(%rsp),%rax
mov    %rax,0x38(%rsp)
lea    0x7c(%rsp),%rax
mov    %rax,0x30(%rsp)
lea    0x80(%rsp),%rax
mov    %rax,0x28(%rsp)
lea    0x84(%rsp),%rax
mov    %rax,0x20(%rsp)
lea    0x90(%rsp),%rax
mov    %rax,0x18(%rsp)
lea    0xb0(%rsp),%rax
mov    %rax,0x10(%rsp)
lea    0x98(%rsp),%rax
mov    %rax,0x8(%rsp)
lea    0xb8(%rsp),%rax
mov    %rax,(%rsp)
lea    0x160(%rsp),%rdx
lea    0xf0(%rsp),%rcx
lea    0x74(%rsp),%r8
lea    0xbc(%rsp),%r9
call   10c0 <cmdarg@plt>
add    $0x70,%rsp
mov    %rax,%r13
mov    0x4(%rsp),%r15d
test   %r15d,%r15d
je     1332 <main+0x132>
cmpl   $0x1,0x10(%rsp)
jne    138a <main+0x18a>
mov    0x8(%rsp),%eax
test   %eax,%eax
lea    0xd27(%rip),%rcx
lea    0xd4d(%rip),%rdx
cmove  %rcx,%rdx
cmpl   $0x0,0xc(%rsp)
lea    0xcda(%rip),%rdi
cmove  %rdx,%rdi
test   %eax,%eax
cmovne %rdx,%rdi
lea    0xf0(%rsp),%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x4(%rsp),%r15d
test   %r15d,%r15d
jne    138a <main+0x18a>
lea    0xffc(%rip),%rdi
call   1050 <puts@plt>
mov    0x4(%rsp),%r15d
lea    0x0(,%r13,8),%rbx
mov    %rbx,%rdi
call   10d0 <malloc@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   10d0 <malloc@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   10d0 <malloc@plt>
mov    %rax,%rcx
mov    0xc(%rsp),%r9d
mov    0x4c(%rsp),%eax
lea    0xf0(%rsp),%rdi
mov    %rbp,0x50(%rsp)
mov    %rbp,%rsi
mov    %r14,%rdx
mov    %rcx,0x60(%rsp)
mov    %r13,%r8
push   %r15
push   %rax
call   1110 <readcols@plt>
add    $0x10,%rsp
mov    0x8(%rsp),%eax
mov    0x10(%rsp),%ecx
or     %eax,%ecx
jne    14e7 <main+0x2e7>
lea    -0x8(%r13),%rdi
call   10d0 <malloc@plt>
mov    %rax,%rbx
mov    0x50(%rsp),%rbp
mov    %rbp,%rdi
mov    %rax,%rsi
mov    %r13,%rdx
call   1070 <arr_diff@plt>
mov    %r13,%rsi
add    $0xffffffffffffffff,%rsi
mov    %rbx,%rdi
call   1090 <arr_median@plt>
addsd  %xmm0,%xmm0
movsd  0xbd3(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  0xbcf(%rip),%xmm0
movsd  %xmm0,0x18(%rsp)
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x30(%rsp)
mov    %rbx,%rdi
call   1040 <free@plt>
movsd  -0x8(%rbp,%r13,8),%xmm0
subsd  0x0(%rbp),%xmm0
mulsd  0xbab(%rip),%xmm0
movsd  0x18(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x18(%rsp)
cmpl   $0x0,0x4(%rsp)
jne    14b5 <main+0x2b5>
lea    0xc3e(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xc54(%rip),%rdi
movsd  0x30(%rsp),%xmm0
mov    $0x1,%al
call   1080 <printf@plt>
lea    0xc6d(%rip),%rdi
movsd  0x18(%rsp),%xmm0
mov    $0x1,%al
call   1080 <printf@plt>
cmpl   $0x0,0x14(%rsp)
je     14e3 <main+0x2e3>
movabs $0x4014000000000000,%rax
mov    %rax,0x28(%rsp)
movsd  0x30(%rsp),%xmm0
movsd  %xmm0,0x40(%rsp)
movsd  0x18(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
mov    0x8(%rsp),%eax
movsd  0x28(%rsp),%xmm2
test   %eax,%eax
mov    %r14,0x58(%rsp)
je     151c <main+0x31c>
movsd  0x38(%rsp),%xmm1
movapd %xmm1,%xmm0
subsd  %xmm2,%xmm0
movsd  %xmm0,0x28(%rsp)
movsd  %xmm2,0x70(%rsp)
addsd  %xmm2,%xmm1
movsd  %xmm1,0x40(%rsp)
jmp    1530 <main+0x330>
movsd  0x40(%rsp),%xmm1
movapd %xmm2,%xmm0
xorpd  %xmm2,%xmm2
movsd  %xmm2,0x70(%rsp)
movsd  0x20(%rsp),%xmm2
call   1060 <arr_util_getstep@plt>
mov    %rax,%r14
lea    0x0(,%rax,8),%r15
mov    %r15,%rdi
call   10d0 <malloc@plt>
mov    %rax,%r12
movsd  0x28(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
mov    %rax,%rdi
mov    %r14,%rsi
call   1120 <arr_init_linspace@plt>
mov    %r15,%rdi
call   10d0 <malloc@plt>
mov    %rax,0x78(%rsp)
mov    %r15,%rdi
call   10d0 <malloc@plt>
mov    %rax,0x30(%rsp)
mov    %r15,%rdi
call   10d0 <malloc@plt>
cmpl   $0x0,0x8(%rsp)
mov    %rax,0x18(%rsp)
je     1705 <main+0x505>
cmpl   $0x0,0x4(%rsp)
jne    15ec <main+0x3ec>
lea    0xd19(%rip),%rdi
call   1050 <puts@plt>
movsd  0x38(%rsp),%xmm0
lea    0xc4c(%rip),%rdi
mov    $0x1,%al
call   1080 <printf@plt>
movsd  0x20(%rsp),%xmm1
lea    0xc64(%rip),%rdi
movsd  0x70(%rsp),%xmm0
mov    $0x2,%al
call   1080 <printf@plt>
lea    0xbf4(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
movsd  0x38(%rsp),%xmm0
mov    0xc(%rsp),%eax
sub    $0x8,%rsp
mov    0x58(%rsp),%rdi
mov    %r12,%rsi
mov    0x68(%rsp),%rdx
mov    %r13,%rcx
mov    %r14,%r8
mov    0x80(%rsp),%rbp
mov    %rbp,%r9
push   %rax
call   1030 <windowfunction@plt>
add    $0x10,%rsp
cmpl   $0x0,0x4(%rsp)
mov    0x58(%rsp),%r15
jne    1649 <main+0x449>
mov    %rbp,%rdi
mov    %r14,%rsi
call   10f0 <arr_sum@plt>
lea    0xc3f(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1080 <printf@plt>
movsd  0x38(%rsp),%xmm0
xorps  0x9ca(%rip),%xmm0
mov    %r12,%rdi
mov    %r14,%rsi
call   1100 <arr_sca_add@plt>
mov    0x30(%rsp),%rbx
cmpl   $0x0,0x4(%rsp)
jne    1683 <main+0x483>
lea    0xc2e(%rip),%rdi
lea    0x80(%rsp),%rsi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0x80(%rsp),%rdi
mov    %r12,%rsi
mov    %rbp,%rdx
mov    %r14,%rcx
call   10e0 <writecols@plt>
mov    0x50(%rsp),%rdi
call   1040 <free@plt>
mov    %r15,%rdi
call   1040 <free@plt>
mov    0x60(%rsp),%rdi
call   1040 <free@plt>
mov    %r12,%rdi
call   1040 <free@plt>
mov    %rbp,%rdi
call   1040 <free@plt>
mov    %rbx,%rdi
call   1040 <free@plt>
mov    0x18(%rsp),%rdi
call   1040 <free@plt>
cmpl   $0x0,0x4(%rsp)
je     16e5 <main+0x4e5>
cmpl   $0x1,0x10(%rsp)
jne    16f1 <main+0x4f1>
lea    0xbce(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
add    $0x158,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rax,%rbx
cmpl   $0x0,0x48(%rsp)
mov    0x4(%rsp),%eax
je     178a <main+0x58a>
test   %eax,%eax
jne    1723 <main+0x523>
lea    0xc35(%rip),%rdi
call   1050 <puts@plt>
mov    0x58(%rsp),%rbp
mov    %rbp,%rdi
mov    %r13,%rsi
call   10b0 <arr_mean@plt>
xorps  0x8e6(%rip),%xmm0
mov    %rbp,%rdi
mov    %r13,%rsi
call   1100 <arr_sca_add@plt>
cmpl   $0x0,0x4(%rsp)
jne    17d9 <main+0x5d9>
lea    0xb89(%rip),%rdi
call   1050 <puts@plt>
cmpl   $0x0,0x14(%rsp)
je     17a8 <main+0x5a8>
lea    0xb97(%rip),%rdi
call   1050 <puts@plt>
movsd  0x28(%rsp),%xmm0
movsd  0x40(%rsp),%xmm1
movsd  0x20(%rsp),%xmm2
lea    0x9c3(%rip),%rdi
jmp    17c1 <main+0x5c1>
test   %eax,%eax
mov    0x58(%rsp),%rbp
jne    17d9 <main+0x5d9>
lea    0xb89(%rip),%rdi
call   1050 <puts@plt>
cmpl   $0x0,0x4(%rsp)
jne    17d9 <main+0x5d9>
jmp    1750 <main+0x550>
movsd  0x28(%rsp),%xmm0
movsd  0x40(%rsp),%xmm1
movsd  0x20(%rsp),%xmm2
lea    0x9d2(%rip),%rdi
mov    $0x3,%al
call   1080 <printf@plt>
lea    0xa07(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0xc(%rsp),%eax
mov    0x50(%rsp),%rdi
mov    %rbp,%r15
mov    %rbp,%rsi
mov    0x60(%rsp),%rdx
mov    %r12,%rcx
mov    %r13,%r8
mov    %r14,%r9
push   %rax
push   %rbx
mov    0x40(%rsp),%rbx
push   %rbx
mov    0x90(%rsp),%rbp
push   %rbp
call   10a0 <fourier@plt>
add    $0x20,%rsp
cmpl   $0x0,0x4(%rsp)
jne    1683 <main+0x483>
jmp    166d <main+0x46d>

LLVM IR (-O0):
@.str = [54 x i8] c"\0ACalculating the weighted power spectrum of \22%s\22 ...\0A\00"
@.str.1 = [45 x i8] c"\0ACalculating the power spectrum of \22%s\22 ...\0A\00"
@.str.2 = [46 x i8] c"\0ACalculating the window function of \22%s\22 ...\0A\00"
@.str.3 = [18 x i8] c" - Reading input\0A\00"
@.str.4 = [39 x i8] c" -- INFO: Length of time series = %li\0A\00"
@.str.5 = [45 x i8] c" -- INFO: Nyquist frequency = %.2lf microHz\0A\00"
@.str.6 = [54 x i8] c" -- INFO: Suggested minimum sampling = %.3lf microHz\0A\00"
@.str.7 = [42 x i8] c" - Subtracting the mean from time series\0A\00"
@.str.8 = [49 x i8] c" - Time series used *without* mean subtraction!\0A\00"
@.str.9 = [34 x i8] c" - Calculating fourier transform\0A\00"
@.str.10 = [35 x i8] c" -- NB: Using automatic sampling!\0A\00"
@.str.11 = [72 x i8] c" -- INFO: Auto-sampling (in microHz): %.2lf to %.2lf in steps of %.4lf\0A\00"
@.str.12 = [67 x i8] c" -- INFO: Sampling (in microHz): %.2lf to %.2lf in steps of %.4lf\0A\00"
@.str.13 = [48 x i8] c" -- INFO: Number of sampling frequencies = %li\0A\00"
@.str.14 = [32 x i8] c" - Calculating window function\0A\00"
@.str.15 = [44 x i8] c" -- INFO: Window frequency = %.2lf microHz\0A\00"
@.str.16 = [77 x i8] c" -- INFO: Sampling in the range +/- %.2lf microHz in steps of %.4lf microHz\0A\00"
@.str.17 = [35 x i8] c" - Sum of spectral window = %.4lf\0A\00"
@.str.18 = [24 x i8] c" - Saving to file \22%s\22\0A\00"
@.str.19 = [8 x i8] c"Done!\0A\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca [100 x i8]
%9 = alloca [100 x i8]
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca double*
%24 = alloca double*
%25 = alloca double*
%26 = alloca double*
%27 = alloca double
%28 = alloca double
%29 = alloca double
%30 = alloca double*
%31 = alloca double*
%32 = alloca double*
%33 = alloca double*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 0, i64* %6
store i64 0, i64* %7
store double 0.000000e+00, double* %13
store i32 0, i32* %14
store i32 1, i32* %15
store i32 1, i32* %16
store i32 0, i32* %17
store i32 0, i32* %18
store i32 0, i32* %19
store i32 0, i32* %20
store i32 0, i32* %21
store i32 0, i32* %22
%34 = load i32, i32* %4
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%37 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%38 = call i64 @cmdarg(i32 %34, i8** %35, i8* %36, i8* %37, i32* %14, i32* %15, i32* %16, double* %10, double* %11, double* %12, i32* %17, i32* %18, i32* %19, i32* %20, double* %13, i32* %21, i32* %22, i32* null, i32* null)
store i64 %38, i64* %6
%39 = load i32, i32* %14
%40 = icmp eq i32 %39, 0
br i1 %40, label %44, label %41
41: ; preds = %2
%42 = load i32, i32* %18
%43 = icmp eq i32 %42, 1
br i1 %43, label %44, label %64
44: ; preds = %41, %2
%45 = load i32, i32* %20
%46 = icmp eq i32 %45, 0
br i1 %46, label %47, label %53
47: ; preds = %44
%48 = load i32, i32* %19
%49 = icmp ne i32 %48, 0
br i1 %49, label %50, label %53
50: ; preds = %47
%51 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i8* %51)
br label %63
53: ; preds = %47, %44
%54 = load i32, i32* %20
%55 = icmp eq i32 %54, 0
br i1 %55, label %56, label %59
56: ; preds = %53
%57 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i8* %57)
br label %62
59: ; preds = %53
%60 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0), i8* %60)
br label %62
62: ; preds = %59, %56
br label %63
63: ; preds = %62, %50
br label %64
64: ; preds = %63, %41
%65 = load i32, i32* %14
%66 = icmp eq i32 %65, 0
br i1 %66, label %67, label %69
67: ; preds = %64
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
br label %69
69: ; preds = %67, %64
%70 = load i64, i64* %6
%71 = mul i64 %70, 8
%72 = call double* @malloc(i64 %71)
store double* %72, double** %23
%73 = load i64, i64* %6
%74 = mul i64 %73, 8
%75 = call double* @malloc(i64 %74)
store double* %75, double** %24
%76 = load i64, i64* %6
%77 = mul i64 %76, 8
%78 = call double* @malloc(i64 %77)
store double* %78, double** %25
%79 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%80 = load double*, double** %23
%81 = load double*, double** %24
%82 = load double*, double** %25
%83 = load i64, i64* %6
%84 = load i32, i32* %19
%85 = load i32, i32* %15
%86 = load i32, i32* %14
%87 = call i32 @readcols(i8* %79, double* %80, double* %81, double* %82, i64 %83, i32 %84, i32 %85, i32 %86)
%88 = load i32, i32* %18
%89 = icmp eq i32 %88, 0
br i1 %89, label %90, label %137
90: ; preds = %69
%91 = load i32, i32* %20
%92 = icmp eq i32 %91, 0
br i1 %92, label %93, label %137
93: ; preds = %90
%94 = load i64, i64* %6
%95 = sub i64 %94, 8
%96 = call double* @malloc(i64 %95)
store double* %96, double** %26
%97 = load double*, double** %23
%98 = load double*, double** %26
%99 = load i64, i64* %6
%100 = call i32 @arr_diff(double* %97, double* %98, i64 %99)
%101 = load double*, double** %26
%102 = load i64, i64* %6
%103 = sub i64 %102, 1
%104 = call double @arr_median(double* %101, i64 %103)
%105 = fmul double 2.000000e+00, %104
%106 = fdiv double 1.000000e+00, %105
%107 = fmul double %106, 1.000000e+06
store double %107, double* %27
%108 = load double*, double** %26
%109 = call i32 @free(double* %108)
%110 = load double*, double** %23
%111 = load i64, i64* %6
%112 = sub i64 %111, 1
%113 = getelementptr inbounds double, double* %110, i64 %112
%114 = load double, double* %113
%115 = load double*, double** %23
%116 = getelementptr inbounds double, double* %115, i64 0
%117 = load double, double* %116
%118 = fsub double %114, %117
%119 = fmul double 4.000000e+00, %118
%120 = fdiv double 1.000000e+06, %119
store double %120, double* %28
%121 = load i32, i32* %14
%122 = icmp eq i32 %121, 0
br i1 %122, label %123, label %130
123: ; preds = %93
%124 = load i64, i64* %6
%125 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i64 %124)
%126 = load double, double* %27
%127 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0), double %126)
%128 = load double, double* %28
%129 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.6, i64 0, i64 0), double %128)
br label %130
130: ; preds = %123, %93
%131 = load i32, i32* %17
%132 = icmp ne i32 %131, 0
br i1 %132, label %133, label %136
133: ; preds = %130
store double 5.000000e+00, double* %10
%134 = load double, double* %27
store double %134, double* %11
%135 = load double, double* %28
store double %135, double* %12
br label %136
136: ; preds = %133, %130
br label %137
137: ; preds = %136, %90, %69
store double 0.000000e+00, double* %29
%138 = load i32, i32* %20
%139 = icmp ne i32 %138, 0
br i1 %139, label %140, label %148
140: ; preds = %137
%141 = load double, double* %10
store double %141, double* %29
%142 = load double, double* %13
%143 = load double, double* %29
%144 = fsub double %142, %143
store double %144, double* %10
%145 = load double, double* %13
%146 = load double, double* %29
%147 = fadd double %145, %146
store double %147, double* %11
br label %148
148: ; preds = %140, %137
%149 = load double, double* %10
%150 = load double, double* %11
%151 = load double, double* %12
%152 = call i64 @arr_util_getstep(double %149, double %150, double %151)
store i64 %152, i64* %7
%153 = load i64, i64* %7
%154 = mul i64 %153, 8
%155 = call double* @malloc(i64 %154)
store double* %155, double** %30
%156 = load double*, double** %30
%157 = load double, double* %10
%158 = load double, double* %12
%159 = load i64, i64* %7
%160 = call i32 @arr_init_linspace(double* %156, double %157, double %158, i64 %159)
%161 = load i64, i64* %7
%162 = mul i64 %161, 8
%163 = call double* @malloc(i64 %162)
store double* %163, double** %31
%164 = load i64, i64* %7
%165 = mul i64 %164, 8
%166 = call double* @malloc(i64 %165)
store double* %166, double** %32
%167 = load i64, i64* %7
%168 = mul i64 %167, 8
%169 = call double* @malloc(i64 %168)
store double* %169, double** %33
%170 = load i32, i32* %20
%171 = icmp eq i32 %170, 0
br i1 %171, label %172, label %227
172: ; preds = %148
%173 = load i32, i32* %16
%174 = icmp ne i32 %173, 0
br i1 %174, label %175, label %188
175: ; preds = %172
%176 = load i32, i32* %14
%177 = icmp eq i32 %176, 0
br i1 %177, label %178, label %180
178: ; preds = %175
%179 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0))
br label %180
180: ; preds = %178, %175
%181 = load double*, double** %24
%182 = load double*, double** %24
%183 = load i64, i64* %6
%184 = call double @arr_mean(double* %182, i64 %183)
%185 = fneg double %184
%186 = load i64, i64* %6
%187 = call i32 @arr_sca_add(double* %181, double %185, i64 %186)
br label %194
188: ; preds = %172
%189 = load i32, i32* %14
%190 = icmp eq i32 %189, 0
br i1 %190, label %191, label %193
191: ; preds = %188
%192 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.8, i64 0, i64 0))
br label %193
193: ; preds = %191, %188
br label %194
194: ; preds = %193, %180
%195 = load i32, i32* %14
%196 = icmp eq i32 %195, 0
br i1 %196, label %197, label %215
197: ; preds = %194
%198 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0))
%199 = load i32, i32* %17
%200 = icmp ne i32 %199, 0
br i1 %200, label %201, label %207
201: ; preds = %197
%202 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.10, i64 0, i64 0))
%203 = load double, double* %10
%204 = load double, double* %11
%205 = load double, double* %12
%206 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.11, i64 0, i64 0), double %203, double %204, double %205)
br label %212
207: ; preds = %197
%208 = load double, double* %10
%209 = load double, double* %11
%210 = load double, double* %12
%211 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.12, i64 0, i64 0), double %208, double %209, double %210)
br label %212
212: ; preds = %207, %201
%213 = load i64, i64* %7
%214 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.13, i64 0, i64 0), i64 %213)
br label %215
215: ; preds = %212, %194
%216 = load double*, double** %23
%217 = load double*, double** %24
%218 = load double*, double** %25
%219 = load double*, double** %30
%220 = load i64, i64* %6
%221 = load i64, i64* %7
%222 = load double*, double** %31
%223 = load double*, double** %32
%224 = load double*, double** %33
%225 = load i32, i32* %19
%226 = call i32 @fourier(double* %216, double* %217, double* %218, double* %219, i64 %220, i64 %221, double* %222, double* %223, double* %224, i32 %225)
br label %262
227: ; preds = %148
%228 = load i32, i32* %14
%229 = icmp eq i32 %228, 0
br i1 %229, label %230, label %239
230: ; preds = %227
%231 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.14, i64 0, i64 0))
%232 = load double, double* %13
%233 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.15, i64 0, i64 0), double %232)
%234 = load double, double* %29
%235 = load double, double* %12
%236 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.16, i64 0, i64 0), double %234, double %235)
%237 = load i64, i64* %7
%238 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.13, i64 0, i64 0), i64 %237)
br label %239
239: ; preds = %230, %227
%240 = load double*, double** %23
%241 = load double*, double** %30
%242 = load double*, double** %25
%243 = load i64, i64* %6
%244 = load i64, i64* %7
%245 = load double, double* %13
%246 = load double*, double** %31
%247 = load i32, i32* %19
%248 = call i32 @windowfunction(double* %240, double* %241, double* %242, i64 %243, i64 %244, double %245, double* %246, i32 %247)
%249 = load i32, i32* %14
%250 = icmp eq i32 %249, 0
br i1 %250, label %251, label %256
251: ; preds = %239
%252 = load double*, double** %31
%253 = load i64, i64* %7
%254 = call i32 @arr_sum(double* %252, i64 %253)
%255 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.17, i64 0, i64 0), i32 %254)
br label %256
256: ; preds = %251, %239
%257 = load double*, double** %30
%258 = load double, double* %13
%259 = fneg double %258
%260 = load i64, i64* %7
%261 = call i32 @arr_sca_add(double* %257, double %259, i64 %260)
br label %262
262: ; preds = %256, %215
%263 = load i32, i32* %14
%264 = icmp eq i32 %263, 0
br i1 %264, label %265, label %268
265: ; preds = %262
%266 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%267 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.18, i64 0, i64 0), i8* %266)
br label %268
268: ; preds = %265, %262
%269 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%270 = load double*, double** %30
%271 = load double*, double** %31
%272 = load i64, i64* %7
%273 = call i32 @writecols(i8* %269, double* %270, double* %271, i64 %272)
%274 = load double*, double** %23
%275 = call i32 @free(double* %274)
%276 = load double*, double** %24
%277 = call i32 @free(double* %276)
%278 = load double*, double** %25
%279 = call i32 @free(double* %278)
%280 = load double*, double** %30
%281 = call i32 @free(double* %280)
%282 = load double*, double** %31
%283 = call i32 @free(double* %282)
%284 = load double*, double** %32
%285 = call i32 @free(double* %284)
%286 = load double*, double** %33
%287 = call i32 @free(double* %286)
%288 = load i32, i32* %14
%289 = icmp eq i32 %288, 0
br i1 %289, label %293, label %290
290: ; preds = %268
%291 = load i32, i32* %18
%292 = icmp eq i32 %291, 1
br i1 %292, label %293, label %295
293: ; preds = %290, %268
%294 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.19, i64 0, i64 0))
br label %295
295: ; preds = %293, %290
ret i32 0
}

LLVM IR (-O2):
@.str = [54 x i8] c"\0ACalculating the weighted power spectrum of \22%s\22 ...\0A\00"
@.str.1 = [45 x i8] c"\0ACalculating the power spectrum of \22%s\22 ...\0A\00"
@.str.2 = [46 x i8] c"\0ACalculating the window function of \22%s\22 ...\0A\00"
@.str.4 = [39 x i8] c" -- INFO: Length of time series = %li\0A\00"
@.str.5 = [45 x i8] c" -- INFO: Nyquist frequency = %.2lf microHz\0A\00"
@.str.6 = [54 x i8] c" -- INFO: Suggested minimum sampling = %.3lf microHz\0A\00"
@.str.11 = [72 x i8] c" -- INFO: Auto-sampling (in microHz): %.2lf to %.2lf in steps of %.4lf\0A\00"
@.str.12 = [67 x i8] c" -- INFO: Sampling (in microHz): %.2lf to %.2lf in steps of %.4lf\0A\00"
@.str.13 = [48 x i8] c" -- INFO: Number of sampling frequencies = %li\0A\00"
@.str.15 = [44 x i8] c" -- INFO: Window frequency = %.2lf microHz\0A\00"
@.str.16 = [77 x i8] c" -- INFO: Sampling in the range +/- %.2lf microHz in steps of %.4lf microHz\0A\00"
@.str.17 = [35 x i8] c" - Sum of spectral window = %.4lf\0A\00"
@.str.18 = [24 x i8] c" - Saving to file \22%s\22\0A\00"
@str = [7 x i8] c"Done!\0A\00"
@str.20 = [31 x i8] c" - Calculating window function\00"
@str.21 = [33 x i8] c" - Calculating fourier transform\00"
@str.22 = [34 x i8] c" -- NB: Using automatic sampling!\00"
@str.23 = [48 x i8] c" - Time series used *without* mean subtraction!\00"
@str.24 = [41 x i8] c" - Subtracting the mean from time series\00"
@str.25 = [17 x i8] c" - Reading input\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [100 x i8]
%4 = alloca [100 x i8]
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%20 = bitcast double* %5 to i8*
%21 = bitcast double* %6 to i8*
%22 = bitcast double* %7 to i8*
%23 = bitcast double* %8 to i8*
store double 0.000000e+00, double* %8
%24 = bitcast i32* %9 to i8*
store i32 0, i32* %9
%25 = bitcast i32* %10 to i8*
store i32 1, i32* %10
%26 = bitcast i32* %11 to i8*
store i32 1, i32* %11
%27 = bitcast i32* %12 to i8*
store i32 0, i32* %12
%28 = bitcast i32* %13 to i8*
store i32 0, i32* %13
%29 = bitcast i32* %14 to i8*
store i32 0, i32* %14
%30 = bitcast i32* %15 to i8*
store i32 0, i32* %15
%31 = bitcast i32* %16 to i8*
store i32 0, i32* %16
%32 = bitcast i32* %17 to i8*
store i32 0, i32* %17
%33 = call i64 @cmdarg(i32 %0, i8** %1, i8* %18, i8* %19, i32* %9, i32* %10, i32* %11, double* %5, double* %6, double* %7, i32* %12, i32* %13, i32* %14, i32* %15, double* %8, i32* %16, i32* %17, i32* null, i32* null)
%34 = load i32, i32* %9
%35 = icmp eq i32 %34, 0
%36 = load i32, i32* %13
%37 = icmp eq i32 %36, 1
%38 = select i1 %35, i1 true, i1 %37
br i1 %38, label %39, label %53
39: ; preds = %2
%40 = load i32, i32* %15
%41 = icmp eq i32 %40, 0
%42 = load i32, i32* %14
%43 = icmp ne i32 %42, 0
%44 = select i1 %41, i1 %43, i1 false
%45 = select i1 %41, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0)
%46 = select i1 %44, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i8* %45
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %46, i8* %18)
%48 = load i32, i32* %9
%49 = icmp eq i32 %48, 0
br i1 %49, label %50, label %53
50: ; preds = %39
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.25, i64 0, i64 0))
%52 = load i32, i32* %9
br label %53
53: ; preds = %2, %50, %39
%54 = phi i32 [ %34, %2 ], [ %52, %50 ], [ %48, %39 ]
%55 = shl i64 %33, 3
%56 = call double* @malloc(i64 %55)
%57 = call double* @malloc(i64 %55)
%58 = call double* @malloc(i64 %55)
%59 = load i32, i32* %14
%60 = load i32, i32* %10
%61 = call i32 @readcols(i8* %18, double* %56, double* %57, double* %58, i64 %33, i32 %59, i32 %60, i32 %54)
%62 = load i32, i32* %13
%63 = icmp eq i32 %62, 0
%64 = load i32, i32* %15
%65 = icmp eq i32 %64, 0
%66 = select i1 %63, i1 %65, i1 false
br i1 %66, label %67, label %95
67: ; preds = %53
%68 = add i64 %33, -8
%69 = call double* @malloc(i64 %68)
%70 = call i32 @arr_diff(double* %56, double* %69, i64 %33)
%71 = add i64 %33, -1
%72 = call double @arr_median(double* %69, i64 %71)
%73 = fmul double %72, 2.000000e+00
%74 = fdiv double 1.000000e+00, %73
%75 = fmul double %74, 1.000000e+06
%76 = call i32 @free(double* %69)
%77 = getelementptr inbounds double, double* %56, i64 %71
%78 = load double, double* %77
%79 = load double, double* %56
%80 = fsub double %78, %79
%81 = fmul double %80, 4.000000e+00
%82 = fdiv double 1.000000e+06, %81
%83 = load i32, i32* %9
%84 = icmp eq i32 %83, 0
br i1 %84, label %85, label %89
85: ; preds = %67
%86 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i64 %33)
%87 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0), double %75)
%88 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.6, i64 0, i64 0), double %82)
br label %89
89: ; preds = %85, %67
%90 = load i32, i32* %12
%91 = icmp eq i32 %90, 0
br i1 %91, label %93, label %92
92: ; preds = %89
store double 5.000000e+00, double* %5
store double %75, double* %6
store double %82, double* %7
br label %93
93: ; preds = %92, %89
%94 = load i32, i32* %15
br label %95
95: ; preds = %93, %53
%96 = phi i32 [ %94, %93 ], [ %64, %53 ]
%97 = icmp eq i32 %96, 0
%98 = load double, double* %5
br i1 %97, label %99, label %101
99: ; preds = %95
%100 = load double, double* %6
br label %105
101: ; preds = %95
%102 = load double, double* %8
%103 = fsub double %102, %98
store double %103, double* %5
%104 = fadd double %98, %102
store double %104, double* %6
br label %105
105: ; preds = %99, %101
%106 = phi double [ %104, %101 ], [ %100, %99 ]
%107 = phi double [ %103, %101 ], [ %98, %99 ]
%108 = phi double [ %98, %101 ], [ 0.000000e+00, %99 ]
%109 = load double, double* %7
%110 = call i64 @arr_util_getstep(double %107, double %106, double %109)
%111 = shl i64 %110, 3
%112 = call double* @malloc(i64 %111)
%113 = load double, double* %5
%114 = load double, double* %7
%115 = call i32 @arr_init_linspace(double* %112, double %113, double %114, i64 %110)
%116 = call double* @malloc(i64 %111)
%117 = call double* @malloc(i64 %111)
%118 = call double* @malloc(i64 %111)
%119 = load i32, i32* %15
%120 = icmp eq i32 %119, 0
br i1 %120, label %121, label %159
121: ; preds = %105
%122 = load i32, i32* %11
%123 = icmp eq i32 %122, 0
%124 = load i32, i32* %9
%125 = icmp eq i32 %124, 0
br i1 %123, label %133, label %126
126: ; preds = %121
br i1 %125, label %127, label %129
127: ; preds = %126
%128 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.24, i64 0, i64 0))
br label %129
129: ; preds = %127, %126
%130 = call double @arr_mean(double* %57, i64 %33)
%131 = fneg double %130
%132 = call i32 @arr_sca_add(double* %57, double %131, i64 %33)
br label %136
133: ; preds = %121
br i1 %125, label %134, label %156
134: ; preds = %133
%135 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.23, i64 0, i64 0))
br label %136
136: ; preds = %134, %129
%137 = load i32, i32* %9
%138 = icmp eq i32 %137, 0
br i1 %138, label %139, label %156
139: ; preds = %136
%140 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.21, i64 0, i64 0))
%141 = load i32, i32* %12
%142 = icmp eq i32 %141, 0
br i1 %142, label %149, label %143
143: ; preds = %139
%144 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.22, i64 0, i64 0))
%145 = load double, double* %5
%146 = load double, double* %6
%147 = load double, double* %7
%148 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @.str.11, i64 0, i64 0), double %145, double %146, double %147)
br label %154
149: ; preds = %139
%150 = load double, double* %5
%151 = load double, double* %6
%152 = load double, double* %7
%153 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @.str.12, i64 0, i64 0), double %150, double %151, double %152)
br label %154
154: ; preds = %149, %143
%155 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.13, i64 0, i64 0), i64 %110)
br label %156
156: ; preds = %133, %154, %136
%157 = load i32, i32* %14
%158 = call i32 @fourier(double* %56, double* %57, double* %58, double* %112, i64 %33, i64 %110, double* %116, double* %117, double* %118, i32 %157)
br label %182
159: ; preds = %105
%160 = load i32, i32* %9
%161 = icmp eq i32 %160, 0
br i1 %161, label %162, label %169
162: ; preds = %159
%163 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.20, i64 0, i64 0))
%164 = load double, double* %8
%165 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.15, i64 0, i64 0), double %164)
%166 = load double, double* %7
%167 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @.str.16, i64 0, i64 0), double %108, double %166)
%168 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.13, i64 0, i64 0), i64 %110)
br label %169
169: ; preds = %162, %159
%170 = load double, double* %8
%171 = load i32, i32* %14
%172 = call i32 @windowfunction(double* %56, double* %112, double* %58, i64 %33, i64 %110, double %170, double* %116, i32 %171)
%173 = load i32, i32* %9
%174 = icmp eq i32 %173, 0
br i1 %174, label %175, label %178
175: ; preds = %169
%176 = call i32 @arr_sum(double* %116, i64 %110)
%177 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.17, i64 0, i64 0), i32 %176)
br label %178
178: ; preds = %175, %169
%179 = load double, double* %8
%180 = fneg double %179
%181 = call i32 @arr_sca_add(double* %112, double %180, i64 %110)
br label %182
182: ; preds = %178, %156
%183 = load i32, i32* %9
%184 = icmp eq i32 %183, 0
br i1 %184, label %185, label %187
185: ; preds = %182
%186 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.18, i64 0, i64 0), i8* %19)
br label %187
187: ; preds = %185, %182
%188 = call i32 @writecols(i8* %19, double* %112, double* %116, i64 %110)
%189 = call i32 @free(double* %56)
%190 = call i32 @free(double* %57)
%191 = call i32 @free(double* %58)
%192 = call i32 @free(double* %112)
%193 = call i32 @free(double* %116)
%194 = call i32 @free(double* %117)
%195 = call i32 @free(double* %118)
%196 = load i32, i32* %9
%197 = icmp eq i32 %196, 0
%198 = load i32, i32* %13
%199 = icmp eq i32 %198, 1
%200 = select i1 %197, i1 true, i1 %199
br i1 %200, label %201, label %203
201: ; preds = %187
%202 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
br label %203
203: ; preds = %187, %201
ret i32 0
}