#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*/ glmCrossProduct3d(double *, double *, double *);
int /*<<< orphan*/ glmMakeVector3d(double *, double const *, double const *);
int /*<<< orphan*/ glmNormalizeVector3d(double *);
void glmComputeTriangleNormald(double normal[3], const double c1[3],
                               const double c2[3], const double c3[3]) {
  double v1[3], v2[3];
  glmMakeVector3d(v1, c1, c2);
  glmMakeVector3d(v2, c1, c3);
  glmCrossProduct3d(normal, v1, v2);
  glmNormalizeVector3d(normal);
}


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

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

LLVM IR (-O0):
define void @glmComputeTriangleNormald(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 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 0
%12 = load double*, double** %6
%13 = load double*, double** %7
%14 = call i32 @glmMakeVector3d(double* %11, double* %12, double* %13)
%15 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 0
%16 = load double*, double** %6
%17 = load double*, double** %8
%18 = call i32 @glmMakeVector3d(double* %15, double* %16, double* %17)
%19 = load double*, double** %5
%20 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 0
%21 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 0
%22 = call i32 @glmCrossProduct3d(double* %19, double* %20, double* %21)
%23 = load double*, double** %5
%24 = call i32 @glmNormalizeVector3d(double* %23)
ret void
}

LLVM IR (-O2):
define void @glmComputeTriangleNormald(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 @glmMakeVector3d(double* %9, double* %1, double* %2)
%11 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
%12 = call i32 @glmMakeVector3d(double* %11, double* %1, double* %3)
%13 = call i32 @glmCrossProduct3d(double* %0, double* %9, double* %11)
%14 = call i32 @glmNormalizeVector3d(double* %0)
ret void
}