#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 calcEnergy(double);
double calcRadius(double, double);
double calcSemiMajor(double);
double calcVelocity(double, double);
double getEccentricity();
double getPeriod();
int /*<<< orphan*/ printResults(double, double, double, double, double, double);
int main() {
  double period = 0.0;
  double eccen = 0.0;
  double semi_axis = 0.0;
  double energy = 0.0;
  double peri_radi = 0.0;
  double peri_v = 0.0;
  double apo_radi = 0.0;
  double apo_v = 0.0;
  period = getPeriod();
  eccen = getEccentricity();
  semi_axis = calcSemiMajor(period * 60);
  energy = calcEnergy(semi_axis);
  peri_radi = calcRadius(semi_axis, -eccen);
  peri_v = calcVelocity(peri_radi, energy);
  apo_radi = calcRadius(semi_axis, eccen);
  apo_v = calcVelocity(apo_radi, energy);
  printResults((period / 1440), eccen, peri_radi, peri_v, apo_radi, apo_v);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    $0x0,%al
call   1040 <getPeriod@plt>
movsd  %xmm0,-0x10(%rbp)
mov    $0x0,%al
call   1090 <getEccentricity@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  0xe29(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
call   1030 <calcSemiMajor@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1050 <calcEnergy@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
call   1080 <calcRadius@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
call   1060 <calcVelocity@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1080 <calcRadius@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
call   1060 <calcVelocity@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xd8f(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm3
movsd  -0x40(%rbp),%xmm4
movsd  -0x48(%rbp),%xmm5
call   1070 <printResults@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x48,%rsp
xor    %eax,%eax
call   1040 <getPeriod@plt>
movsd  %xmm0,0x18(%rsp)
xor    %eax,%eax
call   1090 <getEccentricity@plt>
movaps %xmm0,0x20(%rsp)
movsd  0xe6b(%rip),%xmm0
mulsd  0x18(%rsp),%xmm0
call   1030 <calcSemiMajor@plt>
movsd  %xmm0,0x8(%rsp)
call   1050 <calcEnergy@plt>
movsd  %xmm0,0x10(%rsp)
movaps 0xe58(%rip),%xmm1
xorps  0x20(%rsp),%xmm1
movsd  0x8(%rsp),%xmm0
call   1080 <calcRadius@plt>
movsd  %xmm0,0x40(%rsp)
movsd  0x10(%rsp),%xmm1
call   1060 <calcVelocity@plt>
movsd  %xmm0,0x38(%rsp)
movsd  0x8(%rsp),%xmm0
movaps 0x20(%rsp),%xmm1
call   1080 <calcRadius@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm1
call   1060 <calcVelocity@plt>
movaps %xmm0,%xmm5
movsd  0x18(%rsp),%xmm0
divsd  0xdf7(%rip),%xmm0
movaps 0x20(%rsp),%xmm1
movsd  0x40(%rsp),%xmm2
movsd  0x38(%rsp),%xmm3
movsd  0x8(%rsp),%xmm4
call   1070 <printResults@plt>
xor    %eax,%eax
add    $0x48,%rsp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store i32 0, i32* %1
store double 0.000000e+00, double* %2
store double 0.000000e+00, double* %3
store double 0.000000e+00, double* %4
store double 0.000000e+00, double* %5
store double 0.000000e+00, double* %6
store double 0.000000e+00, double* %7
store double 0.000000e+00, double* %8
store double 0.000000e+00, double* %9
%10 = call double (...) @getPeriod()
store double %10, double* %2
%11 = call double (...) @getEccentricity()
store double %11, double* %3
%12 = load double, double* %2
%13 = fmul double %12, 6.000000e+01
%14 = call double @calcSemiMajor(double %13)
store double %14, double* %4
%15 = load double, double* %4
%16 = call double @calcEnergy(double %15)
store double %16, double* %5
%17 = load double, double* %4
%18 = load double, double* %3
%19 = fneg double %18
%20 = call double @calcRadius(double %17, double %19)
store double %20, double* %6
%21 = load double, double* %6
%22 = load double, double* %5
%23 = call double @calcVelocity(double %21, double %22)
store double %23, double* %7
%24 = load double, double* %4
%25 = load double, double* %3
%26 = call double @calcRadius(double %24, double %25)
store double %26, double* %8
%27 = load double, double* %8
%28 = load double, double* %5
%29 = call double @calcVelocity(double %27, double %28)
store double %29, double* %9
%30 = load double, double* %2
%31 = fdiv double %30, 1.440000e+03
%32 = load double, double* %3
%33 = load double, double* %6
%34 = load double, double* %7
%35 = load double, double* %8
%36 = load double, double* %9
%37 = call i32 @printResults(double %31, double %32, double %33, double %34, double %35, double %36)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call double (...) @getPeriod()
%2 = tail call double (...) @getEccentricity()
%3 = fmul double %1, 6.000000e+01
%4 = tail call double @calcSemiMajor(double %3)
%5 = tail call double @calcEnergy(double %4)
%6 = fneg double %2
%7 = tail call double @calcRadius(double %4, double %6)
%8 = tail call double @calcVelocity(double %7, double %5)
%9 = tail call double @calcRadius(double %4, double %2)
%10 = tail call double @calcVelocity(double %9, double %5)
%11 = fdiv double %1, 1.440000e+03
%12 = tail call i32 @printResults(double %11, double %2, double %7, double %8, double %9, double %10)
ret i32 0
}