#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 main() {
  float peso, altura, caloria, idade;
  char sexo;
  printf("homem ou mulher? ");
  scanf("%c ", &sexo);
  printf("qual seu peso? ");
  scanf("%f", &peso);
  printf(" qual sua idade?");
  scanf("%f", &idade);
  printf("qual sua altura? ");
  scanf("%f", &altura);
  if (sexo == 'h') {
    caloria = 66.47 + (13.7 * peso) + (5 * altura) - (6.8 * idade);
    printf("sua taxa metabólica basal é calorias=%0.2f", caloria);
  } else {
    caloria = 655.1 + (9.6 * peso) + (1.8 * altura) - (4.7 * idade);
    printf("sua taxa metabólica basal é calorias=%0.2f", caloria);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xf06(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf0a(%rip),%rdi
lea    -0x15(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xefc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xefe(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xeef(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xee0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebe(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsbl -0x15(%rbp),%eax
cmp    $0x68,%eax
jne    1230 <main+0x110>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe5b(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe57(%rip),%xmm0
addsd  %xmm0,%xmm1
movss  0xe53(%rip),%xmm0
mulss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  %xmm0,%xmm1
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe1d(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe64(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    12a3 <main+0x183>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdcf(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdcb(%rip),%xmm1
addsd  %xmm1,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xda6(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd85(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdec(%rip),%rdi
mov    $0x1,%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    0xf10(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf14(%rip),%rdi
lea    0x3(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xf05(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf07(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xef4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xee8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpb   $0x68,0x3(%rsp)
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
jne    11ef <main+0xcf>
mulsd  0xe63(%rip),%xmm0
addsd  0xe63(%rip),%xmm0
movss  0x8(%rsp),%xmm1
mulss  0xe65(%rip),%xmm1
cvtss2sd %xmm1,%xmm1
addsd  %xmm0,%xmm1
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe43(%rip),%xmm0
jmp    1227 <main+0x107>
mulsd  0xe09(%rip),%xmm0
addsd  0xe09(%rip),%xmm0
movss  0x8(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  0xdff(%rip),%xmm1
addsd  %xmm0,%xmm1
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xdf1(%rip),%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe4e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"homem ou mulher? \00"
@.str.1 = [4 x i8] c"%c \00"
@.str.2 = [16 x i8] c"qual seu peso? \00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [17 x i8] c" qual sua idade?\00"
@.str.5 = [18 x i8] c"qual sua altura? \00"
@.str.6 = [45 x i8] c"sua taxa metab\C3\B3lica basal \C3\A9 calorias=%0.2f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca i8
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %2)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %5)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %3)
%15 = load i8, i8* %6
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 104
br i1 %17, label %18, label %33
18: ; preds = %0
%19 = load float, float* %2
%20 = fpext float %19 to double
%21 = call double @llvm.fmuladd.f64(double 1.370000e+01, double %20, double 6.647000e+01)
%22 = load float, float* %3
%23 = fmul float 5.000000e+00, %22
%24 = fpext float %23 to double
%25 = fadd double %21, %24
%26 = load float, float* %5
%27 = fpext float %26 to double
%28 = call double @llvm.fmuladd.f64(double -6.800000e+00, double %27, double %25)
%29 = fptrunc double %28 to float
store float %29, float* %4
%30 = load float, float* %4
%31 = fpext float %30 to double
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, i64 0, i64 0), double %31)
br label %47
33: ; preds = %0
%34 = load float, float* %2
%35 = fpext float %34 to double
%36 = call double @llvm.fmuladd.f64(double 0x4023333333333333, double %35, double 6.551000e+02)
%37 = load float, float* %3
%38 = fpext float %37 to double
%39 = call double @llvm.fmuladd.f64(double 1.800000e+00, double %38, double %36)
%40 = load float, float* %5
%41 = fpext float %40 to double
%42 = call double @llvm.fmuladd.f64(double -4.700000e+00, double %41, double %39)
%43 = fptrunc double %42 to float
store float %43, float* %4
%44 = load float, float* %4
%45 = fpext float %44 to double
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, i64 0, i64 0), double %45)
br label %47
47: ; preds = %33, %18
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"homem ou mulher? \00"
@.str.1 = [4 x i8] c"%c \00"
@.str.2 = [16 x i8] c"qual seu peso? \00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [17 x i8] c" qual sua idade?\00"
@.str.5 = [18 x i8] c"qual sua altura? \00"
@.str.6 = [45 x i8] c"sua taxa metab\C3\B3lica basal \C3\A9 calorias=%0.2f\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca i8
%5 = bitcast float* %1 to i8*
%6 = bitcast float* %2 to i8*
%7 = bitcast float* %3 to i8*
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %1)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %3)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %2)
%16 = load i8, i8* %4
%17 = icmp eq i8 %16, 104
%18 = load float, float* %1
%19 = fpext float %18 to double
br i1 %17, label %20, label %29
20: ; preds = %0
%21 = call double @llvm.fmuladd.f64(double %19, double 1.370000e+01, double 6.647000e+01)
%22 = load float, float* %2
%23 = fmul float %22, 5.000000e+00
%24 = fpext float %23 to double
%25 = fadd double %21, %24
%26 = load float, float* %3
%27 = fpext float %26 to double
%28 = call double @llvm.fmuladd.f64(double %27, double -6.800000e+00, double %25)
br label %37
29: ; preds = %0
%30 = call double @llvm.fmuladd.f64(double %19, double 0x4023333333333333, double 6.551000e+02)
%31 = load float, float* %2
%32 = fpext float %31 to double
%33 = call double @llvm.fmuladd.f64(double %32, double 1.800000e+00, double %30)
%34 = load float, float* %3
%35 = fpext float %34 to double
%36 = call double @llvm.fmuladd.f64(double %35, double -4.700000e+00, double %33)
br label %37
37: ; preds = %29, %20
%38 = phi double [ %36, %29 ], [ %28, %20 ]
%39 = fptrunc double %38 to float
%40 = fpext float %39 to double
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, i64 0, i64 0), double %40)
ret i32 0
}