#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, double *);
double sqrt(double);
int main() {
  double a;
  double b;
  double c;
  double p;
  double area;
  printf("%s: ", "Enter side a");
  scanf("%lf", &a);
  printf("%s: ", "Enter side b");
  scanf("%lf", &b);
  printf("%s: ", "Enter side c");
  scanf("%lf", &c);
  p = (a + b + c) / 2;
  area = sqrt(p * (p - a) * (p - b) * (p - c));
  printf("%lf", area);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec2(%rip),%rdi
lea    0xec0(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebf(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe9d(%rip),%rdi
lea    0xeac(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9a(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe78(%rip),%rdi
lea    0xe94(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe75(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <scanf@plt>
movsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  0xe3b(%rip),%xmm1
divsd  %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   1050 <sqrt@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
lea    0xe07(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xeca(%rip),%r14
lea    0xec8(%rip),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec4(%rip),%rbx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xeb4(%rip),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xea3(%rip),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movsd  0x10(%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
movapd %xmm1,%xmm0
addsd  %xmm2,%xmm0
movsd  (%rsp),%xmm3
addsd  %xmm3,%xmm0
mulsd  0xe3e(%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     11f2 <main+0xc2>
sqrtsd %xmm0,%xmm0
jmp    11f7 <main+0xc7>
call   1050 <sqrt@plt>
lea    0xe1c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%s: \00"
@.str.1 = [13 x i8] c"Enter side a\00"
@.str.2 = [4 x i8] c"%lf\00"
@.str.3 = [13 x i8] c"Enter side b\00"
@.str.4 = [13 x i8] c"Enter side c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %2)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %3)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %4)
%13 = load double, double* %2
%14 = load double, double* %3
%15 = fadd double %13, %14
%16 = load double, double* %4
%17 = fadd double %15, %16
%18 = fdiv double %17, 2.000000e+00
store double %18, double* %5
%19 = load double, double* %5
%20 = load double, double* %5
%21 = load double, double* %2
%22 = fsub double %20, %21
%23 = fmul double %19, %22
%24 = load double, double* %5
%25 = load double, double* %3
%26 = fsub double %24, %25
%27 = fmul double %23, %26
%28 = load double, double* %5
%29 = load double, double* %4
%30 = fsub double %28, %29
%31 = fmul double %27, %30
%32 = call double @sqrt(double %31)
store double %32, double* %6
%33 = load double, double* %6
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double %33)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s: \00"
@.str.1 = [13 x i8] c"Enter side a\00"
@.str.2 = [4 x i8] c"%lf\00"
@.str.3 = [13 x i8] c"Enter side b\00"
@.str.4 = [13 x i8] c"Enter side c\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = bitcast double* %1 to i8*
%5 = bitcast double* %2 to i8*
%6 = bitcast double* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %1)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %2)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %3)
%13 = load double, double* %1
%14 = load double, double* %2
%15 = fadd double %13, %14
%16 = load double, double* %3
%17 = fadd double %15, %16
%18 = fmul double %17, 5.000000e-01
%19 = fsub double %18, %13
%20 = fmul double %18, %19
%21 = fsub double %18, %14
%22 = fmul double %21, %20
%23 = fsub double %18, %16
%24 = fmul double %23, %22
%25 = call double @sqrt(double %24)
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double %25)
ret i32 0
}