#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 area_of_triangle(unsigned s1, unsigned s2, unsigned s3) {
  double semiPerimeter, areaOfTriangle;
  semiPerimeter = (s1 + s2 + s3) / 2.0;
  areaOfTriangle = sqrt(semiPerimeter * (semiPerimeter - s1) *
                        (semiPerimeter - s2) * (semiPerimeter - s3));
  return areaOfTriangle;
}


x86 assembly (clang, -O0):
<area_of_triangle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    %ecx,%eax
mov    -0xc(%rbp),%ecx
add    %ecx,%eax
cvtsi2sd %rax,%xmm0
movsd  0xec5(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm1
mov    -0x4(%rbp),%eax
cvtsi2sd %rax,%xmm0
movaps %xmm1,%xmm2
subsd  %xmm0,%xmm2
movaps %xmm1,%xmm0
mulsd  %xmm2,%xmm0
mov    -0x8(%rbp),%eax
cvtsi2sd %rax,%xmm3
movaps %xmm1,%xmm2
subsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
mov    -0xc(%rbp),%eax
cvtsi2sd %rax,%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<area_of_triangle>:
lea    (%rsi,%rdi,1),%eax
add    %edx,%eax
cvtsi2sd %rax,%xmm0
mulsd  0xede(%rip),%xmm0
mov    %edi,%eax
cvtsi2sd %rax,%xmm1
movapd %xmm0,%xmm2
subsd  %xmm1,%xmm2
mulsd  %xmm0,%xmm2
mov    %esi,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %rax,%xmm1
movapd %xmm0,%xmm3
subsd  %xmm1,%xmm3
mulsd  %xmm2,%xmm3
mov    %edx,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %rax,%xmm1
subsd  %xmm1,%xmm0
mulsd  %xmm3,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     116c <area_of_triangle+0x5c>
sqrtsd %xmm0,%xmm0
ret
jmp    1030 <sqrt@plt>

LLVM IR (-O0):
define double @area_of_triangle(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = alloca double
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i32, i32* %4
%10 = load i32, i32* %5
%11 = add i32 %9, %10
%12 = load i32, i32* %6
%13 = add i32 %11, %12
%14 = uitofp i32 %13 to double
%15 = fdiv double %14, 2.000000e+00
store double %15, double* %7
%16 = load double, double* %7
%17 = load double, double* %7
%18 = load i32, i32* %4
%19 = uitofp i32 %18 to double
%20 = fsub double %17, %19
%21 = fmul double %16, %20
%22 = load double, double* %7
%23 = load i32, i32* %5
%24 = uitofp i32 %23 to double
%25 = fsub double %22, %24
%26 = fmul double %21, %25
%27 = load double, double* %7
%28 = load i32, i32* %6
%29 = uitofp i32 %28 to double
%30 = fsub double %27, %29
%31 = fmul double %26, %30
%32 = call double @sqrt(double %31)
store double %32, double* %8
%33 = load double, double* %8
ret double %33
}

LLVM IR (-O2):
define double @area_of_triangle(i32 %0, i32 %1, i32 %2) {
%4 = add i32 %1, %0
%5 = add i32 %4, %2
%6 = uitofp i32 %5 to double
%7 = fmul double %6, 5.000000e-01
%8 = uitofp i32 %0 to double
%9 = fsub double %7, %8
%10 = fmul double %7, %9
%11 = uitofp i32 %1 to double
%12 = fsub double %7, %11
%13 = fmul double %12, %10
%14 = uitofp i32 %2 to double
%15 = fsub double %7, %14
%16 = fmul double %15, %13
%17 = tail call double @sqrt(double %16)
ret double %17
}