#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*/ isdigit(char);
int isnumstr(char *str) {
  if (!*str)
    return 0;
  char *p;
  for (p = str; *p; p++) {
    char c = *p;
    if (c != '.' && !isdigit(c))
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<isnumstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1135 <isnumstr+0x25>
movl   $0x0,-0x4(%rbp)
jmp    119b <isnumstr+0x8b>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1194 <isnumstr+0x84>
mov    -0x18(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
cmp    $0x2e,%eax
je     117e <isnumstr+0x6e>
movsbl -0x19(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    117e <isnumstr+0x6e>
movl   $0x0,-0x4(%rbp)
jmp    119b <isnumstr+0x8b>
jmp    1183 <isnumstr+0x73>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    113d <isnumstr+0x2d>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isnumstr>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%al
xor    %ebp,%ebp
test   %al,%al
je     1142 <isnumstr+0x32>
mov    %rdi,%rbx
jmp    1123 <isnumstr+0x13>
movzbl (%rbx),%eax
add    $0x1,%rbx
cmp    $0x2e,%al
je     1120 <isnumstr+0x10>
test   %al,%al
je     113d <isnumstr+0x2d>
movsbl %al,%edi
call   1030 <isdigit@plt>
test   %eax,%eax
jne    1120 <isnumstr+0x10>
jmp    1142 <isnumstr+0x32>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @isnumstr(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
br i1 %8, label %10, label %9
9: ; preds = %1
store i32 0, i32* %2
br label %32
10: ; preds = %1
%11 = load i8*, i8** %3
store i8* %11, i8** %4
br label %12
12: ; preds = %28, %10
%13 = load i8*, i8** %4
%14 = load i8, i8* %13
%15 = icmp ne i8 %14, 0
br i1 %15, label %16, label %31
16: ; preds = %12
%17 = load i8*, i8** %4
%18 = load i8, i8* %17
store i8 %18, i8* %5
%19 = load i8, i8* %5
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 46
br i1 %21, label %22, label %27
22: ; preds = %16
%23 = load i8, i8* %5
%24 = call i32 @isdigit(i8 signext %23)
%25 = icmp ne i32 %24, 0
br i1 %25, label %27, label %26
26: ; preds = %22
store i32 0, i32* %2
br label %32
27: ; preds = %22, %16
br label %28
28: ; preds = %27
%29 = load i8*, i8** %4
%30 = getelementptr inbounds i8, i8* %29, i32 1
store i8* %30, i8** %4
br label %12
31: ; preds = %12
store i32 1, i32* %2
br label %32
32: ; preds = %31, %26, %9
%33 = load i32, i32* %2
ret i32 %33
}

LLVM IR (-O2):
define i32 @isnumstr(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %10
%5 = phi i8 [ %12, %10 ], [ %2, %1 ]
%6 = phi i8* [ %11, %10 ], [ %0, %1 ]
switch i8 %5, label %7 [
i8 0, label %13
i8 46, label %10
]
7: ; preds = %4
%8 = tail call i32 @isdigit(i8 signext %5)
%9 = icmp eq i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %7, %4
%11 = getelementptr inbounds i8, i8* %6, i64 1
%12 = load i8, i8* %11
br label %4
13: ; preds = %7, %4, %1
%14 = phi i32 [ 0, %1 ], [ 1, %4 ], [ 0, %7 ]
ret i32 %14
}