#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 asin(double);
double sqrt(int);
double CircularSectorArea(double r, double s) {
  if (s <= 0) {
    return 0;
  }
  s *= 0.5;
  double x = s / r;
  if (x < (1. / 32.)) {
    static const double c2 = 2. / 3.;
    static const double c4 = 1. / 5.;
    static const double c6 = 3. / 28.;
    static const double c8 = 3. / 72.;
    x *= x;
    return r * s * (c2 + (c4 + (c6 + c8 * x) * x) * x) * x;
  } else {
    return r * s * (asin(x) / x - sqrt((1. + x) * (1. - x)));
  }
}


x86 assembly (clang, -O0):
<CircularSectorArea>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jb     114d <CircularSectorArea+0x2d>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1258 <CircularSectorArea+0x138>
movsd  0xeb3(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe8a(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    11f4 <CircularSectorArea+0xd4>
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  0xe81(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe7d(%rip),%xmm2
addsd  %xmm2,%xmm1
movsd  -0x20(%rbp),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe58(%rip),%xmm2
addsd  %xmm2,%xmm1
movsd  -0x20(%rbp),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe3b(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1258 <CircularSectorArea+0x138>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <asin@plt>
divsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xdf1(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  0xde4(%rip),%xmm1
subsd  -0x20(%rbp),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sqrt@plt>
movsd  -0x30(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x28(%rbp),%xmm0
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CircularSectorArea>:
sub    $0x18,%rsp
xorpd  %xmm2,%xmm2
ucomisd %xmm1,%xmm2
jae    11e6 <CircularSectorArea+0xc6>
mulsd  0xec6(%rip),%xmm1
movapd %xmm1,%xmm3
divsd  %xmm0,%xmm3
movsd  0xebe(%rip),%xmm2
ucomisd %xmm3,%xmm2
jbe    118e <CircularSectorArea+0x6e>
mulsd  %xmm3,%xmm3
mulsd  %xmm0,%xmm1
movsd  0xeb8(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  0xeb4(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  0xeb0(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  0xeac(%rip),%xmm2
mulsd  %xmm1,%xmm2
mulsd  %xmm3,%xmm2
jmp    11e6 <CircularSectorArea+0xc6>
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
movapd %xmm3,%xmm0
movsd  %xmm3,(%rsp)
call   1030 <asin@plt>
movsd  (%rsp),%xmm2
divsd  %xmm2,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xe53(%rip),%xmm0
movapd %xmm2,%xmm1
addsd  %xmm0,%xmm1
subsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sqrt@plt>
movsd  0x8(%rsp),%xmm2
subsd  %xmm0,%xmm2
mulsd  0x10(%rsp),%xmm2
movapd %xmm2,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
@CircularSectorArea.c2 = internal constant double 0x3FE5555555555555
@CircularSectorArea.c4 = internal constant double 2.000000e-01
@CircularSectorArea.c6 = internal constant double 0x3FBB6DB6DB6DB6DB
@CircularSectorArea.c8 = internal constant double 0x3FA5555555555555
define double @CircularSectorArea(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
%7 = load double, double* %5
%8 = fcmp ole double %7, 0.000000e+00
br i1 %8, label %9, label %10
9: ; preds = %2
store double 0.000000e+00, double* %3
br label %51
10: ; preds = %2
%11 = load double, double* %5
%12 = fmul double %11, 5.000000e-01
store double %12, double* %5
%13 = load double, double* %5
%14 = load double, double* %4
%15 = fdiv double %13, %14
store double %15, double* %6
%16 = load double, double* %6
%17 = fcmp olt double %16, 3.125000e-02
br i1 %17, label %18, label %34
18: ; preds = %10
%19 = load double, double* %6
%20 = load double, double* %6
%21 = fmul double %20, %19
store double %21, double* %6
%22 = load double, double* %4
%23 = load double, double* %5
%24 = fmul double %22, %23
%25 = load double, double* %6
%26 = call double @llvm.fmuladd.f64(double 0x3FA5555555555555, double %25, double 0x3FBB6DB6DB6DB6DB)
%27 = load double, double* %6
%28 = call double @llvm.fmuladd.f64(double %26, double %27, double 2.000000e-01)
%29 = load double, double* %6
%30 = call double @llvm.fmuladd.f64(double %28, double %29, double 0x3FE5555555555555)
%31 = fmul double %24, %30
%32 = load double, double* %6
%33 = fmul double %31, %32
store double %33, double* %3
br label %51
34: ; preds = %10
%35 = load double, double* %4
%36 = load double, double* %5
%37 = fmul double %35, %36
%38 = load double, double* %6
%39 = call double @asin(double %38)
%40 = load double, double* %6
%41 = fdiv double %39, %40
%42 = load double, double* %6
%43 = fadd double 1.000000e+00, %42
%44 = load double, double* %6
%45 = fsub double 1.000000e+00, %44
%46 = fmul double %43, %45
%47 = fptosi double %46 to i32
%48 = call double @sqrt(i32 %47)
%49 = fsub double %41, %48
%50 = fmul double %37, %49
store double %50, double* %3
br label %51
51: ; preds = %34, %18, %9
%52 = load double, double* %3
ret double %52
}

LLVM IR (-O2):
define double @CircularSectorArea(double %0, double %1) {
%3 = fcmp ugt double %1, 0.000000e+00
br i1 %3, label %4, label %27
4: ; preds = %2
%5 = fmul double %1, 5.000000e-01
%6 = fdiv double %5, %0
%7 = fcmp olt double %6, 3.125000e-02
br i1 %7, label %8, label %16
8: ; preds = %4
%9 = fmul double %6, %6
%10 = fmul double %5, %0
%11 = tail call double @llvm.fmuladd.f64(double %9, double 0x3FA5555555555555, double 0x3FBB6DB6DB6DB6DB)
%12 = tail call double @llvm.fmuladd.f64(double %11, double %9, double 2.000000e-01)
%13 = tail call double @llvm.fmuladd.f64(double %12, double %9, double 0x3FE5555555555555)
%14 = fmul double %10, %13
%15 = fmul double %9, %14
br label %27
16: ; preds = %4
%17 = fmul double %5, %0
%18 = tail call double @asin(double %6)
%19 = fdiv double %18, %6
%20 = fadd double %6, 1.000000e+00
%21 = fsub double 1.000000e+00, %6
%22 = fmul double %20, %21
%23 = fptosi double %22 to i32
%24 = tail call double @sqrt(i32 %23)
%25 = fsub double %19, %24
%26 = fmul double %17, %25
br label %27
27: ; preds = %8, %16, %2
%28 = phi double [ 0.000000e+00, %2 ], [ %15, %8 ], [ %26, %16 ]
ret double %28
}