#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 */
scalar_t__ isdigit(unsigned char);
int ss_isnumeric(const char *s) {
  if (!s || !*s)
    return 0;
  while (isdigit((unsigned char)*s))
    ++s;
  return *s == '\0';
}


x86 assembly (clang, -O0):
<ss_isnumeric>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1134 <ss_isnumeric+0x24>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1140 <ss_isnumeric+0x30>
movl   $0x0,-0x4(%rbp)
jmp    1181 <ss_isnumeric+0x71>
jmp    1145 <ss_isnumeric+0x35>
mov    -0x10(%rbp),%rax
movzbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     116c <ss_isnumeric+0x5c>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1145 <ss_isnumeric+0x35>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ss_isnumeric>:
push   %rbx
xor    %eax,%eax
test   %rdi,%rdi
je     114c <ss_isnumeric+0x3c>
mov    %rdi,%rbx
mov    (%rdi),%cl
test   %cl,%cl
je     114c <ss_isnumeric+0x3c>
movzbl %cl,%edi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
call   1030 <isdigit@plt>
test   %rax,%rax
je     1144 <ss_isnumeric+0x34>
movzbl 0x1(%rbx),%edi
add    $0x1,%rbx
jmp    1130 <ss_isnumeric+0x20>
xor    %eax,%eax
cmpb   $0x0,(%rbx)
sete   %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @ss_isnumeric(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
%9 = icmp ne i8 %8, 0
br i1 %9, label %11, label %10
10: ; preds = %6, %1
store i32 0, i32* %2
br label %26
11: ; preds = %6
br label %12
12: ; preds = %17, %11
%13 = load i8*, i8** %3
%14 = load i8, i8* %13
%15 = call i64 @isdigit(i8 zeroext %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %12
%18 = load i8*, i8** %3
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %3
br label %12
20: ; preds = %12
%21 = load i8*, i8** %3
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 0
%25 = zext i1 %24 to i32
store i32 %25, i32* %2
br label %26
26: ; preds = %20, %10
%27 = load i32, i32* %2
ret i32 %27
}

LLVM IR (-O2):
define i32 @ss_isnumeric(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %20, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %20, label %6
6: ; preds = %3
%7 = tail call i64 @isdigit(i8 zeroext %4)
%8 = icmp eq i64 %7, 0
br i1 %8, label %15, label %9
9: ; preds = %6, %9
%10 = phi i8* [ %11, %9 ], [ %0, %6 ]
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %11
%13 = tail call i64 @isdigit(i8 zeroext %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %9
15: ; preds = %9, %6
%16 = phi i8* [ %0, %6 ], [ %11, %9 ]
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 0
%19 = zext i1 %18 to i32
br label %20
20: ; preds = %1, %3, %15
%21 = phi i32 [ %19, %15 ], [ 0, %3 ], [ 0, %1 ]
ret i32 %21
}