#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 *, int *, int *);
int /*<<< orphan*/ system(char *);
int main() {
  int base1, altezza1;
  int base2, altezza2;
  float area1, area2;
  printf(
      "Inserisci il valore della altezza e della base del primo triangolo: ");
  scanf("%d%d", &altezza1, &base1);
  printf("\nInserisci il valore della altezza2 e della base2 del secondo "
         "triangolo: ");
  scanf("%d%d", &altezza2, &base2);
  area1 = (base1 * altezza1) / 2.0;
  area2 = (base2 * altezza2) / 2.0;
  if (area1 > area2) {
    printf("\nE' maggiore l'area 1");
  } else if (area2 > area1) {
    printf("\nE' maggiore l'area 2");
  } else {
    printf("\nSono uguali");
  }
  printf("\nL'area1 = %.2f e L'area2 = %.3f", area1, area2);
  system("pause");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xef9(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1050 <scanf@plt>
lea    0xeea(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xed7(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xe6a(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%eax
imul   -0x14(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xe4a(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x18(%rbp),%xmm0
ucomiss -0x1c(%rbp),%xmm0
jbe    11e5 <main+0xb5>
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    121a <main+0xea>
movss  -0x1c(%rbp),%xmm0
ucomiss -0x18(%rbp),%xmm0
jbe    1207 <main+0xd7>
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1215 <main+0xe5>
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    121a <main+0xea>
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x1c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xea2(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
lea    0xeb5(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xecc(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf03(%rip),%rbx
lea    0x18(%rsp),%rsi
lea    0x1c(%rsp),%rdx
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xeef(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rsp),%rsi
lea    0x14(%rsp),%rdx
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0x18(%rsp),%eax
imul   0x1c(%rsp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xe6f(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm2
mov    0x10(%rsp),%eax
imul   0x14(%rsp),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm1
movss  %xmm1,0xc(%rsp)
movss  %xmm2,0x8(%rsp)
ucomiss %xmm2,%xmm1
lea    0xee8(%rip),%rax
lea    0xef7(%rip),%rcx
cmova  %rax,%rcx
ucomiss %xmm1,%xmm2
lea    0xebd(%rip),%rdi
cmovbe %rcx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0xc(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xed0(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
lea    0xee3(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [69 x i8] c"Inserisci il valore della altezza e della base del primo triangolo: \00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [74 x i8] c"\0AInserisci il valore della altezza2 e della base2 del secondo triangolo: \00"
@.str.3 = [22 x i8] c"\0AE' maggiore l'area 1\00"
@.str.4 = [22 x i8] c"\0AE' maggiore l'area 2\00"
@.str.5 = [13 x i8] c"\0ASono uguali\00"
@.str.6 = [33 x i8] c"\0AL'area1 = %.2f e L'area2 = %.3f\00"
@.str.7 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca float
%7 = alloca float
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %2)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %5, i32* %4)
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = mul nsw i32 %12, %13
%15 = sitofp i32 %14 to double
%16 = fdiv double %15, 2.000000e+00
%17 = fptrunc double %16 to float
store float %17, float* %6
%18 = load i32, i32* %4
%19 = load i32, i32* %5
%20 = mul nsw i32 %18, %19
%21 = sitofp i32 %20 to double
%22 = fdiv double %21, 2.000000e+00
%23 = fptrunc double %22 to float
store float %23, float* %7
%24 = load float, float* %6
%25 = load float, float* %7
%26 = fcmp ogt float %24, %25
br i1 %26, label %27, label %29
27: ; preds = %0
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
br label %38
29: ; preds = %0
%30 = load float, float* %7
%31 = load float, float* %6
%32 = fcmp ogt float %30, %31
br i1 %32, label %33, label %35
33: ; preds = %29
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
br label %37
35: ; preds = %29
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
br label %37
37: ; preds = %35, %33
br label %38
38: ; preds = %37, %27
%39 = load float, float* %6
%40 = fpext float %39 to double
%41 = load float, float* %7
%42 = fpext float %41 to double
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), double %40, double %42)
%44 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [69 x i8] c"Inserisci il valore della altezza e della base del primo triangolo: \00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [74 x i8] c"\0AInserisci il valore della altezza2 e della base2 del secondo triangolo: \00"
@.str.3 = [22 x i8] c"\0AE' maggiore l'area 1\00"
@.str.4 = [22 x i8] c"\0AE' maggiore l'area 2\00"
@.str.5 = [13 x i8] c"\0ASono uguali\00"
@.str.6 = [33 x i8] c"\0AL'area1 = %.2f e L'area2 = %.3f\00"
@.str.7 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %1)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([74 x i8], [74 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %4, i32* %3)
%13 = load i32, i32* %1
%14 = load i32, i32* %2
%15 = mul nsw i32 %14, %13
%16 = sitofp i32 %15 to double
%17 = fmul double %16, 5.000000e-01
%18 = fptrunc double %17 to float
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = mul nsw i32 %20, %19
%22 = sitofp i32 %21 to double
%23 = fmul double %22, 5.000000e-01
%24 = fptrunc double %23 to float
%25 = fcmp ogt float %18, %24
%26 = fcmp ogt float %24, %18
%27 = select i1 %26, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0)
%28 = select i1 %25, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* %27
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %28)
%30 = fpext float %18 to double
%31 = fpext float %24 to double
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), double %30, double %31)
%33 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
ret i32 0
}