#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 dot3(double *, double *);
int /*<<< orphan*/ normalize3(double *);
int /*<<< orphan*/ transcross3(double const *, double const *, double const *,
                               double *);
double cos_angle_triangle_normals(const double v0[3], const double v1[3],
                                  const double v2[3], const double v3[3]) {
  double normal_left[3];
  double normal_right[3];
  transcross3(v0, v1, v2, normal_left);
  transcross3(v0, v3, v1, normal_right);
  normalize3(normal_left);
  normalize3(normal_right);
  return dot3(normal_left, normal_right);
}


x86 assembly (clang, -O0):
<cos_angle_triangle_normals>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    -0x40(%rbp),%rcx
call   1040 <transcross3@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    -0x60(%rbp),%rcx
call   1040 <transcross3@plt>
lea    -0x40(%rbp),%rdi
call   1030 <normalize3@plt>
lea    -0x60(%rbp),%rdi
call   1030 <normalize3@plt>
lea    -0x40(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1050 <dot3@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cos_angle_triangle_normals>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x40,%rsp
mov    %rcx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0x20(%rsp),%r12
mov    %r12,%rcx
call   1040 <transcross3@plt>
mov    %rsp,%r13
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r13,%rcx
call   1040 <transcross3@plt>
mov    %r12,%rdi
call   1030 <normalize3@plt>
mov    %r13,%rdi
call   1030 <normalize3@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1050 <dot3@plt>
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define double @cos_angle_triangle_normals(double* %0, double* %1, double* %2, double* %3) {
%5 = alloca double*
%6 = alloca double*
%7 = alloca double*
%8 = alloca double*
%9 = alloca [3 x double]
%10 = alloca [3 x double]
store double* %0, double** %5
store double* %1, double** %6
store double* %2, double** %7
store double* %3, double** %8
%11 = load double*, double** %5
%12 = load double*, double** %6
%13 = load double*, double** %7
%14 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 0
%15 = call i32 @transcross3(double* %11, double* %12, double* %13, double* %14)
%16 = load double*, double** %5
%17 = load double*, double** %8
%18 = load double*, double** %6
%19 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 0
%20 = call i32 @transcross3(double* %16, double* %17, double* %18, double* %19)
%21 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 0
%22 = call i32 @normalize3(double* %21)
%23 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 0
%24 = call i32 @normalize3(double* %23)
%25 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 0
%26 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 0
%27 = call double @dot3(double* %25, double* %26)
ret double %27
}

LLVM IR (-O2):
define double @cos_angle_triangle_normals(double* %0, double* %1, double* %2, double* %3) {
%5 = alloca [3 x double]
%6 = alloca [3 x double]
%7 = bitcast [3 x double]* %5 to i8*
%8 = bitcast [3 x double]* %6 to i8*
%9 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
%10 = call i32 @transcross3(double* %0, double* %1, double* %2, double* %9)
%11 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
%12 = call i32 @transcross3(double* %0, double* %3, double* %1, double* %11)
%13 = call i32 @normalize3(double* %9)
%14 = call i32 @normalize3(double* %11)
%15 = call double @dot3(double* %9, double* %11)
ret double %15
}