#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 atan(double);
int /*<<< orphan*/ cross_product(double const *, double const *, double *);
double fabs(double);
double norm(double *);
double sqrt(double);
double tan(double);
double mod_tri_area(const double *restrict u, const double *restrict v,
                    const double *restrict w) {
  double tmp_vec[3];
  cross_product(u, v, tmp_vec);
  double sina = sqrt(norm(tmp_vec));
  double a = asin(sina);
  cross_product(u, w, tmp_vec);
  double sinb = sqrt(norm(tmp_vec));
  double b = asin(sinb);
  cross_product(w, v, tmp_vec);
  double sinc = sqrt(norm(tmp_vec));
  double c = asin(sinc);
  double s = 0.5 * (a + b + c);
  double t = tan(s * 0.5) * tan((s - a) * 0.5) * tan((s - b) * 0.5) *
             tan((s - c) * 0.5);
  double area = fabs(4.0 * atan(sqrt(fabs(t))));
  return (area);
}


x86 assembly (clang, -O0):
<mod_tri_area>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   1040 <cross_product@plt>
lea    -0x30(%rbp),%rdi
call   1030 <norm@plt>
call   1080 <sqrt@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1060 <asin@plt>
movsd  %xmm0,-0x40(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   1040 <cross_product@plt>
lea    -0x30(%rbp),%rdi
call   1030 <norm@plt>
call   1080 <sqrt@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
call   1060 <asin@plt>
movsd  %xmm0,-0x50(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   1040 <cross_product@plt>
lea    -0x30(%rbp),%rdi
call   1030 <norm@plt>
call   1080 <sqrt@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
call   1060 <asin@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x40(%rbp),%xmm1
addsd  -0x50(%rbp),%xmm1
addsd  -0x60(%rbp),%xmm1
movsd  0xdf1(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  0xde0(%rip),%xmm0
mulsd  -0x68(%rbp),%xmm0
call   1070 <tan@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x68(%rbp),%xmm0
subsd  -0x40(%rbp),%xmm0
movsd  0xdbc(%rip),%xmm1
mulsd  %xmm1,%xmm0
call   1070 <tan@plt>
movaps %xmm0,%xmm1
movsd  -0x90(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x68(%rbp),%xmm0
subsd  -0x50(%rbp),%xmm0
movsd  0xd8a(%rip),%xmm1
mulsd  %xmm1,%xmm0
call   1070 <tan@plt>
movaps %xmm0,%xmm1
movsd  -0x88(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x68(%rbp),%xmm0
subsd  -0x60(%rbp),%xmm0
movsd  0xd5b(%rip),%xmm1
mulsd  %xmm1,%xmm0
call   1070 <tan@plt>
movaps %xmm0,%xmm1
movsd  -0x80(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
movaps 0xd1d(%rip),%xmm1
pand   %xmm1,%xmm0
call   1080 <sqrt@plt>
call   1050 <atan@plt>
movaps %xmm0,%xmm1
movsd  0xd14(%rip),%xmm0
mulsd  %xmm1,%xmm0
movaps 0xcf9(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mod_tri_area>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0x30(%rsp),%r12
mov    %r12,%rdx
call   1040 <cross_product@plt>
mov    %r12,%rdi
call   1030 <norm@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1199 <mod_tri_area+0x39>
sqrtsd %xmm0,%xmm0
jmp    119e <mod_tri_area+0x3e>
call   1080 <sqrt@plt>
call   1060 <asin@plt>
movsd  %xmm0,0x8(%rsp)
lea    0x30(%rsp),%r12
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
call   1040 <cross_product@plt>
mov    %r12,%rdi
call   1030 <norm@plt>
ucomisd 0xe44(%rip),%xmm0
jb     11d4 <mod_tri_area+0x74>
sqrtsd %xmm0,%xmm0
jmp    11d9 <mod_tri_area+0x79>
call   1080 <sqrt@plt>
call   1060 <asin@plt>
movsd  %xmm0,0x18(%rsp)
lea    0x30(%rsp),%rbx
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1040 <cross_product@plt>
mov    %rbx,%rdi
call   1030 <norm@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     120f <mod_tri_area+0xaf>
sqrtsd %xmm0,%xmm0
jmp    1214 <mod_tri_area+0xb4>
call   1080 <sqrt@plt>
call   1060 <asin@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0x8(%rsp),%xmm1
addsd  0x18(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  0xdc9(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  %xmm1,0x10(%rsp)
movapd %xmm1,%xmm0
mulsd  %xmm2,%xmm0
call   1070 <tan@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x10(%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
mulsd  0xd98(%rip),%xmm0
call   1070 <tan@plt>
mulsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
subsd  0x18(%rsp),%xmm0
mulsd  0xd73(%rip),%xmm0
call   1070 <tan@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
subsd  0x28(%rsp),%xmm0
mulsd  0xd4e(%rip),%xmm0
call   1070 <tan@plt>
mulsd  0x8(%rsp),%xmm0
andpd  0xd5b(%rip),%xmm0
ucomisd 0xd43(%rip),%xmm0
jb     12d5 <mod_tri_area+0x175>
sqrtsd %xmm0,%xmm0
jmp    12da <mod_tri_area+0x17a>
call   1080 <sqrt@plt>
call   1050 <atan@plt>
mulsd  0xd21(%rip),%xmm0
andpd  0xd31(%rip),%xmm0
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define double @mod_tri_area(double* noalias %0, double* noalias %1, double* noalias %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
%7 = alloca [3 x 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
%16 = alloca double
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
%17 = load double*, double** %4
%18 = load double*, double** %5
%19 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%20 = call i32 @cross_product(double* %17, double* %18, double* %19)
%21 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%22 = call double @norm(double* %21)
%23 = call double @sqrt(double %22)
store double %23, double* %8
%24 = load double, double* %8
%25 = call double @asin(double %24)
store double %25, double* %9
%26 = load double*, double** %4
%27 = load double*, double** %6
%28 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%29 = call i32 @cross_product(double* %26, double* %27, double* %28)
%30 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%31 = call double @norm(double* %30)
%32 = call double @sqrt(double %31)
store double %32, double* %10
%33 = load double, double* %10
%34 = call double @asin(double %33)
store double %34, double* %11
%35 = load double*, double** %6
%36 = load double*, double** %5
%37 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%38 = call i32 @cross_product(double* %35, double* %36, double* %37)
%39 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%40 = call double @norm(double* %39)
%41 = call double @sqrt(double %40)
store double %41, double* %12
%42 = load double, double* %12
%43 = call double @asin(double %42)
store double %43, double* %13
%44 = load double, double* %9
%45 = load double, double* %11
%46 = fadd double %44, %45
%47 = load double, double* %13
%48 = fadd double %46, %47
%49 = fmul double 5.000000e-01, %48
store double %49, double* %14
%50 = load double, double* %14
%51 = fmul double %50, 5.000000e-01
%52 = call double @tan(double %51)
%53 = load double, double* %14
%54 = load double, double* %9
%55 = fsub double %53, %54
%56 = fmul double %55, 5.000000e-01
%57 = call double @tan(double %56)
%58 = fmul double %52, %57
%59 = load double, double* %14
%60 = load double, double* %11
%61 = fsub double %59, %60
%62 = fmul double %61, 5.000000e-01
%63 = call double @tan(double %62)
%64 = fmul double %58, %63
%65 = load double, double* %14
%66 = load double, double* %13
%67 = fsub double %65, %66
%68 = fmul double %67, 5.000000e-01
%69 = call double @tan(double %68)
%70 = fmul double %64, %69
store double %70, double* %15
%71 = load double, double* %15
%72 = call double @llvm.fabs.f64(double %71)
%73 = call double @sqrt(double %72)
%74 = call double @atan(double %73)
%75 = fmul double 4.000000e+00, %74
%76 = call double @llvm.fabs.f64(double %75)
store double %76, double* %16
%77 = load double, double* %16
ret double %77
}

LLVM IR (-O2):
define double @mod_tri_area(double* noalias %0, double* noalias %1, double* noalias %2) {
%4 = alloca [3 x double]
%5 = bitcast [3 x double]* %4 to i8*
%6 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 0
%7 = call i32 @cross_product(double* %0, double* %1, double* %6)
%8 = call double @norm(double* %6)
%9 = call double @sqrt(double %8)
%10 = call double @asin(double %9)
%11 = call i32 @cross_product(double* %0, double* %2, double* %6)
%12 = call double @norm(double* %6)
%13 = call double @sqrt(double %12)
%14 = call double @asin(double %13)
%15 = call i32 @cross_product(double* %2, double* %1, double* %6)
%16 = call double @norm(double* %6)
%17 = call double @sqrt(double %16)
%18 = call double @asin(double %17)
%19 = fadd double %10, %14
%20 = fadd double %19, %18
%21 = fmul double %20, 5.000000e-01
%22 = fmul double %21, 5.000000e-01
%23 = call double @tan(double %22)
%24 = fsub double %21, %10
%25 = fmul double %24, 5.000000e-01
%26 = call double @tan(double %25)
%27 = fmul double %23, %26
%28 = fsub double %21, %14
%29 = fmul double %28, 5.000000e-01
%30 = call double @tan(double %29)
%31 = fmul double %27, %30
%32 = fsub double %21, %18
%33 = fmul double %32, 5.000000e-01
%34 = call double @tan(double %33)
%35 = fmul double %31, %34
%36 = call double @llvm.fabs.f64(double %35)
%37 = call double @sqrt(double %36)
%38 = call double @atan(double %37)
%39 = fmul double %38, 4.000000e+00
%40 = call double @llvm.fabs.f64(double %39)
ret double %40
}