#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 /*<<< orphan*/ isspace(char);
int isdigitstr(char *str) {
  while (*str && !isspace(*str)) {
    if (!isdigit(*str))
      return 0;
    str++;
  }
  return 1;
}


x86 assembly (clang, -O0):
<isdigitstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     1158 <isdigitstr+0x38>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isspace@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1168 <isdigitstr+0x48>
jmp    119a <isdigitstr+0x7a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    1189 <isdigitstr+0x69>
movl   $0x0,-0x4(%rbp)
jmp    11a1 <isdigitstr+0x81>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    112c <isdigitstr+0xc>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isdigitstr>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%al
mov    $0x1,%ebp
test   %al,%al
je     1168 <isdigitstr+0x48>
mov    %rdi,%rbx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
movsbl %al,%edi
call   1040 <isspace@plt>
test   %eax,%eax
jne    1168 <isdigitstr+0x48>
movsbl -0x1(%rbx),%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     1166 <isdigitstr+0x46>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1140 <isdigitstr+0x20>
jmp    1168 <isdigitstr+0x48>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @isdigitstr(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 %9, label %15
9: ; preds = %4
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = call i32 @isspace(i8 signext %11)
%13 = icmp ne i32 %12, 0
%14 = xor i1 %13, true
br label %15
15: ; preds = %9, %4
%16 = phi i1 [ false, %4 ], [ %14, %9 ]
br i1 %16, label %17, label %26
17: ; preds = %15
%18 = load i8*, i8** %3
%19 = load i8, i8* %18
%20 = call i32 @isdigit(i8 signext %19)
%21 = icmp ne i32 %20, 0
br i1 %21, label %23, label %22
22: ; preds = %17
store i32 0, i32* %2
br label %27
23: ; preds = %17
%24 = load i8*, i8** %3
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %3
br label %4
26: ; preds = %15
store i32 1, i32* %2
br label %27
27: ; preds = %26, %22
%28 = load i32, i32* %2
ret i32 %28
}

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