#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 ln_get_venus_earth_dist(double);
double ln_get_venus_phase(double);
double ln_get_venus_solar_dist(double);
double log10(double);
double ln_get_venus_magnitude(double JD) {
  double delta, r, i, i2, i3;
  r = ln_get_venus_solar_dist(JD);
  delta = ln_get_venus_earth_dist(JD);
  i = ln_get_venus_phase(JD);
  i2 = i * i;
  i3 = i2 * i;
  return -4.40 + 5.0 * log10(r * delta) + 0.0009 * i + 0.000239 * i2 -
         0.00000065 * i3;
}


x86 assembly (clang, -O0):
<ln_get_venus_magnitude>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1060 <ln_get_venus_solar_dist@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1050 <ln_get_venus_earth_dist@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <ln_get_venus_phase@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
call   1040 <log10@plt>
movaps %xmm0,%xmm1
movsd  0xe66(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe62(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
movsd  0xe41(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  0xe24(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
movsd  0xe07(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ln_get_venus_magnitude>:
sub    $0x28,%rsp
movsd  %xmm0,(%rsp)
call   1060 <ln_get_venus_solar_dist@plt>
movsd  %xmm0,0x20(%rsp)
movsd  (%rsp),%xmm0
call   1050 <ln_get_venus_earth_dist@plt>
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
call   1030 <ln_get_venus_phase@plt>
movsd  %xmm0,0x10(%rsp)
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x18(%rsp)
movapd %xmm0,%xmm2
mulsd  %xmm1,%xmm2
movsd  %xmm2,(%rsp)
movsd  0x8(%rsp),%xmm0
mulsd  0x20(%rsp),%xmm0
call   1040 <log10@plt>
mulsd  0xe58(%rip),%xmm0
addsd  0xe58(%rip),%xmm0
movsd  0x10(%rsp),%xmm1
mulsd  0xe52(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0x18(%rsp),%xmm1
mulsd  0xe48(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  (%rsp),%xmm1
mulsd  0xe3f(%rip),%xmm1
addsd  %xmm1,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @ln_get_venus_magnitude(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %2
%8 = load double, double* %2
%9 = call double @ln_get_venus_solar_dist(double %8)
store double %9, double* %4
%10 = load double, double* %2
%11 = call double @ln_get_venus_earth_dist(double %10)
store double %11, double* %3
%12 = load double, double* %2
%13 = call double @ln_get_venus_phase(double %12)
store double %13, double* %5
%14 = load double, double* %5
%15 = load double, double* %5
%16 = fmul double %14, %15
store double %16, double* %6
%17 = load double, double* %6
%18 = load double, double* %5
%19 = fmul double %17, %18
store double %19, double* %7
%20 = load double, double* %4
%21 = load double, double* %3
%22 = fmul double %20, %21
%23 = call double @log10(double %22)
%24 = call double @llvm.fmuladd.f64(double 5.000000e+00, double %23, double -4.400000e+00)
%25 = load double, double* %5
%26 = call double @llvm.fmuladd.f64(double 9.000000e-04, double %25, double %24)
%27 = load double, double* %6
%28 = call double @llvm.fmuladd.f64(double 2.390000e-04, double %27, double %26)
%29 = load double, double* %7
%30 = call double @llvm.fmuladd.f64(double -6.500000e-07, double %29, double %28)
ret double %30
}

LLVM IR (-O2):
define double @ln_get_venus_magnitude(double %0) {
%2 = tail call double @ln_get_venus_solar_dist(double %0)
%3 = tail call double @ln_get_venus_earth_dist(double %0)
%4 = tail call double @ln_get_venus_phase(double %0)
%5 = fmul double %4, %4
%6 = fmul double %4, %5
%7 = fmul double %2, %3
%8 = tail call double @log10(double %7)
%9 = tail call double @llvm.fmuladd.f64(double %8, double 5.000000e+00, double -4.400000e+00)
%10 = tail call double @llvm.fmuladd.f64(double %4, double 9.000000e-04, double %9)
%11 = tail call double @llvm.fmuladd.f64(double %5, double 2.390000e-04, double %10)
%12 = tail call double @llvm.fmuladd.f64(double %6, double -6.500000e-07, double %11)
ret double %12
}