#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;
  float altura;
  float imc;
  printf("Diga sua altura (ex 1.65):");
  scanf("%f", &altura);
  printf("Agora diga o seu peso(ex 78.6):");
  scanf("%f", &peso);
  imc = peso / (altura * altura);
  if (imc < 20) {
    printf("Você esta abaixo do peso");
  } else if (imc > 19 && imc < 26) {
    printf("Você esta no seu peso ideal");
  } else if (imc > 25 && imc < 31) {
    printf("Você esta acima do peso");
  } else {
    printf("Você esta obeso");
  }
  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    0xeeb(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xede(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
lea    -0x8(%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    0xeb6(%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    0xe95(%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    0xe77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122c <main+0x10c>
lea    0xe7d(%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    0xe6d(%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    0xee8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef5(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xee4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm1
movss  0x8(%rsp),%xmm0
mulss  %xmm0,%xmm0
divss  %xmm0,%xmm1
movss  0xe82(%rip),%xmm0
ucomiss %xmm1,%xmm0
movss  %xmm1,0x4(%rsp)
jbe    1192 <main+0x72>
lea    0xec2(%rip),%rdi
jmp    11d9 <main+0xb9>
ucomiss 0xe6b(%rip),%xmm1
jbe    11b1 <main+0x91>
movss  0xe65(%rip),%xmm0
ucomiss %xmm1,%xmm0
jbe    11b1 <main+0x91>
lea    0xebd(%rip),%rdi
jmp    11d9 <main+0xb9>
movss  0xe53(%rip),%xmm0
ucomiss %xmm1,%xmm0
lea    0xec6(%rip),%rdi
lea    0xed8(%rip),%rax
cmovbe %rax,%rdi
ucomiss 0xe3b(%rip),%xmm1
cmovbe %rax,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xec2(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Diga sua altura (ex 1.65):\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [32 x i8] c"Agora diga o seu peso(ex 78.6):\00"
@.str.3 = [26 x i8] c"Voc\C3\AA esta abaixo do peso\00"
@.str.4 = [29 x i8] c"Voc\C3\AA esta no seu peso ideal\00"
@.str.5 = [25 x i8] c"Voc\C3\AA esta acima do peso\00"
@.str.6 = [17 x i8] c"Voc\C3\AA esta obeso\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 ([27 x i8], [27 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* %3)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 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* %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 ([26 x i8], [26 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 ([29 x i8], [29 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 ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
br label %36
34: ; preds = %29, %26
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 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 = [27 x i8] c"Diga sua altura (ex 1.65):\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [32 x i8] c"Agora diga o seu peso(ex 78.6):\00"
@.str.3 = [26 x i8] c"Voc\C3\AA esta abaixo do peso\00"
@.str.4 = [29 x i8] c"Voc\C3\AA esta no seu peso ideal\00"
@.str.5 = [25 x i8] c"Voc\C3\AA esta acima do peso\00"
@.str.6 = [17 x i8] c"Voc\C3\AA esta obeso\00"
@.str.7 = [19 x i8] c"Seu imc \C3\A9: %2.0f\0A\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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 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* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 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* %1)
%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 ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0)
br label %23
23: ; preds = %18, %14, %0
%24 = phi i8* [ getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), %0 ], [ getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), %14 ], [ %22, %18 ]
%25 = call i32 (i8*, ...) @printf(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
}