#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 */
scalar_t__ ERANGE;
long double HUGE_VAL;
long double HUGE_VALF;
long double HUGE_VALL;
scalar_t__ errno;
int muggle_str_lstrip_idx(char *);
long double strtold(char const *, char **);
int muggle_str_told(const char *str, long double *pval) {
  char *endptr;
  if (str == NULL || pval == NULL) {
    return 0;
  }
  errno = 0;
  *pval = strtold(str, &endptr);
  if (endptr == str) {
    return 0;
  } else if (*endptr != '\0') {
    if (muggle_str_lstrip_idx(endptr) != -1) {
      return 0;
    }
  } else if ((*pval == HUGE_VAL || *pval == HUGE_VALF || *pval == HUGE_VALL) &&
             errno == ERANGE) {
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<muggle_str_told>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1146 <muggle_str_told+0x26>
cmpq   $0x0,-0x18(%rbp)
jne    1152 <muggle_str_told+0x32>
movl   $0x0,-0x4(%rbp)
jmp    1269 <muggle_str_told+0x149>
mov    0x2e67(%rip),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <strtold@plt>
mov    -0x18(%rbp),%rax
fstpt  (%rax)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    118d <muggle_str_told+0x6d>
movl   $0x0,-0x4(%rbp)
jmp    1269 <muggle_str_told+0x149>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11c0 <muggle_str_told+0xa0>
mov    -0x20(%rbp),%rdi
call   1030 <muggle_str_lstrip_idx@plt>
cmp    $0xffffffff,%eax
je     11bb <muggle_str_told+0x9b>
movl   $0x0,-0x4(%rbp)
jmp    1269 <muggle_str_told+0x149>
jmp    125d <muggle_str_told+0x13d>
mov    -0x18(%rbp),%rax
fldt   (%rax)
mov    0x2e0b(%rip),%rax
fldt   (%rax)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jne    11e6 <muggle_str_told+0xc6>
jp     11e6 <muggle_str_told+0xc6>
jmp    1232 <muggle_str_told+0x112>
mov    -0x18(%rbp),%rax
fldt   (%rax)
mov    0x2df5(%rip),%rax
fldt   (%rax)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jne    120c <muggle_str_told+0xec>
jp     120c <muggle_str_told+0xec>
jmp    1232 <muggle_str_told+0x112>
mov    -0x18(%rbp),%rax
fldt   (%rax)
mov    0x2dd7(%rip),%rax
fldt   (%rax)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jne    1258 <muggle_str_told+0x138>
jp     1258 <muggle_str_told+0x138>
jmp    1232 <muggle_str_told+0x112>
mov    0x2d87(%rip),%rax
mov    (%rax),%rax
mov    0x2d8d(%rip),%rcx
cmp    (%rcx),%rax
jne    1258 <muggle_str_told+0x138>
movl   $0x0,-0x4(%rbp)
jmp    1269 <muggle_str_told+0x149>
jmp    125d <muggle_str_told+0x13d>
jmp    1262 <muggle_str_told+0x142>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<muggle_str_told>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %r14d,%r14d
test   %rdi,%rdi
je     11ef <muggle_str_told+0xcf>
mov    %rsi,%rbp
test   %rsi,%rsi
je     11ef <muggle_str_told+0xcf>
mov    %rdi,%rbx
mov    0x2e77(%rip),%r15
movq   $0x0,(%r15)
mov    %rsp,%rsi
call   1040 <strtold@plt>
fld    %st(0)
fstpt  0x0(%rbp)
mov    (%rsp),%rdi
cmp    %rbx,%rdi
je     117f <muggle_str_told+0x5f>
cmpb   $0x0,(%rdi)
je     1183 <muggle_str_told+0x63>
fstp   %st(0)
call   1030 <muggle_str_lstrip_idx@plt>
cmp    $0xffffffff,%eax
fldz
fldz
fldz
jne    11f5 <muggle_str_told+0xd5>
jmp    11e3 <muggle_str_told+0xc3>
fstp   %st(0)
jmp    11ef <muggle_str_told+0xcf>
mov    0x2e4e(%rip),%rax
fldt   (%rax)
fxch   %st(1)
fucomi %st(1),%st
fstp   %st(1)
mov    0x2e4f(%rip),%rax
fldt   (%rax)
mov    0x2e4e(%rip),%rax
fldt   (%rax)
fxch   %st(1)
jne    11aa <muggle_str_told+0x8a>
jnp    11c8 <muggle_str_told+0xa8>
fxch   %st(2)
fucomi %st(2),%st
fstp   %st(2)
fldz
jne    11b6 <muggle_str_told+0x96>
jnp    11c8 <muggle_str_told+0xa8>
fstp   %st(0)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
fldz
fldz
fldz
jne    11e3 <muggle_str_told+0xc3>
jp     11e3 <muggle_str_told+0xc3>
fstp   %st(2)
fstp   %st(0)
fstp   %st(0)
mov    (%r15),%rax
mov    0x2df8(%rip),%rcx
cmp    (%rcx),%rax
fldz
fldz
fldz
je     11f5 <muggle_str_told+0xd5>
fstp   %st(2)
fstp   %st(0)
fstp   %st(0)
mov    $0x1,%r14d
fldz
fldz
fldz
fstp   %st(2)
fstp   %st(0)
fstp   %st(0)
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@errno = global i64 0
@HUGE_VAL = global x86_fp80 0xK00000000000000000000
@HUGE_VALF = global x86_fp80 0xK00000000000000000000
@HUGE_VALL = global x86_fp80 0xK00000000000000000000
@ERANGE = global i64 0
define i32 @muggle_str_told(i8* %0, x86_fp80* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca x86_fp80*
%6 = alloca i8*
store i8* %0, i8** %4
store x86_fp80* %1, x86_fp80** %5
%7 = load i8*, i8** %4
%8 = icmp eq i8* %7, null
br i1 %8, label %12, label %9
9: ; preds = %2
%10 = load x86_fp80*, x86_fp80** %5
%11 = icmp eq x86_fp80* %10, null
br i1 %11, label %12, label %13
12: ; preds = %9, %2
store i32 0, i32* %3
br label %55
13: ; preds = %9
store i64 0, i64* @errno
%14 = load i8*, i8** %4
%15 = call x86_fp80 @strtold(i8* %14, i8** %6)
%16 = load x86_fp80*, x86_fp80** %5
store x86_fp80 %15, x86_fp80* %16
%17 = load i8*, i8** %6
%18 = load i8*, i8** %4
%19 = icmp eq i8* %17, %18
br i1 %19, label %20, label %21
20: ; preds = %13
store i32 0, i32* %3
br label %55
21: ; preds = %13
%22 = load i8*, i8** %6
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %32
26: ; preds = %21
%27 = load i8*, i8** %6
%28 = call i32 @muggle_str_lstrip_idx(i8* %27)
%29 = icmp ne i32 %28, -1
br i1 %29, label %30, label %31
30: ; preds = %26
store i32 0, i32* %3
br label %55
31: ; preds = %26
br label %53
32: ; preds = %21
%33 = load x86_fp80*, x86_fp80** %5
%34 = load x86_fp80, x86_fp80* %33
%35 = load x86_fp80, x86_fp80* @HUGE_VAL
%36 = fcmp oeq x86_fp80 %34, %35
br i1 %36, label %47, label %37
37: ; preds = %32
%38 = load x86_fp80*, x86_fp80** %5
%39 = load x86_fp80, x86_fp80* %38
%40 = load x86_fp80, x86_fp80* @HUGE_VALF
%41 = fcmp oeq x86_fp80 %39, %40
br i1 %41, label %47, label %42
42: ; preds = %37
%43 = load x86_fp80*, x86_fp80** %5
%44 = load x86_fp80, x86_fp80* %43
%45 = load x86_fp80, x86_fp80* @HUGE_VALL
%46 = fcmp oeq x86_fp80 %44, %45
br i1 %46, label %47, label %52
47: ; preds = %42, %37, %32
%48 = load i64, i64* @errno
%49 = load i64, i64* @ERANGE
%50 = icmp eq i64 %48, %49
br i1 %50, label %51, label %52
51: ; preds = %47
store i32 0, i32* %3
br label %55
52: ; preds = %47, %42
br label %53
53: ; preds = %52, %31
br label %54
54: ; preds = %53
store i32 1, i32* %3
br label %55
55: ; preds = %54, %51, %30, %20, %12
%56 = load i32, i32* %3
ret i32 %56
}

LLVM IR (-O2):
@errno = global i64 0
@HUGE_VAL = global x86_fp80 0xK00000000000000000000
@HUGE_VALF = global x86_fp80 0xK00000000000000000000
@HUGE_VALL = global x86_fp80 0xK00000000000000000000
@ERANGE = global i64 0
define i32 @muggle_str_told(i8* %0, x86_fp80* writeonly %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = icmp eq i8* %0, null
%6 = icmp eq x86_fp80* %1, null
%7 = or i1 %5, %6
br i1 %7, label %32, label %8
8: ; preds = %2
store i64 0, i64* @errno
%9 = call x86_fp80 @strtold(i8* %0, i8** %3)
store x86_fp80 %9, x86_fp80* %1
%10 = load i8*, i8** %3
%11 = icmp eq i8* %10, %0
br i1 %11, label %32, label %12
12: ; preds = %8
%13 = load i8, i8* %10
%14 = icmp eq i8 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = tail call i32 @muggle_str_lstrip_idx(i8* %10)
%17 = icmp eq i32 %16, -1
br i1 %17, label %31, label %32
18: ; preds = %12
%19 = load x86_fp80, x86_fp80* @HUGE_VAL
%20 = fcmp oeq x86_fp80 %9, %19
%21 = load x86_fp80, x86_fp80* @HUGE_VALF
%22 = fcmp oeq x86_fp80 %9, %21
%23 = select i1 %20, i1 true, i1 %22
%24 = load x86_fp80, x86_fp80* @HUGE_VALL
%25 = fcmp oeq x86_fp80 %9, %24
%26 = select i1 %23, i1 true, i1 %25
br i1 %26, label %27, label %31
27: ; preds = %18
%28 = load i64, i64* @errno
%29 = load i64, i64* @ERANGE
%30 = icmp eq i64 %28, %29
br i1 %30, label %32, label %31
31: ; preds = %18, %15, %27
br label %32
32: ; preds = %27, %15, %8, %2, %31
%33 = phi i32 [ 1, %31 ], [ 0, %2 ], [ 0, %8 ], [ 0, %15 ], [ 0, %27 ]
ret i32 %33
}