double basal_metabolic_rate(int weight, int height, int age, char gender) {
  double weightInKG = weight / 2.2, heightInSM = height * 2.54;
  if (gender == 'm') {
    return (66.5 + (13.75 * weightInKG) + (5.003 * heightInSM) - (6.755 * age));
  } else {
    return (655 + (9.563 * weightInKG) + (1.850 * heightInSM) - (4.676 * age));
  }
}


x86 assembly (clang, -O0):
<basal_metabolic_rate>:
push   %rbp
mov    %rsp,%rbp
mov    %cl,%al
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %al,-0x15(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xee9(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
cvtsi2sdl -0x10(%rbp),%xmm0
movsd  0xecb(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsbl -0x15(%rbp),%eax
cmp    $0x6d,%eax
jne    119c <basal_metabolic_rate+0x9c>
movsd  -0x20(%rbp),%xmm0
movsd  0xee8(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xee4(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  0xec3(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
cvtsi2sdl -0x14(%rbp),%xmm0
movsd  0xea6(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11e8 <basal_metabolic_rate+0xe8>
movsd  -0x20(%rbp),%xmm0
movsd  0xe77(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe73(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  0xe52(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
cvtsi2sdl -0x14(%rbp),%xmm0
movsd  0xe35(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<basal_metabolic_rate>:
cvtsi2sd %edi,%xmm2
divsd  0xef4(%rip),%xmm2
cvtsi2sd %esi,%xmm1
mulsd  0xef0(%rip),%xmm1
cmp    $0x6d,%cl
jne    114a <basal_metabolic_rate+0x4a>
mulsd  0xf0b(%rip),%xmm2
addsd  0xf0b(%rip),%xmm2
mulsd  0xf0b(%rip),%xmm1
cvtsi2sd %edx,%xmm0
addsd  %xmm2,%xmm1
mulsd  0xf03(%rip),%xmm0
addsd  %xmm1,%xmm0
ret
mulsd  0xebe(%rip),%xmm2
addsd  0xebe(%rip),%xmm2
mulsd  0xebe(%rip),%xmm1
cvtsi2sd %edx,%xmm0
addsd  %xmm2,%xmm1
mulsd  0xeb6(%rip),%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @basal_metabolic_rate(i32 %0, i32 %1, i32 %2, i8 signext %3) {
%5 = alloca double
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8
%10 = alloca double
%11 = alloca double
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i8 %3, i8* %9
%12 = load i32, i32* %6
%13 = sitofp i32 %12 to double
%14 = fdiv double %13, 2.200000e+00
store double %14, double* %10
%15 = load i32, i32* %7
%16 = sitofp i32 %15 to double
%17 = fmul double %16, 2.540000e+00
store double %17, double* %11
%18 = load i8, i8* %9
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 109
br i1 %20, label %21, label %29
21: ; preds = %4
%22 = load double, double* %10
%23 = call double @llvm.fmuladd.f64(double 1.375000e+01, double %22, double 6.650000e+01)
%24 = load double, double* %11
%25 = call double @llvm.fmuladd.f64(double 5.003000e+00, double %24, double %23)
%26 = load i32, i32* %8
%27 = sitofp i32 %26 to double
%28 = call double @llvm.fmuladd.f64(double -6.755000e+00, double %27, double %25)
store double %28, double* %5
br label %37
29: ; preds = %4
%30 = load double, double* %10
%31 = call double @llvm.fmuladd.f64(double 9.563000e+00, double %30, double 6.550000e+02)
%32 = load double, double* %11
%33 = call double @llvm.fmuladd.f64(double 1.850000e+00, double %32, double %31)
%34 = load i32, i32* %8
%35 = sitofp i32 %34 to double
%36 = call double @llvm.fmuladd.f64(double -4.676000e+00, double %35, double %33)
store double %36, double* %5
br label %37
37: ; preds = %29, %21
%38 = load double, double* %5
ret double %38
}

LLVM IR (-O2):
define double @basal_metabolic_rate(i32 %0, i32 %1, i32 %2, i8 signext %3) {
%5 = sitofp i32 %0 to double
%6 = fdiv double %5, 2.200000e+00
%7 = sitofp i32 %1 to double
%8 = fmul double %7, 2.540000e+00
%9 = icmp eq i8 %3, 109
br i1 %9, label %10, label %15
10: ; preds = %4
%11 = tail call double @llvm.fmuladd.f64(double %6, double 1.375000e+01, double 6.650000e+01)
%12 = tail call double @llvm.fmuladd.f64(double %8, double 5.003000e+00, double %11)
%13 = sitofp i32 %2 to double
%14 = tail call double @llvm.fmuladd.f64(double %13, double -6.755000e+00, double %12)
br label %20
15: ; preds = %4
%16 = tail call double @llvm.fmuladd.f64(double %6, double 9.563000e+00, double 6.550000e+02)
%17 = tail call double @llvm.fmuladd.f64(double %8, double 1.850000e+00, double %16)
%18 = sitofp i32 %2 to double
%19 = tail call double @llvm.fmuladd.f64(double %18, double -4.676000e+00, double %17)
br label %20
20: ; preds = %15, %10
%21 = phi double [ %14, %10 ], [ %19, %15 ]
ret double %21
}