#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 */
double pow(float, int);
int /*<<< orphan*/ printf(char *, float);
void imc(float alt, float pes) {
  float imc = pes / pow(alt, 2);
  float pesoIdeal;
  printf("O IMC eh: %f\n", imc);
  if (imc > 25) {
    pesoIdeal = pow(alt, 2) * 25;
    printf("Para atingir o peso ideal, deve-se perder %fkg\n",
           (pes - pesoIdeal));
  } else {
    if (imc < 18.5) {
      pesoIdeal = pow(alt, 2) * 18.5;
      printf("Para atingir o peso ideal, deve-se ganhar %fkg\n",
             (pesoIdeal - pes));
    }
  }
}


x86 assembly (clang, -O0):
<imc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movss  -0x4(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
movss  0xe7e(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    11ca <imc+0xaa>
movss  -0x4(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movsd  0xe6e(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
subss  -0x10(%rbp),%xmm0
lea    0xe66(%rip),%rdi
call   1030 <printf@plt>
jmp    1224 <imc+0x104>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe2d(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    121f <imc+0xff>
movss  -0x4(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movsd  0xe0c(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
lea    0xe3c(%rip),%rdi
call   1030 <printf@plt>
jmp    1224 <imc+0x104>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<imc>:
sub    $0x18,%rsp
movss  %xmm1,0x8(%rsp)
cvtss2sd %xmm1,%xmm1
movsd  %xmm1,0x10(%rsp)
movss  %xmm0,0xc(%rsp)
mov    $0x2,%edi
call   1040 <pow@plt>
movsd  0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  %xmm0,0x10(%rsp)
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
movss  0x10(%rsp),%xmm2
ucomiss 0xe8c(%rip),%xmm2
jbe    11a4 <imc+0x84>
movss  0xc(%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mulsd  0xe82(%rip),%xmm0
xorps  %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm1
lea    0xe8a(%rip),%rdi
movss  0x8(%rsp),%xmm0
jmp    11da <imc+0xba>
movss  0xc(%rsp),%xmm0
movss  0xe52(%rip),%xmm1
ucomiss %xmm2,%xmm1
jbe    11e7 <imc+0xc7>
mov    $0x2,%edi
call   1040 <pow@plt>
mulsd  0xe3f(%rip),%xmm0
movss  0x8(%rsp),%xmm1
cvtsd2ss %xmm0,%xmm0
lea    0xe7c(%rip),%rdi
subss  %xmm1,%xmm0
add    $0x18,%rsp
jmp    1030 <printf@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"O IMC eh: %f\0A\00"
@.str.1 = [48 x i8] c"Para atingir o peso ideal, deve-se perder %fkg\0A\00"
@.str.2 = [48 x i8] c"Para atingir o peso ideal, deve-se ganhar %fkg\0A\00"
define void @imc(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %3
store float %1, float* %4
%7 = load float, float* %4
%8 = fpext float %7 to double
%9 = load float, float* %3
%10 = call double @pow(float %9, i32 2)
%11 = fdiv double %8, %10
%12 = fptrunc double %11 to float
store float %12, float* %5
%13 = load float, float* %5
%14 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), float %13)
%15 = load float, float* %5
%16 = fcmp ogt float %15, 2.500000e+01
br i1 %16, label %17, label %26
17: ; preds = %2
%18 = load float, float* %3
%19 = call double @pow(float %18, i32 2)
%20 = fmul double %19, 2.500000e+01
%21 = fptrunc double %20 to float
store float %21, float* %6
%22 = load float, float* %4
%23 = load float, float* %6
%24 = fsub float %22, %23
%25 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), float %24)
br label %40
26: ; preds = %2
%27 = load float, float* %5
%28 = fpext float %27 to double
%29 = fcmp olt double %28, 1.850000e+01
br i1 %29, label %30, label %39
30: ; preds = %26
%31 = load float, float* %3
%32 = call double @pow(float %31, i32 2)
%33 = fmul double %32, 1.850000e+01
%34 = fptrunc double %33 to float
store float %34, float* %6
%35 = load float, float* %6
%36 = load float, float* %4
%37 = fsub float %35, %36
%38 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0), float %37)
br label %39
39: ; preds = %30, %26
br label %40
40: ; preds = %39, %17
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"O IMC eh: %f\0A\00"
@.str.1 = [48 x i8] c"Para atingir o peso ideal, deve-se perder %fkg\0A\00"
@.str.2 = [48 x i8] c"Para atingir o peso ideal, deve-se ganhar %fkg\0A\00"
define void @imc(float %0, float %1) {
%3 = fpext float %1 to double
%4 = tail call double @pow(float %0, i32 2)
%5 = fdiv double %3, %4
%6 = fptrunc double %5 to float
%7 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), float %6)
%8 = fcmp ogt float %6, 2.500000e+01
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = tail call double @pow(float %0, i32 2)
%11 = fmul double %10, 2.500000e+01
%12 = fptrunc double %11 to float
br label %19
13: ; preds = %2
%14 = fcmp olt float %6, 1.850000e+01
br i1 %14, label %15, label %25
15: ; preds = %13
%16 = tail call double @pow(float %0, i32 2)
%17 = fmul double %16, 1.850000e+01
%18 = fptrunc double %17 to float
br label %19
19: ; preds = %9, %15
%20 = phi float [ %1, %15 ], [ %12, %9 ]
%21 = phi float [ %18, %15 ], [ %1, %9 ]
%22 = phi i8* [ getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0), %15 ], [ getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), %9 ]
%23 = fsub float %21, %20
%24 = tail call i32 @printf(i8* %22, float %23)
br label %25
25: ; preds = %19, %13
ret void
}