#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 */
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
int main() {
  char sexo;
  float h;
  printf("Digite o sexo - (F) Feminino / (M) Masculino: ");
  sexo = getchar();
  printf("Digite a altura: ");
  scanf("%f", &h);
  switch (sexo) {
  case 'F':
    printf("Peso ideal: %.2f \n", (62.1 * h) - 44.7);
    break;
  case 'M':
    printf("Peso ideal: %.2f \n", (72.7 * h) - 58);
    break;
  default:
    printf("Sexo inválido! \n");
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x11(%rbp)
call   1030 <printf@plt>
mov    -0x11(%rbp),%al
call   1040 <getchar@plt>
mov    %al,%cl
mov    -0x11(%rbp),%al
mov    %cl,-0x5(%rbp)
lea    0xee8(%rip),%rdi
call   1030 <printf@plt>
lea    0xeee(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
movsbl -0x5(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x46,%eax
je     11a2 <main+0x72>
jmp    1191 <main+0x61>
mov    -0x10(%rbp),%eax
sub    $0x4d,%eax
je     11d6 <main+0xa6>
jmp    120a <main+0xda>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe5d(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe59(%rip),%xmm1
addsd  %xmm1,%xmm0
lea    0xe9a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1218 <main+0xe8>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe19(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe15(%rip),%xmm1
addsd  %xmm1,%xmm0
lea    0xe66(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1218 <main+0xe8>
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebx
lea    0xeec(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xef0(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
movsbl %bl,%eax
cmp    $0x4d,%eax
je     11a4 <main+0x64>
cmp    $0x46,%eax
jne    11ce <main+0x8e>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe76(%rip),%xmm0
addsd  0xe76(%rip),%xmm0
jmp    11be <main+0x7e>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe4a(%rip),%xmm0
addsd  0xe4a(%rip),%xmm0
lea    0xe9f(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    11da <main+0x9a>
lea    0xea2(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"Digite o sexo - (F) Feminino / (M) Masculino: \00"
@.str.1 = [18 x i8] c"Digite a altura: \00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [19 x i8] c"Peso ideal: %.2f \0A\00"
@.str.4 = [18 x i8] c"Sexo inv\C3\A1lido! \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca float
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%5 = call signext i8 (...) @getchar()
store i8 %5, i8* %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %3)
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
switch i32 %9, label %20 [
i32 70, label %10
i32 77, label %15
]
10: ; preds = %0
%11 = load float, float* %3
%12 = fpext float %11 to double
%13 = call double @llvm.fmuladd.f64(double 6.210000e+01, double %12, double -4.470000e+01)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), double %13)
br label %22
15: ; preds = %0
%16 = load float, float* %3
%17 = fpext float %16 to double
%18 = call double @llvm.fmuladd.f64(double 7.270000e+01, double %17, double -5.800000e+01)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), double %18)
br label %22
20: ; preds = %0
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
br label %22
22: ; preds = %20, %15, %10
ret i32 0
}

LLVM IR (-O2):
@.str = [47 x i8] c"Digite o sexo - (F) Feminino / (M) Masculino: \00"
@.str.1 = [18 x i8] c"Digite a altura: \00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [19 x i8] c"Peso ideal: %.2f \0A\00"
@str = [17 x i8] c"Sexo inv\C3\A1lido! \00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%4 = tail call signext i8 (...) @getchar()
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %1)
%7 = sext i8 %4 to i32
switch i32 %7, label %18 [
i32 70, label %8
i32 77, label %13
]
8: ; preds = %0
%9 = load float, float* %1
%10 = fpext float %9 to double
%11 = call double @llvm.fmuladd.f64(double %10, double 6.210000e+01, double -4.470000e+01)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), double %11)
br label %20
13: ; preds = %0
%14 = load float, float* %1
%15 = fpext float %14 to double
%16 = call double @llvm.fmuladd.f64(double %15, double 7.270000e+01, double -5.800000e+01)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), double %16)
br label %20
18: ; preds = %0
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
br label %20
20: ; preds = %18, %13, %8
ret i32 0
}