#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 pow(double, double);
double sma(double period, double hostmass, double satmass) {
  double r;
  double m;
  double r_numerator;
  double r_denominator;
  m = fabs(hostmass + satmass);
  r_numerator = 6.67408E-11 * m * pow(fabs(period), 2.0);
  r_denominator = 4 * pow(3.14159265358979323846, 2.0);
  r = pow(r_numerator / r_denominator, 1.0 / 3.0);
  return r;
}


x86 assembly (clang, -O0):
<sma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movaps 0xee8(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xecf(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
movaps 0xec1(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xea5(%rip),%xmm1
call   1030 <pow@plt>
movsd  -0x40(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe7e(%rip),%xmm0
movsd  0xe7e(%rip),%xmm1
call   1030 <pow@plt>
shl    $0x2,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
divsd  -0x38(%rbp),%xmm0
movsd  0xe4b(%rip),%xmm1
call   1030 <pow@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sma>:
sub    $0x18,%rsp
addsd  %xmm2,%xmm1
movapd 0xee0(%rip),%xmm2
andpd  %xmm2,%xmm1
mulsd  0xee4(%rip),%xmm1
movapd %xmm1,(%rsp)
andpd  %xmm2,%xmm0
movsd  0xedb(%rip),%xmm1
call   1030 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0xec5(%rip),%xmm0
movsd  0xeb5(%rip),%xmm1
call   1030 <pow@plt>
shl    $0x2,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  (%rsp),%xmm0
divsd  %xmm1,%xmm0
movsd  0xea5(%rip),%xmm1
call   1030 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @sma(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%11 = load double, double* %5
%12 = load double, double* %6
%13 = fadd double %11, %12
%14 = call double @llvm.fabs.f64(double %13)
store double %14, double* %8
%15 = load double, double* %8
%16 = fmul double 6.674080e-11, %15
%17 = load double, double* %4
%18 = call double @llvm.fabs.f64(double %17)
%19 = call i32 @pow(double %18, double 2.000000e+00)
%20 = sitofp i32 %19 to double
%21 = fmul double %16, %20
store double %21, double* %9
%22 = call i32 @pow(double 0x400921FB54442D18, double 2.000000e+00)
%23 = mul nsw i32 4, %22
%24 = sitofp i32 %23 to double
store double %24, double* %10
%25 = load double, double* %9
%26 = load double, double* %10
%27 = fdiv double %25, %26
%28 = call i32 @pow(double %27, double 0x3FD5555555555555)
%29 = sitofp i32 %28 to double
store double %29, double* %7
%30 = load double, double* %7
ret double %30
}

LLVM IR (-O2):
define double @sma(double %0, double %1, double %2) {
%4 = fadd double %1, %2
%5 = tail call double @llvm.fabs.f64(double %4)
%6 = fmul double %5, 6.674080e-11
%7 = tail call double @llvm.fabs.f64(double %0)
%8 = tail call i32 @pow(double %7, double 2.000000e+00)
%9 = sitofp i32 %8 to double
%10 = fmul double %6, %9
%11 = tail call i32 @pow(double 0x400921FB54442D18, double 2.000000e+00)
%12 = shl nsw i32 %11, 2
%13 = sitofp i32 %12 to double
%14 = fdiv double %10, %13
%15 = tail call i32 @pow(double %14, double 0x3FD5555555555555)
%16 = sitofp i32 %15 to double
ret double %16
}