#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 strlen(char *);
int isnumeric(char *input) {
  int i;
  for (i = 0; i < strlen(input); i++)
    if (!isdigit(*input + i))
      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   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jge    1189 <isnumeric+0x69>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
add    -0x14(%rbp),%eax
movsbl %al,%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    1176 <isnumeric+0x56>
movl   $0x0,-0x4(%rbp)
jmp    1190 <isnumeric+0x70>
jmp    117b <isnumeric+0x5b>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1133 <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   1040 <strlen@plt>
mov    $0x1,%r14d
test   %eax,%eax
jle    1165 <isnumeric+0x45>
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
movzbl (%rbx),%eax
add    %ebp,%eax
movsbl %al,%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     1162 <isnumeric+0x42>
add    $0x1,%ebp
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    %eax,%ebp
jl     1140 <isnumeric+0x20>
jmp    1165 <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 = %21, %1
%6 = load i32, i32* %4
%7 = load i8*, i8** %3
%8 = call i32 @strlen(i8* %7)
%9 = icmp slt i32 %6, %8
br i1 %9, label %10, label %24
10: ; preds = %5
%11 = load i8*, i8** %3
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = load i32, i32* %4
%15 = add nsw i32 %13, %14
%16 = trunc i32 %15 to i8
%17 = call i32 @isdigit(i8 signext %16)
%18 = icmp ne i32 %17, 0
br i1 %18, label %20, label %19
19: ; preds = %10
store i32 0, i32* %2
br label %25
20: ; preds = %10
br label %21
21: ; preds = %20
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
br label %5
24: ; preds = %5
store i32 1, i32* %2
br label %25
25: ; preds = %24, %19
%26 = load i32, i32* %2
ret i32 %26
}

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