#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);
scalar_t__ isspace(char);
int strisdigit(char *s) {
  for (; ((*s != 0) || isspace(*s)); s++)
    if (!isdigit(*s))
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<strisdigit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
jne    1157 <strisdigit+0x37>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1167 <strisdigit+0x47>
jmp    119e <strisdigit+0x7e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    1188 <strisdigit+0x68>
movl   $0x0,-0x4(%rbp)
jmp    11a5 <strisdigit+0x85>
jmp    118d <strisdigit+0x6d>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    112c <strisdigit+0xc>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strisdigit>:
push   %rbx
mov    %rdi,%rbx
jmp    1140 <strisdigit+0x20>
cs nopw 0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <isdigit@plt>
add    $0x1,%rbx
test   %eax,%eax
je     1158 <strisdigit+0x38>
movzbl (%rbx),%eax
test   %al,%al
jne    1130 <strisdigit+0x10>
xor    %edi,%edi
call   1040 <isspace@plt>
test   %rax,%rax
je     115c <strisdigit+0x3c>
movzbl (%rbx),%eax
jmp    1130 <strisdigit+0x10>
xor    %eax,%eax
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

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

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