#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 *, ...);
int 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    -0x10(%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    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x1,-0x8(%rbp)
jne    11aa <ideal_weight+0x8a>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe6f(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe6b(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    11de <ideal_weight+0xbe>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe4b(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe47(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe74(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
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    %rcx
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 i32 @ideal_weight() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca float
%5 = call i32 (i8*, ...) @printf(i8* 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* %4)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* 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* %2)
%10 = load i32, i32* %2
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %17
12: ; preds = %0
%13 = load float, float* %4
%14 = fpext float %13 to double
%15 = call double @llvm.fmuladd.f64(double 7.270000e+01, double %14, double -5.800000e+01)
%16 = fptrunc double %15 to float
store float %16, float* %3
br label %17
17: ; preds = %12, %0
%18 = load i32, i32* %2
%19 = icmp eq i32 %18, 2
br i1 %19, label %20, label %25
20: ; preds = %17
%21 = load float, float* %4
%22 = fpext float %21 to double
%23 = call double @llvm.fmuladd.f64(double 6.210000e+01, double %22, double -4.470000e+01)
%24 = fptrunc double %23 to float
store float %24, float* %3
br label %25
25: ; preds = %20, %17
%26 = load float, float* %3
%27 = fpext float %26 to double
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), double %27)
%29 = load i32, i32* %1
ret i32 %29
}

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 i32 @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 i32 undef
}