#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__ isdigit(char const);
int _xte_cstr_is_numeric(char const *in_string) {
  if (!in_string)
    in_string = "";
  int has_dec_pt = 0;
  if (in_string[0] == '-')
    in_string++;
  for (char const *ptr = in_string; *ptr != 0; ptr++) {
    if (isdigit(*ptr))
      continue;
    else if (*ptr == '.') {
      if (!has_dec_pt)
        has_dec_pt = 1;
      else
        return 0;
    } else
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<_xte_cstr_is_numeric>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1132 <_xte_cstr_is_numeric+0x22>
lea    0xed2(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1155 <_xte_cstr_is_numeric+0x45>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11e6 <_xte_cstr_is_numeric+0xd6>
mov    -0x20(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     1188 <_xte_cstr_is_numeric+0x78>
jmp    11d5 <_xte_cstr_is_numeric+0xc5>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    11bf <_xte_cstr_is_numeric+0xaf>
cmpl   $0x0,-0x14(%rbp)
jne    11ae <_xte_cstr_is_numeric+0x9e>
movl   $0x1,-0x14(%rbp)
jmp    11ba <_xte_cstr_is_numeric+0xaa>
movl   $0x0,-0x4(%rbp)
jmp    11ed <_xte_cstr_is_numeric+0xdd>
jmp    11cb <_xte_cstr_is_numeric+0xbb>
movl   $0x0,-0x4(%rbp)
jmp    11ed <_xte_cstr_is_numeric+0xdd>
jmp    11d0 <_xte_cstr_is_numeric+0xc0>
jmp    11d5 <_xte_cstr_is_numeric+0xc5>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    115d <_xte_cstr_is_numeric+0x4d>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_xte_cstr_is_numeric>:
push   %rbp
push   %rbx
push   %rax
test   %rdi,%rdi
lea    0xee3(%rip),%rcx
cmovne %rdi,%rcx
xor    %edx,%edx
cmpb   $0x2d,(%rcx)
sete   %dl
mov    (%rcx,%rdx,1),%al
test   %al,%al
je     116b <_xte_cstr_is_numeric+0x5b>
lea    (%rdx,%rcx,1),%rbx
add    $0x1,%rbx
xor    %ebp,%ebp
jmp    114b <_xte_cstr_is_numeric+0x3b>
nopl   0x0(%rax)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     116b <_xte_cstr_is_numeric+0x5b>
movsbl %al,%edi
call   1030 <isdigit@plt>
test   %rax,%rax
jne    1140 <_xte_cstr_is_numeric+0x30>
xor    %eax,%eax
cmpb   $0x2e,-0x1(%rbx)
jne    1170 <_xte_cstr_is_numeric+0x60>
test   %ebp,%ebp
mov    $0x1,%ebp
je     1140 <_xte_cstr_is_numeric+0x30>
jmp    1170 <_xte_cstr_is_numeric+0x60>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i32 @_xte_cstr_is_numeric(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %9, label %8
8: ; preds = %1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %3
br label %9
9: ; preds = %8, %1
store i32 0, i32* %4
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i64 0
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 45
br i1 %14, label %15, label %18
15: ; preds = %9
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %3
br label %18
18: ; preds = %15, %9
%19 = load i8*, i8** %3
store i8* %19, i8** %5
br label %20
20: ; preds = %45, %18
%21 = load i8*, i8** %5
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %48
25: ; preds = %20
%26 = load i8*, i8** %5
%27 = load i8, i8* %26
%28 = call i64 @isdigit(i8 signext %27)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %25
br label %45
31: ; preds = %25
%32 = load i8*, i8** %5
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 46
br i1 %35, label %36, label %42
36: ; preds = %31
%37 = load i32, i32* %4
%38 = icmp ne i32 %37, 0
br i1 %38, label %40, label %39
39: ; preds = %36
store i32 1, i32* %4
br label %41
40: ; preds = %36
store i32 0, i32* %2
br label %49
41: ; preds = %39
br label %43
42: ; preds = %31
store i32 0, i32* %2
br label %49
43: ; preds = %41
br label %44
44: ; preds = %43
br label %45
45: ; preds = %44, %30
%46 = load i8*, i8** %5
%47 = getelementptr inbounds i8, i8* %46, i32 1
store i8* %47, i8** %5
br label %20
48: ; preds = %20
store i32 1, i32* %2
br label %49
49: ; preds = %48, %42, %40
%50 = load i32, i32* %2
ret i32 %50
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i32 @_xte_cstr_is_numeric(i8* %0) {
%2 = icmp eq i8* %0, null
%3 = select i1 %2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %0
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 45
%6 = zext i1 %5 to i64
%7 = getelementptr i8, i8* %3, i64 %6
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 0
br i1 %9, label %26, label %10
10: ; preds = %1, %21
%11 = phi i8 [ %24, %21 ], [ %8, %1 ]
%12 = phi i8* [ %23, %21 ], [ %7, %1 ]
%13 = phi i32 [ %22, %21 ], [ 0, %1 ]
%14 = tail call i64 @isdigit(i8 signext %11)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %10
%17 = load i8, i8* %12
%18 = icmp eq i8 %17, 46
%19 = icmp eq i32 %13, 0
%20 = select i1 %18, i1 %19, i1 false
br i1 %20, label %21, label %26
21: ; preds = %16, %10
%22 = phi i32 [ %13, %10 ], [ 1, %16 ]
%23 = getelementptr inbounds i8, i8* %12, i64 1
%24 = load i8, i8* %23
%25 = icmp eq i8 %24, 0
br i1 %25, label %26, label %10
26: ; preds = %16, %21, %1
%27 = phi i32 [ 1, %1 ], [ 1, %21 ], [ 0, %16 ]
ret i32 %27
}