#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 */
typedef int /*<<< orphan*/ array;

/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char const *);
int strlen(char const *);
int isNumber(const char *pstr) {
  int isnum = 1;
  char array[16];
  int i;
  size_t len;
  if (pstr == NULL) {
    return 0;
  }
  len = strlen(pstr);
  if (strlen(pstr) >= sizeof(array)) {
    return 0;
  }
  (void)strcpy(array, pstr);
  for (i = 0; array[i] != '\0'; i++) {
    if (('9' < array[i]) || ('0' > array[i])) {
      isnum = 0;
      break;
    }
  }
  return isnum;
}


x86 assembly (clang, -O0):
<isNumber>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114a <isNumber+0x2a>
movl   $0x0,-0x4(%rbp)
jmp    11f1 <isNumber+0xd1>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
cltq
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
cltq
cmp    $0x10,%rax
jb     117a <isNumber+0x5a>
movl   $0x0,-0x4(%rbp)
jmp    11f1 <isNumber+0xd1>
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
movl   $0x0,-0x34(%rbp)
movslq -0x34(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     11eb <isNumber+0xcb>
movslq -0x34(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%ecx
mov    $0x39,%eax
cmp    %ecx,%eax
jl     11cc <isNumber+0xac>
movslq -0x34(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%ecx
mov    $0x30,%eax
cmp    %ecx,%eax
jle    11d8 <isNumber+0xb8>
movl   $0x0,-0x14(%rbp)
jmp    11eb <isNumber+0xcb>
jmp    11dd <isNumber+0xbd>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    118e <isNumber+0x6e>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isNumber>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
xor    %ebp,%ebp
test   %rdi,%rdi
je     1176 <isNumber+0x56>
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0xf,%eax
ja     1176 <isNumber+0x56>
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    (%rsp),%al
test   %al,%al
je     1171 <isNumber+0x51>
lea    0x1(%rsp),%rcx
nopl   0x0(%rax)
add    $0xc6,%al
cmp    $0xf5,%al
jbe    1176 <isNumber+0x56>
movzbl (%rcx),%eax
add    $0x1,%rcx
test   %al,%al
jne    1160 <isNumber+0x40>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @isNumber(i8* %0) {
%2 = alloca [16 x i8]
%3 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%4 = icmp eq i8* %0, null
br i1 %4, label %23, label %5
5: ; preds = %1
%6 = tail call i32 @strlen(i8* %0)
%7 = tail call i32 @strlen(i8* %0)
%8 = icmp ugt i32 %7, 15
br i1 %8, label %23, label %9
9: ; preds = %5
%10 = call i32 @strcpy(i8* %3, i8* %0)
%11 = load i8, i8* %3
%12 = icmp eq i8 %11, 0
br i1 %12, label %23, label %17
13: ; preds = %17
%14 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 %22
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %23, label %17
17: ; preds = %9, %13
%18 = phi i64 [ %22, %13 ], [ 0, %9 ]
%19 = phi i8 [ %15, %13 ], [ %11, %9 ]
%20 = add i8 %19, -58
%21 = icmp ult i8 %20, -10
%22 = add nuw i64 %18, 1
br i1 %21, label %23, label %13
23: ; preds = %17, %13, %9, %5, %1
%24 = phi i32 [ 0, %1 ], [ 0, %5 ], [ 1, %9 ], [ 0, %17 ], [ 1, %13 ]
ret i32 %24
}