#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 edgelen(int, int);
int sqrt(double);
double AspectRatio(int t) {
  double a, b, c;
  double s;
  double h;
  double rho;
  a = edgelen(t, 0);
  b = edgelen(t, 1);
  c = edgelen(t, 2);
  s = 0.5 * (a + b + c);
  rho = sqrt(s * (s - a) * (s - b) * (s - c)) / s;
  h = a * b * c / (4 * sqrt(s * (s - a) * (s - b) * (s - c)));
  return h / rho;
}


x86 assembly (clang, -O0):
<AspectRatio>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
xor    %esi,%esi
call   1030 <edgelen@plt>
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1030 <edgelen@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x2,%esi
call   1030 <edgelen@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm1
addsd  -0x18(%rbp),%xmm1
addsd  -0x20(%rbp),%xmm1
movsd  0xe8b(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm1
subsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm1
subsd  -0x20(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
cvtsi2sd %eax,%xmm0
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm1
subsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm1
subsd  -0x20(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movsd  -0x40(%rbp),%xmm0
shl    $0x2,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
divsd  -0x38(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AspectRatio>:
push   %rbx
sub    $0x50,%rsp
mov    %edi,%ebx
xor    %esi,%esi
call   1030 <edgelen@plt>
movapd %xmm0,0x10(%rsp)
mov    %ebx,%edi
mov    $0x1,%esi
call   1030 <edgelen@plt>
movsd  %xmm0,0x8(%rsp)
mov    %ebx,%edi
mov    $0x2,%esi
call   1030 <edgelen@plt>
movapd 0x10(%rsp),%xmm1
movapd %xmm1,%xmm2
movsd  0x8(%rsp),%xmm3
addsd  %xmm3,%xmm2
addsd  %xmm0,%xmm2
movapd %xmm0,%xmm4
movsd  %xmm0,0x28(%rsp)
mulsd  0xe84(%rip),%xmm2
movapd %xmm2,0x40(%rsp)
movapd %xmm2,%xmm0
subsd  %xmm1,%xmm0
mulsd  %xmm2,%xmm0
movapd %xmm2,%xmm1
subsd  %xmm3,%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm2,%xmm0
subsd  %xmm4,%xmm0
mulsd  %xmm1,%xmm0
movapd %xmm0,0x30(%rsp)
call   1040 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movapd 0x10(%rsp),%xmm1
mulsd  0x8(%rsp),%xmm1
mulsd  0x28(%rsp),%xmm1
unpcklpd %xmm0,%xmm1
movapd %xmm1,0x10(%rsp)
movaps 0x30(%rsp),%xmm0
call   1040 <sqrt@plt>
shl    $0x2,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
unpcklpd 0x40(%rsp),%xmm1
movapd 0x10(%rsp),%xmm0
divpd  %xmm1,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
divsd  %xmm1,%xmm0
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @AspectRatio(i32 %0) {
%2 = alloca i32
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store i32 %0, i32* %2
%9 = load i32, i32* %2
%10 = call double @edgelen(i32 %9, i32 0)
store double %10, double* %3
%11 = load i32, i32* %2
%12 = call double @edgelen(i32 %11, i32 1)
store double %12, double* %4
%13 = load i32, i32* %2
%14 = call double @edgelen(i32 %13, i32 2)
store double %14, double* %5
%15 = load double, double* %3
%16 = load double, double* %4
%17 = fadd double %15, %16
%18 = load double, double* %5
%19 = fadd double %17, %18
%20 = fmul double 5.000000e-01, %19
store double %20, double* %6
%21 = load double, double* %6
%22 = load double, double* %6
%23 = load double, double* %3
%24 = fsub double %22, %23
%25 = fmul double %21, %24
%26 = load double, double* %6
%27 = load double, double* %4
%28 = fsub double %26, %27
%29 = fmul double %25, %28
%30 = load double, double* %6
%31 = load double, double* %5
%32 = fsub double %30, %31
%33 = fmul double %29, %32
%34 = call i32 @sqrt(double %33)
%35 = sitofp i32 %34 to double
%36 = load double, double* %6
%37 = fdiv double %35, %36
store double %37, double* %8
%38 = load double, double* %3
%39 = load double, double* %4
%40 = fmul double %38, %39
%41 = load double, double* %5
%42 = fmul double %40, %41
%43 = load double, double* %6
%44 = load double, double* %6
%45 = load double, double* %3
%46 = fsub double %44, %45
%47 = fmul double %43, %46
%48 = load double, double* %6
%49 = load double, double* %4
%50 = fsub double %48, %49
%51 = fmul double %47, %50
%52 = load double, double* %6
%53 = load double, double* %5
%54 = fsub double %52, %53
%55 = fmul double %51, %54
%56 = call i32 @sqrt(double %55)
%57 = mul nsw i32 4, %56
%58 = sitofp i32 %57 to double
%59 = fdiv double %42, %58
store double %59, double* %7
%60 = load double, double* %7
%61 = load double, double* %8
%62 = fdiv double %60, %61
ret double %62
}

LLVM IR (-O2):
define double @AspectRatio(i32 %0) {
%2 = tail call double @edgelen(i32 %0, i32 0)
%3 = tail call double @edgelen(i32 %0, i32 1)
%4 = tail call double @edgelen(i32 %0, i32 2)
%5 = fadd double %2, %3
%6 = fadd double %5, %4
%7 = fmul double %6, 5.000000e-01
%8 = fsub double %7, %2
%9 = fmul double %7, %8
%10 = fsub double %7, %3
%11 = fmul double %10, %9
%12 = fsub double %7, %4
%13 = fmul double %12, %11
%14 = tail call i32 @sqrt(double %13)
%15 = sitofp i32 %14 to double
%16 = fmul double %2, %3
%17 = fmul double %16, %4
%18 = tail call i32 @sqrt(double %13)
%19 = shl nsw i32 %18, 2
%20 = sitofp i32 %19 to double
%21 = insertelement <2 x double> poison, double %17, i64 0
%22 = insertelement <2 x double> %21, double %15, i64 1
%23 = insertelement <2 x double> poison, double %20, i64 0
%24 = insertelement <2 x double> %23, double %7, i64 1
%25 = fdiv <2 x double> %22, %24
%26 = extractelement <2 x double> %25, i64 0
%27 = extractelement <2 x double> %25, i64 1
%28 = fdiv double %26, %27
ret double %28
}