#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 */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
float strtof(char const *, char **);
bool token_is_number(float *x, const char *t) {
  char *endptr;
  *x = strtof(t, &endptr);
  if (endptr == t)
    return false;
  if (*endptr != '\0')
    fprintf(stderr,
            "TOKEN "
            "WARNING: trailing characters (\"%s\") "
            "ignored "
            "in numeric constant\n",
            endptr);
  return true;
}


x86 assembly (clang, -O0):
<token_is_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <strtof@plt>
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    115f <token_is_number+0x3f>
movl   $0x0,-0x4(%rbp)
jmp    118f <token_is_number+0x6f>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1188 <token_is_number+0x68>
mov    0x2e6a(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xe7d(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<token_is_number>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1030 <strtof@plt>
movss  %xmm0,(%r14)
mov    (%rsp),%rdx
cmp    %rbx,%rdx
je     1164 <token_is_number+0x44>
mov    $0x1,%ebx
cmpb   $0x0,(%rdx)
je     1166 <token_is_number+0x46>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
lea    0xea3(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1166 <token_is_number+0x46>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [71 x i8] c"TOKEN WARNING: trailing characters (\22%s\22) ignored in numeric constant\0A\00"
define i32 @token_is_number(float* %0, i8* %1) {
%3 = alloca i32
%4 = alloca float*
%5 = alloca i8*
%6 = alloca i8*
store float* %0, float** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %5
%8 = call float @strtof(i8* %7, i8** %6)
%9 = load float*, float** %4
store float %8, float* %9
%10 = load i8*, i8** %6
%11 = load i8*, i8** %5
%12 = icmp eq i8* %10, %11
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 0, i32* %3
br label %24
14: ; preds = %2
%15 = load i8*, i8** %6
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %14
%20 = load i32, i32* @stderr
%21 = load i8*, i8** %6
%22 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0), i8* %21)
br label %23
23: ; preds = %19, %14
store i32 1, i32* %3
br label %24
24: ; preds = %23, %13
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [71 x i8] c"TOKEN WARNING: trailing characters (\22%s\22) ignored in numeric constant\0A\00"
define i32 @token_is_number(float* nocapture writeonly %0, i8* %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = call float @strtof(i8* %1, i8** %3)
store float %5, float* %0
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, %1
br i1 %7, label %14, label %8
8: ; preds = %2
%9 = load i8, i8* %6
%10 = icmp eq i8 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %8
%12 = load i32, i32* @stderr
%13 = tail call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %14
14: ; preds = %8, %11, %2
%15 = phi i32 [ 0, %2 ], [ 1, %11 ], [ 1, %8 ]
ret i32 %15
}