#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 */
double newmoon(double);
void findnewmoons(double newmoons[], int nmcount, double startjd) {
  int i;
  double nm;
  for (i = 0; i < nmcount; i++) {
    nm = newmoon(startjd);
    newmoons[i] = nm;
    startjd = nm + 29.53;
  }
}


x86 assembly (clang, -O0):
<findnewmoons>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1178 <findnewmoons+0x68>
movsd  -0x18(%rbp),%xmm0
call   1030 <newmoon@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  0xea0(%rip),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112b <findnewmoons+0x1b>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findnewmoons>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
jle    114c <findnewmoons+0x3c>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
call   1030 <newmoon@plt>
movsd  %xmm0,(%r14,%rbx,8)
addsd  0xebd(%rip),%xmm0
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <findnewmoons+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @findnewmoons(double* %0, i32 %1, double %2) {
%4 = alloca double*
%5 = alloca i32
%6 = alloca double
%7 = alloca i32
%8 = alloca double
store double* %0, double** %4
store i32 %1, i32* %5
store double %2, double* %6
store i32 0, i32* %7
br label %9
9: ; preds = %23, %3
%10 = load i32, i32* %7
%11 = load i32, i32* %5
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %26
13: ; preds = %9
%14 = load double, double* %6
%15 = call double @newmoon(double %14)
store double %15, double* %8
%16 = load double, double* %8
%17 = load double*, double** %4
%18 = load i32, i32* %7
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds double, double* %17, i64 %19
store double %16, double* %20
%21 = load double, double* %8
%22 = fadd double %21, 2.953000e+01
store double %22, double* %6
br label %23
23: ; preds = %13
%24 = load i32, i32* %7
%25 = add nsw i32 %24, 1
store i32 %25, i32* %7
br label %9
26: ; preds = %9
ret void
}

LLVM IR (-O2):
define void @findnewmoons(double* nocapture writeonly %0, i32 %1, double %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %15
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %13, %7 ]
%9 = phi double [ %2, %5 ], [ %12, %7 ]
%10 = tail call double @newmoon(double %9)
%11 = getelementptr inbounds double, double* %0, i64 %8
store double %10, double* %11
%12 = fadd double %10, 2.953000e+01
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, %6
br i1 %14, label %15, label %7
15: ; preds = %7, %3
ret void
}