#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 */
long double NAN;
long double *fpc_get_var(char);
long double strtold(char *, char **);
long double parse_num(char **pstr) {
  char *p = *pstr;
  long double val = strtold(*pstr, pstr);
  if (*pstr != p)
    return val;
  (*pstr)++;
  long double *var = fpc_get_var(*p);
  return var ? *var : NAN;
}


x86 assembly (clang, -O0):
<parse_num>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rsi
mov    (%rsi),%rdi
call   1040 <strtold@plt>
fstpt  -0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
cmp    -0x20(%rbp),%rax
je     1162 <parse_num+0x42>
fldt   -0x30(%rbp)
fstpt  -0x10(%rbp)
jmp    11ab <parse_num+0x8b>
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
movsbl (%rax),%edi
call   1030 <fpc_get_var@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     1199 <parse_num+0x79>
mov    -0x38(%rbp),%rax
fldt   (%rax)
fstpt  -0x44(%rbp)
jmp    11a5 <parse_num+0x85>
mov    0x2e58(%rip),%rax
fldt   (%rax)
fstpt  -0x44(%rbp)
fldt   -0x44(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_num>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <strtold@plt>
cmp    %r14,(%rbx)
jne    115a <parse_num+0x3a>
fstp   %st(0)
lea    0x1(%r14),%rax
mov    %rax,(%rbx)
movsbl (%r14),%edi
call   1030 <fpc_get_var@plt>
test   %rax,%rax
jne    1158 <parse_num+0x38>
mov    0x2ea0(%rip),%rax
fldt   (%rax)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@NAN = global x86_fp80 0xK00000000000000000000
define x86_fp80 @parse_num(i8** %0) {
%2 = alloca x86_fp80
%3 = alloca i8**
%4 = alloca i8*
%5 = alloca x86_fp80
%6 = alloca x86_fp80*
store i8** %0, i8*** %3
%7 = load i8**, i8*** %3
%8 = load i8*, i8** %7
store i8* %8, i8** %4
%9 = load i8**, i8*** %3
%10 = load i8*, i8** %9
%11 = load i8**, i8*** %3
%12 = call x86_fp80 @strtold(i8* %10, i8** %11)
store x86_fp80 %12, x86_fp80* %5
%13 = load i8**, i8*** %3
%14 = load i8*, i8** %13
%15 = load i8*, i8** %4
%16 = icmp ne i8* %14, %15
br i1 %16, label %17, label %19
17: ; preds = %1
%18 = load x86_fp80, x86_fp80* %5
store x86_fp80 %18, x86_fp80* %2
br label %35
19: ; preds = %1
%20 = load i8**, i8*** %3
%21 = load i8*, i8** %20
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %20
%23 = load i8*, i8** %4
%24 = load i8, i8* %23
%25 = call x86_fp80* @fpc_get_var(i8 signext %24)
store x86_fp80* %25, x86_fp80** %6
%26 = load x86_fp80*, x86_fp80** %6
%27 = icmp ne x86_fp80* %26, null
br i1 %27, label %28, label %31
28: ; preds = %19
%29 = load x86_fp80*, x86_fp80** %6
%30 = load x86_fp80, x86_fp80* %29
br label %33
31: ; preds = %19
%32 = load x86_fp80, x86_fp80* @NAN
br label %33
33: ; preds = %31, %28
%34 = phi x86_fp80 [ %30, %28 ], [ %32, %31 ]
store x86_fp80 %34, x86_fp80* %2
br label %35
35: ; preds = %33, %17
%36 = load x86_fp80, x86_fp80* %2
ret x86_fp80 %36
}

LLVM IR (-O2):
@NAN = global x86_fp80 0xK00000000000000000000
define x86_fp80 @parse_num(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = tail call x86_fp80 @strtold(i8* %2, i8** %0)
%4 = load i8*, i8** %0
%5 = icmp eq i8* %4, %2
br i1 %5, label %6, label %13
6: ; preds = %1
%7 = getelementptr inbounds i8, i8* %2, i64 1
store i8* %7, i8** %0
%8 = load i8, i8* %2
%9 = tail call x86_fp80* @fpc_get_var(i8 signext %8)
%10 = icmp eq x86_fp80* %9, null
%11 = select i1 %10, x86_fp80* @NAN, x86_fp80* %9
%12 = load x86_fp80, x86_fp80* %11
br label %13
13: ; preds = %1, %6
%14 = phi x86_fp80 [ %12, %6 ], [ %3, %1 ]
ret x86_fp80 %14
}