#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 *, ...);
void ideal_weight() {
  int sexo;
  float peso, altura;
  printf("Informe a altura: ");
  scanf("%f", &altura);
  printf("1 -- Homem\n2 -- Mulher\n");
  printf("Informe o sexo: ");
  scanf("%d", &sexo);
  if (sexo == 1) {
    peso = ((72.7 * altura) - 58);
  }
  if (sexo == 2) {
    peso = ((62.1 * altura) - 44.7);
  }
  printf("%.2f\n", peso);
}


x86 assembly (clang, -O0):
<ideal_weight>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xef1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef6(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xee7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef4(%rip),%rdi
lea    -0x4(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x1,-0x4(%rbp)
jne    11aa <ideal_weight+0x8a>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe6f(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe6b(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
cmpl   $0x2,-0x4(%rbp)
jne    11de <ideal_weight+0xbe>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe4b(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe47(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe74(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ideal_weight>:
push   %rax
lea    0xee8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeed(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xef9(%rip),%rdi
call   1030 <puts@plt>
lea    0xed3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed6(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x2,%eax
je     11a6 <ideal_weight+0x76>
cmp    $0x1,%eax
jne    11c3 <ideal_weight+0x93>
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe74(%rip),%xmm0
addsd  0xe74(%rip),%xmm0
jmp    11bf <ideal_weight+0x8f>
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe49(%rip),%xmm0
addsd  0xe49(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe7c(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Informe a altura: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [24 x i8] c"1 -- Homem\0A2 -- Mulher\0A\00"
@.str.3 = [17 x i8] c"Informe o sexo: \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [6 x i8] c"%.2f\0A\00"
define void @ideal_weight() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%9 = load i32, i32* %1
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %16
11: ; preds = %0
%12 = load float, float* %3
%13 = fpext float %12 to double
%14 = call double @llvm.fmuladd.f64(double 7.270000e+01, double %13, double -5.800000e+01)
%15 = fptrunc double %14 to float
store float %15, float* %2
br label %16
16: ; preds = %11, %0
%17 = load i32, i32* %1
%18 = icmp eq i32 %17, 2
br i1 %18, label %19, label %24
19: ; preds = %16
%20 = load float, float* %3
%21 = fpext float %20 to double
%22 = call double @llvm.fmuladd.f64(double 6.210000e+01, double %21, double -4.470000e+01)
%23 = fptrunc double %22 to float
store float %23, float* %2
br label %24
24: ; preds = %19, %16
%25 = load float, float* %2
%26 = fpext float %25 to double
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), double %26)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"Informe a altura: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.3 = [17 x i8] c"Informe o sexo: \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [6 x i8] c"%.2f\0A\00"
@str = [23 x i8] c"1 -- Homem\0A2 -- Mulher\00"
define void @ideal_weight() {
%1 = alloca i32
%2 = alloca float
%3 = bitcast i32* %1 to i8*
%4 = bitcast float* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %1
switch i32 %10, label %21 [
i32 1, label %11
i32 2, label %16
]
11: ; preds = %0
%12 = load float, float* %2
%13 = fpext float %12 to double
%14 = call double @llvm.fmuladd.f64(double %13, double 7.270000e+01, double -5.800000e+01)
%15 = fptrunc double %14 to float
br label %21
16: ; preds = %0
%17 = load float, float* %2
%18 = fpext float %17 to double
%19 = call double @llvm.fmuladd.f64(double %18, double 6.210000e+01, double -4.470000e+01)
%20 = fptrunc double %19 to float
br label %21
21: ; preds = %0, %11, %16
%22 = phi float [ %20, %16 ], [ %15, %11 ], [ undef, %0 ]
%23 = fpext float %22 to double
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), double %23)
ret void
}