#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 *);
int /*<<< orphan*/ update_sincos(int, double *, double *, double *, double *,
                                 int /*<<< orphan*/);
double do_lomb_zoom(int numt, int detrend_order, double *cn, double *sinx,
                    double *cosx, double *sinx1, double *cosx1,
                    double *sinx_back, double *cosx_back,
                    double *sinx_smallstep, double *cosx_smallstep, double *wth,
                    double freq_zoom, int *ifreq) {
  int i;
  double px, pxmax = 0.;
  copy_sincos(numt, sinx, cosx, sinx1, cosx1);
  update_sincos(numt, sinx_back, cosx_back, sinx1, cosx1, 0);
  for (i = 0; i < freq_zoom; i++) {
    px = do_lomb(numt, detrend_order, cn, sinx1, cosx1, wth);
    if (px > pxmax) {
      pxmax = px;
      *ifreq = i;
    }
    update_sincos(numt, sinx_smallstep, cosx_smallstep, sinx1, cosx1, 0);
  }
  copy_sincos(numt, sinx, cosx, sinx1, cosx1);
  if (*ifreq < freq_zoom / 2.) {
    update_sincos(numt, sinx_back, cosx_back, sinx1, cosx1, 0);
    for (i = 0; i < *ifreq; i++)
      update_sincos(numt, sinx_smallstep, cosx_smallstep, sinx1, cosx1, 0);
  } else {
    for (i = 0; i < *ifreq - freq_zoom / 2.; i++)
      update_sincos(numt, sinx_smallstep, cosx_smallstep, sinx1, cosx1, 0);
  }
  return px;
}


