#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 *, float *);
int /*<<< orphan*/ system(char *);
main() {
  float base, altura, resultado;
  system("title Programa para calcular a area dun triangulo");
  system("color 72");
  printf("Introduce a base:\n");
  scanf("%f", &base);
  printf("Introduce a altura:\n");
  scanf("%f", &altura);
  resultado = base * altura / 2;
  printf("A \240rea do tri\240ngulo \202: %f * %f = %f\n", base, altura,
         resultado);
  system("pause");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xebe(%rip),%rdi
call   1030 <system@plt>
lea    0xee4(%rip),%rdi
call   1030 <system@plt>
lea    0xee1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xee6(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec8(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
movss  -0x8(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  0xe5b(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x10(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xe9a(%rip),%rdi
mov    $0x3,%al
call   1040 <printf@plt>
lea    0xeb1(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xeb8(%rip),%rdi
call   1040 <system@plt>
lea    0xede(%rip),%rdi
call   1040 <system@plt>
lea    0xf09(%rip),%rdi
call   1030 <puts@plt>
lea    0xecf(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xefb(%rip),%rdi
call   1030 <puts@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
movss  0xc(%rsp),%xmm2
movss  0x8(%rsp),%xmm1
cvtss2sd %xmm2,%xmm0
mulss  %xmm1,%xmm2
mulss  0xe4e(%rip),%xmm2
cvtss2sd %xmm1,%xmm1
cvtss2sd %xmm2,%xmm2
lea    0xe81(%rip),%rdi
mov    $0x3,%al
call   1050 <printf@plt>
lea    0xe98(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [50 x i8] c"title Programa para calcular a area dun triangulo\00"
@.str.1 = [9 x i8] c"color 72\00"
@.str.2 = [19 x i8] c"Introduce a base:\0A\00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [21 x i8] c"Introduce a altura:\0A\00"
@.str.5 = [37 x i8] c"A \A0rea do tri\A0ngulo \82: %f * %f = %f\0A\00"
@.str.6 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
store i32 0, i32* %1
%5 = call i32 @system(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @system(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %2)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %3)
%11 = load float, float* %2
%12 = load float, float* %3
%13 = fmul float %11, %12
%14 = fdiv float %13, 2.000000e+00
store float %14, float* %4
%15 = load float, float* %2
%16 = fpext float %15 to double
%17 = load float, float* %3
%18 = fpext float %17 to double
%19 = load float, float* %4
%20 = fpext float %19 to double
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), double %16, double %18, double %20)
%22 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [50 x i8] c"title Programa para calcular a area dun triangulo\00"
@.str.1 = [9 x i8] c"color 72\00"
@.str.3 = [3 x i8] c"%f\00"
@.str.5 = [37 x i8] c"A \A0rea do tri\A0ngulo \82: %f * %f = %f\0A\00"
@.str.6 = [6 x i8] c"pause\00"
@str = [18 x i8] c"Introduce a base:\00"
@str.7 = [20 x i8] c"Introduce a altura:\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 @system(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @system(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %1)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.7, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %2)
%11 = load float, float* %1
%12 = load float, float* %2
%13 = fmul float %11, %12
%14 = fmul float %13, 5.000000e-01
%15 = fpext float %11 to double
%16 = fpext float %12 to double
%17 = fpext float %14 to double
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), double %15, double %16, double %17)
%19 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}