#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 sqrt(double);
double triangleArea(double arr[]) {
  double s = 0.0;
  double area = 0.0;
  s = (arr[0] + arr[1] + arr[2]) / 2;
  area = sqrt(s * (s - arr[0]) * (s - arr[1]) * (s - arr[2]));
  return area;
}


x86 assembly (clang, -O0):
<triangleArea>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
addsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
addsd  0x10(%rax),%xmm0
movsd  0xeb2(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mov    -0x8(%rbp),%rax
subsd  (%rax),%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm1
mov    -0x8(%rbp),%rax
subsd  0x8(%rax),%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm1
mov    -0x8(%rbp),%rax
subsd  0x10(%rax),%xmm1
mulsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<triangleArea>:
movsd  (%rdi),%xmm1
movsd  0x8(%rdi),%xmm2
movapd %xmm1,%xmm0
addsd  %xmm2,%xmm0
movsd  0x10(%rdi),%xmm3
addsd  %xmm3,%xmm0
mulsd  0xece(%rip),%xmm0
movapd %xmm0,%xmm4
subsd  %xmm1,%xmm4
mulsd  %xmm0,%xmm4
movapd %xmm0,%xmm1
subsd  %xmm2,%xmm1
mulsd  %xmm4,%xmm1
subsd  %xmm3,%xmm0
mulsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1161 <triangleArea+0x51>
sqrtsd %xmm0,%xmm0
ret
jmp    1030 <sqrt@plt>

LLVM IR (-O0):
define double @triangleArea(double* %0) {
%2 = alloca double*
%3 = alloca double
%4 = alloca double
store double* %0, double** %2
store double 0.000000e+00, double* %3
store double 0.000000e+00, double* %4
%5 = load double*, double** %2
%6 = getelementptr inbounds double, double* %5, i64 0
%7 = load double, double* %6
%8 = load double*, double** %2
%9 = getelementptr inbounds double, double* %8, i64 1
%10 = load double, double* %9
%11 = fadd double %7, %10
%12 = load double*, double** %2
%13 = getelementptr inbounds double, double* %12, i64 2
%14 = load double, double* %13
%15 = fadd double %11, %14
%16 = fdiv double %15, 2.000000e+00
store double %16, double* %3
%17 = load double, double* %3
%18 = load double, double* %3
%19 = load double*, double** %2
%20 = getelementptr inbounds double, double* %19, i64 0
%21 = load double, double* %20
%22 = fsub double %18, %21
%23 = fmul double %17, %22
%24 = load double, double* %3
%25 = load double*, double** %2
%26 = getelementptr inbounds double, double* %25, i64 1
%27 = load double, double* %26
%28 = fsub double %24, %27
%29 = fmul double %23, %28
%30 = load double, double* %3
%31 = load double*, double** %2
%32 = getelementptr inbounds double, double* %31, i64 2
%33 = load double, double* %32
%34 = fsub double %30, %33
%35 = fmul double %29, %34
%36 = call double @sqrt(double %35)
store double %36, double* %4
%37 = load double, double* %4
ret double %37
}

LLVM IR (-O2):
define double @triangleArea(double* nocapture %0) {
%2 = load double, double* %0
%3 = getelementptr inbounds double, double* %0, i64 1
%4 = load double, double* %3
%5 = fadd double %2, %4
%6 = getelementptr inbounds double, double* %0, i64 2
%7 = load double, double* %6
%8 = fadd double %5, %7
%9 = fmul double %8, 5.000000e-01
%10 = fsub double %9, %2
%11 = fmul double %9, %10
%12 = fsub double %9, %4
%13 = fmul double %12, %11
%14 = fsub double %9, %7
%15 = fmul double %14, %13
%16 = tail call double @sqrt(double %15)
ret double %16
}