x86 assembly (clang, -O0):
<do_lomb_zoom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
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,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
movsd  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    0x10(%rbp),%r8
call   1050 <copy_sincos@plt>
mov    -0x4(%rbp),%edi
mov    0x18(%rbp),%rsi
mov    0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    0x10(%rbp),%r8
xor    %r9d,%r9d
call   1040 <update_sincos@plt>
movl   $0x0,-0x34(%rbp)
cvtsi2sdl -0x34(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1231 <do_lomb_zoom+0x101>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    0x10(%rbp),%r8
mov    0x38(%rbp),%r9
call   1030 <do_lomb@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
ucomisd -0x48(%rbp),%xmm0
jbe    1208 <do_lomb_zoom+0xd8>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x34(%rbp),%ecx
mov    0x40(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%edi
mov    0x28(%rbp),%rsi
mov    0x30(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    0x10(%rbp),%r8
xor    %r9d,%r9d
call   1040 <update_sincos@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11b1 <do_lomb_zoom+0x81>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    0x10(%rbp),%r8
call   1050 <copy_sincos@plt>
mov    0x40(%rbp),%rax
cvtsi2sdl (%rax),%xmm1
movsd  -0x30(%rbp),%xmm0
movsd  0xda2(%rip),%xmm2
divsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jbe    12cb <do_lomb_zoom+0x19b>
mov    -0x4(%rbp),%edi
mov    0x18(%rbp),%rsi
mov    0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    0x10(%rbp),%r8
xor    %r9d,%r9d
call   1040 <update_sincos@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    0x40(%rbp),%rcx
cmp    (%rcx),%eax
jge    12c6 <do_lomb_zoom+0x196>
mov    -0x4(%rbp),%edi
mov    0x28(%rbp),%rsi
mov    0x30(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    0x10(%rbp),%r8
xor    %r9d,%r9d
call   1040 <update_sincos@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    128e <do_lomb_zoom+0x15e>
jmp    132c <do_lomb_zoom+0x1fc>
movl   $0x0,-0x34(%rbp)
cvtsi2sdl -0x34(%rbp),%xmm1
mov    0x40(%rbp),%rax
cvtsi2sdl (%rax),%xmm0
movsd  -0x30(%rbp),%xmm2
movsd  0xd14(%rip),%xmm3
divsd  %xmm3,%xmm2
subsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jbe    1327 <do_lomb_zoom+0x1f7>
mov    -0x4(%rbp),%edi
mov    0x28(%rbp),%rsi
mov    0x30(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    0x10(%rbp),%r8
xor    %r9d,%r9d
call   1040 <update_sincos@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    12d2 <do_lomb_zoom+0x1a2>
jmp    132c <do_lomb_zoom+0x1fc>
movsd  -0x40(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_lomb_zoom>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movsd  %xmm0,(%rsp)
mov    %r9,%r12
mov    %rdx,%r13
mov    %esi,%r14d
mov    %edi,%ebp
mov    0x60(%rsp),%rbx
mov    %rcx,0x10(%rsp)
mov    %rcx,%rsi
mov    %r8,0x18(%rsp)
mov    %r8,%rdx
mov    %r9,%rcx
mov    %rbx,%r8
call   1050 <copy_sincos@plt>
xor    %r15d,%r15d
mov    %ebp,%edi
mov    0x68(%rsp),%rsi
mov    0x70(%rsp),%rdx
mov    %r12,%rcx
mov    %rbx,%r8
xor    %r9d,%r9d
call   1040 <update_sincos@plt>
xorpd  %xmm1,%xmm1
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
ucomisd %xmm1,%xmm0
ja     129e <do_lomb_zoom+0x16e>
mov    %ebp,%edi
mov    0x10(%rsp),%rsi
mov    0x18(%rsp),%rdx
mov    %r12,%rcx
mov    %rbx,%r8
call   1050 <copy_sincos@plt>
mov    0x90(%rsp),%rax
xorps  %xmm0,%xmm0
cvtsi2sdl (%rax),%xmm0
movsd  (%rsp),%xmm2
mulsd  0xe26(%rip),%xmm2
ucomisd %xmm0,%xmm2
mov    %rbx,%r14
jbe    12d4 <do_lomb_zoom+0x1a4>
xor    %ebx,%ebx
mov    %ebp,%edi
mov    0x68(%rsp),%rsi
mov    0x70(%rsp),%rdx
mov    %r12,%rcx
mov    %r14,%r8
xor    %r9d,%r9d
call   1040 <update_sincos@plt>
mov    0x90(%rsp),%rax
cmpl   $0x0,(%rax)
mov    0x80(%rsp),%r15
mov    0x78(%rsp),%r13
jle    133e <do_lomb_zoom+0x20e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %r13,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
mov    %r14,%r8
xor    %r9d,%r9d
call   1040 <update_sincos@plt>
add    $0x1,%ebx
mov    0x90(%rsp),%rax
cmp    (%rax),%ebx
jl     1230 <do_lomb_zoom+0x100>
jmp    133e <do_lomb_zoom+0x20e>
nopw   0x0(%rax,%rax,1)
movsd  %xmm0,0x20(%rsp)
mov    %ebp,%edi
mov    0x78(%rsp),%rsi
mov    0x80(%rsp),%rdx
mov    %r12,%rcx
mov    %rbx,%r8
xor    %r9d,%r9d
call   1040 <update_sincos@plt>
add    $0x1,%r15d
xorps  %xmm0,%xmm0
cvtsi2sd %r15d,%xmm0
movsd  (%rsp),%xmm1
ucomisd %xmm0,%xmm1
jbe    11a7 <do_lomb_zoom+0x77>
mov    %ebp,%edi
mov    %r14d,%esi
mov    %r13,%rdx
mov    %r12,%rcx
mov    %rbx,%r8
mov    0x88(%rsp),%r9
call   1030 <do_lomb@plt>
ucomisd 0x8(%rsp),%xmm0
jbe    1260 <do_lomb_zoom+0x130>
mov    0x90(%rsp),%rax
mov    %r15d,(%rax)
movsd  %xmm0,0x8(%rsp)
jmp    1260 <do_lomb_zoom+0x130>
subsd  %xmm2,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    0x80(%rsp),%r15
mov    0x78(%rsp),%r13
jbe    133e <do_lomb_zoom+0x20e>
mov    $0x1,%ebx
movsd  %xmm2,(%rsp)
nopl   0x0(%rax)
mov    %ebp,%edi
mov    %r13,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
mov    %r14,%r8
xor    %r9d,%r9d
call   1040 <update_sincos@plt>
movsd  (%rsp),%xmm2
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
mov    0x90(%rsp),%rax
xorps  %xmm1,%xmm1
cvtsi2sdl (%rax),%xmm1
subsd  %xmm2,%xmm1
add    $0x1,%ebx
ucomisd %xmm0,%xmm1
ja     1300 <do_lomb_zoom+0x1d0>
movsd  0x20(%rsp),%xmm0
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @do_lomb_zoom(i32 %0, i32 %1, double* %2, double* %3, double* %4, double* %5, double* %6, double* %7, double* %8, double* %9, double* %10, double* %11, double %12, i32* %13) {
%15 = alloca i32
%16 = alloca i32
%17 = alloca double*
%18 = alloca double*
%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
%28 = alloca i32*
%29 = alloca i32
%30 = alloca double
%31 = alloca double
store i32 %0, i32* %15
store i32 %1, i32* %16
store double* %2, double** %17
store double* %3, double** %18
store double* %4, double** %19
store double* %5, double** %20
store double* %6, double** %21
store double* %7, double** %22
store double* %8, double** %23
store double* %9, double** %24
store double* %10, double** %25
store double* %11, double** %26
store double %12, double* %27
store i32* %13, i32** %28
store double 0.000000e+00, double* %31
%32 = load i32, i32* %15
%33 = load double*, double** %18
%34 = load double*, double** %19
%35 = load double*, double** %20
%36 = load double*, double** %21
%37 = call i32 @copy_sincos(i32 %32, double* %33, double* %34, double* %35, double* %36)
%38 = load i32, i32* %15
%39 = load double*, double** %22
%40 = load double*, double** %23
%41 = load double*, double** %20
%42 = load double*, double** %21
%43 = call i32 @update_sincos(i32 %38, double* %39, double* %40, double* %41, double* %42, i32 0)
store i32 0, i32* %29
br label %44
44: ; preds = %71, %14
%45 = load i32, i32* %29
%46 = sitofp i32 %45 to double
%47 = load double, double* %27
%48 = fcmp olt double %46, %47
br i1 %48, label %49, label %74
49: ; preds = %44
%50 = load i32, i32* %15
%51 = load i32, i32* %16
%52 = load double*, double** %17
%53 = load double*, double** %20
%54 = load double*, double** %21
%55 = load double*, double** %26
%56 = call double @do_lomb(i32 %50, i32 %51, double* %52, double* %53, double* %54, double* %55)
store double %56, double* %30
%57 = load double, double* %30
%58 = load double, double* %31
%59 = fcmp ogt double %57, %58
br i1 %59, label %60, label %64
60: ; preds = %49
%61 = load double, double* %30
store double %61, double* %31
%62 = load i32, i32* %29
%63 = load i32*, i32** %28
store i32 %62, i32* %63
br label %64
64: ; preds = %60, %49
%65 = load i32, i32* %15
%66 = load double*, double** %24
%67 = load double*, double** %25
%68 = load double*, double** %20
%69 = load double*, double** %21
%70 = call i32 @update_sincos(i32 %65, double* %66, double* %67, double* %68, double* %69, i32 0)
br label %71
71: ; preds = %64
%72 = load i32, i32* %29
%73 = add nsw i32 %72, 1
store i32 %73, i32* %29
br label %44
74: ; preds = %44
%75 = load i32, i32* %15
%76 = load double*, double** %18
%77 = load double*, double** %19
%78 = load double*, double** %20
%79 = load double*, double** %21
%80 = call i32 @copy_sincos(i32 %75, double* %76, double* %77, double* %78, double* %79)
%81 = load i32*, i32** %28
%82 = load i32, i32* %81
%83 = sitofp i32 %82 to double
%84 = load double, double* %27
%85 = fdiv double %84, 2.000000e+00
%86 = fcmp olt double %83, %85
br i1 %86, label %87, label %110
87: ; preds = %74
%88 = load i32, i32* %15
%89 = load double*, double** %22
%90 = load double*, double** %23
%91 = load double*, double** %20
%92 = load double*, double** %21
%93 = call i32 @update_sincos(i32 %88, double* %89, double* %90, double* %91, double* %92, i32 0)
store i32 0, i32* %29
br label %94
94: ; preds = %106, %87
%95 = load i32, i32* %29
%96 = load i32*, i32** %28
%97 = load i32, i32* %96
%98 = icmp slt i32 %95, %97
br i1 %98, label %99, label %109
99: ; preds = %94
%100 = load i32, i32* %15
%101 = load double*, double** %24
%102 = load double*, double** %25
%103 = load double*, double** %20
%104 = load double*, double** %21
%105 = call i32 @update_sincos(i32 %100, double* %101, double* %102, double* %103, double* %104, i32 0)
br label %106
106: ; preds = %99
%107 = load i32, i32* %29
%108 = add nsw i32 %107, 1
store i32 %108, i32* %29
br label %94
109: ; preds = %94
br label %132
110: ; preds = %74
store i32 0, i32* %29
br label %111
111: ; preds = %128, %110
%112 = load i32, i32* %29
%113 = sitofp i32 %112 to double
%114 = load i32*, i32** %28
%115 = load i32, i32* %114
%116 = sitofp i32 %115 to double
%117 = load double, double* %27
%118 = fdiv double %117, 2.000000e+00
%119 = fsub double %116, %118
%120 = fcmp olt double %113, %119
br i1 %120, label %121, label %131
121: ; preds = %111
%122 = load i32, i32* %15
%123 = load double*, double** %24
%124 = load double*, double** %25
%125 = load double*, double** %20
%126 = load double*, double** %21
%127 = call i32 @update_sincos(i32 %122, double* %123, double* %124, double* %125, double* %126, i32 0)
br label %128
128: ; preds = %121
%129 = load i32, i32* %29
%130 = add nsw i32 %129, 1
store i32 %130, i32* %29
br label %111
131: ; preds = %111
br label %132
132: ; preds = %131, %109
%133 = load double, double* %30
ret double %133
}

LLVM IR (-O2):
define double @do_lomb_zoom(i32 %0, i32 %1, double* %2, double* %3, double* %4, double* %5, double* %6, double* %7, double* %8, double* %9, double* %10, double* %11, double %12, i32* nocapture %13) {
%15 = tail call i32 @copy_sincos(i32 %0, double* %3, double* %4, double* %5, double* %6)
%16 = tail call i32 @update_sincos(i32 %0, double* %7, double* %8, double* %5, double* %6, i32 0)
%17 = fcmp ogt double %12, 0.000000e+00
br i1 %17, label %18, label %30
18: ; preds = %14, %24
%19 = phi double [ %25, %24 ], [ 0.000000e+00, %14 ]
%20 = phi i32 [ %27, %24 ], [ 0, %14 ]
%21 = tail call double @do_lomb(i32 %0, i32 %1, double* %2, double* %5, double* %6, double* %11)
%22 = fcmp ogt double %21, %19
br i1 %22, label %23, label %24
23: ; preds = %18
store i32 %20, i32* %13
br label %24
24: ; preds = %23, %18
%25 = phi double [ %21, %23 ], [ %19, %18 ]
%26 = tail call i32 @update_sincos(i32 %0, double* %9, double* %10, double* %5, double* %6, i32 0)
%27 = add nuw nsw i32 %20, 1
%28 = sitofp i32 %27 to double
%29 = fcmp olt double %28, %12
br i1 %29, label %18, label %30
30: ; preds = %24, %14
%31 = phi double [ undef, %14 ], [ %21, %24 ]
%32 = tail call i32 @copy_sincos(i32 %0, double* %3, double* %4, double* %5, double* %6)
%33 = load i32, i32* %13
%34 = sitofp i32 %33 to double
%35 = fmul double %12, 5.000000e-01
%36 = fcmp ogt double %35, %34
br i1 %36, label %40, label %37
37: ; preds = %30
%38 = fsub double %34, %35
%39 = fcmp ogt double %38, 0.000000e+00
br i1 %39, label %50, label %59
40: ; preds = %30
%41 = tail call i32 @update_sincos(i32 %0, double* %7, double* %8, double* %5, double* %6, i32 0)
%42 = load i32, i32* %13
%43 = icmp sgt i32 %42, 0
br i1 %43, label %44, label %59
44: ; preds = %40, %44
%45 = phi i32 [ %47, %44 ], [ 0, %40 ]
%46 = tail call i32 @update_sincos(i32 %0, double* %9, double* %10, double* %5, double* %6, i32 0)
%47 = add nuw nsw i32 %45, 1
%48 = load i32, i32* %13
%49 = icmp slt i32 %47, %48
br i1 %49, label %44, label %59
50: ; preds = %37, %50
%51 = phi i32 [ %53, %50 ], [ 0, %37 ]
%52 = tail call i32 @update_sincos(i32 %0, double* %9, double* %10, double* %5, double* %6, i32 0)
%53 = add nuw nsw i32 %51, 1
%54 = sitofp i32 %53 to double
%55 = load i32, i32* %13
%56 = sitofp i32 %55 to double
%57 = fsub double %56, %35
%58 = fcmp ogt double %57, %54
br i1 %58, label %50, label %59
59: ; preds = %50, %44, %37, %40
ret double %31
}