#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*/ copy_sincos(int, double *, double *, double *, double *);
double do_lomb(int, int, double *, double *, double *, double *);
double do_lomb_zoom(int, int, double *, double *, double *, double *, double *,
                    double *, double *, double *, double *, double *, double,
                    int *);
double refine_psd(int, int, int, double *, double *, double *, double *,
                  double *, double *, double *, double *, double *, double *,
                  double, double, double *, int);
int /*<<< orphan*/ update_sincos(int, double *, double *, double *, double *,
                                 int /*<<< orphan*/);
void lomb_scargle(int numt, int numf, int nharm, int detrend_order,
                  double psd[], double cn[], double wth[], double sinx[],
                  double cosx[], double sinx_step[], double cosx_step[],
                  double sinx_back[], double cosx_back[],
                  double sinx_smallstep[], double cosx_smallstep[],
                  double hat_matr[], double hat_hat[], double hat0[],
                  double soln[], double chi0, double freq_zoom, double psdmin,
                  double tone_control, double lambda0[], double lambda0_range[],
                  double Tr[], int ifreq[]) {
  int i, k, npar = 2 * (int)nharm, ifr = (int)(freq_zoom) / 2;
  unsigned long j;
  unsigned long jmax = 0;
  *ifreq = ifr;
  double psdmax = 0., psd0max = 0., Trace, sinx1[numt], cosx1[numt],
         sinx2[numt], cosx2[numt], lambda, px, pxmax;
  for (j = 0; j < numf; j++) {
    psd[j] = do_lomb(numt, detrend_order, cn, sinx, cosx, wth);
    if (psd[j] > psd0max && psdmax == 0) {
      psd0max = psd[j];
      copy_sincos(numt, sinx, cosx, sinx2, cosx2);
      jmax = j;
    }
    if (psd[j] > (double)psdmin) {
      px = do_lomb_zoom(numt, detrend_order, cn, sinx, cosx, sinx1, cosx1,
                        sinx_back, cosx_back, sinx_smallstep, cosx_smallstep,
                        wth, freq_zoom, &ifr);
      lambda = *lambda0;
      psd[j] = refine_psd(numt, nharm, detrend_order, hat_matr, hat0, hat_hat,
                          sinx1, cosx1, wth, cn, soln, &lambda, lambda0_range,
                          chi0, tone_control, &Trace, 0);
      if (psd[j] > psdmax) {
        copy_sincos(numt, sinx1, cosx1, sinx2, cosx2);
        psdmax = psd[j];
        *ifreq = ifr;
        jmax = j;
      }
    }
    update_sincos(numt, sinx_step, cosx_step, sinx, cosx, 0);
  }
  psd[jmax] = refine_psd(numt, nharm, detrend_order, hat_matr, hat0, hat_hat,
                         sinx2, cosx2, wth, cn, soln, lambda0, lambda0_range,
                         chi0, tone_control, Tr, 1);
}


