#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_earth_solar_dist(double);
double ln_get_mercury_earth_dist(double);
double ln_get_mercury_solar_dist(double);
double ln_get_mercury_disk(double JD) {
  double r, delta, R;
  R = ln_get_earth_solar_dist(JD);
  r = ln_get_mercury_solar_dist(JD);
  delta = ln_get_mercury_earth_dist(JD);
  return (((r + delta) * (r + delta)) - R * R) / (4 * r * delta);
}


x86 assembly (clang, -O0):
<ln_get_mercury_disk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <ln_get_earth_solar_dist@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <ln_get_mercury_solar_dist@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1050 <ln_get_mercury_earth_dist@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
addsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe51(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ln_get_mercury_disk>:
sub    $0x18,%rsp
movsd  %xmm0,(%rsp)
call   1040 <ln_get_earth_solar_dist@plt>
movsd  %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
call   1030 <ln_get_mercury_solar_dist@plt>
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
call   1050 <ln_get_mercury_earth_dist@plt>
movsd  0x8(%rsp),%xmm2
movapd %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%rsp),%xmm3
mulsd  %xmm3,%xmm3
mulsd  %xmm1,%xmm1
subsd  %xmm3,%xmm1
mulsd  0xe7a(%rip),%xmm2
mulsd  %xmm0,%xmm2
divsd  %xmm2,%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @ln_get_mercury_disk(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_earth_solar_dist(double %6)
store double %7, double* %5
%8 = load double, double* %2
%9 = call double @ln_get_mercury_solar_dist(double %8)
store double %9, double* %3
%10 = load double, double* %2
%11 = call double @ln_get_mercury_earth_dist(double %10)
store double %11, double* %4
%12 = load double, double* %3
%13 = load double, double* %4
%14 = fadd double %12, %13
%15 = load double, double* %3
%16 = load double, double* %4
%17 = fadd double %15, %16
%18 = load double, double* %5
%19 = load double, double* %5
%20 = fmul double %18, %19
%21 = fneg double %20
%22 = call double @llvm.fmuladd.f64(double %14, double %17, double %21)
%23 = load double, double* %3
%24 = fmul double 4.000000e+00, %23
%25 = load double, double* %4
%26 = fmul double %24, %25
%27 = fdiv double %22, %26
ret double %27
}

LLVM IR (-O2):
define double @ln_get_mercury_disk(double %0) {
%2 = tail call double @ln_get_earth_solar_dist(double %0)
%3 = tail call double @ln_get_mercury_solar_dist(double %0)
%4 = tail call double @ln_get_mercury_earth_dist(double %0)
%5 = fadd double %3, %4
%6 = fneg double %2
%7 = fmul double %2, %6
%8 = tail call double @llvm.fmuladd.f64(double %5, double %5, double %7)
%9 = fmul double %3, 4.000000e+00
%10 = fmul double %9, %4
%11 = fdiv double %8, %10
ret double %11
}