#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("Qual é o seu peso em quilos: Ex( 75.5 )\n");
  scanf("%f", &peso);
  printf("Qual é a sua altura em metros: Ex( 1.75 )\n");
  scanf("%f", &altura);
  imc = peso / (altura * altura);
  if (imc < 20) {
    printf("Você abaixo do peso ideal\n");
  } else if (imc > 19 && imc < 26) {
    printf("Você está com peso ideal\n");
  } else if (imc > 25 && imc < 31) {
    printf("Você está acima do peso\n");
  } else {
    printf("Você está obeso, sendo prejudicial a saúde\n");
  }
  printf("Seu IMC é: %2.0f\n", imc);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xede(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xefa(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeed(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedc(%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  0xe75(%rip),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    11a8 <main+0x88>
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1236 <main+0x116>
movss  -0x10(%rbp),%xmm0
movss  0xe4f(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    11e3 <main+0xc3>
movss  0xe42(%rip),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    11e3 <main+0xc3>
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1231 <main+0x111>
movss  -0x10(%rbp),%xmm0
movss  0xe1c(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    121e <main+0xfe>
movss  0xe0f(%rip),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    121e <main+0xfe>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122c <main+0x10c>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1231 <main+0x111>
jmp    1236 <main+0x116>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xea9(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xeee(%rip),%rdi
call   1030 <puts@plt>
lea    0xecc(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xef7(%rip),%rdi
call   1030 <puts@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
movss  0xc(%rsp),%xmm1
movss  0x8(%rsp),%xmm0
mulss  %xmm0,%xmm0
divss  %xmm0,%xmm1
movss  0xe76(%rip),%xmm0
ucomiss %xmm1,%xmm0
movss  %xmm1,0x4(%rsp)
jbe    119e <main+0x6e>
lea    0xf45(%rip),%rdi
jmp    11e5 <main+0xb5>
ucomiss 0xe5f(%rip),%xmm1
jbe    11bd <main+0x8d>
movss  0xe59(%rip),%xmm0
ucomiss %xmm1,%xmm0
jbe    11bd <main+0x8d>
lea    0xf0b(%rip),%rdi
jmp    11e5 <main+0xb5>
movss  0xe47(%rip),%xmm0
ucomiss %xmm1,%xmm0
lea    0xedd(%rip),%rdi
lea    0xea8(%rip),%rax
cmovbe %rax,%rdi
ucomiss 0xe2f(%rip),%xmm1
cmovbe %rax,%rdi
call   1030 <puts@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe1c(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [42 x i8] c"Qual \C3\A9 o seu peso em quilos: Ex( 75.5 )\0A\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [44 x i8] c"Qual \C3\A9 a sua altura em metros: Ex( 1.75 )\0A\00"
@.str.3 = [28 x i8] c"Voc\C3\AA abaixo do peso ideal\0A\00"
@.str.4 = [28 x i8] c"Voc\C3\AA est\C3\A1 com peso ideal\0A\00"
@.str.5 = [27 x i8] c"Voc\C3\AA est\C3\A1 acima do peso\0A\00"
@.str.6 = [47 x i8] c"Voc\C3\AA est\C3\A1 obeso, sendo prejudicial a sa\C3\BAde\0A\00"
@.str.7 = [19 x i8] c"Seu IMC \C3\A9: %2.0f\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 ([42 x i8], [42 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 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 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
store float %13, float* %4
%14 = load float, float* %4
%15 = fcmp olt float %14, 2.000000e+01
br i1 %15, label %16, label %18
16: ; preds = %0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
br label %38
18: ; preds = %0
%19 = load float, float* %4
%20 = fcmp ogt float %19, 1.900000e+01
br i1 %20, label %21, label %26
21: ; preds = %18
%22 = load float, float* %4
%23 = fcmp olt float %22, 2.600000e+01
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
br label %37
26: ; preds = %21, %18
%27 = load float, float* %4
%28 = fcmp ogt float %27, 2.500000e+01
br i1 %28, label %29, label %34
29: ; preds = %26
%30 = load float, float* %4
%31 = fcmp olt float %30, 3.100000e+01
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
br label %36
34: ; preds = %29, %26
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.6, i64 0, i64 0))
br label %36
36: ; preds = %34, %32
br label %37
37: ; preds = %36, %24
br label %38
38: ; preds = %37, %16
%39 = load float, float* %4
%40 = fpext float %39 to double
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), double %40)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%f\00"
@.str.7 = [19 x i8] c"Seu IMC \C3\A9: %2.0f\0A\00"
@str = [41 x i8] c"Qual \C3\A9 o seu peso em quilos: Ex( 75.5 )\00"
@str.8 = [43 x i8] c"Qual \C3\A9 a sua altura em metros: Ex( 1.75 )\00"
@str.9 = [46 x i8] c"Voc\C3\AA est\C3\A1 obeso, sendo prejudicial a sa\C3\BAde\00"
@str.10 = [26 x i8] c"Voc\C3\AA est\C3\A1 acima do peso\00"
@str.11 = [27 x i8] c"Voc\C3\AA est\C3\A1 com peso ideal\00"
@str.12 = [27 x i8] c"Voc\C3\AA abaixo do peso ideal\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 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.8, 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 = fcmp olt float %12, 2.000000e+01
br i1 %13, label %23, label %14
14: ; preds = %0
%15 = fcmp ogt float %12, 1.900000e+01
%16 = fcmp olt float %12, 2.600000e+01
%17 = and i1 %15, %16
br i1 %17, label %23, label %18
18: ; preds = %14
%19 = fcmp ogt float %12, 2.500000e+01
%20 = fcmp olt float %12, 3.100000e+01
%21 = and i1 %19, %20
%22 = select i1 %21, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @str.10, i64 0, i64 0), i8* getelementptr inbounds ([46 x i8], [46 x i8]* @str.9, i64 0, i64 0)
br label %23
23: ; preds = %18, %14, %0
%24 = phi i8* [ getelementptr inbounds ([27 x i8], [27 x i8]* @str.12, i64 0, i64 0), %0 ], [ getelementptr inbounds ([27 x i8], [27 x i8]* @str.11, i64 0, i64 0), %14 ], [ %22, %18 ]
%25 = call i32 @puts(i8* dereferenceable(1) %24)
%26 = fpext float %12 to double
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), double %26)
ret i32 0
}