#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);
double arr_median(double *, size_t);
int /*<<< orphan*/ bandpass(double *, double *, double *, size_t, double,
                            double, double, double, double, double *, int, int);
size_t cmdarg(int, char **, char *, char *, int *, int *, int /*<<< orphan*/ *,
              double *, double *, double *, int *, int *, int *,
              int /*<<< orphan*/ *, int /*<<< orphan*/ *, int *, int *,
              double *, double *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(double *);
int /*<<< orphan*/ highpass(double *, double *, double *, size_t, double,
                            double, double, double, double *, int, int);
int /*<<< orphan*/ lowpass(double *, double *, double *, size_t, double, double,
                           double, double, double *, int, int);
double *malloc(size_t);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ readcols(char *, double *, double *, double *, size_t, int,
                            int, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ writecols3(char *, double *, double *, double *, size_t, int,
                              int);
int main(int argc, char *argv[]) {
  size_t N = 0;
  char inname[100];
  char outname[100];
  double low, high, rate;
  int quiet = 0;
  int unit = 1;
  int autosamp = 0;
  int fast = 0;
  int useweight = 0;
  int Nclean = 0;
  int filter = 1;
  double fstart = 0;
  double fstop = 0;
  N = cmdarg(argc, argv, inname, outname, &quiet, &unit, NULL, &low, &high,
             &rate, &autosamp, &fast, &useweight, NULL, NULL, &Nclean, &filter,
             &fstart, &fstop);
  if (quiet == 0 || fast == 1) {
    if (useweight != 0)
      printf("\nFiltering the time series \"%s\" using weights...\n", inname);
    else
      printf("\nFiltering the time series \"%s\" without weights...\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) {
    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 *filt = malloc(N * sizeof(double));
  if (filter == 2) {
    if (quiet == 0) {
      printf(" - Calculating bandpass filter between %.2lf and %.2lf"
             " microHz\n",
             fstart, fstop);
    }
    bandpass(time, flux, weight, N, fstart, fstop, low, high, rate, filt,
             useweight, quiet);
  } else if (filter == 3) {
    if (quiet == 0) {
      printf(" - Calculating lowpass filter up to %.2lf microHz\n", fstop);
    }
    lowpass(time, flux, weight, N, fstop, low, high, rate, filt, useweight,
            quiet);
  } else if (filter == 4) {
    if (quiet == 0) {
      printf(" - Calculating highpass filter from %.2lf microHz\n", fstop);
    }
    highpass(time, flux, weight, N, fstop, low, high, rate, filt, useweight,
             quiet);
  } else {
    fprintf(stderr, "ERROR: Unknown filter chosen !");
  }
  if (quiet == 0)
    printf(" - Saving to file \"%s\"\n", outname);
  writecols3(outname, time, filt, weight, N, useweight, unit);
  free(time);
  free(flux);
  free(weight);
  free(filt);
  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    $0x1f8,%rsp
movl   $0x0,-0x2c(%rbp)
mov    %edi,-0x30(%rbp)
mov    %rsi,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
movl   $0x0,-0x13c(%rbp)
movl   $0x1,-0x140(%rbp)
movl   $0x0,-0x144(%rbp)
movl   $0x0,-0x148(%rbp)
movl   $0x0,-0x14c(%rbp)
movl   $0x0,-0x150(%rbp)
movl   $0x1,-0x154(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x160(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x168(%rbp)
ff
mov    -0x30(%rbp),%edi
mov    -0x38(%rbp),%rsi
lea    -0xb0(%rbp),%rdx
lea    -0x120(%rbp),%rcx
lea    -0x13c(%rbp),%r8
lea    -0x140(%rbp),%r9
xor    %eax,%eax
lea    -0x128(%rbp),%rax
mov    %rax,-0x1b8(%rbp)
lea    -0x130(%rbp),%rax
mov    %rax,-0x1b0(%rbp)
lea    -0x138(%rbp),%r13
lea    -0x144(%rbp),%r12
lea    -0x148(%rbp),%r15
lea    -0x14c(%rbp),%r14
lea    -0x150(%rbp),%rbx
lea    -0x154(%rbp),%r11
lea    -0x160(%rbp),%r10
lea    -0x168(%rbp),%rax
mov    %rax,-0x1a8(%rbp)
mov    -0x1b8(%rbp),%rax
movq   $0x0,(%rsp)
mov    %rax,0x8(%rsp)
mov    -0x1b0(%rbp),%rax
mov    %rax,0x10(%rsp)
mov    -0x1a8(%rbp),%rax
mov    %r13,0x18(%rsp)
mov    %r12,0x20(%rsp)
mov    %r15,0x28(%rsp)
mov    %r14,0x30(%rsp)
movq   $0x0,0x38(%rsp)
movq   $0x0,0x40(%rsp)
mov    %rbx,0x48(%rsp)
mov    %r11,0x50(%rsp)
mov    %r10,0x58(%rsp)
mov    %rax,0x60(%rsp)
call   10a0 <cmdarg@plt>
mov    %rax,-0x40(%rbp)
cmpl   $0x0,-0x13c(%rbp)
je     134a <main+0x18a>
cmpl   $0x1,-0x148(%rbp)
jne    138b <main+0x1cb>
cmpl   $0x0,-0x14c(%rbp)
je     1371 <main+0x1b1>
lea    -0xb0(%rbp),%rsi
lea    0xcc3(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1386 <main+0x1c6>
lea    -0xb0(%rbp),%rsi
lea    0xcdb(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    138b <main+0x1cb>
cmpl   $0x0,-0x13c(%rbp)
jne    13a6 <main+0x1e6>
lea    0xcef(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x40(%rbp),%rdi
shl    $0x3,%rdi
call   10b0 <malloc@plt>
mov    %rax,-0x170(%rbp)
mov    -0x40(%rbp),%rdi
shl    $0x3,%rdi
call   10b0 <malloc@plt>
mov    %rax,-0x178(%rbp)
mov    -0x40(%rbp),%rdi
shl    $0x3,%rdi
call   10b0 <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    -0x14c(%rbp),%r9d
mov    -0x140(%rbp),%r10d
mov    -0x13c(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   10c0 <readcols@plt>
cmpl   $0x0,-0x148(%rbp)
jne    1573 <main+0x3b3>
mov    -0x40(%rbp),%rdi
sub    $0x8,%rdi
call   10b0 <malloc@plt>
mov    %rax,-0x188(%rbp)
mov    -0x170(%rbp),%rdi
mov    -0x188(%rbp),%rsi
mov    -0x40(%rbp),%rdx
call   1050 <arr_diff@plt>
mov    -0x188(%rbp),%rdi
mov    -0x40(%rbp),%rsi
sub    $0x1,%rsi
call   1080 <arr_median@plt>
movsd  0xba1(%rip),%xmm1
mulsd  %xmm0,%xmm1
movsd  0xb8d(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  0xb71(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x190(%rbp)
ff
mov    -0x188(%rbp),%rdi
call   1030 <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  0xb3a(%rip),%xmm1
mulsd  %xmm0,%xmm1
movsd  0xb26(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x198(%rbp)
ff
cmpl   $0x0,-0x13c(%rbp)
jne    1531 <main+0x371>
mov    -0x40(%rbp),%rsi
lea    0xba2(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movsd  -0x190(%rbp),%xmm0
ff
lea    0xbb3(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
movsd  -0x198(%rbp),%xmm0
ff
lea    0xbca(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
cmpl   $0x0,-0x144(%rbp)
je     156e <main+0x3ae>
movsd  0xada(%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    1573 <main+0x3b3>
mov    -0x40(%rbp),%rdi
shl    $0x3,%rdi
call   10b0 <malloc@plt>
mov    %rax,-0x1a0(%rbp)
cmpl   $0x2,-0x154(%rbp)
jne    1621 <main+0x461>
cmpl   $0x0,-0x13c(%rbp)
jne    15bf <main+0x3ff>
movsd  -0x160(%rbp),%xmm0
ff
movsd  -0x168(%rbp),%xmm1
ff
lea    0xb72(%rip),%rdi
mov    $0x2,%al
call   1070 <printf@plt>
mov    -0x170(%rbp),%rdi
mov    -0x178(%rbp),%rsi
mov    -0x180(%rbp),%rdx
mov    -0x40(%rbp),%rcx
movsd  -0x160(%rbp),%xmm0
ff
movsd  -0x168(%rbp),%xmm1
ff
movsd  -0x128(%rbp),%xmm2
ff
movsd  -0x130(%rbp),%xmm3
ff
movsd  -0x138(%rbp),%xmm4
ff
mov    -0x1a0(%rbp),%r8
mov    -0x14c(%rbp),%r9d
mov    -0x13c(%rbp),%eax
mov    %eax,(%rsp)
call   1060 <bandpass@plt>
jmp    1754 <main+0x594>
cmpl   $0x3,-0x154(%rbp)
jne    16ab <main+0x4eb>
cmpl   $0x0,-0x13c(%rbp)
jne    1651 <main+0x491>
movsd  -0x168(%rbp),%xmm0
ff
lea    0xb20(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
mov    -0x170(%rbp),%rdi
mov    -0x178(%rbp),%rsi
mov    -0x180(%rbp),%rdx
mov    -0x40(%rbp),%rcx
movsd  -0x168(%rbp),%xmm0
ff
movsd  -0x128(%rbp),%xmm1
ff
movsd  -0x130(%rbp),%xmm2
ff
movsd  -0x138(%rbp),%xmm3
ff
mov    -0x1a0(%rbp),%r8
mov    -0x14c(%rbp),%r9d
mov    -0x13c(%rbp),%eax
mov    %eax,(%rsp)
call   1040 <lowpass@plt>
jmp    174f <main+0x58f>
cmpl   $0x4,-0x154(%rbp)
jne    1735 <main+0x575>
cmpl   $0x0,-0x13c(%rbp)
jne    16db <main+0x51b>
movsd  -0x168(%rbp),%xmm0
ff
lea    0xac9(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
mov    -0x170(%rbp),%rdi
mov    -0x178(%rbp),%rsi
mov    -0x180(%rbp),%rdx
mov    -0x40(%rbp),%rcx
movsd  -0x168(%rbp),%xmm0
ff
movsd  -0x128(%rbp),%xmm1
ff
movsd  -0x130(%rbp),%xmm2
ff
movsd  -0x138(%rbp),%xmm3
ff
mov    -0x1a0(%rbp),%r8
mov    -0x14c(%rbp),%r9d
mov    -0x13c(%rbp),%eax
mov    %eax,(%rsp)
call   10d0 <highpass@plt>
jmp    174a <main+0x58a>
mov    0x28a4(%rip),%rax
mov    (%rax),%edi
lea    0xa8b(%rip),%rsi
call   1090 <fprintf@plt>
jmp    174f <main+0x58f>
jmp    1754 <main+0x594>
cmpl   $0x0,-0x13c(%rbp)
jne    1776 <main+0x5b6>
lea    -0x120(%rbp),%rsi
lea    0xa80(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x120(%rbp),%rdi
mov    -0x170(%rbp),%rsi
mov    -0x1a0(%rbp),%rdx
mov    -0x180(%rbp),%rcx
mov    -0x40(%rbp),%r8
mov    -0x14c(%rbp),%r9d
mov    -0x140(%rbp),%eax
mov    %eax,(%rsp)
call   10e0 <writecols3@plt>
mov    -0x170(%rbp),%rdi
call   1030 <free@plt>
mov    -0x178(%rbp),%rdi
call   1030 <free@plt>
mov    -0x180(%rbp),%rdi
call   1030 <free@plt>
mov    -0x1a0(%rbp),%rdi
call   1030 <free@plt>
cmpl   $0x0,-0x13c(%rbp)
je     17f5 <main+0x635>
cmpl   $0x1,-0x148(%rbp)
jne    1803 <main+0x643>
lea    0xa0b(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
xor    %eax,%eax
add    $0x1f8,%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    $0x1a8,%rsp
movl   $0x0,0x74(%rsp)
movl   $0x1,0x8c(%rsp)
movl   $0x0,0x94(%rsp)
movl   $0x0,0x7c(%rsp)
movl   $0x0,0x78(%rsp)
movl   $0x0,0xc4(%rsp)
movl   $0x1,0x90(%rsp)
movq   $0x0,0xb8(%rsp)
movq   $0x0,0x80(%rsp)
lea    0x80(%rsp),%rax
mov    %rax,0x60(%rsp)
lea    0xb8(%rsp),%rax
mov    %rax,0x58(%rsp)
lea    0x90(%rsp),%rax
mov    %rax,0x50(%rsp)
lea    0xc4(%rsp),%rax
mov    %rax,0x48(%rsp)
xorpd  %xmm0,%xmm0
movupd %xmm0,0x38(%rsp)
lea    0x78(%rsp),%rax
mov    %rax,0x30(%rsp)
lea    0x7c(%rsp),%rax
mov    %rax,0x28(%rsp)
lea    0x94(%rsp),%rax
mov    %rax,0x20(%rsp)
lea    0xa0(%rsp),%rax
mov    %rax,0x18(%rsp)
lea    0xa8(%rsp),%rax
mov    %rax,0x10(%rsp)
lea    0xb0(%rsp),%rax
mov    %rax,0x8(%rsp)
movq   $0x0,(%rsp)
lea    0x140(%rsp),%rdx
lea    0xd0(%rsp),%rcx
lea    0x74(%rsp),%r8
lea    0x8c(%rsp),%r9
call   10b0 <cmdarg@plt>
mov    %rax,%r14
mov    0x74(%rsp),%ebp
test   %ebp,%ebp
je     12ff <main+0x12f>
cmpl   $0x1,0x7c(%rsp)
jne    133d <main+0x16d>
cmpl   $0x0,0x78(%rsp)
lea    0xd3f(%rip),%rax
lea    0xd06(%rip),%rdi
cmove  %rax,%rdi
lea    0x140(%rsp),%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x74(%rsp),%ebp
test   %ebp,%ebp
jne    133d <main+0x16d>
lea    0xeb8(%rip),%rdi
call   1050 <puts@plt>
mov    0x74(%rsp),%ebp
lea    0x0(,%r14,8),%r13
mov    %r13,%rdi
call   10c0 <malloc@plt>
mov    %rax,%r15
mov    %r13,%rdi
call   10c0 <malloc@plt>
mov    %rax,%rbx
mov    %r13,%rdi
call   10c0 <malloc@plt>
mov    %rax,%r12
mov    0x78(%rsp),%r9d
mov    0x8c(%rsp),%eax
mov    %ebp,0x8(%rsp)
mov    %eax,(%rsp)
lea    0x140(%rsp),%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
mov    %r12,%rcx
mov    %r14,%r8
call   10d0 <readcols@plt>
cmpl   $0x0,0x7c(%rsp)
jne    14ac <main+0x2dc>
lea    -0x8(%r14),%rdi
call   10c0 <malloc@plt>
mov    %rax,%rbp
mov    %r15,%rdi
mov    %rax,%rsi
mov    %r14,%rdx
call   1060 <arr_diff@plt>
mov    %r14,%rsi
add    $0xffffffffffffffff,%rsi
mov    %rbp,%rdi
call   1090 <arr_median@plt>
addsd  %xmm0,%xmm0
movsd  0xc2e(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  0xc2a(%rip),%xmm0
movsd  %xmm0,0x98(%rsp)
mulsd  %xmm0,%xmm1
movsd  %xmm1,0xc8(%rsp)
mov    %rbp,%rdi
call   1030 <free@plt>
movsd  -0x8(%r15,%r14,8),%xmm0
subsd  (%r15),%xmm0
mulsd  0xc00(%rip),%xmm0
movsd  0x98(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x98(%rsp)
cmpl   $0x0,0x74(%rsp)
jne    146c <main+0x29c>
lea    0xc4a(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xc60(%rip),%rdi
movsd  0xc8(%rsp),%xmm0
mov    $0x1,%al
call   1080 <printf@plt>
lea    0xc76(%rip),%rdi
movsd  0x98(%rsp),%xmm0
mov    $0x1,%al
call   1080 <printf@plt>
cmpl   $0x0,0x94(%rsp)
je     14ac <main+0x2dc>
movabs $0x4014000000000000,%rax
mov    %rax,0xb0(%rsp)
movsd  0xc8(%rsp),%xmm0
movsd  %xmm0,0xa8(%rsp)
movsd  0x98(%rsp),%xmm0
movsd  %xmm0,0xa0(%rsp)
mov    %r13,%rdi
call   10c0 <malloc@plt>
mov    %rax,%r13
mov    0x90(%rsp),%eax
cmp    $0x4,%eax
je     155e <main+0x38e>
cmp    $0x3,%eax
je     15d1 <main+0x401>
cmp    $0x2,%eax
jne    163d <main+0x46d>
mov    0x74(%rsp),%eax
test   %eax,%eax
jne    1505 <main+0x335>
movsd  0xb8(%rsp),%xmm0
movsd  0x80(%rsp),%xmm1
lea    0xc0e(%rip),%rdi
mov    $0x2,%al
call   1080 <printf@plt>
mov    0x74(%rsp),%eax
movsd  0xb8(%rsp),%xmm0
movsd  0x80(%rsp),%xmm1
movsd  0xb0(%rsp),%xmm2
movsd  0xa8(%rsp),%xmm3
movsd  0xa0(%rsp),%xmm4
mov    0x78(%rsp),%r9d
mov    %eax,(%rsp)
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r14,%rcx
mov    %r13,%r8
call   1070 <bandpass@plt>
cmpl   $0x0,0x74(%rsp)
jne    166f <main+0x49f>
jmp    1659 <main+0x489>
mov    0x74(%rsp),%eax
test   %eax,%eax
jne    1581 <main+0x3b1>
movsd  0x80(%rsp),%xmm0
lea    0xc05(%rip),%rdi
mov    $0x1,%al
call   1080 <printf@plt>
mov    0x74(%rsp),%eax
movsd  0x80(%rsp),%xmm0
movsd  0xb0(%rsp),%xmm1
movsd  0xa8(%rsp),%xmm2
movsd  0xa0(%rsp),%xmm3
mov    0x78(%rsp),%r9d
mov    %eax,(%rsp)
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r14,%rcx
mov    %r13,%r8
call   10e0 <highpass@plt>
cmpl   $0x0,0x74(%rsp)
jne    166f <main+0x49f>
jmp    1659 <main+0x489>
mov    0x74(%rsp),%eax
test   %eax,%eax
jne    15f4 <main+0x424>
movsd  0x80(%rsp),%xmm0
lea    0xb5f(%rip),%rdi
mov    $0x1,%al
call   1080 <printf@plt>
mov    0x74(%rsp),%eax
movsd  0x80(%rsp),%xmm0
movsd  0xb0(%rsp),%xmm1
movsd  0xa8(%rsp),%xmm2
movsd  0xa0(%rsp),%xmm3
mov    0x78(%rsp),%r9d
mov    %eax,(%rsp)
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r14,%rcx
mov    %r13,%r8
call   1040 <lowpass@plt>
cmpl   $0x0,0x74(%rsp)
jne    166f <main+0x49f>
jmp    1659 <main+0x489>
mov    0x299c(%rip),%rax
mov    (%rax),%edi
lea    0xb61(%rip),%rsi
call   10a0 <fprintf@plt>
cmpl   $0x0,0x74(%rsp)
jne    166f <main+0x49f>
lea    0xb6d(%rip),%rdi
lea    0xd0(%rsp),%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x78(%rsp),%r9d
mov    0x8c(%rsp),%eax
mov    %eax,(%rsp)
lea    0xd0(%rsp),%rdi
mov    %r15,%rsi
mov    %r13,%rdx
mov    %r12,%rcx
mov    %r14,%r8
call   10f0 <writecols3@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %r13,%rdi
call   1030 <free@plt>
cmpl   $0x0,0x74(%rsp)
je     16c5 <main+0x4f5>
cmpl   $0x1,0x7c(%rsp)
jne    16d1 <main+0x501>
lea    0xb19(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
add    $0x1a8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [50 x i8] c"\0AFiltering the time series \22%s\22 using weights...\0A\00"
@.str.1 = [52 x i8] c"\0AFiltering the time series \22%s\22 without weights...\0A\00"
@.str.2 = [18 x i8] c" - Reading input\0A\00"
@.str.3 = [39 x i8] c" -- INFO: Length of time series = %li\0A\00"
@.str.4 = [45 x i8] c" -- INFO: Nyquist frequency = %.2lf microHz\0A\00"
@.str.5 = [54 x i8] c" -- INFO: Suggested minimum sampling = %.3lf microHz\0A\00"
@.str.6 = [64 x i8] c" - Calculating bandpass filter between %.2lf and %.2lf microHz\0A\00"
@.str.7 = [51 x i8] c" - Calculating lowpass filter up to %.2lf microHz\0A\00"
@.str.8 = [51 x i8] c" - Calculating highpass filter from %.2lf microHz\0A\00"
@stderr = global i32 0
@.str.9 = [31 x i8] c"ERROR: Unknown filter chosen !\00"
@.str.10 = [24 x i8] c" - Saving to file \22%s\22\0A\00"
@.str.11 = [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 [100 x i8]
%8 = alloca [100 x i8]
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca double
%20 = alloca double
%21 = alloca double*
%22 = alloca double*
%23 = alloca double*
%24 = alloca double*
%25 = alloca double
%26 = alloca double
%27 = alloca double*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 0, i64* %6
store i32 0, i32* %12
store i32 1, i32* %13
store i32 0, i32* %14
store i32 0, i32* %15
store i32 0, i32* %16
store i32 0, i32* %17
store i32 1, i32* %18
store double 0.000000e+00, double* %19
store double 0.000000e+00, double* %20
%28 = load i32, i32* %4
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%31 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%32 = call i64 @cmdarg(i32 %28, i8** %29, i8* %30, i8* %31, i32* %12, i32* %13, i32* null, double* %9, double* %10, double* %11, i32* %14, i32* %15, i32* %16, i32* null, i32* null, i32* %17, i32* %18, double* %19, double* %20)
store i64 %32, i64* %6
%33 = load i32, i32* %12
%34 = icmp eq i32 %33, 0
br i1 %34, label %38, label %35
35: ; preds = %2
%36 = load i32, i32* %15
%37 = icmp eq i32 %36, 1
br i1 %37, label %38, label %48
38: ; preds = %35, %2
%39 = load i32, i32* %16
%40 = icmp ne i32 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %38
%42 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* %42)
br label %47
44: ; preds = %38
%45 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0), i8* %45)
br label %47
47: ; preds = %44, %41
br label %48
48: ; preds = %47, %35
%49 = load i32, i32* %12
%50 = icmp eq i32 %49, 0
br i1 %50, label %51, label %53
51: ; preds = %48
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %53
53: ; preds = %51, %48
%54 = load i64, i64* %6
%55 = mul i64 %54, 8
%56 = call double* @malloc(i64 %55)
store double* %56, double** %21
%57 = load i64, i64* %6
%58 = mul i64 %57, 8
%59 = call double* @malloc(i64 %58)
store double* %59, double** %22
%60 = load i64, i64* %6
%61 = mul i64 %60, 8
%62 = call double* @malloc(i64 %61)
store double* %62, double** %23
%63 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%64 = load double*, double** %21
%65 = load double*, double** %22
%66 = load double*, double** %23
%67 = load i64, i64* %6
%68 = load i32, i32* %16
%69 = load i32, i32* %13
%70 = load i32, i32* %12
%71 = call i32 @readcols(i8* %63, double* %64, double* %65, double* %66, i64 %67, i32 %68, i32 %69, i32 %70)
%72 = load i32, i32* %15
%73 = icmp eq i32 %72, 0
br i1 %73, label %74, label %118
74: ; preds = %53
%75 = load i64, i64* %6
%76 = sub i64 %75, 8
%77 = call double* @malloc(i64 %76)
store double* %77, double** %24
%78 = load double*, double** %21
%79 = load double*, double** %24
%80 = load i64, i64* %6
%81 = call i32 @arr_diff(double* %78, double* %79, i64 %80)
%82 = load double*, double** %24
%83 = load i64, i64* %6
%84 = sub i64 %83, 1
%85 = call double @arr_median(double* %82, i64 %84)
%86 = fmul double 2.000000e+00, %85
%87 = fdiv double 1.000000e+00, %86
%88 = fmul double %87, 1.000000e+06
store double %88, double* %25
%89 = load double*, double** %24
%90 = call i32 @free(double* %89)
%91 = load double*, double** %21
%92 = load i64, i64* %6
%93 = sub i64 %92, 1
%94 = getelementptr inbounds double, double* %91, i64 %93
%95 = load double, double* %94
%96 = load double*, double** %21
%97 = getelementptr inbounds double, double* %96, i64 0
%98 = load double, double* %97
%99 = fsub double %95, %98
%100 = fmul double 4.000000e+00, %99
%101 = fdiv double 1.000000e+06, %100
store double %101, double* %26
%102 = load i32, i32* %12
%103 = icmp eq i32 %102, 0
br i1 %103, label %104, label %111
104: ; preds = %74
%105 = load i64, i64* %6
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i64 %105)
%107 = load double, double* %25
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0), double %107)
%109 = load double, double* %26
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.5, i64 0, i64 0), double %109)
br label %111
111: ; preds = %104, %74
%112 = load i32, i32* %14
%113 = icmp ne i32 %112, 0
br i1 %113, label %114, label %117
114: ; preds = %111
store double 5.000000e+00, double* %9
%115 = load double, double* %25
store double %115, double* %10
%116 = load double, double* %26
store double %116, double* %11
br label %117
117: ; preds = %114, %111
br label %118
118: ; preds = %117, %53
%119 = load i64, i64* %6
%120 = mul i64 %119, 8
%121 = call double* @malloc(i64 %120)
store double* %121, double** %27
%122 = load i32, i32* %18
%123 = icmp eq i32 %122, 2
br i1 %123, label %124, label %145
124: ; preds = %118
%125 = load i32, i32* %12
%126 = icmp eq i32 %125, 0
br i1 %126, label %127, label %131
127: ; preds = %124
%128 = load double, double* %19
%129 = load double, double* %20
%130 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.6, i64 0, i64 0), double %128, double %129)
br label %131
131: ; preds = %127, %124
%132 = load double*, double** %21
%133 = load double*, double** %22
%134 = load double*, double** %23
%135 = load i64, i64* %6
%136 = load double, double* %19
%137 = load double, double* %20
%138 = load double, double* %9
%139 = load double, double* %10
%140 = load double, double* %11
%141 = load double*, double** %27
%142 = load i32, i32* %16
%143 = load i32, i32* %12
%144 = call i32 @bandpass(double* %132, double* %133, double* %134, i64 %135, double %136, double %137, double %138, double %139, double %140, double* %141, i32 %142, i32 %143)
br label %194
145: ; preds = %118
%146 = load i32, i32* %18
%147 = icmp eq i32 %146, 3
br i1 %147, label %148, label %167
148: ; preds = %145
%149 = load i32, i32* %12
%150 = icmp eq i32 %149, 0
br i1 %150, label %151, label %154
151: ; preds = %148
%152 = load double, double* %20
%153 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.7, i64 0, i64 0), double %152)
br label %154
154: ; preds = %151, %148
%155 = load double*, double** %21
%156 = load double*, double** %22
%157 = load double*, double** %23
%158 = load i64, i64* %6
%159 = load double, double* %20
%160 = load double, double* %9
%161 = load double, double* %10
%162 = load double, double* %11
%163 = load double*, double** %27
%164 = load i32, i32* %16
%165 = load i32, i32* %12
%166 = call i32 @lowpass(double* %155, double* %156, double* %157, i64 %158, double %159, double %160, double %161, double %162, double* %163, i32 %164, i32 %165)
br label %193
167: ; preds = %145
%168 = load i32, i32* %18
%169 = icmp eq i32 %168, 4
br i1 %169, label %170, label %189
170: ; preds = %167
%171 = load i32, i32* %12
%172 = icmp eq i32 %171, 0
br i1 %172, label %173, label %176
173: ; preds = %170
%174 = load double, double* %20
%175 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.8, i64 0, i64 0), double %174)
br label %176
176: ; preds = %173, %170
%177 = load double*, double** %21
%178 = load double*, double** %22
%179 = load double*, double** %23
%180 = load i64, i64* %6
%181 = load double, double* %20
%182 = load double, double* %9
%183 = load double, double* %10
%184 = load double, double* %11
%185 = load double*, double** %27
%186 = load i32, i32* %16
%187 = load i32, i32* %12
%188 = call i32 @highpass(double* %177, double* %178, double* %179, i64 %180, double %181, double %182, double %183, double %184, double* %185, i32 %186, i32 %187)
br label %192
189: ; preds = %167
%190 = load i32, i32* @stderr
%191 = call i32 @fprintf(i32 %190, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0))
br label %192
192: ; preds = %189, %176
br label %193
193: ; preds = %192, %154
br label %194
194: ; preds = %193, %131
%195 = load i32, i32* %12
%196 = icmp eq i32 %195, 0
br i1 %196, label %197, label %200
197: ; preds = %194
%198 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%199 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0), i8* %198)
br label %200
200: ; preds = %197, %194
%201 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%202 = load double*, double** %21
%203 = load double*, double** %27
%204 = load double*, double** %23
%205 = load i64, i64* %6
%206 = load i32, i32* %16
%207 = load i32, i32* %13
%208 = call i32 @writecols3(i8* %201, double* %202, double* %203, double* %204, i64 %205, i32 %206, i32 %207)
%209 = load double*, double** %21
%210 = call i32 @free(double* %209)
%211 = load double*, double** %22
%212 = call i32 @free(double* %211)
%213 = load double*, double** %23
%214 = call i32 @free(double* %213)
%215 = load double*, double** %27
%216 = call i32 @free(double* %215)
%217 = load i32, i32* %12
%218 = icmp eq i32 %217, 0
br i1 %218, label %222, label %219
219: ; preds = %200
%220 = load i32, i32* %15
%221 = icmp eq i32 %220, 1
br i1 %221, label %222, label %224
222: ; preds = %219, %200
%223 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0))
br label %224
224: ; preds = %222, %219
ret i32 0
}

LLVM IR (-O2):
@.str = [50 x i8] c"\0AFiltering the time series \22%s\22 using weights...\0A\00"
@.str.1 = [52 x i8] c"\0AFiltering the time series \22%s\22 without weights...\0A\00"
@.str.3 = [39 x i8] c" -- INFO: Length of time series = %li\0A\00"
@.str.4 = [45 x i8] c" -- INFO: Nyquist frequency = %.2lf microHz\0A\00"
@.str.5 = [54 x i8] c" -- INFO: Suggested minimum sampling = %.3lf microHz\0A\00"
@.str.6 = [64 x i8] c" - Calculating bandpass filter between %.2lf and %.2lf microHz\0A\00"
@.str.7 = [51 x i8] c" - Calculating lowpass filter up to %.2lf microHz\0A\00"
@.str.8 = [51 x i8] c" - Calculating highpass filter from %.2lf microHz\0A\00"
@stderr = global i32 0
@.str.9 = [31 x i8] c"ERROR: Unknown filter chosen !\00"
@.str.10 = [24 x i8] c" - Saving to file \22%s\22\0A\00"
@str = [7 x i8] c"Done!\0A\00"
@str.12 = [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 i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca double
%16 = alloca double
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%19 = bitcast double* %5 to i8*
%20 = bitcast double* %6 to i8*
%21 = bitcast double* %7 to i8*
%22 = bitcast i32* %8 to i8*
store i32 0, i32* %8
%23 = bitcast i32* %9 to i8*
store i32 1, i32* %9
%24 = bitcast i32* %10 to i8*
store i32 0, i32* %10
%25 = bitcast i32* %11 to i8*
store i32 0, i32* %11
%26 = bitcast i32* %12 to i8*
store i32 0, i32* %12
%27 = bitcast i32* %13 to i8*
store i32 0, i32* %13
%28 = bitcast i32* %14 to i8*
store i32 1, i32* %14
%29 = bitcast double* %15 to i8*
store double 0.000000e+00, double* %15
%30 = bitcast double* %16 to i8*
store double 0.000000e+00, double* %16
%31 = call i64 @cmdarg(i32 %0, i8** %1, i8* %17, i8* %18, i32* %8, i32* %9, i32* null, double* %5, double* %6, double* %7, i32* %10, i32* %11, i32* %12, i32* null, i32* null, i32* %13, i32* %14, double* %15, double* %16)
%32 = load i32, i32* %8
%33 = icmp eq i32 %32, 0
%34 = load i32, i32* %11
%35 = icmp eq i32 %34, 1
%36 = select i1 %33, i1 true, i1 %35
br i1 %36, label %37, label %47
37: ; preds = %2
%38 = load i32, i32* %12
%39 = icmp eq i32 %38, 0
%40 = select i1 %39, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0)
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %40, i8* %17)
%42 = load i32, i32* %8
%43 = icmp eq i32 %42, 0
br i1 %43, label %44, label %47
44: ; preds = %37
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.12, i64 0, i64 0))
%46 = load i32, i32* %8
br label %47
47: ; preds = %2, %44, %37
%48 = phi i32 [ %32, %2 ], [ %46, %44 ], [ %42, %37 ]
%49 = shl i64 %31, 3
%50 = call double* @malloc(i64 %49)
%51 = call double* @malloc(i64 %49)
%52 = call double* @malloc(i64 %49)
%53 = load i32, i32* %12
%54 = load i32, i32* %9
%55 = call i32 @readcols(i8* %17, double* %50, double* %51, double* %52, i64 %31, i32 %53, i32 %54, i32 %48)
%56 = load i32, i32* %11
%57 = icmp eq i32 %56, 0
br i1 %57, label %58, label %84
58: ; preds = %47
%59 = add i64 %31, -8
%60 = call double* @malloc(i64 %59)
%61 = call i32 @arr_diff(double* %50, double* %60, i64 %31)
%62 = add i64 %31, -1
%63 = call double @arr_median(double* %60, i64 %62)
%64 = fmul double %63, 2.000000e+00
%65 = fdiv double 1.000000e+00, %64
%66 = fmul double %65, 1.000000e+06
%67 = call i32 @free(double* %60)
%68 = getelementptr inbounds double, double* %50, i64 %62
%69 = load double, double* %68
%70 = load double, double* %50
%71 = fsub double %69, %70
%72 = fmul double %71, 4.000000e+00
%73 = fdiv double 1.000000e+06, %72
%74 = load i32, i32* %8
%75 = icmp eq i32 %74, 0
br i1 %75, label %76, label %80
76: ; preds = %58
%77 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i64 %31)
%78 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0), double %66)
%79 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.5, i64 0, i64 0), double %73)
br label %80
80: ; preds = %76, %58
%81 = load i32, i32* %10
%82 = icmp eq i32 %81, 0
br i1 %82, label %84, label %83
83: ; preds = %80
store double 5.000000e+00, double* %5
store double %66, double* %6
store double %73, double* %7
br label %84
84: ; preds = %80, %83, %47
%85 = call double* @malloc(i64 %49)
%86 = load i32, i32* %14
switch i32 %86, label %134 [
i32 2, label %87
i32 3, label %104
i32 4, label %119
]
87: ; preds = %84
%88 = load i32, i32* %8
%89 = icmp eq i32 %88, 0
br i1 %89, label %90, label %95
90: ; preds = %87
%91 = load double, double* %15
%92 = load double, double* %16
%93 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @.str.6, i64 0, i64 0), double %91, double %92)
%94 = load i32, i32* %8
br label %95
95: ; preds = %90, %87
%96 = phi i32 [ %94, %90 ], [ %88, %87 ]
%97 = load double, double* %15
%98 = load double, double* %16
%99 = load double, double* %5
%100 = load double, double* %6
%101 = load double, double* %7
%102 = load i32, i32* %12
%103 = call i32 @bandpass(double* %50, double* %51, double* %52, i64 %31, double %97, double %98, double %99, double %100, double %101, double* %85, i32 %102, i32 %96)
br label %137
104: ; preds = %84
%105 = load i32, i32* %8
%106 = icmp eq i32 %105, 0
br i1 %106, label %107, label %111
107: ; preds = %104
%108 = load double, double* %16
%109 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.7, i64 0, i64 0), double %108)
%110 = load i32, i32* %8
br label %111
111: ; preds = %107, %104
%112 = phi i32 [ %110, %107 ], [ %105, %104 ]
%113 = load double, double* %16
%114 = load double, double* %5
%115 = load double, double* %6
%116 = load double, double* %7
%117 = load i32, i32* %12
%118 = call i32 @lowpass(double* %50, double* %51, double* %52, i64 %31, double %113, double %114, double %115, double %116, double* %85, i32 %117, i32 %112)
br label %137
119: ; preds = %84
%120 = load i32, i32* %8
%121 = icmp eq i32 %120, 0
br i1 %121, label %122, label %126
122: ; preds = %119
%123 = load double, double* %16
%124 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.8, i64 0, i64 0), double %123)
%125 = load i32, i32* %8
br label %126
126: ; preds = %122, %119
%127 = phi i32 [ %125, %122 ], [ %120, %119 ]
%128 = load double, double* %16
%129 = load double, double* %5
%130 = load double, double* %6
%131 = load double, double* %7
%132 = load i32, i32* %12
%133 = call i32 @highpass(double* %50, double* %51, double* %52, i64 %31, double %128, double %129, double %130, double %131, double* %85, i32 %132, i32 %127)
br label %137
134: ; preds = %84
%135 = load i32, i32* @stderr
%136 = call i32 @fprintf(i32 %135, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0))
br label %137
137: ; preds = %111, %134, %126, %95
%138 = load i32, i32* %8
%139 = icmp eq i32 %138, 0
br i1 %139, label %140, label %142
140: ; preds = %137
%141 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0), i8* %18)
br label %142
142: ; preds = %140, %137
%143 = load i32, i32* %12
%144 = load i32, i32* %9
%145 = call i32 @writecols3(i8* %18, double* %50, double* %85, double* %52, i64 %31, i32 %143, i32 %144)
%146 = call i32 @free(double* %50)
%147 = call i32 @free(double* %51)
%148 = call i32 @free(double* %52)
%149 = call i32 @free(double* %85)
%150 = load i32, i32* %8
%151 = icmp eq i32 %150, 0
%152 = load i32, i32* %11
%153 = icmp eq i32 %152, 1
%154 = select i1 %151, i1 true, i1 %153
br i1 %154, label %155, label %157
155: ; preds = %142
%156 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
br label %157
157: ; preds = %142, %155
ret i32 0
}