#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 */
int asin(double);
double sin(double);
double sqrt(double);
double area_arc(double x1, double y1, double x2, double y2, double r) {
  double a, theta;
  a = sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
  theta = 2. * asin(0.5 * a / r);
  return 0.5 * r * r * (theta - sin(theta));
}


x86 assembly (clang, -O0):
<area_arc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
subsd  -0x8(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm3
subsd  -0x10(%rbp),%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  0xe69(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
call   1040 <asin@plt>
cvtsi2sd %eax,%xmm1
movsd  0xe56(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe3d(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1030 <sin@plt>
movsd  -0x48(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x40(%rbp),%xmm0
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<area_arc>:
sub    $0x18,%rsp
movsd  %xmm4,0x8(%rsp)
subsd  %xmm0,%xmm2
subsd  %xmm1,%xmm3
mulsd  %xmm3,%xmm3
mulsd  %xmm2,%xmm2
addsd  %xmm3,%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jb     1161 <area_arc+0x31>
xorps  %xmm0,%xmm0
sqrtsd %xmm2,%xmm0
jmp    116a <area_arc+0x3a>
movapd %xmm2,%xmm0
call   1050 <sqrt@plt>
mulsd  0xe8e(%rip),%xmm0
divsd  0x8(%rsp),%xmm0
call   1040 <asin@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0xe6a(%rip),%xmm1
movsd  0x8(%rsp),%xmm2
mulsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm1
movsd  %xmm1,0x8(%rsp)
call   1030 <sin@plt>
movsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0x8(%rsp),%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @area_arc(double %0, double %1, double %2, double %3, double %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store double %3, double* %9
store double %4, double* %10
%13 = load double, double* %8
%14 = load double, double* %6
%15 = fsub double %13, %14
%16 = load double, double* %8
%17 = load double, double* %6
%18 = fsub double %16, %17
%19 = load double, double* %9
%20 = load double, double* %7
%21 = fsub double %19, %20
%22 = load double, double* %9
%23 = load double, double* %7
%24 = fsub double %22, %23
%25 = fmul double %21, %24
%26 = call double @llvm.fmuladd.f64(double %15, double %18, double %25)
%27 = call double @sqrt(double %26)
store double %27, double* %11
%28 = load double, double* %11
%29 = fmul double 5.000000e-01, %28
%30 = load double, double* %10
%31 = fdiv double %29, %30
%32 = call i32 @asin(double %31)
%33 = sitofp i32 %32 to double
%34 = fmul double 2.000000e+00, %33
store double %34, double* %12
%35 = load double, double* %10
%36 = fmul double 5.000000e-01, %35
%37 = load double, double* %10
%38 = fmul double %36, %37
%39 = load double, double* %12
%40 = load double, double* %12
%41 = call double @sin(double %40)
%42 = fsub double %39, %41
%43 = fmul double %38, %42
ret double %43
}

LLVM IR (-O2):
define double @area_arc(double %0, double %1, double %2, double %3, double %4) {
%6 = fsub double %2, %0
%7 = fsub double %3, %1
%8 = fmul double %7, %7
%9 = tail call double @llvm.fmuladd.f64(double %6, double %6, double %8)
%10 = tail call double @sqrt(double %9)
%11 = fmul double %10, 5.000000e-01
%12 = fdiv double %11, %4
%13 = tail call i32 @asin(double %12)
%14 = sitofp i32 %13 to double
%15 = fmul double %14, 2.000000e+00
%16 = fmul double %4, 5.000000e-01
%17 = fmul double %16, %4
%18 = tail call double @sin(double %15)
%19 = fsub double %15, %18
%20 = fmul double %17, %19
ret double %20
}