#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 /*<<< orphan*/ _cross_prod(long double *, long double *, long double *);
int /*<<< orphan*/ _to_cart(long double *, long double *);
long double angle_betw_0pi(long double *, long double *);
long double angle_direction(long double *a, long double *b, long double *c) {
  long double A[3], B[3], C[3];
  _to_cart(a, A);
  _to_cart(b, B);
  _to_cart(c, C);
  long double N1[3], N2[3];
  _cross_prod(A, B, N1);
  _cross_prod(B, C, N2);
  return angle_betw_0pi(N1, N2);
}


x86 assembly (clang, -O0):
<angle_direction>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    %rsi,-0x138(%rbp)
call   1050 <_to_cart@plt>
mov    -0x10(%rbp),%rdi
lea    -0x80(%rbp),%rsi
mov    %rsi,-0x130(%rbp)
call   1050 <_to_cart@plt>
mov    -0x18(%rbp),%rdi
lea    -0xb0(%rbp),%rsi
mov    %rsi,-0x128(%rbp)
call   1050 <_to_cart@plt>
mov    -0x138(%rbp),%rdi
mov    -0x130(%rbp),%rsi
lea    -0xe0(%rbp),%rdx
mov    %rdx,-0x120(%rbp)
call   1040 <_cross_prod@plt>
mov    -0x130(%rbp),%rdi
mov    -0x128(%rbp),%rsi
lea    -0x110(%rbp),%rdx
mov    %rdx,-0x118(%rbp)
call   1040 <_cross_prod@plt>
mov    -0x120(%rbp),%rdi
mov    -0x118(%rbp),%rsi
call   1030 <angle_betw_0pi@plt>
fld    %st(0)
fstp   %st(0)
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<angle_direction>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xf0,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
lea    0xc0(%rsp),%r15
mov    %r15,%rsi
call   1050 <_to_cart@plt>
lea    0x90(%rsp),%r12
mov    %rbx,%rdi
mov    %r12,%rsi
call   1050 <_to_cart@plt>
lea    0x60(%rsp),%r13
mov    %r14,%rdi
mov    %r13,%rsi
call   1050 <_to_cart@plt>
lea    0x30(%rsp),%r14
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r14,%rdx
call   1040 <_cross_prod@plt>
mov    %rsp,%rbx
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1040 <_cross_prod@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <angle_betw_0pi@plt>
add    $0xf0,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define x86_fp80 @angle_direction(x86_fp80* %0, x86_fp80* %1, x86_fp80* %2) {
%4 = alloca x86_fp80*
%5 = alloca x86_fp80*
%6 = alloca x86_fp80*
%7 = alloca [3 x x86_fp80]
%8 = alloca [3 x x86_fp80]
%9 = alloca [3 x x86_fp80]
%10 = alloca [3 x x86_fp80]
%11 = alloca [3 x x86_fp80]
store x86_fp80* %0, x86_fp80** %4
store x86_fp80* %1, x86_fp80** %5
store x86_fp80* %2, x86_fp80** %6
%12 = load x86_fp80*, x86_fp80** %4
%13 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %7, i64 0, i64 0
%14 = call i32 @_to_cart(x86_fp80* %12, x86_fp80* %13)
%15 = load x86_fp80*, x86_fp80** %5
%16 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %8, i64 0, i64 0
%17 = call i32 @_to_cart(x86_fp80* %15, x86_fp80* %16)
%18 = load x86_fp80*, x86_fp80** %6
%19 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %9, i64 0, i64 0
%20 = call i32 @_to_cart(x86_fp80* %18, x86_fp80* %19)
%21 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %7, i64 0, i64 0
%22 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %8, i64 0, i64 0
%23 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %10, i64 0, i64 0
%24 = call i32 @_cross_prod(x86_fp80* %21, x86_fp80* %22, x86_fp80* %23)
%25 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %8, i64 0, i64 0
%26 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %9, i64 0, i64 0
%27 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %11, i64 0, i64 0
%28 = call i32 @_cross_prod(x86_fp80* %25, x86_fp80* %26, x86_fp80* %27)
%29 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %10, i64 0, i64 0
%30 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %11, i64 0, i64 0
%31 = call x86_fp80 @angle_betw_0pi(x86_fp80* %29, x86_fp80* %30)
ret x86_fp80 %31
}

LLVM IR (-O2):
define x86_fp80 @angle_direction(x86_fp80* %0, x86_fp80* %1, x86_fp80* %2) {
%4 = alloca [3 x x86_fp80]
%5 = alloca [3 x x86_fp80]
%6 = alloca [3 x x86_fp80]
%7 = alloca [3 x x86_fp80]
%8 = alloca [3 x x86_fp80]
%9 = bitcast [3 x x86_fp80]* %4 to i8*
%10 = bitcast [3 x x86_fp80]* %5 to i8*
%11 = bitcast [3 x x86_fp80]* %6 to i8*
%12 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %4, i64 0, i64 0
%13 = call i32 @_to_cart(x86_fp80* %0, x86_fp80* %12)
%14 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %5, i64 0, i64 0
%15 = call i32 @_to_cart(x86_fp80* %1, x86_fp80* %14)
%16 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %6, i64 0, i64 0
%17 = call i32 @_to_cart(x86_fp80* %2, x86_fp80* %16)
%18 = bitcast [3 x x86_fp80]* %7 to i8*
%19 = bitcast [3 x x86_fp80]* %8 to i8*
%20 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %7, i64 0, i64 0
%21 = call i32 @_cross_prod(x86_fp80* %12, x86_fp80* %14, x86_fp80* %20)
%22 = getelementptr inbounds [3 x x86_fp80], [3 x x86_fp80]* %8, i64 0, i64 0
%23 = call i32 @_cross_prod(x86_fp80* %14, x86_fp80* %16, x86_fp80* %22)
%24 = call x86_fp80 @angle_betw_0pi(x86_fp80* %20, x86_fp80* %22)
ret x86_fp80 %24
}