#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 fabs(double);
int log(double);
double pow(double, int);
double MoonsBrightness(double dist, double phasemoon) {
  double log10 = 2.302585092994;
  return -21.62 + 5 * log(dist / (6378136.6 / 1000)) / log10 +
         0.026 * fabs(phasemoon) + 0.000000004 * pow(phasemoon, 4);
}


x86 assembly (clang, -O0):
<MoonsBrightness>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  0xee6(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xecc(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <log@plt>
imul   $0x5,%eax,%eax
cvtsi2sd %eax,%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  0xea7(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
movaps 0xeb7(%rip),%xmm2
pand   %xmm2,%xmm0
movsd  0xe83(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    $0x4,%edi
call   1040 <pow@plt>
movsd  -0x20(%rbp),%xmm1
movsd  0xe52(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MoonsBrightness>:
sub    $0x28,%rsp
movaps %xmm1,0x10(%rsp)
divsd  0xecf(%rip),%xmm0
call   1030 <log@plt>
lea    (%rax,%rax,4),%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
divsd  0xec0(%rip),%xmm1
addsd  0xec0(%rip),%xmm1
movapd 0xed8(%rip),%xmm2
movapd 0x10(%rsp),%xmm0
andpd  %xmm0,%xmm2
mulsd  0xeae(%rip),%xmm2
addsd  %xmm1,%xmm2
movapd %xmm2,(%rsp)
mov    $0x4,%edi
call   1040 <pow@plt>
mulsd  0xe9b(%rip),%xmm0
addsd  (%rsp),%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @MoonsBrightness(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
store double 0x40026BB1BBB554AF, double* %5
%6 = load double, double* %3
%7 = fdiv double %6, 0x40B8EA22F837B4A2
%8 = call i32 @log(double %7)
%9 = mul nsw i32 5, %8
%10 = sitofp i32 %9 to double
%11 = load double, double* %5
%12 = fdiv double %10, %11
%13 = fadd double -2.162000e+01, %12
%14 = load double, double* %4
%15 = call double @llvm.fabs.f64(double %14)
%16 = call double @llvm.fmuladd.f64(double 2.600000e-02, double %15, double %13)
%17 = load double, double* %4
%18 = call double @pow(double %17, i32 4)
%19 = call double @llvm.fmuladd.f64(double 4.000000e-09, double %18, double %16)
ret double %19
}

LLVM IR (-O2):
define double @MoonsBrightness(double %0, double %1) {
%3 = fdiv double %0, 0x40B8EA22F837B4A2
%4 = tail call i32 @log(double %3)
%5 = mul nsw i32 %4, 5
%6 = sitofp i32 %5 to double
%7 = fdiv double %6, 0x40026BB1BBB554AF
%8 = fadd double %7, -2.162000e+01
%9 = tail call double @llvm.fabs.f64(double %1)
%10 = tail call double @llvm.fmuladd.f64(double %9, double 2.600000e-02, double %8)
%11 = tail call double @pow(double %1, i32 4)
%12 = tail call double @llvm.fmuladd.f64(double %11, double 4.000000e-09, double %10)
ret double %12
}