#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 areacirclesection2(double, double, double);
double atan(double);
double atan2(double, double);
double cos(double);
double sin(double);
double tan(double);
double areaellipsesection(double a, double b, double ang0, double ang1) {
  double f, v, w, cang0, cang1, ep;
  if (b < 0)
    b = (-b);
  f = a / b;
  ep = atan(a * tan(ang0) / b);
  if (ang0 > 1.5707963267948966192313216916398 &&
      ang0 < 4.7123889803846898576939650749193)
    ep += 3.1415926535897932384626433832795;
  v = a * cos(ep);
  w = b * sin(ep);
  w *= f;
  cang0 = atan2(w, v);
  if (cang0 < 0)
    cang0 += 6.283185307179586476925286766559;
  ep = atan(a * tan(ang1) / b);
  if (ang1 > 1.5707963267948966192313216916398 &&
      ang1 < 4.7123889803846898576939650749193)
    ep += 3.1415926535897932384626433832795;
  v = a * cos(ep);
  w = b * sin(ep);
  w *= f;
  cang1 = atan2(w, v);
  if (cang1 < 0)
    cang1 += 6.283185307179586476925286766559;
  return areacirclesection2(a, cang0, cang1) / f;
}


x86 assembly (clang, -O0):
<areaellipsesection>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11ae <areaellipsesection+0x4e>
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1070 <tan@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
mulsd  %xmm1,%xmm0
divsd  -0x10(%rbp),%xmm0
call   1060 <atan@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe07(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1228 <areaellipsesection+0xc8>
movsd  0xdfd(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1228 <areaellipsesection+0xc8>
movsd  0xdf2(%rip),%xmm0
addsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x50(%rbp),%xmm0
call   1080 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x50(%rbp),%xmm0
call   1050 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
call   1030 <atan2@plt>
movsd  %xmm0,-0x40(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x40(%rbp),%xmm0
jbe    12b5 <areaellipsesection+0x155>
movsd  0xd6d(%rip),%xmm0
addsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1070 <tan@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm1,%xmm0
divsd  -0x10(%rbp),%xmm0
call   1060 <atan@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xd0f(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1320 <areaellipsesection+0x1c0>
movsd  0xd05(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1320 <areaellipsesection+0x1c0>
movsd  0xcfa(%rip),%xmm0
addsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x50(%rbp),%xmm0
call   1080 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x80(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x50(%rbp),%xmm0
call   1050 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
call   1030 <atan2@plt>
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x48(%rbp),%xmm0
jbe    13ad <areaellipsesection+0x24d>
movsd  0xc75(%rip),%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm2
call   1040 <areacirclesection2@plt>
divsd  -0x28(%rbp),%xmm0
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<areaellipsesection>:
sub    $0x58,%rsp
movapd %xmm3,0x20(%rsp)
movapd %xmm2,%xmm5
movsd  %xmm2,0x10(%rsp)
movsd  %xmm0,(%rsp)
movapd 0xe7f(%rip),%xmm2
xorpd  %xmm1,%xmm2
xorpd  %xmm3,%xmm3
movapd %xmm1,%xmm4
cmpltsd %xmm3,%xmm4
andpd  %xmm4,%xmm2
andnpd %xmm1,%xmm4
orpd   %xmm2,%xmm4
movapd %xmm4,0x30(%rsp)
movapd %xmm0,%xmm1
divsd  %xmm4,%xmm1
movsd  %xmm1,0x8(%rsp)
movapd %xmm5,%xmm0
call   1070 <tan@plt>
mulsd  (%rsp),%xmm0
divsd  0x30(%rsp),%xmm0
call   1060 <atan@plt>
movsd  0xe3d(%rip),%xmm2
movapd %xmm0,%xmm1
addsd  %xmm2,%xmm1
movsd  0x10(%rsp),%xmm4
movapd %xmm4,%xmm2
cmpltsd 0xe2a(%rip),%xmm2
movapd %xmm2,%xmm3
andnpd %xmm0,%xmm3
andpd  %xmm1,%xmm2
orpd   %xmm3,%xmm2
movsd  0xe1a(%rip),%xmm1
cmpltsd %xmm4,%xmm1
andpd  %xmm1,%xmm2
andnpd %xmm0,%xmm1
orpd   %xmm2,%xmm1
movapd %xmm1,0x40(%rsp)
movapd %xmm1,%xmm0
call   1080 <cos@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movapd 0x40(%rsp),%xmm0
call   1050 <sin@plt>
mulsd  0x30(%rsp),%xmm0
mulsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
call   1030 <atan2@plt>
movsd  0xdcd(%rip),%xmm2
movapd %xmm0,%xmm1
addsd  %xmm2,%xmm1
movapd %xmm0,%xmm2
cmpltsd 0xdc0(%rip),%xmm2
andpd  %xmm2,%xmm1
andnpd %xmm0,%xmm2
orpd   %xmm1,%xmm2
movapd %xmm2,0x10(%rsp)
movapd 0x20(%rsp),%xmm0
call   1070 <tan@plt>
mulsd  (%rsp),%xmm0
divsd  0x30(%rsp),%xmm0
call   1060 <atan@plt>
movsd  0xd6b(%rip),%xmm3
addsd  %xmm0,%xmm3
movapd 0x20(%rsp),%xmm2
movsd  0xd69(%rip),%xmm4
cmpltsd %xmm2,%xmm4
cmpltsd 0xd53(%rip),%xmm2
movapd %xmm2,%xmm1
andnpd %xmm0,%xmm1
andpd  %xmm3,%xmm2
orpd   %xmm1,%xmm2
movapd %xmm4,%xmm1
andpd  %xmm4,%xmm2
andnpd %xmm0,%xmm1
orpd   %xmm2,%xmm1
movapd %xmm1,0x40(%rsp)
movapd %xmm1,%xmm0
call   1080 <cos@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
movapd 0x40(%rsp),%xmm0
call   1050 <sin@plt>
mulsd  0x30(%rsp),%xmm0
mulsd  0x8(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
call   1030 <atan2@plt>
movsd  0xcff(%rip),%xmm1
addsd  %xmm0,%xmm1
movapd %xmm0,%xmm2
cmpltsd 0xcf6(%rip),%xmm2
andpd  %xmm2,%xmm1
andnpd %xmm0,%xmm2
orpd   %xmm1,%xmm2
movsd  (%rsp),%xmm0
movaps 0x10(%rsp),%xmm1
call   1040 <areacirclesection2@plt>
divsd  0x8(%rsp),%xmm0
add    $0x58,%rsp
ret

LLVM IR (-O0):
define double @areaellipsesection(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
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%15 = load double, double* %6
%16 = fcmp olt double %15, 0.000000e+00
br i1 %16, label %17, label %20
17: ; preds = %4
%18 = load double, double* %6
%19 = fneg double %18
store double %19, double* %6
br label %20
20: ; preds = %17, %4
%21 = load double, double* %5
%22 = load double, double* %6
%23 = fdiv double %21, %22
store double %23, double* %9
%24 = load double, double* %5
%25 = load double, double* %7
%26 = call double @tan(double %25)
%27 = fmul double %24, %26
%28 = load double, double* %6
%29 = fdiv double %27, %28
%30 = call double @atan(double %29)
store double %30, double* %14
%31 = load double, double* %7
%32 = fcmp ogt double %31, 0x3FF921FB54442D18
br i1 %32, label %33, label %39
33: ; preds = %20
%34 = load double, double* %7
%35 = fcmp olt double %34, 0x4012D97C7F3321D2
br i1 %35, label %36, label %39
36: ; preds = %33
%37 = load double, double* %14
%38 = fadd double %37, 0x400921FB54442D18
store double %38, double* %14
br label %39
39: ; preds = %36, %33, %20
%40 = load double, double* %5
%41 = load double, double* %14
%42 = call double @cos(double %41)
%43 = fmul double %40, %42
store double %43, double* %10
%44 = load double, double* %6
%45 = load double, double* %14
%46 = call double @sin(double %45)
%47 = fmul double %44, %46
store double %47, double* %11
%48 = load double, double* %9
%49 = load double, double* %11
%50 = fmul double %49, %48
store double %50, double* %11
%51 = load double, double* %11
%52 = load double, double* %10
%53 = call double @atan2(double %51, double %52)
store double %53, double* %12
%54 = load double, double* %12
%55 = fcmp olt double %54, 0.000000e+00
br i1 %55, label %56, label %59
56: ; preds = %39
%57 = load double, double* %12
%58 = fadd double %57, 0x401921FB54442D18
store double %58, double* %12
br label %59
59: ; preds = %56, %39
%60 = load double, double* %5
%61 = load double, double* %8
%62 = call double @tan(double %61)
%63 = fmul double %60, %62
%64 = load double, double* %6
%65 = fdiv double %63, %64
%66 = call double @atan(double %65)
store double %66, double* %14
%67 = load double, double* %8
%68 = fcmp ogt double %67, 0x3FF921FB54442D18
br i1 %68, label %69, label %75
69: ; preds = %59
%70 = load double, double* %8
%71 = fcmp olt double %70, 0x4012D97C7F3321D2
br i1 %71, label %72, label %75
72: ; preds = %69
%73 = load double, double* %14
%74 = fadd double %73, 0x400921FB54442D18
store double %74, double* %14
br label %75
75: ; preds = %72, %69, %59
%76 = load double, double* %5
%77 = load double, double* %14
%78 = call double @cos(double %77)
%79 = fmul double %76, %78
store double %79, double* %10
%80 = load double, double* %6
%81 = load double, double* %14
%82 = call double @sin(double %81)
%83 = fmul double %80, %82
store double %83, double* %11
%84 = load double, double* %9
%85 = load double, double* %11
%86 = fmul double %85, %84
store double %86, double* %11
%87 = load double, double* %11
%88 = load double, double* %10
%89 = call double @atan2(double %87, double %88)
store double %89, double* %13
%90 = load double, double* %13
%91 = fcmp olt double %90, 0.000000e+00
br i1 %91, label %92, label %95
92: ; preds = %75
%93 = load double, double* %13
%94 = fadd double %93, 0x401921FB54442D18
store double %94, double* %13
br label %95
95: ; preds = %92, %75
%96 = load double, double* %5
%97 = load double, double* %12
%98 = load double, double* %13
%99 = call double @areacirclesection2(double %96, double %97, double %98)
%100 = load double, double* %9
%101 = fdiv double %99, %100
ret double %101
}

LLVM IR (-O2):
define double @areaellipsesection(double %0, double %1, double %2, double %3) {
%5 = fcmp olt double %1, 0.000000e+00
%6 = fneg double %1
%7 = select i1 %5, double %6, double %1
%8 = fdiv double %0, %7
%9 = tail call double @tan(double %2)
%10 = fmul double %9, %0
%11 = fdiv double %10, %7
%12 = tail call double @atan(double %11)
%13 = fcmp ogt double %2, 0x3FF921FB54442D18
%14 = fcmp olt double %2, 0x4012D97C7F3321D2
%15 = and i1 %13, %14
%16 = fadd double %12, 0x400921FB54442D18
%17 = select i1 %15, double %16, double %12
%18 = tail call double @cos(double %17)
%19 = fmul double %18, %0
%20 = tail call double @sin(double %17)
%21 = fmul double %7, %20
%22 = fmul double %8, %21
%23 = tail call double @atan2(double %22, double %19)
%24 = fcmp olt double %23, 0.000000e+00
%25 = fadd double %23, 0x401921FB54442D18
%26 = select i1 %24, double %25, double %23
%27 = tail call double @tan(double %3)
%28 = fmul double %27, %0
%29 = fdiv double %28, %7
%30 = tail call double @atan(double %29)
%31 = fcmp ogt double %3, 0x3FF921FB54442D18
%32 = fcmp olt double %3, 0x4012D97C7F3321D2
%33 = and i1 %31, %32
%34 = fadd double %30, 0x400921FB54442D18
%35 = select i1 %33, double %34, double %30
%36 = tail call double @cos(double %35)
%37 = fmul double %36, %0
%38 = tail call double @sin(double %35)
%39 = fmul double %7, %38
%40 = fmul double %8, %39
%41 = tail call double @atan2(double %40, double %37)
%42 = fcmp olt double %41, 0.000000e+00
%43 = fadd double %41, 0x401921FB54442D18
%44 = select i1 %42, double %43, double %41
%45 = tail call double @areacirclesection2(double %0, double %26, double %44)
%46 = fdiv double %45, %8
ret double %46
}