#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 */
double atof(char const *);
double nmeap_altitude(const char *palt, const char *punits) {
  double alt;
  if (*palt == 0) {
    return 0.0;
  }
  alt = atof(palt);
  if (*punits == 'M') {
  } else if (*punits == 'F') {
    alt = alt * 3.2808399;
  }
  return alt;
}


x86 assembly (clang, -O0):
<nmeap_altitude>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    113d <nmeap_altitude+0x2d>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1191 <nmeap_altitude+0x81>
mov    -0x10(%rbp),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x4d,%eax
jne    1160 <nmeap_altitude+0x50>
jmp    1187 <nmeap_altitude+0x77>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x46,%eax
jne    1182 <nmeap_altitude+0x72>
movsd  0xe88(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1187 <nmeap_altitude+0x77>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nmeap_altitude>:
push   %rbx
cmpb   $0x0,(%rdi)
je     112d <nmeap_altitude+0x1d>
mov    %rsi,%rbx
call   1030 <atof@plt>
cmpb   $0x46,(%rbx)
jne    112b <nmeap_altitude+0x1b>
mulsd  0xed5(%rip),%xmm0
pop    %rbx
ret
xorps  %xmm0,%xmm0
pop    %rbx
ret

LLVM IR (-O0):
define double @nmeap_altitude(i8* %0, i8* %1) {
%3 = alloca double
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca double
store i8* %0, i8** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %4
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %2
store double 0.000000e+00, double* %3
br label %31
12: ; preds = %2
%13 = load i8*, i8** %4
%14 = call double @atof(i8* %13)
store double %14, double* %6
%15 = load i8*, i8** %5
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 77
br i1 %18, label %19, label %20
19: ; preds = %12
br label %29
20: ; preds = %12
%21 = load i8*, i8** %5
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 70
br i1 %24, label %25, label %28
25: ; preds = %20
%26 = load double, double* %6
%27 = fmul double %26, 0x400A3F28FD4F4B98
store double %27, double* %6
br label %28
28: ; preds = %25, %20
br label %29
29: ; preds = %28, %19
%30 = load double, double* %6
store double %30, double* %3
br label %31
31: ; preds = %29, %11
%32 = load double, double* %3
ret double %32
}

LLVM IR (-O2):
define double @nmeap_altitude(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %11, label %5
5: ; preds = %2
%6 = tail call double @atof(i8* %0)
%7 = load i8, i8* %1
%8 = icmp eq i8 %7, 70
%9 = fmul double %6, 0x400A3F28FD4F4B98
%10 = select i1 %8, double %9, double %6
br label %11
11: ; preds = %5, %2
%12 = phi double [ 0.000000e+00, %2 ], [ %10, %5 ]
ret double %12
}