#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 main() {
  float peso, altura, imc;
  printf("---- Cálculo e Classificação IMC ----\n");
  printf("Digite o peso em kg: ");
  scanf("%f", &peso);
  printf("Digite a altura em metros: ");
  scanf("%f", &altura);
  imc = peso / (altura * altura);
  if (imc < 18.5) {
    printf("Abaixo do peso!");
  } else if (imc >= 18.6 && imc <= 24.9) {
    printf("Saudável!");
  } else if (imc >= 25.0 && imc < 29.9) {
    printf("Peso em excesso!");
  } else if (imc >= 30.0 && imc < 34.9) {
    printf("Obesidade grau I!");
  } else if (imc >= 35.0 && imc < 39.9) {
    printf("Obesidade grau II(severa)!");
  } else {
    printf("Obesidade grau III(mórbida)!");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xf12(%rip),%rdi
call   1030 <printf@plt>
lea    0xf30(%rip),%rdi
call   1030 <printf@plt>
lea    0xf3a(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xf2d(%rip),%rdi
call   1030 <printf@plt>
lea    0xf1e(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
mulss  -0xc(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe64(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11b7 <main+0x97>
lea    0xefa(%rip),%rdi
call   1030 <printf@plt>
jmp    12f3 <main+0x1d3>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe40(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     11fe <main+0xde>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe2d(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     11fe <main+0xde>
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
jmp    12ee <main+0x1ce>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe09(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1245 <main+0x125>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xdf6(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1245 <main+0x125>
lea    0xe87(%rip),%rdi
call   1030 <printf@plt>
jmp    12e9 <main+0x1c9>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdd2(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     128c <main+0x16c>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xdbf(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    128c <main+0x16c>
lea    0xe51(%rip),%rdi
call   1030 <printf@plt>
jmp    12e4 <main+0x1c4>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd9b(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     12d3 <main+0x1b3>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xd88(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    12d3 <main+0x1b3>
lea    0xe1c(%rip),%rdi
call   1030 <printf@plt>
jmp    12df <main+0x1bf>
lea    0xe26(%rip),%rdi
call   1030 <printf@plt>
jmp    12e4 <main+0x1c4>
jmp    12e9 <main+0x1c9>
jmp    12ee <main+0x1ce>
jmp    12f3 <main+0x1d3>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xfa8(%rip),%rdi
call   1030 <puts@plt>
lea    0xef0(%rip),%rdi
call   1040 <printf@plt>
lea    0xefa(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xee9(%rip),%rdi
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
movss  0xc(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
mulss  %xmm1,%xmm1
divss  %xmm1,%xmm0
movss  0xe6a(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    11a7 <main+0x77>
lea    0xecb(%rip),%rdi
jmp    1238 <main+0x108>
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
ucomisd 0xe5a(%rip),%xmm1
jb     11cf <main+0x9f>
movsd  0xe58(%rip),%xmm2
ucomisd %xmm1,%xmm2
jb     11cf <main+0x9f>
lea    0xeb0(%rip),%rdi
jmp    1238 <main+0x108>
ucomiss 0xe2e(%rip),%xmm0
jb     11ef <main+0xbf>
movsd  0xe40(%rip),%xmm2
ucomisd %xmm1,%xmm2
jbe    11ef <main+0xbf>
lea    0xe9b(%rip),%rdi
jmp    1238 <main+0x108>
ucomiss 0xe12(%rip),%xmm0
jb     120f <main+0xdf>
movsd  0xe28(%rip),%xmm2
ucomisd %xmm1,%xmm2
jbe    120f <main+0xdf>
lea    0xe8c(%rip),%rdi
jmp    1238 <main+0x108>
movsd  0xe19(%rip),%xmm2
ucomisd %xmm1,%xmm2
lea    0xe89(%rip),%rdi
lea    0xe9d(%rip),%rax
cmovbe %rax,%rdi
ucomiss 0xdd8(%rip),%xmm0
cmovb  %rax,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [42 x i8] c"---- C\C3\A1lculo e Classifica\C3\A7\C3\A3o IMC ----\0A\00"
@.str.1 = [22 x i8] c"Digite o peso em kg: \00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [28 x i8] c"Digite a altura em metros: \00"
@.str.4 = [16 x i8] c"Abaixo do peso!\00"
@.str.5 = [11 x i8] c"Saud\C3\A1vel!\00"
@.str.6 = [17 x i8] c"Peso em excesso!\00"
@.str.7 = [18 x i8] c"Obesidade grau I!\00"
@.str.8 = [27 x i8] c"Obesidade grau II(severa)!\00"
@.str.9 = [30 x i8] c"Obesidade grau III(m\C3\B3rbida)!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
store i32 0, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %2)
%8 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %3)
%10 = load float, float* %2
%11 = load float, float* %3
%12 = load float, float* %3
%13 = fmul float %11, %12
%14 = fdiv float %10, %13
store float %14, float* %4
%15 = load float, float* %4
%16 = fpext float %15 to double
%17 = fcmp olt double %16, 1.850000e+01
br i1 %17, label %18, label %20
18: ; preds = %0
%19 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
br label %66
20: ; preds = %0
%21 = load float, float* %4
%22 = fpext float %21 to double
%23 = fcmp oge double %22, 1.860000e+01
br i1 %23, label %24, label %30
24: ; preds = %20
%25 = load float, float* %4
%26 = fpext float %25 to double
%27 = fcmp ole double %26, 2.490000e+01
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
br label %65
30: ; preds = %24, %20
%31 = load float, float* %4
%32 = fpext float %31 to double
%33 = fcmp oge double %32, 2.500000e+01
br i1 %33, label %34, label %40
34: ; preds = %30
%35 = load float, float* %4
%36 = fpext float %35 to double
%37 = fcmp olt double %36, 2.990000e+01
br i1 %37, label %38, label %40
38: ; preds = %34
%39 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
br label %64
40: ; preds = %34, %30
%41 = load float, float* %4
%42 = fpext float %41 to double
%43 = fcmp oge double %42, 3.000000e+01
br i1 %43, label %44, label %50
44: ; preds = %40
%45 = load float, float* %4
%46 = fpext float %45 to double
%47 = fcmp olt double %46, 3.490000e+01
br i1 %47, label %48, label %50
48: ; preds = %44
%49 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0))
br label %63
50: ; preds = %44, %40
%51 = load float, float* %4
%52 = fpext float %51 to double
%53 = fcmp oge double %52, 3.500000e+01
br i1 %53, label %54, label %60
54: ; preds = %50
%55 = load float, float* %4
%56 = fpext float %55 to double
%57 = fcmp olt double %56, 3.990000e+01
br i1 %57, label %58, label %60
58: ; preds = %54
%59 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0))
br label %62
60: ; preds = %54, %50
%61 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0))
br label %62
62: ; preds = %60, %58
br label %63
63: ; preds = %62, %48
br label %64
64: ; preds = %63, %38
br label %65
65: ; preds = %64, %28
br label %66
66: ; preds = %65, %18
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [22 x i8] c"Digite o peso em kg: \00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [28 x i8] c"Digite a altura em metros: \00"
@.str.4 = [16 x i8] c"Abaixo do peso!\00"
@.str.5 = [11 x i8] c"Saud\C3\A1vel!\00"
@.str.6 = [17 x i8] c"Peso em excesso!\00"
@.str.7 = [18 x i8] c"Obesidade grau I!\00"
@.str.8 = [27 x i8] c"Obesidade grau II(severa)!\00"
@.str.9 = [30 x i8] c"Obesidade grau III(m\C3\B3rbida)!\00"
@str = [41 x i8] c"---- C\C3\A1lculo e Classifica\C3\A7\C3\A3o IMC ----\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 ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %1)
%8 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %2)
%10 = load float, float* %1
%11 = load float, float* %2
%12 = fmul float %11, %11
%13 = fdiv float %10, %12
%14 = fpext float %13 to double
%15 = fcmp olt float %13, 1.850000e+01
br i1 %15, label %33, label %16
16: ; preds = %0
%17 = fcmp ult double %14, 1.860000e+01
%18 = fcmp ugt double %14, 2.490000e+01
%19 = or i1 %17, %18
br i1 %19, label %20, label %33
20: ; preds = %16
%21 = fcmp oge float %13, 2.500000e+01
%22 = fcmp olt double %14, 2.990000e+01
%23 = and i1 %21, %22
br i1 %23, label %33, label %24
24: ; preds = %20
%25 = fcmp oge float %13, 3.000000e+01
%26 = fcmp olt double %14, 3.490000e+01
%27 = and i1 %25, %26
br i1 %27, label %33, label %28
28: ; preds = %24
%29 = fcmp oge float %13, 3.500000e+01
%30 = fcmp olt double %14, 3.990000e+01
%31 = and i1 %29, %30
%32 = select i1 %31, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0)
br label %33
33: ; preds = %28, %24, %20, %16, %0
%34 = phi i8* [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), %0 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), %16 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), %20 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), %24 ], [ %32, %28 ]
%35 = call i32 @printf(i8* dereferenceable(1) %34)
ret i32 0
}