#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_jupiter_earth_dist(double);
double ln_get_jupiter_phase(double);
double ln_get_jupiter_solar_dist(double);
double log10(double);
double ln_get_jupiter_magnitude(double JD) {
  double delta, r, i;
  r = ln_get_jupiter_solar_dist(JD);
  delta = ln_get_jupiter_earth_dist(JD);
  i = ln_get_jupiter_phase(JD);
  return -9.40 + 5.0 * log10(r * delta) + 0.005 * i;
}


x86 assembly (clang, -O0):
<ln_get_jupiter_magnitude>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1060 <ln_get_jupiter_solar_dist@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <ln_get_jupiter_earth_dist@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <ln_get_jupiter_phase@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
call   1050 <log10@plt>
movaps %xmm0,%xmm1
movsd  0xe74(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe70(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
movsd  0xe4f(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ln_get_jupiter_magnitude>:
sub    $0x18,%rsp
movsd  %xmm0,(%rsp)
call   1060 <ln_get_jupiter_solar_dist@plt>
movsd  %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
call   1040 <ln_get_jupiter_earth_dist@plt>
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
call   1030 <ln_get_jupiter_phase@plt>
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
mulsd  0x10(%rsp),%xmm0
call   1050 <log10@plt>
mulsd  0xe74(%rip),%xmm0
addsd  0xe74(%rip),%xmm0
movsd  (%rsp),%xmm1
mulsd  0xe6f(%rip),%xmm1
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @ln_get_jupiter_magnitude(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %2
%6 = load double, double* %2
%7 = call double @ln_get_jupiter_solar_dist(double %6)
store double %7, double* %4
%8 = load double, double* %2
%9 = call double @ln_get_jupiter_earth_dist(double %8)
store double %9, double* %3
%10 = load double, double* %2
%11 = call double @ln_get_jupiter_phase(double %10)
store double %11, double* %5
%12 = load double, double* %4
%13 = load double, double* %3
%14 = fmul double %12, %13
%15 = call double @log10(double %14)
%16 = call double @llvm.fmuladd.f64(double 5.000000e+00, double %15, double -9.400000e+00)
%17 = load double, double* %5
%18 = call double @llvm.fmuladd.f64(double 5.000000e-03, double %17, double %16)
ret double %18
}

LLVM IR (-O2):
define double @ln_get_jupiter_magnitude(double %0) {
%2 = tail call double @ln_get_jupiter_solar_dist(double %0)
%3 = tail call double @ln_get_jupiter_earth_dist(double %0)
%4 = tail call double @ln_get_jupiter_phase(double %0)
%5 = fmul double %2, %3
%6 = tail call double @log10(double %5)
%7 = tail call double @llvm.fmuladd.f64(double %6, double 5.000000e+00, double -9.400000e+00)
%8 = tail call double @llvm.fmuladd.f64(double %4, double 5.000000e-03, double %7)
ret double %8
}