#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_product_3fo(float *, float *, float *);
int /*<<< orphan*/ difference_3fo(float const *, float const *, float *);
int /*<<< orphan*/ normalize_3f(float *);
void triangle_normal_3fo(const float *a, const float *b, const float *c,
                         float *result) {
  float ab[3];
  difference_3fo(b, a, ab);
  float ac[3];
  difference_3fo(c, a, ac);
  cross_product_3fo(ab, ac, result);
  normalize_3f(result);
}


x86 assembly (clang, -O0):
<triangle_normal_3fo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
lea    -0x2c(%rbp),%rdx
call   1050 <difference_3fo@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
lea    -0x38(%rbp),%rdx
call   1050 <difference_3fo@plt>
lea    -0x2c(%rbp),%rdi
lea    -0x38(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <cross_product_3fo@plt>
mov    -0x20(%rbp),%rdi
call   1040 <normalize_3f@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<triangle_normal_3fo>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %rcx,%r15
mov    %rdx,%r14
mov    %rdi,%rbx
lea    0x14(%rsp),%r12
mov    %rsi,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1050 <difference_3fo@plt>
lea    0x8(%rsp),%r13
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r13,%rdx
call   1050 <difference_3fo@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %r15,%rdx
call   1030 <cross_product_3fo@plt>
mov    %r15,%rdi
call   1040 <normalize_3f@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @triangle_normal_3fo(float* %0, float* %1, float* %2, float* %3) {
%5 = alloca float*
%6 = alloca float*
%7 = alloca float*
%8 = alloca float*
%9 = alloca [3 x float]
%10 = alloca [3 x float]
store float* %0, float** %5
store float* %1, float** %6
store float* %2, float** %7
store float* %3, float** %8
%11 = load float*, float** %6
%12 = load float*, float** %5
%13 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 0
%14 = call i32 @difference_3fo(float* %11, float* %12, float* %13)
%15 = load float*, float** %7
%16 = load float*, float** %5
%17 = getelementptr inbounds [3 x float], [3 x float]* %10, i64 0, i64 0
%18 = call i32 @difference_3fo(float* %15, float* %16, float* %17)
%19 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 0
%20 = getelementptr inbounds [3 x float], [3 x float]* %10, i64 0, i64 0
%21 = load float*, float** %8
%22 = call i32 @cross_product_3fo(float* %19, float* %20, float* %21)
%23 = load float*, float** %8
%24 = call i32 @normalize_3f(float* %23)
ret void
}

LLVM IR (-O2):
define void @triangle_normal_3fo(float* %0, float* %1, float* %2, float* %3) {
%5 = alloca [3 x float]
%6 = alloca [3 x float]
%7 = bitcast [3 x float]* %5 to i8*
%8 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 0
%9 = call i32 @difference_3fo(float* %1, float* %0, float* %8)
%10 = bitcast [3 x float]* %6 to i8*
%11 = getelementptr inbounds [3 x float], [3 x float]* %6, i64 0, i64 0
%12 = call i32 @difference_3fo(float* %2, float* %0, float* %11)
%13 = call i32 @cross_product_3fo(float* %8, float* %11, float* %3)
%14 = call i32 @normalize_3f(float* %3)
ret void
}