#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 */
scalar_t__ pow(double, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
float sqrt(scalar_t__);
int main() {
  float altezza, area, ab, bc, perimetro;
  printf("Inserisci ab\n");
  scanf("%f", &ab);
  printf("Inserisci il bc\n");
  scanf("%f", &bc);
  altezza = sqrt(pow(ab, 2) + pow(0.5 * bc, 2));
  area = (bc * altezza) / 2;
  perimetro = ab * 2 + bc;
  printf("Il perimetro e\' %f\n", perimetro);
  printf("L\'area e\' %f\n", area);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec1(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea3(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
mov    %rax,-0x20(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe5c(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
mov    -0x20(%rbp),%rdi
add    %rax,%rdi
call   1060 <sqrt@plt>
movss  %xmm0,-0x4(%rbp)
movss  -0x10(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  0xe23(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
addss  %xmm0,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe25(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe22(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
lea    0xea4(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xec2(%rip),%rdi
call   1030 <puts@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    $0x2,%edi
call   1060 <pow@plt>
mov    %rax,%rbx
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe49(%rip),%xmm0
mov    $0x2,%edi
call   1060 <pow@plt>
add    %rax,%rbx
mov    %rbx,%rdi
call   1070 <sqrt@plt>
movss  0x4(%rsp),%xmm2
mulss  %xmm2,%xmm0
mulss  0xe2a(%rip),%xmm0
movss  %xmm0,0xc(%rsp)
movss  0x8(%rsp),%xmm1
addss  %xmm1,%xmm1
addss  %xmm2,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xe0f(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe0b(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Inserisci ab\0A\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [17 x i8] c"Inserisci il bc\0A\00"
@.str.3 = [20 x i8] c"Il perimetro e' %f\0A\00"
@.str.4 = [14 x i8] c"L'area e' %f\0A\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
%10 = load float, float* %3
%11 = fpext float %10 to double
%12 = call i64 @pow(double %11, i32 2)
%13 = load float, float* %4
%14 = fpext float %13 to double
%15 = fmul double 5.000000e-01, %14
%16 = call i64 @pow(double %15, i32 2)
%17 = add nsw i64 %12, %16
%18 = call float @sqrt(i64 %17)
store float %18, float* %1
%19 = load float, float* %4
%20 = load float, float* %1
%21 = fmul float %19, %20
%22 = fdiv float %21, 2.000000e+00
store float %22, float* %2
%23 = load float, float* %3
%24 = load float, float* %4
%25 = call float @llvm.fmuladd.f32(float %23, float 2.000000e+00, float %24)
store float %25, float* %5
%26 = load float, float* %5
%27 = fpext float %26 to double
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), double %27)
%29 = load float, float* %2
%30 = fpext float %29 to double
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), double %30)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%f\00"
@.str.3 = [20 x i8] c"Il perimetro e' %f\0A\00"
@.str.4 = [14 x i8] c"L'area e' %f\0A\00"
@str = [13 x i8] c"Inserisci ab\00"
@str.5 = [16 x i8] c"Inserisci il bc\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = bitcast float* %1 to i8*
%4 = bitcast float* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.5, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%9 = load float, float* %1
%10 = fpext float %9 to double
%11 = call i64 @pow(double %10, i32 2)
%12 = load float, float* %2
%13 = fpext float %12 to double
%14 = fmul double %13, 5.000000e-01
%15 = call i64 @pow(double %14, i32 2)
%16 = add nsw i64 %15, %11
%17 = call float @sqrt(i64 %16)
%18 = load float, float* %2
%19 = fmul float %17, %18
%20 = fmul float %19, 5.000000e-01
%21 = load float, float* %1
%22 = call float @llvm.fmuladd.f32(float %21, float 2.000000e+00, float %18)
%23 = fpext float %22 to double
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), double %23)
%25 = fpext float %20 to double
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), double %25)
ret i32 0
}