#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*/ crossVectors(float *, float *, float *);
scalar_t__ dotVectors(float *, float const *);
float magnitudeVector(float *);
float orientedArea(const float v0[3], const float v1[3], const float v2[3],
                   const float n[3]) {
  float v0v1[3], v0v2[3], tmp[3], area;
  v0v1[0] = v1[0] - v0[0];
  v0v1[1] = v1[1] - v0[1];
  v0v1[2] = v1[2] - v0[2];
  v0v2[0] = v2[0] - v0[0];
  v0v2[1] = v2[1] - v0[1];
  v0v2[2] = v2[2] - v0[2];
  crossVectors(v0v1, v0v2, tmp);
  area = magnitudeVector(tmp) / 2.0f;
  if (dotVectors(tmp, n) > 0)
    return area;
  else
    return -1.0f * area;
}


x86 assembly (clang, -O0):
<orientedArea>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subss  (%rax),%xmm0
movss  %xmm0,-0x34(%rbp)
mov    -0x18(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x10(%rbp),%rax
subss  0x4(%rax),%xmm0
movss  %xmm0,-0x30(%rbp)
mov    -0x18(%rbp),%rax
movss  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
subss  0x8(%rax),%xmm0
movss  %xmm0,-0x2c(%rbp)
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subss  (%rax),%xmm0
movss  %xmm0,-0x40(%rbp)
mov    -0x20(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x10(%rbp),%rax
subss  0x4(%rax),%xmm0
movss  %xmm0,-0x3c(%rbp)
mov    -0x20(%rbp),%rax
movss  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
subss  0x8(%rax),%xmm0
movss  %xmm0,-0x38(%rbp)
lea    -0x34(%rbp),%rdi
lea    -0x40(%rbp),%rsi
lea    -0x4c(%rbp),%rdx
call   1040 <crossVectors@plt>
lea    -0x4c(%rbp),%rdi
call   1050 <magnitudeVector@plt>
movss  0xe10(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x50(%rbp)
lea    -0x4c(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <dotVectors@plt>
cmp    $0x0,%rax
jle    121f <orientedArea+0xef>
movss  -0x50(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1231 <orientedArea+0x101>
movss  0xddd(%rip),%xmm0
mulss  -0x50(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<orientedArea>:
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    %rcx,%r14
movss  (%rsi),%xmm0
movss  (%rdi),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,0x14(%rsp)
movss  0x4(%rsi),%xmm0
movss  0x4(%rdi),%xmm2
subss  %xmm2,%xmm0
movss  %xmm0,0x18(%rsp)
movss  0x8(%rsi),%xmm0
movss  0x8(%rdi),%xmm3
subss  %xmm3,%xmm0
movss  %xmm0,0x1c(%rsp)
movss  (%rdx),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,0x8(%rsp)
movss  0x4(%rdx),%xmm0
subss  %xmm2,%xmm0
movss  %xmm0,0xc(%rsp)
movss  0x8(%rdx),%xmm0
subss  %xmm3,%xmm0
movss  %xmm0,0x10(%rsp)
lea    0x14(%rsp),%rdi
lea    0x8(%rsp),%rsi
lea    0x3c(%rsp),%rbx
mov    %rbx,%rdx
call   1040 <crossVectors@plt>
mov    %rbx,%rdi
call   1050 <magnitudeVector@plt>
mulss  0xe39(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <dotVectors@plt>
test   %rax,%rax
jg     11ea <orientedArea+0xba>
movaps 0x20(%rsp),%xmm0
xorps  0xe28(%rip),%xmm0
jmp    11ef <orientedArea+0xbf>
movaps 0x20(%rsp),%xmm0
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define float @orientedArea(float* %0, float* %1, float* %2, float* %3) {
%5 = alloca float
%6 = alloca float*
%7 = alloca float*
%8 = alloca float*
%9 = alloca float*
%10 = alloca [3 x float]
%11 = alloca [3 x float]
%12 = alloca [3 x float]
%13 = alloca float
store float* %0, float** %6
store float* %1, float** %7
store float* %2, float** %8
store float* %3, float** %9
%14 = load float*, float** %7
%15 = getelementptr inbounds float, float* %14, i64 0
%16 = load float, float* %15
%17 = load float*, float** %6
%18 = getelementptr inbounds float, float* %17, i64 0
%19 = load float, float* %18
%20 = fsub float %16, %19
%21 = getelementptr inbounds [3 x float], [3 x float]* %10, i64 0, i64 0
store float %20, float* %21
%22 = load float*, float** %7
%23 = getelementptr inbounds float, float* %22, i64 1
%24 = load float, float* %23
%25 = load float*, float** %6
%26 = getelementptr inbounds float, float* %25, i64 1
%27 = load float, float* %26
%28 = fsub float %24, %27
%29 = getelementptr inbounds [3 x float], [3 x float]* %10, i64 0, i64 1
store float %28, float* %29
%30 = load float*, float** %7
%31 = getelementptr inbounds float, float* %30, i64 2
%32 = load float, float* %31
%33 = load float*, float** %6
%34 = getelementptr inbounds float, float* %33, i64 2
%35 = load float, float* %34
%36 = fsub float %32, %35
%37 = getelementptr inbounds [3 x float], [3 x float]* %10, i64 0, i64 2
store float %36, float* %37
%38 = load float*, float** %8
%39 = getelementptr inbounds float, float* %38, i64 0
%40 = load float, float* %39
%41 = load float*, float** %6
%42 = getelementptr inbounds float, float* %41, i64 0
%43 = load float, float* %42
%44 = fsub float %40, %43
%45 = getelementptr inbounds [3 x float], [3 x float]* %11, i64 0, i64 0
store float %44, float* %45
%46 = load float*, float** %8
%47 = getelementptr inbounds float, float* %46, i64 1
%48 = load float, float* %47
%49 = load float*, float** %6
%50 = getelementptr inbounds float, float* %49, i64 1
%51 = load float, float* %50
%52 = fsub float %48, %51
%53 = getelementptr inbounds [3 x float], [3 x float]* %11, i64 0, i64 1
store float %52, float* %53
%54 = load float*, float** %8
%55 = getelementptr inbounds float, float* %54, i64 2
%56 = load float, float* %55
%57 = load float*, float** %6
%58 = getelementptr inbounds float, float* %57, i64 2
%59 = load float, float* %58
%60 = fsub float %56, %59
%61 = getelementptr inbounds [3 x float], [3 x float]* %11, i64 0, i64 2
store float %60, float* %61
%62 = getelementptr inbounds [3 x float], [3 x float]* %10, i64 0, i64 0
%63 = getelementptr inbounds [3 x float], [3 x float]* %11, i64 0, i64 0
%64 = getelementptr inbounds [3 x float], [3 x float]* %12, i64 0, i64 0
%65 = call i32 @crossVectors(float* %62, float* %63, float* %64)
%66 = getelementptr inbounds [3 x float], [3 x float]* %12, i64 0, i64 0
%67 = call float @magnitudeVector(float* %66)
%68 = fdiv float %67, 2.000000e+00
store float %68, float* %13
%69 = getelementptr inbounds [3 x float], [3 x float]* %12, i64 0, i64 0
%70 = load float*, float** %9
%71 = call i64 @dotVectors(float* %69, float* %70)
%72 = icmp sgt i64 %71, 0
br i1 %72, label %73, label %75
73: ; preds = %4
%74 = load float, float* %13
store float %74, float* %5
br label %78
75: ; preds = %4
%76 = load float, float* %13
%77 = fmul float -1.000000e+00, %76
store float %77, float* %5
br label %78
78: ; preds = %75, %73
%79 = load float, float* %5
ret float %79
}

LLVM IR (-O2):
define float @orientedArea(float* nocapture %0, float* nocapture %1, float* nocapture %2, float* %3) {
%5 = alloca [3 x float]
%6 = alloca [3 x float]
%7 = alloca [3 x float]
%8 = bitcast [3 x float]* %5 to i8*
%9 = bitcast [3 x float]* %6 to i8*
%10 = bitcast [3 x float]* %7 to i8*
%11 = load float, float* %1
%12 = load float, float* %0
%13 = fsub float %11, %12
%14 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 0
store float %13, float* %14
%15 = getelementptr inbounds float, float* %1, i64 1
%16 = load float, float* %15
%17 = getelementptr inbounds float, float* %0, i64 1
%18 = load float, float* %17
%19 = fsub float %16, %18
%20 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 1
store float %19, float* %20
%21 = getelementptr inbounds float, float* %1, i64 2
%22 = load float, float* %21
%23 = getelementptr inbounds float, float* %0, i64 2
%24 = load float, float* %23
%25 = fsub float %22, %24
%26 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 2
store float %25, float* %26
%27 = load float, float* %2
%28 = fsub float %27, %12
%29 = getelementptr inbounds [3 x float], [3 x float]* %6, i64 0, i64 0
store float %28, float* %29
%30 = getelementptr inbounds float, float* %2, i64 1
%31 = load float, float* %30
%32 = fsub float %31, %18
%33 = getelementptr inbounds [3 x float], [3 x float]* %6, i64 0, i64 1
store float %32, float* %33
%34 = getelementptr inbounds float, float* %2, i64 2
%35 = load float, float* %34
%36 = fsub float %35, %24
%37 = getelementptr inbounds [3 x float], [3 x float]* %6, i64 0, i64 2
store float %36, float* %37
%38 = getelementptr inbounds [3 x float], [3 x float]* %7, i64 0, i64 0
%39 = call i32 @crossVectors(float* %14, float* %29, float* %38)
%40 = call float @magnitudeVector(float* %38)
%41 = fmul float %40, 5.000000e-01
%42 = call i64 @dotVectors(float* %38, float* %3)
%43 = icmp sgt i64 %42, 0
%44 = fneg float %41
%45 = select i1 %43, float %41, float %44
ret float %45
}