#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, altura = 0;
  int imc = 0;
  printf("Informe o seu peso:");
  scanf("%f", &peso);
  printf("Informe sua altura:");
  scanf("%f", &altura);
  imc = peso / (altura * altura);
  if (imc <= 19) {
    printf("Você está magro!");
  }
  if (imc >= 20 && imc <= 25) {
    printf("Você está no peso ideal!");
  }
  if (imc >= 26 && imc <= 30) {
    printf("Você está acima do peso!");
  }
  if (imc > 31) {
    printf("Você está obeso(a)!");
  }
  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)
movl   $0x0,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
lea    0xebb(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
lea    0xe9f(%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
cvttss2si %xmm0,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x13,-0x10(%rbp)
jg     11ae <main+0x8e>
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x14,-0x10(%rbp)
jl     11ce <main+0xae>
cmpl   $0x19,-0x10(%rbp)
jg     11ce <main+0xae>
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x1a,-0x10(%rbp)
jl     11ee <main+0xce>
cmpl   $0x1e,-0x10(%rbp)
jg     11ee <main+0xce>
lea    0xe70(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x1f,-0x10(%rbp)
jle    1204 <main+0xe4>
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
lea    0xecc(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
mulss  %xmm1,%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
cmp    $0x14,%eax
jge    1194 <main+0x74>
lea    0xe99(%rip),%rdi
jmp    11c2 <main+0xa2>
lea    -0x14(%rax),%ecx
cmp    $0x6,%ecx
jae    11a5 <main+0x85>
lea    0xe9b(%rip),%rdi
jmp    11c2 <main+0xa2>
lea    -0x1a(%rax),%ecx
cmp    $0x5,%ecx
jae    11b6 <main+0x96>
lea    0xea5(%rip),%rdi
jmp    11c2 <main+0xa2>
cmp    $0x20,%eax
jb     11c7 <main+0xa7>
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Informe o seu peso:\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [20 x i8] c"Informe sua altura:\00"
@.str.3 = [19 x i8] c"Voc\C3\AA est\C3\A1 magro!\00"
@.str.4 = [27 x i8] c"Voc\C3\AA est\C3\A1 no peso ideal!\00"
@.str.5 = [27 x i8] c"Voc\C3\AA est\C3\A1 acima do peso!\00"
@.str.6 = [22 x i8] c"Voc\C3\AA est\C3\A1 obeso(a)!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca i32
store i32 0, i32* %1
store float 0.000000e+00, float* %2
store float 0.000000e+00, float* %3
store i32 0, i32* %4
%5 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%7 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%9 = load float, float* %2
%10 = load float, float* %3
%11 = load float, float* %3
%12 = fmul float %10, %11
%13 = fdiv float %9, %12
%14 = fptosi float %13 to i32
store i32 %14, i32* %4
%15 = load i32, i32* %4
%16 = icmp sle i32 %15, 19
br i1 %16, label %17, label %19
17: ; preds = %0
%18 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
br label %19
19: ; preds = %17, %0
%20 = load i32, i32* %4
%21 = icmp sge i32 %20, 20
br i1 %21, label %22, label %27
22: ; preds = %19
%23 = load i32, i32* %4
%24 = icmp sle i32 %23, 25
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
br label %27
27: ; preds = %25, %22, %19
%28 = load i32, i32* %4
%29 = icmp sge i32 %28, 26
br i1 %29, label %30, label %35
30: ; preds = %27
%31 = load i32, i32* %4
%32 = icmp sle i32 %31, 30
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
br label %35
35: ; preds = %33, %30, %27
%36 = load i32, i32* %4
%37 = icmp sgt i32 %36, 31
br i1 %37, label %38, label %40
38: ; preds = %35
%39 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
br label %40
40: ; preds = %38, %35
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Informe o seu peso:\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [20 x i8] c"Informe sua altura:\00"
@.str.3 = [19 x i8] c"Voc\C3\AA est\C3\A1 magro!\00"
@.str.4 = [27 x i8] c"Voc\C3\AA est\C3\A1 no peso ideal!\00"
@.str.5 = [27 x i8] c"Voc\C3\AA est\C3\A1 acima do peso!\00"
@.str.6 = [22 x i8] c"Voc\C3\AA est\C3\A1 obeso(a)!\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 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%7 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%9 = load float, float* %1
%10 = load float, float* %2
%11 = fmul float %10, %10
%12 = fdiv float %9, %11
%13 = fptosi float %12 to i32
%14 = icmp slt i32 %13, 20
br i1 %14, label %23, label %15
15: ; preds = %0
%16 = add nsw i32 %13, -20
%17 = icmp ult i32 %16, 6
br i1 %17, label %23, label %18
18: ; preds = %15
%19 = add nsw i32 %13, -26
%20 = icmp ult i32 %19, 5
br i1 %20, label %23, label %21
21: ; preds = %18
%22 = icmp ugt i32 %13, 31
br i1 %22, label %23, label %26
23: ; preds = %21, %18, %15, %0
%24 = phi i8* [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), %0 ], [ getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), %15 ], [ getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), %18 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), %21 ]
%25 = call i32 @printf(i8* dereferenceable(1) %24)
br label %26
26: ; preds = %23, %21
ret i32 0
}