x86 assembly (clang, -O0):
<lomb_scargle>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xd8,%rsp
mov    0x90(%rbp),%rax
mov    0x88(%rbp),%rax
mov    0x80(%rbp),%rax
mov    0x78(%rbp),%rax
mov    0x70(%rbp),%rax
mov    0x68(%rbp),%rax
mov    0x60(%rbp),%rax
mov    0x58(%rbp),%rax
mov    0x50(%rbp),%rax
mov    0x48(%rbp),%rax
mov    0x40(%rbp),%rax
mov    0x38(%rbp),%rax
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x2c(%rbp)
mov    %esi,-0x30(%rbp)
mov    %edx,-0x34(%rbp)
mov    %ecx,-0x38(%rbp)
mov    %r8,-0x40(%rbp)
mov    %r9,-0x48(%rbp)
movsd  %xmm0,-0x50(%rbp)
movsd  %xmm1,-0x58(%rbp)
movsd  %xmm2,-0x60(%rbp)
movsd  %xmm3,-0x68(%rbp)
mov    -0x34(%rbp),%eax
add    %eax,%eax
mov    %eax,-0x74(%rbp)
cvttsd2si -0x58(%rbp),%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %ecx,%eax
sar    %eax
mov    %eax,-0x78(%rbp)
movq   $0x0,-0x88(%rbp)
mov    -0x78(%rbp),%ecx
mov    0x90(%rbp),%rax
mov    %ecx,(%rax)
movq   $0x0,-0x90(%rbp)
movq   $0x0,-0x98(%rbp)
mov    -0x2c(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0xa8(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x100(%rbp)
mov    %rcx,%rsp
mov    %rax,-0xb0(%rbp)
mov    -0x2c(%rbp),%eax
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xf8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0xb8(%rbp)
mov    -0x2c(%rbp),%eax
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xf0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0xc0(%rbp)
mov    -0x2c(%rbp),%eax
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xe8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0xc8(%rbp)
movq   $0x0,-0x80(%rbp)
mov    -0x80(%rbp),%rax
movslq -0x30(%rbp),%rcx
cmp    %rcx,%rax
jae    1544 <lomb_scargle+0x3f4>
mov    -0x2c(%rbp),%edi
mov    -0x38(%rbp),%esi
mov    -0x48(%rbp),%rdx
mov    0x18(%rbp),%rcx
mov    0x20(%rbp),%r8
mov    0x10(%rbp),%r9
call   1040 <do_lomb@plt>
mov    -0x40(%rbp),%rax
mov    -0x80(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x40(%rbp),%rax
mov    -0x80(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd -0x98(%rbp),%xmm0
ff
jbe    1376 <lomb_scargle+0x226>
movsd  -0x90(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1376 <lomb_scargle+0x226>
jp     1376 <lomb_scargle+0x226>
mov    -0xe8(%rbp),%r8
mov    -0xf0(%rbp),%rcx
mov    -0x40(%rbp),%rax
mov    -0x80(%rbp),%rdx
movsd  (%rax,%rdx,8),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0x2c(%rbp),%edi
mov    0x18(%rbp),%rsi
mov    0x20(%rbp),%rdx
call   1060 <copy_sincos@plt>
mov    -0x80(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x40(%rbp),%rax
mov    -0x80(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd -0x60(%rbp),%xmm0
jbe    1518 <lomb_scargle+0x3c8>
mov    -0xf8(%rbp),%r12
mov    -0x100(%rbp),%r13
mov    -0x2c(%rbp),%edi
mov    -0x38(%rbp),%esi
mov    -0x48(%rbp),%rdx
mov    0x18(%rbp),%rcx
mov    0x20(%rbp),%r8
mov    0x38(%rbp),%r15
mov    0x40(%rbp),%r14
mov    0x48(%rbp),%rbx
mov    0x50(%rbp),%r11
mov    0x10(%rbp),%r10
movsd  -0x58(%rbp),%xmm0
lea    -0x78(%rbp),%rax
sub    $0x40,%rsp
mov    %r13,%r9
mov    %r12,(%rsp)
mov    %r15,0x8(%rsp)
mov    %r14,0x10(%rsp)
mov    %rbx,0x18(%rsp)
mov    %r11,0x20(%rsp)
mov    %r10,0x28(%rsp)
mov    %rax,0x30(%rsp)
call   1030 <do_lomb_zoom@plt>
add    $0x40,%rsp
movsd  %xmm0,-0xd8(%rbp)
ff
mov    0x78(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
mov    -0x2c(%rbp),%edi
mov    -0x34(%rbp),%esi
mov    -0x38(%rbp),%edx
mov    0x58(%rbp),%rcx
mov    0x68(%rbp),%r8
mov    0x60(%rbp),%r9
mov    0x10(%rbp),%r15
mov    -0x48(%rbp),%r14
mov    0x70(%rbp),%rbx
mov    0x80(%rbp),%r10
movsd  -0x50(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm1
lea    -0xd0(%rbp),%r11
lea    -0xa0(%rbp),%rax
xor    %r12d,%r12d
mov    -0xf8(%rbp),%r12
sub    $0x50,%rsp
mov    %r13,(%rsp)
mov    %r12,0x8(%rsp)
mov    %r15,0x10(%rsp)
mov    %r14,0x18(%rsp)
mov    %rbx,0x20(%rsp)
mov    %r11,0x28(%rsp)
mov    %r10,0x30(%rsp)
mov    %rax,0x38(%rsp)
movl   $0x0,0x40(%rsp)
call   1070 <refine_psd@plt>
add    $0x50,%rsp
mov    -0x40(%rbp),%rax
mov    -0x80(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x40(%rbp),%rax
mov    -0x80(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd -0x90(%rbp),%xmm0
ff
jbe    1513 <lomb_scargle+0x3c3>
mov    -0xe8(%rbp),%r8
mov    -0xf0(%rbp),%rcx
mov    -0xf8(%rbp),%rdx
mov    -0x100(%rbp),%rsi
mov    -0x2c(%rbp),%edi
call   1060 <copy_sincos@plt>
mov    -0x40(%rbp),%rax
mov    -0x80(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x78(%rbp),%ecx
mov    0x90(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x80(%rbp),%rax
mov    %rax,-0x88(%rbp)
jmp    1518 <lomb_scargle+0x3c8>
mov    -0x2c(%rbp),%edi
mov    0x28(%rbp),%rsi
mov    0x30(%rbp),%rdx
mov    0x18(%rbp),%rcx
mov    0x20(%rbp),%r8
xor    %r9d,%r9d
call   1050 <update_sincos@plt>
mov    -0x80(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x80(%rbp)
jmp    12c9 <lomb_scargle+0x179>
mov    -0xe8(%rbp),%r12
mov    -0xf0(%rbp),%r13
mov    -0x2c(%rbp),%edi
mov    -0x34(%rbp),%esi
mov    -0x38(%rbp),%edx
mov    0x58(%rbp),%rcx
mov    0x68(%rbp),%r8
mov    0x60(%rbp),%r9
mov    0x10(%rbp),%r15
mov    -0x48(%rbp),%r14
mov    0x70(%rbp),%rbx
mov    0x78(%rbp),%r11
mov    0x80(%rbp),%r10
movsd  -0x50(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm1
mov    0x88(%rbp),%rax
sub    $0x50,%rsp
mov    %r13,(%rsp)
mov    %r12,0x8(%rsp)
mov    %r15,0x10(%rsp)
mov    %r14,0x18(%rsp)
mov    %rbx,0x20(%rsp)
mov    %r11,0x28(%rsp)
mov    %r10,0x30(%rsp)
mov    %rax,0x38(%rsp)
movl   $0x1,0x40(%rsp)
call   1070 <refine_psd@plt>
add    $0x50,%rsp
mov    -0x40(%rbp),%rax
mov    -0x88(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0xa8(%rbp),%rax
mov    %rax,%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<lomb_scargle>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
movsd  %xmm3,-0x80(%rbp)
movsd  %xmm2,-0xb8(%rbp)
ff
movsd  %xmm0,-0x78(%rbp)
mov    %r9,-0x70(%rbp)
mov    %r8,-0x38(%rbp)
mov    %ecx,-0x2c(%rbp)
mov    %edx,-0x3c(%rbp)
mov    %edi,%r13d
mov    %rsp,-0xa0(%rbp)
mov    0x90(%rbp),%rdx
movsd  %xmm1,-0xa8(%rbp)
ff
cvttsd2si %xmm1,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
mov    %ecx,-0x44(%rbp)
mov    %ecx,(%rdx)
mov    %edi,%eax
mov    %rsp,%rcx
lea    0xf(,%rax,8),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rcx
mov    %rcx,-0x90(%rbp)
mov    %rcx,%rsp
mov    %rsp,%rcx
sub    %rax,%rcx
mov    %rcx,-0x88(%rbp)
mov    %rcx,%rsp
mov    %rsp,%rcx
sub    %rax,%rcx
mov    %rcx,-0x60(%rbp)
mov    %rcx,%rsp
mov    %rsp,%rcx
sub    %rax,%rcx
mov    %rcx,-0x58(%rbp)
mov    %rcx,%rsp
test   %esi,%esi
je     1410 <lomb_scargle+0x2c0>
mov    0x30(%rbp),%rbx
mov    0x20(%rbp),%r8
mov    0x18(%rbp),%r14
movslq %esi,%rax
mov    %rax,-0xb0(%rbp)
xor    %r15d,%r15d
xorpd  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
xor    %eax,%eax
mov    %rax,-0x50(%rbp)
mov    %r13d,-0x40(%rbp)
jmp    1270 <lomb_scargle+0x120>
nopl   0x0(%rax)
mov    %r13d,%edi
mov    0x28(%rbp),%rsi
mov    %rbx,%rdx
mov    0x18(%rbp),%r14
mov    %r14,%rcx
mov    %r12,%r8
xor    %r9d,%r9d
call   1050 <update_sincos@plt>
mov    %r12,%r8
add    $0x1,%r15
cmp    %r15,-0xb0(%rbp)
je     1416 <lomb_scargle+0x2c6>
mov    %r13d,%edi
mov    -0x2c(%rbp),%esi
mov    -0x70(%rbp),%rdx
mov    %r14,%rcx
mov    %r8,%r12
mov    0x10(%rbp),%r9
call   1040 <do_lomb@plt>
movapd %xmm0,%xmm1
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax,%r15,8)
ucomisd -0x98(%rbp),%xmm0
ff
jbe    12f0 <lomb_scargle+0x1a0>
movsd  -0x68(%rbp),%xmm0
ucomisd 0xd52(%rip),%xmm0
jne    12f0 <lomb_scargle+0x1a0>
jp     12f0 <lomb_scargle+0x1a0>
mov    %r13d,%edi
mov    0x18(%rbp),%rsi
mov    %r12,%rdx
mov    -0x60(%rbp),%rcx
mov    -0x58(%rbp),%r8
movsd  %xmm1,-0x98(%rbp)
ff
call   1060 <copy_sincos@plt>
mov    -0x38(%rbp),%rax
movsd  (%rax,%r15,8),%xmm0
mov    %r15,-0x50(%rbp)
ucomisd -0xb8(%rbp),%xmm0
ff
jbe    1240 <lomb_scargle+0xf0>
jmp    1302 <lomb_scargle+0x1b2>
nop
movapd %xmm1,%xmm0
ucomisd -0xb8(%rbp),%xmm0
ff
jbe    1240 <lomb_scargle+0xf0>
sub    $0x8,%rsp
mov    %r13d,%edi
mov    -0x2c(%rbp),%esi
mov    -0x70(%rbp),%r13
mov    %r13,%rdx
mov    0x18(%rbp),%rcx
mov    %r12,%r8
mov    -0x90(%rbp),%rbx
mov    %rbx,%r9
movsd  -0xa8(%rbp),%xmm0
ff
lea    -0x44(%rbp),%rax
push   %rax
push   0x10(%rbp)
push   0x50(%rbp)
push   0x48(%rbp)
push   0x40(%rbp)
push   0x38(%rbp)
mov    -0x88(%rbp),%r14
push   %r14
call   1030 <do_lomb_zoom@plt>
add    $0x40,%rsp
mov    0x78(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
sub    $0x8,%rsp
mov    -0x40(%rbp),%edi
mov    -0x3c(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    0x58(%rbp),%rcx
mov    0x68(%rbp),%r8
mov    0x60(%rbp),%r9
movsd  -0x78(%rbp),%xmm0
movsd  -0x80(%rbp),%xmm1
push   $0x0
lea    -0xc8(%rbp),%rax
push   %rax
push   0x80(%rbp)
lea    -0xc0(%rbp),%rax
push   %rax
push   0x70(%rbp)
push   %r13
mov    -0x40(%rbp),%r13d
push   0x10(%rbp)
push   %r14
push   %rbx
mov    0x30(%rbp),%rbx
call   1070 <refine_psd@plt>
add    $0x50,%rsp
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax,%r15,8)
ucomisd -0x68(%rbp),%xmm0
jbe    1240 <lomb_scargle+0xf0>
mov    %r13d,%edi
mov    -0x90(%rbp),%rsi
mov    -0x88(%rbp),%rdx
mov    -0x60(%rbp),%rcx
mov    -0x58(%rbp),%r8
call   1060 <copy_sincos@plt>
mov    -0x38(%rbp),%rax
movsd  (%rax,%r15,8),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x44(%rbp),%eax
mov    0x90(%rbp),%rcx
mov    %eax,(%rcx)
mov    %r15,-0x50(%rbp)
jmp    1240 <lomb_scargle+0xf0>
xor    %eax,%eax
mov    %rax,-0x50(%rbp)
sub    $0x8,%rsp
mov    %r13d,%edi
mov    -0x3c(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    0x58(%rbp),%rcx
mov    0x68(%rbp),%r8
mov    0x60(%rbp),%r9
movsd  -0x78(%rbp),%xmm0
movsd  -0x80(%rbp),%xmm1
push   $0x1
push   0x88(%rbp)
push   0x80(%rbp)
push   0x78(%rbp)
push   0x70(%rbp)
push   -0x70(%rbp)
push   0x10(%rbp)
push   -0x58(%rbp)
push   -0x60(%rbp)
call   1070 <refine_psd@plt>
add    $0x50,%rsp
mov    -0x38(%rbp),%rax
mov    -0x50(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0xa0(%rbp),%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @lomb_scargle(i32 %0, i32 %1, i32 %2, i32 %3, double* %4, double* %5, double* %6, double* %7, double* %8, double* %9, double* %10, double* %11, double* %12, double* %13, double* %14, double* %15, double* %16, double* %17, double* %18, double %19, double %20, double %21, double %22, double* %23, double* %24, double* %25, i32* %26) {
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
%32 = alloca double*
%33 = alloca double*
%34 = alloca double*
%35 = alloca double*
%36 = alloca double*
%37 = alloca double*
%38 = alloca double*
%39 = alloca double*
%40 = alloca double*
%41 = alloca double*
%42 = alloca double*
%43 = alloca double*
%44 = alloca double*
%45 = alloca double*
%46 = alloca double*
%47 = alloca double
%48 = alloca double
%49 = alloca double
%50 = alloca double
%51 = alloca double*
%52 = alloca double*
%53 = alloca double*
%54 = alloca i32*
%55 = alloca i32
%56 = alloca i32
%57 = alloca i32
%58 = alloca i32
%59 = alloca i64
%60 = alloca i64
%61 = alloca double
%62 = alloca double
%63 = alloca double
%64 = alloca i8*
%65 = alloca i64
%66 = alloca i64
%67 = alloca i64
%68 = alloca i64
%69 = alloca double
%70 = alloca double
%71 = alloca double
store i32 %0, i32* %28
store i32 %1, i32* %29
store i32 %2, i32* %30
store i32 %3, i32* %31
store double* %4, double** %32
store double* %5, double** %33
store double* %6, double** %34
store double* %7, double** %35
store double* %8, double** %36
store double* %9, double** %37
store double* %10, double** %38
store double* %11, double** %39
store double* %12, double** %40
store double* %13, double** %41
store double* %14, double** %42
store double* %15, double** %43
store double* %16, double** %44
store double* %17, double** %45
store double* %18, double** %46
store double %19, double* %47
store double %20, double* %48
store double %21, double* %49
store double %22, double* %50
store double* %23, double** %51
store double* %24, double** %52
store double* %25, double** %53
store i32* %26, i32** %54
%72 = load i32, i32* %30
%73 = mul nsw i32 2, %72
store i32 %73, i32* %57
%74 = load double, double* %48
%75 = fptosi double %74 to i32
%76 = sdiv i32 %75, 2
store i32 %76, i32* %58
store i64 0, i64* %60
%77 = load i32, i32* %58
%78 = load i32*, i32** %54
store i32 %77, i32* %78
store double 0.000000e+00, double* %61
store double 0.000000e+00, double* %62
%79 = load i32, i32* %28
%80 = zext i32 %79 to i64
%81 = call i8* @llvm.stacksave()
store i8* %81, i8** %64
%82 = alloca double, i64 %80
store i64 %80, i64* %65
%83 = load i32, i32* %28
%84 = zext i32 %83 to i64
%85 = alloca double, i64 %84
store i64 %84, i64* %66
%86 = load i32, i32* %28
%87 = zext i32 %86 to i64
%88 = alloca double, i64 %87
store i64 %87, i64* %67
%89 = load i32, i32* %28
%90 = zext i32 %89 to i64
%91 = alloca double, i64 %90
store i64 %90, i64* %68
store i64 0, i64* %59
br label %92
92: ; preds = %189, %27
%93 = load i64, i64* %59
%94 = load i32, i32* %29
%95 = sext i32 %94 to i64
%96 = icmp ult i64 %93, %95
br i1 %96, label %97, label %192
97: ; preds = %92
%98 = load i32, i32* %28
%99 = load i32, i32* %31
%100 = load double*, double** %33
%101 = load double*, double** %35
%102 = load double*, double** %36
%103 = load double*, double** %34
%104 = call double @do_lomb(i32 %98, i32 %99, double* %100, double* %101, double* %102, double* %103)
%105 = load double*, double** %32
%106 = load i64, i64* %59
%107 = getelementptr inbounds double, double* %105, i64 %106
store double %104, double* %107
%108 = load double*, double** %32
%109 = load i64, i64* %59
%110 = getelementptr inbounds double, double* %108, i64 %109
%111 = load double, double* %110
%112 = load double, double* %62
%113 = fcmp ogt double %111, %112
br i1 %113, label %114, label %127
114: ; preds = %97
%115 = load double, double* %61
%116 = fcmp oeq double %115, 0.000000e+00
br i1 %116, label %117, label %127
117: ; preds = %114
%118 = load double*, double** %32
%119 = load i64, i64* %59
%120 = getelementptr inbounds double, double* %118, i64 %119
%121 = load double, double* %120
store double %121, double* %62
%122 = load i32, i32* %28
%123 = load double*, double** %35
%124 = load double*, double** %36
%125 = call i32 @copy_sincos(i32 %122, double* %123, double* %124, double* %88, double* %91)
%126 = load i64, i64* %59
store i64 %126, i64* %60
br label %127
127: ; preds = %117, %114, %97
%128 = load double*, double** %32
%129 = load i64, i64* %59
%130 = getelementptr inbounds double, double* %128, i64 %129
%131 = load double, double* %130
%132 = load double, double* %49
%133 = fcmp ogt double %131, %132
br i1 %133, label %134, label %182
134: ; preds = %127
%135 = load i32, i32* %28
%136 = load i32, i32* %31
%137 = load double*, double** %33
%138 = load double*, double** %35
%139 = load double*, double** %36
%140 = load double*, double** %39
%141 = load double*, double** %40
%142 = load double*, double** %41
%143 = load double*, double** %42
%144 = load double*, double** %34
%145 = load double, double* %48
%146 = call double @do_lomb_zoom(i32 %135, i32 %136, double* %137, double* %138, double* %139, double* %82, double* %85, double* %140, double* %141, double* %142, double* %143, double* %144, double %145, i32* %58)
store double %146, double* %70
%147 = load double*, double** %51
%148 = load double, double* %147
store double %148, double* %69
%149 = load i32, i32* %28
%150 = load i32, i32* %30
%151 = load i32, i32* %31
%152 = load double*, double** %43
%153 = load double*, double** %45
%154 = load double*, double** %44
%155 = load double*, double** %34
%156 = load double*, double** %33
%157 = load double*, double** %46
%158 = load double*, double** %52
%159 = load double, double* %47
%160 = load double, double* %50
%161 = call double @refine_psd(i32 %149, i32 %150, i32 %151, double* %152, double* %153, double* %154, double* %82, double* %85, double* %155, double* %156, double* %157, double* %69, double* %158, double %159, double %160, double* %63, i32 0)
%162 = load double*, double** %32
%163 = load i64, i64* %59
%164 = getelementptr inbounds double, double* %162, i64 %163
store double %161, double* %164
%165 = load double*, double** %32
%166 = load i64, i64* %59
%167 = getelementptr inbounds double, double* %165, i64 %166
%168 = load double, double* %167
%169 = load double, double* %61
%170 = fcmp ogt double %168, %169
br i1 %170, label %171, label %181
171: ; preds = %134
%172 = load i32, i32* %28
%173 = call i32 @copy_sincos(i32 %172, double* %82, double* %85, double* %88, double* %91)
%174 = load double*, double** %32
%175 = load i64, i64* %59
%176 = getelementptr inbounds double, double* %174, i64 %175
%177 = load double, double* %176
store double %177, double* %61
%178 = load i32, i32* %58
%179 = load i32*, i32** %54
store i32 %178, i32* %179
%180 = load i64, i64* %59
store i64 %180, i64* %60
br label %181
181: ; preds = %171, %134
br label %182
182: ; preds = %181, %127
%183 = load i32, i32* %28
%184 = load double*, double** %37
%185 = load double*, double** %38
%186 = load double*, double** %35
%187 = load double*, double** %36
%188 = call i32 @update_sincos(i32 %183, double* %184, double* %185, double* %186, double* %187, i32 0)
br label %189
189: ; preds = %182
%190 = load i64, i64* %59
%191 = add i64 %190, 1
store i64 %191, i64* %59
br label %92
192: ; preds = %92
%193 = load i32, i32* %28
%194 = load i32, i32* %30
%195 = load i32, i32* %31
%196 = load double*, double** %43
%197 = load double*, double** %45
%198 = load double*, double** %44
%199 = load double*, double** %34
%200 = load double*, double** %33
%201 = load double*, double** %46
%202 = load double*, double** %51
%203 = load double*, double** %52
%204 = load double, double* %47
%205 = load double, double* %50
%206 = load double*, double** %53
%207 = call double @refine_psd(i32 %193, i32 %194, i32 %195, double* %196, double* %197, double* %198, double* %88, double* %91, double* %199, double* %200, double* %201, double* %202, double* %203, double %204, double %205, double* %206, i32 1)
%208 = load double*, double** %32
%209 = load i64, i64* %60
%210 = getelementptr inbounds double, double* %208, i64 %209
store double %207, double* %210
%211 = load i8*, i8** %64
ret void
}

LLVM IR (-O2):
define void @lomb_scargle(i32 %0, i32 %1, i32 %2, i32 %3, double* nocapture %4, double* %5, double* %6, double* %7, double* %8, double* %9, double* %10, double* %11, double* %12, double* %13, double* %14, double* %15, double* %16, double* %17, double* %18, double %19, double %20, double %21, double %22, double* %23, double* %24, double* %25, i32* nocapture writeonly %26) {
%28 = alloca i32
%29 = alloca double
%30 = alloca double
%31 = bitcast i32* %28 to i8*
%32 = fptosi double %20 to i32
%33 = sdiv i32 %32, 2
store i32 %33, i32* %28
store i32 %33, i32* %26
%34 = bitcast double* %29 to i8*
%35 = zext i32 %0 to i64
%36 = tail call i8* @llvm.stacksave()
%37 = alloca double, i64 %35
%38 = alloca double, i64 %35
%39 = alloca double, i64 %35
%40 = alloca double, i64 %35
%41 = bitcast double* %30 to i8*
%42 = icmp eq i32 %1, 0
br i1 %42, label %78, label %43
43: ; preds = %27
%44 = sext i32 %1 to i64
br label %45
45: ; preds = %43, %72
%46 = phi i64 [ %76, %72 ], [ 0, %43 ]
%47 = phi i64 [ %74, %72 ], [ 0, %43 ]
%48 = phi double [ %73, %72 ], [ 0.000000e+00, %43 ]
%49 = phi double [ %60, %72 ], [ 0.000000e+00, %43 ]
%50 = call double @do_lomb(i32 %0, i32 %3, double* %5, double* %7, double* %8, double* %6)
%51 = getelementptr inbounds double, double* %4, i64 %46
store double %50, double* %51
%52 = fcmp ogt double %50, %49
%53 = fcmp oeq double %48, 0.000000e+00
%54 = select i1 %52, i1 %53, i1 false
br i1 %54, label %55, label %58
55: ; preds = %45
%56 = call i32 @copy_sincos(i32 %0, double* %7, double* %8, double* %39, double* %40)
%57 = load double, double* %51
br label %58
58: ; preds = %55, %45
%59 = phi double [ %57, %55 ], [ %50, %45 ]
%60 = phi double [ %50, %55 ], [ %49, %45 ]
%61 = phi i64 [ %46, %55 ], [ %47, %45 ]
%62 = fcmp ogt double %59, %21
br i1 %62, label %63, label %72
63: ; preds = %58
%64 = call double @do_lomb_zoom(i32 %0, i32 %3, double* %5, double* %7, double* %8, double* %37, double* %38, double* %11, double* %12, double* %13, double* %14, double* %6, double %20, i32* %28)
%65 = load double, double* %23
store double %65, double* %30
%66 = call double @refine_psd(i32 %0, i32 %2, i32 %3, double* %15, double* %17, double* %16, double* %37, double* %38, double* %6, double* %5, double* %18, double* %30, double* %24, double %19, double %22, double* %29, i32 0)
store double %66, double* %51
%67 = fcmp ogt double %66, %48
br i1 %67, label %68, label %72
68: ; preds = %63
%69 = call i32 @copy_sincos(i32 %0, double* %37, double* %38, double* %39, double* %40)
%70 = load double, double* %51
%71 = load i32, i32* %28
store i32 %71, i32* %26
br label %72
72: ; preds = %63, %68, %58
%73 = phi double [ %70, %68 ], [ %48, %63 ], [ %48, %58 ]
%74 = phi i64 [ %46, %68 ], [ %61, %63 ], [ %61, %58 ]
%75 = call i32 @update_sincos(i32 %0, double* %9, double* %10, double* %7, double* %8, i32 0)
%76 = add nuw i64 %46, 1
%77 = icmp eq i64 %76, %44
br i1 %77, label %78, label %45
78: ; preds = %72, %27
%79 = phi i64 [ 0, %27 ], [ %74, %72 ]
%80 = call double @refine_psd(i32 %0, i32 %2, i32 %3, double* %15, double* %17, double* %16, double* %39, double* %40, double* %6, double* %5, double* %18, double* %23, double* %24, double %19, double %22, double* %25, i32 1)
%81 = getelementptr inbounds double, double* %4, i64 %79
store double %80, double* %81
ret void
}