#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 *);
float sqrt(float);
float computeArea(const float v0[3], const float v1[3], const float v2[3]) {
  float res[3], v0v1[3], v0v2[3];
  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, res);
  return ((float)(sqrt(res[0] * res[0] + res[1] * res[1] + res[2] * res[2]) /
                  2.0f));
}


x86 assembly (clang, -O0):
<computeArea>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x8(%rbp),%rax
subss  (%rax),%xmm0
movss  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x8(%rbp),%rax
subss  0x4(%rax),%xmm0
movss  %xmm0,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
subss  0x8(%rax),%xmm0
movss  %xmm0,-0x28(%rbp)
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x8(%rbp),%rax
subss  (%rax),%xmm0
movss  %xmm0,-0x3c(%rbp)
mov    -0x18(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x8(%rbp),%rax
subss  0x4(%rax),%xmm0
movss  %xmm0,-0x38(%rbp)
mov    -0x18(%rbp),%rax
movss  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
subss  0x8(%rax),%xmm0
movss  %xmm0,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
lea    -0x3c(%rbp),%rsi
lea    -0x24(%rbp),%rdx
call   1030 <crossVectors@plt>
movss  -0x24(%rbp),%xmm1
movss  -0x24(%rbp),%xmm2
movss  -0x20(%rbp),%xmm0
mulss  -0x20(%rbp),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0x1c(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1040 <sqrt@plt>
movss  0xdfa(%rip),%xmm1
divss  %xmm1,%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<computeArea>:
sub    $0x28,%rsp
movss  (%rsi),%xmm0
movss  (%rdi),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,0x10(%rsp)
movss  0x4(%rsi),%xmm0
movss  0x4(%rdi),%xmm2
subss  %xmm2,%xmm0
movss  %xmm0,0x14(%rsp)
movss  0x8(%rsi),%xmm0
movss  0x8(%rdi),%xmm3
subss  %xmm3,%xmm0
movss  %xmm0,0x18(%rsp)
movss  (%rdx),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,0x4(%rsp)
movss  0x4(%rdx),%xmm0
subss  %xmm2,%xmm0
movss  %xmm0,0x8(%rsp)
movss  0x8(%rdx),%xmm0
subss  %xmm3,%xmm0
movss  %xmm0,0xc(%rsp)
lea    0x10(%rsp),%rdi
lea    0x4(%rsp),%rsi
lea    0x1c(%rsp),%rdx
call   1030 <crossVectors@plt>
movss  0x1c(%rsp),%xmm1
movss  0x20(%rsp),%xmm0
mulss  %xmm0,%xmm0
mulss  %xmm1,%xmm1
addss  %xmm0,%xmm1
movss  0x24(%rsp),%xmm0
mulss  %xmm0,%xmm0
addss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     11d2 <computeArea+0xb2>
sqrtss %xmm0,%xmm0
jmp    11d7 <computeArea+0xb7>
call   1040 <sqrt@plt>
mulss  0xe21(%rip),%xmm0
add    $0x28,%rsp
ret

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

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