#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*/ isascii(unsigned char);
int /*<<< orphan*/ isdigit(unsigned char);
bool str_alldig(const char *string) {
  const char *cp;
  if (*string == 0)
    return false;
  for (cp = string; *cp != 0; cp++)
    if (!isascii((unsigned char)*cp) || !isdigit((unsigned char)*cp))
      return false;
  return true;
}


x86 assembly (clang, -O0):
<str_alldig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1148 <str_alldig+0x28>
movl   $0x0,-0x4(%rbp)
jmp    11b3 <str_alldig+0x93>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11ac <str_alldig+0x8c>
mov    -0x18(%rbp),%rax
movzbl (%rax),%edi
call   1040 <isascii@plt>
cmp    $0x0,%eax
je     118a <str_alldig+0x6a>
mov    -0x18(%rbp),%rax
movzbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    1196 <str_alldig+0x76>
movl   $0x0,-0x4(%rbp)
jmp    11b3 <str_alldig+0x93>
jmp    119b <str_alldig+0x7b>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1150 <str_alldig+0x30>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_alldig>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%al
xor    %ebp,%ebp
test   %al,%al
je     1169 <str_alldig+0x49>
mov    %rdi,%rbx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl %al,%edi
call   1040 <isascii@plt>
test   %eax,%eax
je     1169 <str_alldig+0x49>
movzbl -0x1(%rbx),%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     1169 <str_alldig+0x49>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1140 <str_alldig+0x20>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

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