#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 FLT_MAX;
double FLT_MIN;
double strtod(char *, int /*<<< orphan*/ *);
int is_float(char *tbd) {
  double d = FLT_MAX;
  d = strtod(tbd, NULL);
  return ((d > 0 && (d > FLT_MAX || d < FLT_MIN)) ||
          (d < 0 && (d < -FLT_MAX || d > -FLT_MIN)));
}


x86 assembly (clang, -O0):
<is_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <strtod@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    118a <is_float+0x7a>
movsd  -0x10(%rbp),%xmm0
mov    $0x1,%al
mov    0x2e82(%rip),%rcx
ucomisd (%rcx),%xmm0
mov    %al,-0x11(%rbp)
ja     1210 <is_float+0x100>
movsd  -0x10(%rbp),%xmm1
mov    0x2e71(%rip),%rax
movsd  (%rax),%xmm0
mov    $0x1,%al
ucomisd %xmm1,%xmm0
mov    %al,-0x11(%rbp)
ja     1210 <is_float+0x100>
xor    %eax,%eax
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
mov    %al,-0x12(%rbp)
jbe    120a <is_float+0xfa>
movsd  -0x10(%rbp),%xmm1
mov    0x2e37(%rip),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    $0x1,%al
ucomisd %xmm1,%xmm0
mov    %al,-0x13(%rbp)
ja     1204 <is_float+0xf4>
movsd  -0x10(%rbp),%xmm0
mov    0x2e09(%rip),%rax
movsd  (%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
ucomisd %xmm1,%xmm0
seta   %al
mov    %al,-0x13(%rbp)
mov    -0x13(%rbp),%al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_float>:
push   %rax
xor    %esi,%esi
call   1030 <strtod@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1145 <is_float+0x35>
mov    0x2eb7(%rip),%rax
ucomisd (%rax),%xmm0
mov    $0x1,%eax
ja     1189 <is_float+0x79>
mov    0x2ead(%rip),%rcx
movsd  (%rcx),%xmm2
ucomisd %xmm0,%xmm2
ja     1189 <is_float+0x79>
ucomisd %xmm0,%xmm1
mov    $0x0,%eax
jbe    1189 <is_float+0x79>
mov    0x2e89(%rip),%rax
movsd  (%rax),%xmm1
movapd 0xe9d(%rip),%xmm2
xorpd  %xmm2,%xmm1
ucomisd %xmm0,%xmm1
seta   %al
mov    0x2e73(%rip),%rcx
movsd  (%rcx),%xmm1
xorpd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
seta   %cl
or     %al,%cl
movzbl %cl,%eax
pop    %rcx
ret

LLVM IR (-O0):
@FLT_MAX = global double 0.000000e+00
@FLT_MIN = global double 0.000000e+00
define i32 @is_float(i8* %0) {
%2 = alloca i8*
%3 = alloca double
store i8* %0, i8** %2
%4 = load double, double* @FLT_MAX
store double %4, double* %3
%5 = load i8*, i8** %2
%6 = call double @strtod(i8* %5, i32* null)
store double %6, double* %3
%7 = load double, double* %3
%8 = fcmp ogt double %7, 0.000000e+00
br i1 %8, label %9, label %17
9: ; preds = %1
%10 = load double, double* %3
%11 = load double, double* @FLT_MAX
%12 = fcmp ogt double %10, %11
br i1 %12, label %34, label %13
13: ; preds = %9
%14 = load double, double* %3
%15 = load double, double* @FLT_MIN
%16 = fcmp olt double %14, %15
br i1 %16, label %34, label %17
17: ; preds = %13, %1
%18 = load double, double* %3
%19 = fcmp olt double %18, 0.000000e+00
br i1 %19, label %20, label %32
20: ; preds = %17
%21 = load double, double* %3
%22 = load double, double* @FLT_MAX
%23 = fneg double %22
%24 = fcmp olt double %21, %23
br i1 %24, label %30, label %25
25: ; preds = %20
%26 = load double, double* %3
%27 = load double, double* @FLT_MIN
%28 = fneg double %27
%29 = fcmp ogt double %26, %28
br label %30
30: ; preds = %25, %20
%31 = phi i1 [ true, %20 ], [ %29, %25 ]
br label %32
32: ; preds = %30, %17
%33 = phi i1 [ false, %17 ], [ %31, %30 ]
br label %34
34: ; preds = %32, %13, %9
%35 = phi i1 [ true, %13 ], [ true, %9 ], [ %33, %32 ]
%36 = zext i1 %35 to i32
ret i32 %36
}

LLVM IR (-O2):
@FLT_MAX = global double 0.000000e+00
@FLT_MIN = global double 0.000000e+00
define i32 @is_float(i8* nocapture %0) {
%2 = tail call double @strtod(i8* nocapture %0, i32* null)
%3 = fcmp ogt double %2, 0.000000e+00
br i1 %3, label %4, label %10
4: ; preds = %1
%5 = load double, double* @FLT_MAX
%6 = fcmp ogt double %2, %5
%7 = load double, double* @FLT_MIN
%8 = fcmp olt double %2, %7
%9 = select i1 %6, i1 true, i1 %8
br i1 %9, label %21, label %10
10: ; preds = %4, %1
%11 = fcmp olt double %2, 0.000000e+00
br i1 %11, label %12, label %21
12: ; preds = %10
%13 = load double, double* @FLT_MAX
%14 = fneg double %13
%15 = fcmp olt double %2, %14
%16 = load double, double* @FLT_MIN
%17 = fneg double %16
%18 = fcmp ogt double %2, %17
%19 = select i1 %15, i1 true, i1 %18
%20 = zext i1 %19 to i32
br label %21
21: ; preds = %10, %12, %4
%22 = phi i32 [ 1, %4 ], [ 0, %10 ], [ %20, %12 ]
ret i32 %22
}