#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 */
float powf(float, float);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
int main(void) {
  float massa;
  float altura;
  float imc;
  printf("CÁLCULO DE ÍNDICE DE MASSA CORPORAL\n");
  printf("===================================\n\n");
  printf("Informe a massa em quilogramas (kg):\n");
  scanf("%f", &massa);
  printf("Informe a altura em metros (m):\n");
  scanf("%f", &altura);
  imc = massa / powf(altura, 2.0f);
  printf("MASSA=%.1f kg\n", massa);
  printf("ALTURA=%.2f m\n", altura);
  printf("IMC=%.3f m\n", imc);
  if (imc < 18.5) {
    printf("Abaixo do peso normal.\n");
  } else if (imc <= 24.9) {
    printf("Peso normal.\n");
  } else {
    printf("Acima do peso normal.\n");
  }
  printf("*FIM*\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xee7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeff(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf17(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xf0a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xef9(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0xc(%rbp),%xmm0
movss  0xe62(%rip),%xmm1
call   1030 <powf@plt>
movaps %xmm0,%xmm1
movss  -0x14(%rbp),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xed7(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xecf(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xec7(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xde6(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1237 <main+0x107>
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1278 <main+0x148>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xdc0(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     1265 <main+0x135>
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1273 <main+0x143>
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1278 <main+0x148>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xefd(%rip),%rdi
call   1030 <puts@plt>
lea    0xf17(%rip),%rdi
call   1030 <puts@plt>
lea    0xf30(%rip),%rdi
call   1030 <puts@plt>
lea    0xeac(%rip),%rbx
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xf35(%rip),%rdi
call   1030 <puts@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
movss  0x14(%rsp),%xmm2
movss  0x10(%rsp),%xmm1
mulss  %xmm1,%xmm1
cvtss2sd %xmm2,%xmm0
divss  %xmm1,%xmm2
movss  %xmm2,0xc(%rsp)
lea    0xe64(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe5b(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x18(%rsp)
lea    0xe4c(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0xe10(%rip),%xmm0
ucomisd 0x18(%rsp),%xmm0
lea    0xecc(%rip),%rax
lea    0xee1(%rip),%rcx
cmovb  %rax,%rcx
movss  0xdf8(%rip),%xmm0
ucomiss 0xc(%rsp),%xmm0
lea    0xed6(%rip),%rdi
cmovbe %rcx,%rdi
call   1030 <puts@plt>
lea    0xeb3(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [39 x i8] c"C\C3\81LCULO DE \C3\8DNDICE DE MASSA CORPORAL\0A\00"
@.str.1 = [38 x i8] c"===================================\0A\0A\00"
@.str.2 = [38 x i8] c"Informe a massa em quilogramas (kg):\0A\00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [33 x i8] c"Informe a altura em metros (m):\0A\00"
@.str.5 = [15 x i8] c"MASSA=%.1f kg\0A\00"
@.str.6 = [15 x i8] c"ALTURA=%.2f m\0A\00"
@.str.7 = [12 x i8] c"IMC=%.3f m\0A\00"
@.str.8 = [24 x i8] c"Abaixo do peso normal.\0A\00"
@.str.9 = [14 x i8] c"Peso normal.\0A\00"
@.str.10 = [23 x i8] c"Acima do peso normal.\0A\00"
@.str.11 = [7 x i8] c"*FIM*\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 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 ([33 x i8], [33 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 = call float @powf(float %12, float 2.000000e+00)
%14 = fdiv float %11, %13
store float %14, float* %4
%15 = load float, float* %2
%16 = fpext float %15 to double
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), double %16)
%18 = load float, float* %3
%19 = fpext float %18 to double
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), double %19)
%21 = load float, float* %4
%22 = fpext float %21 to double
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), double %22)
%24 = load float, float* %4
%25 = fpext float %24 to double
%26 = fcmp olt double %25, 1.850000e+01
br i1 %26, label %27, label %29
27: ; preds = %0
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0))
br label %38
29: ; preds = %0
%30 = load float, float* %4
%31 = fpext float %30 to double
%32 = fcmp ole double %31, 2.490000e+01
br i1 %32, label %33, label %35
33: ; preds = %29
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0))
br label %37
35: ; preds = %29
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.10, i64 0, i64 0))
br label %37
37: ; preds = %35, %33
br label %38
38: ; preds = %37, %27
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.3 = [3 x i8] c"%f\00"
@.str.5 = [15 x i8] c"MASSA=%.1f kg\0A\00"
@.str.6 = [15 x i8] c"ALTURA=%.2f m\0A\00"
@.str.7 = [12 x i8] c"IMC=%.3f m\0A\00"
@str = [38 x i8] c"C\C3\81LCULO DE \C3\8DNDICE DE MASSA CORPORAL\00"
@str.12 = [37 x i8] c"===================================\0A\00"
@str.13 = [37 x i8] c"Informe a massa em quilogramas (kg):\00"
@str.14 = [32 x i8] c"Informe a altura em metros (m):\00"
@str.15 = [22 x i8] c"Acima do peso normal.\00"
@str.16 = [6 x i8] c"*FIM*\00"
@str.17 = [13 x i8] c"Peso normal.\00"
@str.18 = [23 x i8] c"Abaixo do peso normal.\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 ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.12, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.13, 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 ([32 x i8], [32 x i8]* @str.14, 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 %12, %12
%14 = fdiv float %11, %13
%15 = fpext float %11 to double
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), double %15)
%17 = load float, float* %2
%18 = fpext float %17 to double
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), double %18)
%20 = fpext float %14 to double
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), double %20)
%22 = fcmp olt float %14, 1.850000e+01
%23 = fcmp ugt double %20, 2.490000e+01
%24 = select i1 %23, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @str.15, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @str.17, i64 0, i64 0)
%25 = select i1 %22, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @str.18, i64 0, i64 0), i8* %24
%26 = call i32 @puts(i8* dereferenceable(1) %25)
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.16, i64 0, i64 0))
ret i32 0
}