#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*/ printf(char *, char);
int allisdigit(char *s) {
  int ret = 1;
  while (*s) {
    if (!isdigit(*s)) {
      printf("error:%c is not an digit character\n", *s);
      ret = 0;
    }
    s++;
  }
  return ret;
}


x86 assembly (clang, -O0):
<allisdigit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1180 <allisdigit+0x60>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    116f <allisdigit+0x4f>
mov    -0x8(%rbp),%rax
lea    0xea0(%rip),%rdi
movsbl (%rax),%esi
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1133 <allisdigit+0x13>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<allisdigit>:
push   %rbp
push   %r14
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1167 <allisdigit+0x47>
mov    %rdi,%rbx
add    $0x1,%rbx
mov    $0x1,%ebp
lea    0xec3(%rip),%r14
jmp    114b <allisdigit+0x2b>
nop
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     116c <allisdigit+0x4c>
movsbl %al,%edi
call   1030 <isdigit@plt>
test   %eax,%eax
jne    1140 <allisdigit+0x20>
movsbl -0x1(%rbx),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
xor    %ebp,%ebp
jmp    1140 <allisdigit+0x20>
mov    $0x1,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [36 x i8] c"error:%c is not an digit character\0A\00"
define i32 @allisdigit(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 1, i32* %3
br label %4
4: ; preds = %17, %1
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %20
8: ; preds = %4
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = call i32 @isdigit(i8 signext %10)
%12 = icmp ne i32 %11, 0
br i1 %12, label %17, label %13
13: ; preds = %8
%14 = load i8*, i8** %2
%15 = load i8, i8* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8 signext %15)
store i32 0, i32* %3
br label %17
17: ; preds = %13, %8
%18 = load i8*, i8** %2
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %2
br label %4
20: ; preds = %4
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
@.str = [36 x i8] c"error:%c is not an digit character\0A\00"
define i32 @allisdigit(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %18, label %4
4: ; preds = %1, %13
%5 = phi i8 [ %16, %13 ], [ %2, %1 ]
%6 = phi i32 [ %14, %13 ], [ 1, %1 ]
%7 = phi i8* [ %15, %13 ], [ %0, %1 ]
%8 = tail call i32 @isdigit(i8 signext %5)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %4
%11 = load i8, i8* %7
%12 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8 signext %11)
br label %13
13: ; preds = %10, %4
%14 = phi i32 [ %6, %4 ], [ 0, %10 ]
%15 = getelementptr inbounds i8, i8* %7, i64 1
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %18, label %4
18: ; preds = %13, %1
%19 = phi i32 [ 1, %1 ], [ %14, %13 ]
ret i32 %19
}