#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*/ areaTriangle(double, double, double);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, double *, double *, double *);
void f() {
  double a, b, c, area, semiPerimeter;
  for (;;) {
    printf("Input three lengths \"a b c\".\n");
    if (!scanf("%lf %lf %lf", &a, &b, &c))
      return;
    printf("Triangle %lf, %lf, %lf, has an area of %lf.\n", a, b, c,
           areaTriangle(a, b, c));
  }
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x18(%rbp),%rcx
call   1050 <scanf@plt>
cmp    $0x0,%eax
jne    116d <f+0x3d>
add    $0x40,%rsp
pop    %rbp
ret
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
call   1040 <areaTriangle@plt>
movsd  -0x40(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
mov    %eax,%esi
lea    0xe73(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
jmp    1138 <f+0x8>

x86 assembly (clang, -O2):
<f>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
lea    0xee4(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9f(%rip),%rdi
lea    0x18(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   1060 <scanf@plt>
test   %eax,%eax
je     1214 <f+0xd4>
lea    0xe88(%rip),%r14
lea    0xeae(%rip),%r15
lea    0xe6e(%rip),%r12
lea    0x18(%rsp),%r13
lea    0x10(%rsp),%rbx
lea    0x8(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  0x18(%rsp),%xmm0
movsd  %xmm0,0x30(%rsp)
movsd  0x10(%rsp),%xmm1
movsd  %xmm1,0x28(%rsp)
movsd  0x8(%rsp),%xmm2
movsd  %xmm2,0x20(%rsp)
call   1050 <areaTriangle@plt>
mov    %r14,%rdi
movsd  0x30(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
movsd  0x20(%rsp),%xmm2
mov    %eax,%esi
mov    $0x3,%al
call   1040 <printf@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
mov    %rbp,%rcx
call   1060 <scanf@plt>
test   %eax,%eax
jne    11b0 <f+0x70>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Input three lengths \22a b c\22.\0A\00"
@.str.1 = [12 x i8] c"%lf %lf %lf\00"
@.str.2 = [45 x i8] c"Triangle %lf, %lf, %lf, has an area of %lf.\0A\00"
define void @f() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
br label %6
6: ; preds = %11, %0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double* %1, double* %2, double* %3)
%9 = icmp ne i32 %8, 0
br i1 %9, label %11, label %10
10: ; preds = %6
ret void
11: ; preds = %6
%12 = load double, double* %1
%13 = load double, double* %2
%14 = load double, double* %3
%15 = load double, double* %1
%16 = load double, double* %2
%17 = load double, double* %3
%18 = call i32 @areaTriangle(double %15, double %16, double %17)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), double %12, double %13, double %14, i32 %18)
br label %6
}

LLVM IR (-O2):
@.str.1 = [12 x i8] c"%lf %lf %lf\00"
@.str.2 = [45 x i8] c"Triangle %lf, %lf, %lf, has an area of %lf.\0A\00"
@str = [29 x i8] c"Input three lengths \22a b c\22.\00"
define void @f() {
%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 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double* %1, double* %2, double* %3)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %11, %0
ret void
11: ; preds = %0, %11
%12 = load double, double* %1
%13 = load double, double* %2
%14 = load double, double* %3
%15 = call i32 @areaTriangle(double %12, double %13, double %14)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), double %12, double %13, double %14, i32 %15)
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double* %1, double* %2, double* %3)
%19 = icmp eq i32 %18, 0
br i1 %19, label %10, label %11
}