#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 cos(double);
double el_true_anomaly(double, double, double);
double fabs(double);
double sin(double);
double el_segment_area(double semiMajor, double ecc, double fi0, double fi1) {
  double r0 = el_true_anomaly(semiMajor, ecc, fi0);
  double r1 = el_true_anomaly(semiMajor, ecc, fi1);
  double x0 = r0 * cos(fi0);
  double y0 = r0 * sin(fi0);
  double x1 = r1 * cos(fi1);
  double y1 = r1 * sin(fi1);
  double seg = 0.5 * fabs(x0 * y1 - x1 * y0);
  return seg;
}


x86 assembly (clang, -O0):
<el_segment_area>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
call   1040 <el_true_anomaly@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
call   1040 <el_true_anomaly@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x38(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movaps 0xdc1(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xda5(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<el_segment_area>:
sub    $0x28,%rsp
movsd  %xmm3,0x20(%rsp)
movsd  %xmm2,(%rsp)
movsd  %xmm1,0x18(%rsp)
movsd  %xmm0,0x10(%rsp)
call   1040 <el_true_anomaly@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
movsd  0x20(%rsp),%xmm2
call   1040 <el_true_anomaly@plt>
movsd  %xmm0,0x18(%rsp)
movsd  (%rsp),%xmm0
call   1050 <cos@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
call   1030 <sin@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x20(%rsp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,(%rsp)
movsd  0x20(%rsp),%xmm0
call   1030 <sin@plt>
movsd  0x18(%rsp),%xmm1
mulsd  %xmm1,%xmm0
mulsd  0x10(%rsp),%xmm0
movsd  (%rsp),%xmm2
mulsd  %xmm1,%xmm2
mulsd  0x8(%rsp),%xmm2
subsd  %xmm2,%xmm0
andpd  0xe1b(%rip),%xmm0
mulsd  0xe23(%rip),%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @el_segment_area(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%16 = load double, double* %5
%17 = load double, double* %6
%18 = load double, double* %7
%19 = call double @el_true_anomaly(double %16, double %17, double %18)
store double %19, double* %9
%20 = load double, double* %5
%21 = load double, double* %6
%22 = load double, double* %8
%23 = call double @el_true_anomaly(double %20, double %21, double %22)
store double %23, double* %10
%24 = load double, double* %9
%25 = load double, double* %7
%26 = call double @cos(double %25)
%27 = fmul double %24, %26
store double %27, double* %11
%28 = load double, double* %9
%29 = load double, double* %7
%30 = call double @sin(double %29)
%31 = fmul double %28, %30
store double %31, double* %12
%32 = load double, double* %10
%33 = load double, double* %8
%34 = call double @cos(double %33)
%35 = fmul double %32, %34
store double %35, double* %13
%36 = load double, double* %10
%37 = load double, double* %8
%38 = call double @sin(double %37)
%39 = fmul double %36, %38
store double %39, double* %14
%40 = load double, double* %11
%41 = load double, double* %14
%42 = load double, double* %13
%43 = load double, double* %12
%44 = fmul double %42, %43
%45 = fneg double %44
%46 = call double @llvm.fmuladd.f64(double %40, double %41, double %45)
%47 = call double @llvm.fabs.f64(double %46)
%48 = fmul double 5.000000e-01, %47
store double %48, double* %15
%49 = load double, double* %15
ret double %49
}

LLVM IR (-O2):
define double @el_segment_area(double %0, double %1, double %2, double %3) {
%5 = tail call double @el_true_anomaly(double %0, double %1, double %2)
%6 = tail call double @el_true_anomaly(double %0, double %1, double %3)
%7 = tail call double @cos(double %2)
%8 = fmul double %5, %7
%9 = tail call double @sin(double %2)
%10 = fmul double %5, %9
%11 = tail call double @cos(double %3)
%12 = tail call double @sin(double %3)
%13 = fmul double %6, %12
%14 = fneg double %6
%15 = fmul double %11, %14
%16 = fmul double %10, %15
%17 = tail call double @llvm.fmuladd.f64(double %8, double %13, double %16)
%18 = tail call double @llvm.fabs.f64(double %17)
%19 = fmul double %18, 5.000000e-01
ret double %19
}