#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 const);
scalar_t__ strcmp(char const *, char *);
int strlen(char const *);
int isNum(const char *token) {
  if (strcmp(token, "") == 0)
    return 0;
  int i = 0;
  if (token[i] == '-') {
    if (strlen(token) > 1)
      i++;
    else
      return 0;
  }
  for (; i < strlen(token); i++)
    if (!isdigit(token[i]))
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<isNum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1162 <isNum+0x32>
movl   $0x0,-0x4(%rbp)
jmp    1210 <isNum+0xe0>
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2d,%eax
jne    11af <isNum+0x7f>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x1,%eax
jle    119e <isNum+0x6e>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11aa <isNum+0x7a>
movl   $0x0,-0x4(%rbp)
jmp    1210 <isNum+0xe0>
jmp    11af <isNum+0x7f>
jmp    11b4 <isNum+0x84>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jge    1209 <isNum+0xd9>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    11f6 <isNum+0xc6>
movl   $0x0,-0x4(%rbp)
jmp    1210 <isNum+0xe0>
jmp    11fb <isNum+0xcb>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11b4 <isNum+0x84>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isNum>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
lea    0xec2(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     119f <isNum+0x6f>
xor    %ebp,%ebp
cmpb   $0x2d,(%rbx)
jne    1164 <isNum+0x34>
mov    %rbx,%rdi
call   1040 <strlen@plt>
xor    %r14d,%r14d
mov    $0x1,%ebp
cmp    $0x2,%eax
jl     11a2 <isNum+0x72>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    $0x1,%r14d
cmp    %eax,%ebp
jge    11a2 <isNum+0x72>
mov    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
movsbl (%rbx,%rbp,1),%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     119f <isNum+0x6f>
add    $0x1,%rbp
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    %ebp,%eax
jg     1180 <isNum+0x50>
jmp    11a2 <isNum+0x72>
xor    %r14d,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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