#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 */
struct ln_ell_orbit {
  int dummy;
};

/* Variables and functions */
double ln_get_ell_body_earth_dist(double, struct ln_ell_orbit *);
double log10(double);
double ln_get_asteroid_sdiam_arc(double JD, struct ln_ell_orbit *orbit,
                                 double H, double A) {
  double d, dist;
  dist = ln_get_ell_body_earth_dist(JD, orbit);
  d = 3.13 - 0.2 * H - (0.5 * log10(A));
  return 0.0013788 * d / dist;
}


x86 assembly (clang, -O0):
<ln_get_asteroid_sdiam_arc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rdi
call   1030 <ln_get_ell_body_earth_dist@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xeb5(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xeb1(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <log10@plt>
movsd  -0x38(%rbp),%xmm1
movsd  0xe81(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe64(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
divsd  -0x30(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ln_get_asteroid_sdiam_arc>:
sub    $0x18,%rsp
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,(%rsp)
call   1030 <ln_get_ell_body_earth_dist@plt>
movsd  %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
mulsd  0xeb9(%rip),%xmm0
addsd  0xeb9(%rip),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <log10@plt>
mulsd  0xea9(%rip),%xmm0
addsd  (%rsp),%xmm0
mulsd  0xea4(%rip),%xmm0
divsd  0x10(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.ln_ell_orbit = type { i32 }
define double @ln_get_asteroid_sdiam_arc(double %0, %struct.ln_ell_orbit* %1, double %2, double %3) {
%5 = alloca double
%6 = alloca %struct.ln_ell_orbit*
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store double %0, double* %5
store %struct.ln_ell_orbit* %1, %struct.ln_ell_orbit** %6
store double %2, double* %7
store double %3, double* %8
%11 = load double, double* %5
%12 = load %struct.ln_ell_orbit*, %struct.ln_ell_orbit** %6
%13 = call double @ln_get_ell_body_earth_dist(double %11, %struct.ln_ell_orbit* %12)
store double %13, double* %10
%14 = load double, double* %7
%15 = call double @llvm.fmuladd.f64(double -2.000000e-01, double %14, double 3.130000e+00)
%16 = load double, double* %8
%17 = call double @log10(double %16)
%18 = call double @llvm.fmuladd.f64(double -5.000000e-01, double %17, double %15)
store double %18, double* %9
%19 = load double, double* %9
%20 = fmul double 1.378800e-03, %19
%21 = load double, double* %10
%22 = fdiv double %20, %21
ret double %22
}

LLVM IR (-O2):
%struct.ln_ell_orbit = type { i32 }
define double @ln_get_asteroid_sdiam_arc(double %0, %struct.ln_ell_orbit* %1, double %2, double %3) {
%5 = tail call double @ln_get_ell_body_earth_dist(double %0, %struct.ln_ell_orbit* %1)
%6 = tail call double @llvm.fmuladd.f64(double %2, double -2.000000e-01, double 3.130000e+00)
%7 = tail call double @log10(double %3)
%8 = tail call double @llvm.fmuladd.f64(double %7, double -5.000000e-01, double %6)
%9 = fmul double %8, 1.378800e-03
%10 = fdiv double %9, %5
ret double %10
}