#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 = 0.00, altura = 0.00, imc;
  printf("TESTE DE INDICE DE MASSA CORPORAL\n");
  printf("Seu peso (kg):");
  scanf("%f", &peso);
  printf("Sua altura (metro):");
  scanf("%f", &altura);
  imc = peso / (altura * altura);
  printf("Seu índice de massa corporal corresponde a: %.2f -", imc);
  if (imc < 19) {
    printf(" MAGRA\n");
  } else if (imc < 25) {
    printf(" PESO IDEAL\n");
  } else if (imc < 30) {
    printf(" ACIMA DO PESO\n");
  } else {
    printf(" OBESO\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebe(%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,%xmm0
lea    0xea4(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  0xe40(%rip),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    11dd <main+0xbd>
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123f <main+0x11f>
movss  0xe1f(%rip),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    1202 <main+0xe2>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123a <main+0x11a>
movss  0xdfe(%rip),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    1227 <main+0x107>
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1235 <main+0x115>
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123a <main+0x11a>
jmp    123f <main+0x11f>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0x8(%rsp)
movl   $0x0,0x4(%rsp)
lea    0xf1a(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb5(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xea4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
movss  0x8(%rsp),%xmm1
movss  0x4(%rsp),%xmm0
mulss  %xmm0,%xmm0
divss  %xmm0,%xmm1
movss  %xmm1,0xc(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xe7c(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0xc(%rsp),%xmm1
movss  0xe35(%rip),%xmm0
ucomiss %xmm1,%xmm0
jbe    11d9 <main+0xa9>
lea    0xed3(%rip),%rdi
jmp    120c <main+0xdc>
movss  0xe23(%rip),%xmm0
ucomiss %xmm1,%xmm0
jbe    11ef <main+0xbf>
lea    0xeb1(%rip),%rdi
jmp    120c <main+0xdc>
movss  0xe11(%rip),%xmm0
ucomiss %xmm1,%xmm0
lea    0xe8e(%rip),%rax
lea    0xe80(%rip),%rdi
cmova  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [35 x i8] c"TESTE DE INDICE DE MASSA CORPORAL\0A\00"
@.str.1 = [15 x i8] c"Seu peso (kg):\00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [20 x i8] c"Sua altura (metro):\00"
@.str.4 = [52 x i8] c"Seu \C3\ADndice de massa corporal corresponde a: %.2f -\00"
@.str.5 = [8 x i8] c" MAGRA\0A\00"
@.str.6 = [13 x i8] c" PESO IDEAL\0A\00"
@.str.7 = [16 x i8] c" ACIMA DO PESO\0A\00"
@.str.8 = [8 x i8] c" OBESO\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
store i32 0, i32* %1
store float 0.000000e+00, float* %2
store float 0.000000e+00, float* %3
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 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 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 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 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0), double %16)
%18 = load float, float* %4
%19 = fcmp olt float %18, 1.900000e+01
br i1 %19, label %20, label %22
20: ; preds = %0
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
br label %36
22: ; preds = %0
%23 = load float, float* %4
%24 = fcmp olt float %23, 2.500000e+01
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
br label %35
27: ; preds = %22
%28 = load float, float* %4
%29 = fcmp olt float %28, 3.000000e+01
br i1 %29, label %30, label %32
30: ; preds = %27
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
br label %34
32: ; preds = %27
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
br label %34
34: ; preds = %32, %30
br label %35
35: ; preds = %34, %25
br label %36
36: ; preds = %35, %20
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [15 x i8] c"Seu peso (kg):\00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [20 x i8] c"Sua altura (metro):\00"
@.str.4 = [52 x i8] c"Seu \C3\ADndice de massa corporal corresponde a: %.2f -\00"
@str = [34 x i8] c"TESTE DE INDICE DE MASSA CORPORAL\00"
@str.9 = [7 x i8] c" OBESO\00"
@str.10 = [15 x i8] c" ACIMA DO PESO\00"
@str.11 = [12 x i8] c" PESO IDEAL\00"
@str.12 = [7 x i8] c" MAGRA\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = bitcast float* %1 to i8*
store float 0.000000e+00, float* %1
%4 = bitcast float* %2 to i8*
store float 0.000000e+00, float* %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 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 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0), double %14)
%16 = fcmp olt float %13, 1.900000e+01
br i1 %16, label %22, label %17
17: ; preds = %0
%18 = fcmp olt float %13, 2.500000e+01
br i1 %18, label %22, label %19
19: ; preds = %17
%20 = fcmp olt float %13, 3.000000e+01
%21 = select i1 %20, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @str.10, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @str.9, i64 0, i64 0)
br label %22
22: ; preds = %19, %17, %0
%23 = phi i8* [ getelementptr inbounds ([7 x i8], [7 x i8]* @str.12, i64 0, i64 0), %0 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @str.11, i64 0, i64 0), %17 ], [ %21, %19 ]
%24 = call i32 @puts(i8* dereferenceable(1) %23)
ret i32 0
}