#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 apparentmoon(double, int);
int /*<<< orphan*/ fmtdeg(char *, double);
double lightabbr_high(double);
int /*<<< orphan*/ printf(char *, double, char *, char *);
void testapparentmoon(void) {
  double jd = 2411545.0;
  char deg[30];
  char degsun[30];
  double d;
  int i;
  for (i = 0; i < 20; i++) {
    d = apparentmoon(jd, 1) * 57.295779513082320876798;
    fmtdeg(deg, d);
    d = lightabbr_high(jd) * 57.295779513082320876798;
    fmtdeg(degsun, d);
    printf("%.2f %s %s\n", jd, deg, degsun);
    jd += 2;
  }
}


x86 assembly (clang, -O0):
<testapparentmoon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  0xeb0(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movl   $0x0,-0x5c(%rbp)
cmpl   $0x14,-0x5c(%rbp)
jge    11f6 <testapparentmoon+0xb6>
movsd  -0x8(%rbp),%xmm0
mov    $0x1,%edi
call   1030 <apparentmoon@plt>
movsd  0xe93(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
lea    -0x30(%rbp),%rdi
movsd  -0x58(%rbp),%xmm0
call   1050 <fmtdeg@plt>
movsd  -0x8(%rbp),%xmm0
call   1060 <lightabbr_high@plt>
movsd  0xe6a(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
lea    -0x50(%rbp),%rdi
movsd  -0x58(%rbp),%xmm0
call   1050 <fmtdeg@plt>
movsd  -0x8(%rbp),%xmm0
lea    -0x30(%rbp),%rsi
lea    -0x50(%rbp),%rdx
lea    0xe47(%rip),%rdi
call   1040 <printf@plt>
movsd  0xe2a(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    115c <testapparentmoon+0x1c>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testapparentmoon>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x58,%rsp
movsd  0xeae(%rip),%xmm0
mov    $0x14,%ebp
lea    0x30(%rsp),%r14
lea    0x10(%rsp),%rbx
lea    0xeb0(%rip),%r15
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,0x8(%rsp)
movsd  0x8(%rsp),%xmm0
mov    $0x1,%edi
call   1030 <apparentmoon@plt>
movsd  0xe7a(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    %r14,%rdi
call   1050 <fmtdeg@plt>
movsd  0x8(%rsp),%xmm0
call   1060 <lightabbr_high@plt>
mulsd  0xe5b(%rip),%xmm0
mov    %rbx,%rdi
call   1050 <fmtdeg@plt>
mov    %r15,%rdi
movsd  0x8(%rsp),%xmm0
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm0
addsd  0xe39(%rip),%xmm0
add    $0xffffffff,%ebp
jne    1170 <testapparentmoon+0x30>
add    $0x58,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"%.2f %s %s\0A\00"
define void @testapparentmoon() {
%1 = alloca double
%2 = alloca [30 x i8]
%3 = alloca [30 x i8]
%4 = alloca double
%5 = alloca i32
store double 0x4142660C80000000, double* %1
store i32 0, i32* %5
br label %6
6: ; preds = %28, %0
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 20
br i1 %8, label %9, label %31
9: ; preds = %6
%10 = load double, double* %1
%11 = call double @apparentmoon(double %10, i32 1)
%12 = fmul double %11, 0x404CA5DC1A63C1F8
store double %12, double* %4
%13 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%14 = load double, double* %4
%15 = call i32 @fmtdeg(i8* %13, double %14)
%16 = load double, double* %1
%17 = call double @lightabbr_high(double %16)
%18 = fmul double %17, 0x404CA5DC1A63C1F8
store double %18, double* %4
%19 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%20 = load double, double* %4
%21 = call i32 @fmtdeg(i8* %19, double %20)
%22 = load double, double* %1
%23 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%24 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%25 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double %22, i8* %23, i8* %24)
%26 = load double, double* %1
%27 = fadd double %26, 2.000000e+00
store double %27, double* %1
br label %28
28: ; preds = %9
%29 = load i32, i32* %5
%30 = add nsw i32 %29, 1
store i32 %30, i32* %5
br label %6
31: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"%.2f %s %s\0A\00"
define void @testapparentmoon() {
%1 = alloca [30 x i8]
%2 = alloca [30 x i8]
%3 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
br label %5
5: ; preds = %0, %5
%6 = phi i32 [ 0, %0 ], [ %16, %5 ]
%7 = phi double [ 0x4142660C80000000, %0 ], [ %15, %5 ]
%8 = call double @apparentmoon(double %7, i32 1)
%9 = fmul double %8, 0x404CA5DC1A63C1F8
%10 = call i32 @fmtdeg(i8* %3, double %9)
%11 = call double @lightabbr_high(double %7)
%12 = fmul double %11, 0x404CA5DC1A63C1F8
%13 = call i32 @fmtdeg(i8* %4, double %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double %7, i8* %3, i8* %4)
%15 = fadd double %7, 2.000000e+00
%16 = add nuw nsw i32 %6, 1
%17 = icmp eq i32 %16, 20
br i1 %17, label %18, label %5
18: ; preds = %5
ret void
}