#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*/ NPisnumber(char);
int /*<<< orphan*/ isdigit(char);
int strlen(char *);
int isnumword(char *str) {
  int i, len, numpt;
  char c;
  len = strlen(str);
  numpt = 0;
  for (i = 0; i < len; i++) {
    c = str[i];
    if ((c == '.') && (numpt == 0)) {
      ++numpt;
      continue;
    }
    if (!NPisnumber(c))
      return 0;
    if (!isdigit(c) && (i > 0))
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<isnumword>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11ee <isnumword+0xbe>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x1d(%rbp)
movsbl -0x1d(%rbp),%eax
cmp    $0x2e,%eax
jne    1195 <isnumword+0x65>
cmpl   $0x0,-0x1c(%rbp)
jne    1195 <isnumword+0x65>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11e0 <isnumword+0xb0>
movsbl -0x1d(%rbp),%edi
call   1030 <NPisnumber@plt>
cmp    $0x0,%eax
jne    11b3 <isnumword+0x83>
movl   $0x0,-0x4(%rbp)
jmp    11f5 <isnumword+0xc5>
movsbl -0x1d(%rbp),%edi
call   1040 <isdigit@plt>
cmp    $0x0,%eax
jne    11db <isnumword+0xab>
cmpl   $0x0,-0x14(%rbp)
jle    11db <isnumword+0xab>
movl   $0x0,-0x4(%rbp)
jmp    11f5 <isnumword+0xc5>
jmp    11e0 <isnumword+0xb0>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1156 <isnumword+0x26>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isnumword>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
call   1050 <strlen@plt>
test   %eax,%eax
jle    11a6 <isnumword+0x76>
mov    %eax,%r15d
xor    %ebp,%ebp
xor    %r13d,%r13d
xor    %r12d,%r12d
jmp    116f <isnumword+0x3f>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r13d,%eax
add    $0x1,%rbp
mov    %eax,%r13d
cmp    %rbp,%r15
je     11a6 <isnumword+0x76>
movzbl (%r14,%rbp,1),%ecx
cmp    $0x2e,%cl
jne    1183 <isnumword+0x53>
mov    $0x1,%eax
test   %r13d,%r13d
je     1163 <isnumword+0x33>
movsbl %cl,%ebx
mov    %ebx,%edi
call   1030 <NPisnumber@plt>
test   %eax,%eax
je     11ac <isnumword+0x7c>
mov    %ebx,%edi
call   1040 <isdigit@plt>
test   %eax,%eax
jne    1160 <isnumword+0x30>
mov    %r13d,%eax
test   %rbp,%rbp
je     1163 <isnumword+0x33>
jmp    11ac <isnumword+0x7c>
mov    $0x1,%r12d
mov    %r12d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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