#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 strlen(char *);
int isNumeric(char *value) {
  int i;
  for (i = 0; i < strlen(value) - 1; i++) {
    if (value[i] >= '0' && value[i] <= '9') {
    } else {
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<isNumeric>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1190 <isNumeric+0x80>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x30,%eax
jl     1171 <isNumeric+0x61>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x39,%eax
jg     1171 <isNumeric+0x61>
jmp    117d <isNumeric+0x6d>
movl   $0x0,-0x4(%rbp)
jmp    1197 <isNumeric+0x87>
jmp    1182 <isNumeric+0x72>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1123 <isNumeric+0x13>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isNumeric>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    $0x1,%r14d
cmp    $0x2,%eax
jl     1155 <isNumeric+0x45>
xor    %ebp,%ebp
nopl   0x0(%rax)
movzbl (%rbx,%rbp,1),%eax
add    $0xd0,%al
cmp    $0xa,%al
jae    1152 <isNumeric+0x42>
add    $0x1,%rbp
mov    %rbx,%rdi
call   1030 <strlen@plt>
add    $0xffffffff,%eax
cltq
cmp    %rax,%rbp
jl     1130 <isNumeric+0x20>
jmp    1155 <isNumeric+0x45>
xor    %r14d,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @isNumeric(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
br label %5
5: ; preds = %30, %1
%6 = load i32, i32* %4
%7 = load i8*, i8** %3
%8 = call i32 @strlen(i8* %7)
%9 = sub nsw i32 %8, 1
%10 = icmp slt i32 %6, %9
br i1 %10, label %11, label %33
11: ; preds = %5
%12 = load i8*, i8** %3
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp sge i32 %17, 48
br i1 %18, label %19, label %28
19: ; preds = %11
%20 = load i8*, i8** %3
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp sle i32 %25, 57
br i1 %26, label %27, label %28
27: ; preds = %19
br label %29
28: ; preds = %19, %11
store i32 0, i32* %2
br label %34
29: ; preds = %27
br label %30
30: ; preds = %29
%31 = load i32, i32* %4
%32 = add nsw i32 %31, 1
store i32 %32, i32* %4
br label %5
33: ; preds = %5
store i32 1, i32* %2
br label %34
34: ; preds = %33, %28
%35 = load i32, i32* %2
ret i32 %35
}

LLVM IR (-O2):
define i32 @isNumeric(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 1
br i1 %3, label %9, label %16
4: ; preds = %9
%5 = tail call i32 @strlen(i8* %0)
%6 = add nsw i32 %5, -1
%7 = sext i32 %6 to i64
%8 = icmp slt i64 %15, %7
br i1 %8, label %9, label %16
9: ; preds = %1, %4
%10 = phi i64 [ %15, %4 ], [ 0, %1 ]
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = add i8 %12, -48
%14 = icmp ult i8 %13, 10
%15 = add nuw nsw i64 %10, 1
br i1 %14, label %4, label %16
16: ; preds = %9, %4, %1
%17 = phi i32 [ 1, %1 ], [ 1, %4 ], [ 0, %9 ]
ret i32 %17
}